Java 27 and 26: runnable demos and captured output for every JEP, plus version lanes
Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B38FGKKam5SCGgwgduVAh3
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* A primitive pattern placed after the reference pattern that already matches every Integer.
|
||||
* The compiler rejects it on both 26 and 27. Driven by scripts/broken-on-27.sh.
|
||||
*/
|
||||
public class Dominated {
|
||||
static String describe(Object o) {
|
||||
return switch (o) {
|
||||
case Integer boxed -> "an Integer";
|
||||
case int primitive -> "an int"; // dominated: every Integer is already caught above
|
||||
default -> "something else";
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user