Files
java-core-examples/copying/scripts/broken.sh
T

16 lines
532 B
Bash
Executable File

#!/usr/bin/env bash
# Compiles each deliberately broken source and captures the compiler's own message.
cd "$(dirname "$0")/.."
OUT=$(mktemp -d)
capture() { # <source file name> <output name>
{
echo "\$ javac src/broken/$1"
javac -d "$OUT" "src/broken/$1" 2>&1 | grep -v '^Picked up JAVA_TOOL_OPTIONS' || true
} > "output/$2.txt"
cat "output/$2.txt"
}
capture FinalFieldClone.java 02-final-field-clone
capture ForgotToOverride.java 16-forgot-override
capture WithExpression.java 17-with-expression
rm -rf "$OUT"