equals-hashcode: equals/hashCode contract demos, missing hashCode and constant-hash costs, mutable keys, records, JPA entity id trap, 13 contract tests

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b66uwsWr9B1ouyrzUh
This commit is contained in:
Claude
2026-11-12 20:08:35 +05:30
parent 319697c345
commit 682b7b067c
22 changed files with 692 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
# Regenerates every file in output/. Hash-collision counts are deterministic; nothing here is timing-based.
set -euo pipefail
cd "$(dirname "$0")/.."
mvn -q -B compile
run() { java -Dstdout.encoding=UTF-8 -cp target/classes "com.ankurm.equalshashcode.$1" 2>&1 | grep -v '^Picked up JAVA_TOOL_OPTIONS' > "output/$2.txt"; }
run ContractDemo 01-contract
run MissingHashCodeDemo 02-missing-hashcode
run MutableKeyDemo 03-mutable-key
run SymmetryDemo 04-jdk-symmetry
run RecordsDemo 05-records
run EntityIdDemo 06-entity-id
run HashCodeRecipeDemo 07-hashcode-recipes
mvn -B test 2>&1 | grep -E 'Tests run|BUILD|ERROR|FAIL' | grep -v 'Picked up' > output/08-tests.txt
echo "regenerated:"; ls output