Repository navigation
build(deps): update classgraph from 4.8.197 to 5.0.0 - #1425
bestbeforetoday wants to merge 1 commit into
Conversation
Classgraph 4.x is end-of-life. Classgraph 6.x supports only Java 25 and later. Classgraph 5.x is an interim version that continues support for Java 17 to 24. This change adopts Classgraph 5.x to maintain compatibility with the current build, which uses Java 17. Signed-off-by: Mark S. Lewis <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
| private List<Class<?>> loadClasses(ClassInfoList classInfos) { | ||
| List<Class<?>> classes = new ArrayList<>(); | ||
| for (ClassInfo classInfo : classInfos) { | ||
| Class<?> c = access.findClassByName(classInfo.getName()); | ||
| if (c == null) { | ||
| throw new IllegalStateException("Class not found: " + classInfo.getName()); | ||
| } | ||
| classes.add(c); | ||
| } | ||
| return classes; | ||
| } |
There was a problem hiding this comment.
findClassByName doesn't only return null for a missing class. In GraalVM 25.0.2 it is imageClassLoader.findClass(className).get(). ImageClassLoader.findClass catches both ClassNotFoundException and LinkageError and wraps them in a TypeResult whose get() returns null. So a class that is on the classpath but fails to link, for example a NoClassDefFoundError from a missing optional dependency, is reported as "Class not found" and the real cause is lost. ClassGraph 4's loadClasses() kept the cause: it threw IllegalArgumentException("Could not load class …", e).
findClassByName loads through getApplicationClassLoader(), so calling Class.forName on that loader behaves the same and keeps the exception:
| private List<Class<?>> loadClasses(ClassInfoList classInfos) { | |
| List<Class<?>> classes = new ArrayList<>(); | |
| for (ClassInfo classInfo : classInfos) { | |
| Class<?> c = access.findClassByName(classInfo.getName()); | |
| if (c == null) { | |
| throw new IllegalStateException("Class not found: " + classInfo.getName()); | |
| } | |
| classes.add(c); | |
| } | |
| return classes; | |
| } | |
| private List<Class<?>> loadClasses(ClassInfoList classInfos) { | |
| ClassLoader loader = access.getApplicationClassLoader(); | |
| List<Class<?>> classes = new ArrayList<>(); | |
| for (ClassInfo classInfo : classInfos) { | |
| try { | |
| classes.add(Class.forName(classInfo.getName(), false, loader)); | |
| } catch (ClassNotFoundException | LinkageError e) { | |
| throw new IllegalStateException("Could not load class " + classInfo.getName(), e); | |
| } | |
| } | |
| return classes; | |
| } |
Classgraph 4.x is end-of-life. Classgraph 6.x supports only Java 25 and later. Classgraph 5.x is an interim version that continues support for Java 17 to 24.
This change adopts Classgraph 5.x to maintain compatibility with the current build, which uses Java 17.