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:
2026-09-21 15:08:50 +00:00
committed by Claude
co-authored by Claude Sonnet 5
commit f59c1de96d
152 changed files with 5049 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
# _ (unnamed variables and patterns) and compact source files with instance main()
$ javac UnnamedVariables.java (JDK 21, no flag)
<repo>/lanes/src/UnnamedVariables.java:12: error: unnamed variables are a preview feature and are disabled by default.
if (o instanceof Point(int x, _)) {
^
(use --enable-preview to enable unnamed variables)
1 error
exit=1
$ javac UnnamedVariables.java (JDK 25, no flag)
exit=0
$ java UnnamedVariables (JDK 25)
matched a Point, x = 3, y ignored with _
caught NumberFormatException without naming it
$ java CompactHello.java (JDK 21, no flag)
<repo>/lanes/src/CompactHello.java:1: error: unnamed classes are a preview feature and are disabled by default.
void main() {
^
(use --enable-preview to enable unnamed classes)
1 error
error: compilation failed
$ java CompactHello.java (JDK 25, no flag)
compact source file: no class, no static, no String[] args