Add fresher-qa module: 50 Java interview questions for freshers, one runnable demo each, asserted transcripts, javac error captures
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b5DfjBGLBr7F5km2AN
This commit is contained in:
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
# Compiles each file in src/broken/ (they are NOT part of the Maven build) and captures javac's own message.
|
||||
set -uo pipefail
|
||||
cd "$(dirname "$0")/../src/broken"
|
||||
out=../../output/07-compile-errors.txt
|
||||
: > "$out"
|
||||
for f in FinalOverride CheckedNotHandled LossyCast MissingReturnAndUnreachable; do
|
||||
echo "=== javac $f.java ===" >> "$out"
|
||||
javac --release 25 -d /tmp/fresher-broken "$f.java" 2>&1 | grep -v '^Picked up JAVA_TOOL_OPTIONS' >> "$out"
|
||||
echo >> "$out"
|
||||
done
|
||||
# The same file under both language levels: an error before Java 25, fine from Java 25 (JEP 513).
|
||||
for rel in 21 25; do
|
||||
echo "=== javac --release $rel PreSuper.java ===" >> "$out"
|
||||
if javac --release "$rel" -d /tmp/fresher-broken "PreSuper.java" 2>&1 | grep -v '^Picked up JAVA_TOOL_OPTIONS' >> "$out"; [ "${PIPESTATUS[0]}" -eq 0 ]; then
|
||||
echo "compiled without errors" >> "$out"
|
||||
fi
|
||||
echo >> "$out"
|
||||
done
|
||||
cat "$out"
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# Regenerates every file in output/. Needs JDK 25 and Maven (first Maven run online).
|
||||
# 01-06 are written by JUnit tests that assert the lines they write; 07 is javac's own output for src/broken/.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
mvn -B -q -T1 test
|
||||
./scripts/compile-errors.sh > /dev/null
|
||||
echo "done:"; ls -1 output
|
||||
Reference in New Issue
Block a user