copying: deep vs shallow copy module (clone() traps, copy constructors, serialization copy, records, defensive copies, collection copies), 17 contract tests

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b4X2xx7RrveVQU9R1N
This commit is contained in:
asmhatre
2026-11-12 20:18:06 +05:30
parent 682b7b067c
commit 38fbd513c9
29 changed files with 1201 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Regenerates every file in output/. All outputs are deterministic EXCEPT 10-cost.txt (timing, indicative only).
set -euo pipefail
cd "$(dirname "$0")/.."
mvn -q -B compile
run() { java -Dstdout.encoding=UTF-8 -cp target/classes "com.ankurm.copying.$1" 2>&1 | grep -v '^Picked up JAVA_TOOL_OPTIONS' > "output/$2.txt"; }
run ShallowVsDeepDemo 01-shallow-vs-deep
scripts/broken.sh > /dev/null
run CloneDemo 03-clone
run CopyConstructorDemo 04-copy-constructor
run SerializationCopyDemo 05-serialization
run RecordCopyDemo 06-records
run DefensiveCopyDemo 07-defensive
run CollectionCopyDemo 08-collections
run CopyOfIdentityDemo 11-copyof-identity
mvn -B test 2>&1 | grep -E 'Tests run|BUILD|ERROR|FAIL' | grep -v 'Picked up' > output/09-tests.txt
run CopyCostDemo 10-cost
echo "regenerated:"; ls output