data-jpa-3-to-4: Spring Data JPA 3.5 vs 4.2 side by side - package moves, nullness, Specification, keyset, Page JSON, Jackson 3, test slices, real transcripts
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b7N4ZDbUtA3ofqAqRV
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
3f061c5e5d
commit
7a2bcc1eb6
@@ -0,0 +1,36 @@
|
||||
import java.lang.reflect.*;
|
||||
import java.util.*;
|
||||
import java.util.stream.*;
|
||||
|
||||
/**
|
||||
* Prints the public methods each named type declares, flagging {@code @Deprecated} ones.
|
||||
* Run it once per classpath (Boot 3.5 and Boot 4) and diff the two files.
|
||||
* Usage: java -cp "$(cat cp.txt)" ApiDump.java org.springframework.data.jpa.repository.JpaRepository ...
|
||||
*/
|
||||
public class ApiDump {
|
||||
public static void main(String[] args) {
|
||||
for (String name : args) {
|
||||
System.out.println("== " + name);
|
||||
try {
|
||||
Class<?> c = Class.forName(name, false, Thread.currentThread().getContextClassLoader());
|
||||
if (c.isAnnotationPresent(Deprecated.class)) System.out.println(" (type is @Deprecated)");
|
||||
Arrays.stream(c.getDeclaredMethods())
|
||||
.filter(m -> Modifier.isPublic(m.getModifiers()) && !m.isSynthetic() && !m.isBridge())
|
||||
.map(m -> " " + sig(m) + (m.isAnnotationPresent(Deprecated.class) ? " @Deprecated" : ""))
|
||||
.sorted().forEach(System.out::println);
|
||||
} catch (ClassNotFoundException e) {
|
||||
System.out.println(" NOT ON THIS CLASSPATH");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static String sig(Method m) {
|
||||
return (Modifier.isStatic(m.getModifiers()) ? "static " : "")
|
||||
+ simple(m.getGenericReturnType()) + " " + m.getName() + "("
|
||||
+ Arrays.stream(m.getGenericParameterTypes()).map(ApiDump::simple).collect(Collectors.joining(", ")) + ")";
|
||||
}
|
||||
|
||||
static String simple(Type t) {
|
||||
return t.getTypeName().replaceAll("[a-z][\\w]*\\.", "").replace('$', '.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user