Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B38FGKKam5SCGgwgduVAh3
33 lines
1.2 KiB
Bash
Executable File
33 lines
1.2 KiB
Bash
Executable File
#!/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"
|