Add patterns module: pattern matching from JDK 21 to 27
Type, record and primitive patterns, guards, sealed exhaustiveness, MatchException via separate compilation, and eight captured transcripts. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TF9JWFvJSNm6HVzswzZU5a
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
$ javap -v PrimitiveSwitch | grep -E 'minor|major' (compiled by 25.0.4.1+1-LTS with --enable-preview)
|
||||
minor version: 65535
|
||||
major version: 69
|
||||
|
||||
$ java --enable-preview PrimitiveSwitch (class compiled on 25, run on 27+35)
|
||||
Error: LinkageError occurred while loading main class PrimitiveSwitch
|
||||
java.lang.UnsupportedClassVersionError: PrimitiveSwitch (class file version 69.65535) was compiled with preview features that are unsupported. This version of the Java Runtime only recognizes preview features for class file version 71.65535
|
||||
|
||||
$ java PrimitiveSwitch (same class, no flag, run on 25.0.4.1+1-LTS)
|
||||
Error: LinkageError occurred while loading main class PrimitiveSwitch
|
||||
java.lang.UnsupportedClassVersionError: Preview features are not enabled for PrimitiveSwitch (class file version 69.65535). Try running with '--enable-preview'
|
||||
Reference in New Issue
Block a user