#!/usr/bin/env bash # Regenerates every file in docs/output/ from scratch. Run from the module root # (java-interview-lab/collections). # # Needs JDK 25 (LTS) on PATH as `java`/`javac`, and a `mvn` that can reach Maven Central the # first time (surefire/compiler plugins must be cached locally before -o works). set -eu cd "$(dirname "$0")/.." echo "== compiling ==" mvn -q -B compile echo "== 01/02: reflection into HashMap internals, with and without --add-opens ==" mkdir -p docs/output java -cp target/classes com.ankurm.interviewlab.collections.ReflectionAddOpensDemo \ > docs/output/01-reflection-without-add-opens.txt 2>&1 || true java --add-opens java.base/java.util=ALL-UNNAMED -cp target/classes \ com.ankurm.interviewlab.collections.ReflectionAddOpensDemo \ > docs/output/02-reflection-with-add-opens.txt 2>&1 # Strip the sandbox's own proxy/trust-store banner (JAVA_TOOL_OPTIONS) - it is environment # noise, not part of either demonstration, and should not be in a committed transcript. for f in docs/output/01-reflection-without-add-opens.txt docs/output/02-reflection-with-add-opens.txt; do grep -v '^Picked up JAVA_TOOL_OPTIONS' "$f" > "$f.tmp" && mv "$f.tmp" "$f" done echo "== 03-10: JUnit-driven transcripts (BucketLayoutTest, TreeifyTriggerTest, ConcurrentModificationTest, EqualsHashCodeContractTest) ==" mvn -q -B test echo "== done - docs/output now contains: ==" ls -1 docs/output