Add resttemplate-to-restclient module: RestTemplate deprecation on Spring Framework 7.1 / Boot 4.2.0 vs 4.1.3, method mapping, exchange() trap, bridge URI encoding, RestTestClient, OpenRewrite recipe run, with real transcripts

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b7M7FEdeEm3APj16Bu
This commit is contained in:
Claude
2026-11-21 21:26:48 +05:30
parent 5f85ec8d53
commit cbcfb05e35
77 changed files with 2187 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
# Compiles each file in src/broken/ with -Xlint:deprecation against the module classpath of the
# given pom (default pom.xml = 4.2.0; pass pom-41.xml for the 4.1.3 baseline) and stores the
# compiler's own messages in output/NN-... (suffix -on-4.1.3 for the baseline).
set -u
cd "$(dirname "$0")/.."
POM="${1:-pom.xml}"
LABEL=$(grep -m1 '<boot.label>' "$POM" | sed -E 's/.*<boot.label>(.*)<\/boot.label>.*/\1/')
SUFFIX=""; [[ "$LABEL" == 4.2* ]] || SUFFIX="-on-$LABEL"
mvn -B -q -f "$POM" dependency:build-classpath -Dmdep.outputFile=target/cp.txt >/dev/null 2>&1
CP="$(cat target/cp.txt):target/classes"
compile_one() { # <source> <outfile-base>
local src="$1" base="$2" out="output/$2$SUFFIX.txt"
rm -rf target/broken && mkdir -p target/broken
{
echo "# $base (Spring Boot $LABEL, JDK $(javac -version 2>&1 | grep -v Picked | awk '{print $2}'))"
echo "\$ javac -Xlint:deprecation -cp <module classpath> -d target/broken $src"
javac -Xlint:deprecation -cp "$CP" -d target/broken "$src" 2>&1 | grep -v '^Picked up' | sed -e "s#^$(pwd)/##"
echo "exit: ${PIPESTATUS[0]}"
} > "$out"
cat "$out"
}
compile_one src/broken/UsesRestTemplate.java 13-resttemplate-compiler-warnings
compile_one src/broken/UsesTestRestTemplate.java 14-testresttemplate-compiler-warnings
compile_one src/broken/OldTimeoutSettings.java 15-old-timeout-settings-compiler-error
compile_one src/broken/NewTimeoutSettings.java 16-new-timeout-settings-compiler
# The migrated client must compile with no [removal] warning at all.
compile_one src/main/java/com/ankurm/rtmigration/StudentClient.java 17-migrated-client-compiler
# The legacy client carries @SuppressWarnings("removal"); without it the warnings come back.
sed 's/^@SuppressWarnings("removal")//' src/main/java/com/ankurm/rtmigration/LegacyStudentClient.java > target/LegacyStudentClient.java
compile_one target/LegacyStudentClient.java 18-legacy-client-without-suppression