Skip to content

Commit b68356b

Browse files
committed
8320806: Augment test/langtools/tools/javac/versions/Versions.java for JDK 22 language changes
Reviewed-by: jlahoda, vromero
1 parent d783aa3 commit b68356b

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

test/langtools/tools/javac/versions/Versions.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* @test
2626
* @bug 4981566 5028634 5094412 6304984 7025786 7025789 8001112 8028545
2727
* 8000961 8030610 8028546 8188870 8173382 8173382 8193290 8205619 8028563
28-
* 8245147 8245586 8257453 8286035 8306586
28+
* 8245147 8245586 8257453 8286035 8306586 8320806
2929
* @summary Check interpretation of -target and -source options
3030
* @modules java.compiler
3131
* jdk.compiler
@@ -272,8 +272,8 @@ protected void check(String major, List<String> args) {
272272
* the uncommon program that is accepted in one version of the
273273
* language and rejected in a later version.)
274274
*
275-
* When version of the language get a new, non-preview feature, a
276-
* new source example enum constant should be added.
275+
* When a version of the language gets a new, non-preview feature,
276+
* a new source example enum constant should be added.
277277
*/
278278
enum SourceExample {
279279
BASE(7, "Base.java", "public class Base { }\n"),
@@ -375,6 +375,20 @@ public static void main(String... args) {
375375
}
376376
"""),
377377

378+
SOURCE_22(22, "New22.java",
379+
// New feature in 22: Unnamed Variables & Patterns
380+
"""
381+
public class New22 {
382+
public static void main(String... args) {
383+
Object o = new Object(){};
384+
385+
System.out.println(switch (o) {
386+
case Integer _ -> "Hello world.";
387+
default -> o.toString();
388+
});
389+
}
390+
}
391+
"""),
378392
; // Reduce code churn when appending new constants
379393

380394
private int sourceLevel;

0 commit comments

Comments
 (0)