#!/usr/bin/env bash # Stream Gatherers (JEP 485, final since JDK 24, no preview flag needed on 25+). Every demo # asserts its own claims (see Check.java), so a green transcript means the post's claims still # hold on whatever JDK25 points at. # ./scripts/gatherers.sh -> docs/output/98-basics.txt 98-mapconcurrent.txt # 98-custom-gatherer.txt 98-collector-vs-gatherer.txt set -uo pipefail source "$(dirname "$0")/env.sh" S="$ROOT/gatherers/src"; B="$ROOT/build/gatherers"; rm -rf "$B"; mkdir -p "$B" "$JDK25/bin/javac" -d "$B" "$S"/*.java 2>&1 | grep -v -E '^(Note:|$)' || true run() { local outfile="$1" cls="$2" { echo "\$ java $cls (JDK 25)"; "$JDK25/bin/java" -cp "$B" "$cls" 2>&1; echo "exit=${PIPESTATUS[0]}"; } > "$OUT/$outfile" 2>&1 } run 98-basics.txt GathererBasics run 98-mapconcurrent.txt MapConcurrentDemo run 98-custom-gatherer.txt CustomGatherer run 98-collector-vs-gatherer.txt CollectorVsGatherer echo "wrote $OUT/98-*.txt"