#!/usr/bin/env bash # Reads the deprecation annotations straight out of the published jars: which types carry # @Deprecated(since, forRemoval) in Spring Framework 7.0.x vs 7.1.0 and Spring Boot 4.1.3 vs 4.2.0. # Needs the jars in ~/.m2 (run `mvn test` and `mvn -f pom-41.xml test` once first). set -u cd "$(dirname "$0")/.." M="$HOME/.m2/repository/org/springframework" OUT=output/19-deprecation-annotations.txt FW41=$(ls "$M/spring-web" | grep -E '^7\.0\.' | sort -V | tail -1) annot() { # -> "since=X forRemoval=true" or "not deprecated" local out out=$(javap -v -cp "$1" "$2" 2>/dev/null | awk '/^RuntimeVisibleAnnotations:/{f=1} f&&/java.lang.Deprecated\(/{d=1} d&&/since=/{s=$0} d&&/forRemoval=/{r=$0} /^[A-Za-z]/&&!/^RuntimeVisibleAnnotations/&&f&&!/^ /{} END{ if(d) print s " " r }' | tr -s " " | sed "s/^ //") [ -n "$out" ] && echo "$out" || echo "not deprecated" } { echo "# 19-deprecation-annotations (javap -v on the published jars, JDK $(javac -version 2>&1 | grep -v Picked | awk '{print $2}'))" echo for fw in "$FW41" 7.1.0; do jar="$M/spring-web/$fw/spring-web-$fw.jar" echo "spring-web $fw org.springframework.web.client.RestTemplate : $(annot "$jar" org.springframework.web.client.RestTemplate)" echo "spring-web $fw org.springframework.web.client.RestClient : $(annot "$jar" org.springframework.web.client.RestClient)" done echo for b in 4.1.3 4.2.0; do rj="$HOME/.m2/repository/org/springframework/boot/spring-boot-restclient/$b/spring-boot-restclient-$b.jar" tj="$HOME/.m2/repository/org/springframework/boot/spring-boot-resttestclient/$b/spring-boot-resttestclient-$b.jar" for c in org.springframework.boot.restclient.RestTemplateBuilder org.springframework.boot.restclient.RestTemplateCustomizer \ org.springframework.boot.restclient.RestClientCustomizer org.springframework.boot.restclient.autoconfigure.RestTemplateAutoConfiguration \ org.springframework.boot.restclient.autoconfigure.RestClientAutoConfiguration; do echo "spring-boot-restclient $b ${c#org.springframework.boot.restclient.} : $(annot "$rj" "$c")" done for c in org.springframework.boot.resttestclient.TestRestTemplate org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate \ org.springframework.boot.resttestclient.autoconfigure.AutoConfigureRestTestClient; do echo "spring-boot-resttestclient $b ${c#org.springframework.boot.resttestclient.} : $(annot "$tj" "$c")" done echo done } | sed "s#$HOME#~#g" > "$OUT" cat "$OUT"