|
25 | 25 | * @test |
26 | 26 | * @bug 4981566 5028634 5094412 6304984 7025786 7025789 8001112 8028545 |
27 | 27 | * 8000961 8030610 8028546 8188870 8173382 8173382 8193290 8205619 8028563 |
28 | | - * 8245147 8245586 8257453 8286035 8306586 |
| 28 | + * 8245147 8245586 8257453 8286035 8306586 8320806 |
29 | 29 | * @summary Check interpretation of -target and -source options |
30 | 30 | * @modules java.compiler |
31 | 31 | * jdk.compiler |
@@ -272,8 +272,8 @@ protected void check(String major, List<String> args) { |
272 | 272 | * the uncommon program that is accepted in one version of the |
273 | 273 | * language and rejected in a later version.) |
274 | 274 | * |
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. |
277 | 277 | */ |
278 | 278 | enum SourceExample { |
279 | 279 | BASE(7, "Base.java", "public class Base { }\n"), |
@@ -375,6 +375,20 @@ public static void main(String... args) { |
375 | 375 | } |
376 | 376 | """), |
377 | 377 |
|
| 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 | + """), |
378 | 392 | ; // Reduce code churn when appending new constants |
379 | 393 |
|
380 | 394 | private int sourceLevel; |
|
0 commit comments