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
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# The most useful demonstrations of a preview API are the compile errors. This compiles the same
# JDK 26 sources with the 26 and the 27 compiler and commits what javac actually said.
# ./scripts/broken-on-27.sh -> docs/output/20-broken-*.txt
set -uo pipefail
source "$(dirname "$0")/env.sh"
SRC="$ROOT/jep-tour/src"
compile() { # jdk-home release file -> prints javac's own output, then its real exit code
local out rc
out="$( cd "$SRC/broken" && "$1/bin/javac" --enable-preview --release "$2" -Xlint:-preview -d "$ROOT/build/broken-$2" "$3" 2>&1 )"; rc=$?
printf '%s\n' "$out" | grep -v -E '^(Note: |$)' || true
echo "exit=$rc"
}
for f in Pem26Style StructuredScope26 Lazy26; do
out="$OUT/20-broken-$(echo "$f" | tr 'A-Z' 'a-z').txt"
{
echo "\$ javac --enable-preview --release 26 $f.java (JDK 26)"
compile "$JDK26" 26 "$f.java"
echo
echo "\$ javac --enable-preview --release 27 $f.java (JDK 27)"
compile "$JDK27" 27 "$f.java"
} > "$out" 2>&1
echo "wrote $out"
done
{
echo "\$ javac --enable-preview --release 27 Dominated.java (JDK 27)"
compile "$JDK27" 27 Dominated.java
} > "$OUT/20-broken-dominated.txt" 2>&1
echo "wrote $OUT/20-broken-dominated.txt"