-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable some tests after J19 problems were fixed for J21
Two test classes which had redundant default clauses for switch with record patterns were copied from the java19 to the java21 directory and the redundant clauses deactivated, i.e. the test now run as originally intended. For older JDK versions, the old tests still stay active in order to document the old state of affairs. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
- Loading branch information
Showing
5 changed files
with
52 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
tests/features1921/java21/RecordPatternsPreview1ExhaustivenessAspect.aj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
public aspect RecordPatternsPreview1ExhaustivenessAspect { | ||
static Pair<I> p2 = new Pair<>(new C(), new D()); | ||
|
||
public static void main(String[] args) { | ||
doSomething(p2); | ||
} | ||
|
||
public static void doSomething(Pair<I> pair) { | ||
System.out.println(pair.toString().replaceAll("@[0-9a-f]+", "@000")); | ||
} | ||
|
||
before(Pair<I> pair) : execution(* doSomething(Pair)) && args(pair) { | ||
switch (pair) { | ||
case Pair<I>(I i, C c) -> System.out.println("x"); | ||
case Pair<I>(I i, D d) -> System.out.println("y"); | ||
// Redundant default clause no longer necessary after fix of https://github.com/eclipse-jdt/eclipse.jdt.core/issues/455. | ||
// Old version with default clause see features1919/java19/RecordPatternsPreview1ExhaustivenessAspect.aj. | ||
// default -> System.out.println("z"); | ||
} | ||
|
||
switch (pair) { | ||
case Pair<I>(C c, I i) -> System.out.println("a"); | ||
case Pair<I>(D d, C c) -> System.out.println("b"); | ||
case Pair<I>(D d1, D d2) -> System.out.println("c"); | ||
// Redundant default clause no longer necessary after fix of https://github.com/eclipse-jdt/eclipse.jdt.core/issues/455. | ||
// Old version with default clause see features1919/java19/RecordPatternsPreview1ExhaustivenessAspect.aj. | ||
// default -> System.out.println("d"); | ||
} | ||
} | ||
} | ||
|
||
sealed interface I permits C, D { } | ||
final class C implements I { } | ||
final class D implements I { } | ||
record Pair<T>(T x, T y) { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters