Repository navigation
chore: update ClassGraph to 5.0.2 - #2450
Draft
totally-not-ai[bot] wants to merge 2 commits into
Draft
totally-not-ai[bot] wants to merge 2 commits into
totally-not-ai[bot] wants to merge 2 commits into
Conversation
ClassGraph 4 is end of life. ClassGraph 5 is the JDK 17+ line and has the same API as ClassGraph 6, which needs JDK 25. ClassGraph 5 scans nothing unless a source is enabled, so the tester and route scans now enable the classpath and the non-system modules, which is what 4.x scanned by default. ClassGraph no longer loads classes, so discovered routes and error routes are loaded with the thread context class loader, falling back to the class loader of Routes, without initializing them, as before. getClassesImplementing is now getAllClassesImplementing.
Keep a linkage error from the context class loader as a suppressed exception when the fallback cannot load the class either, and cover loadClass directly and through Routes: a context class loader that defines its own copy of the views wins over the class loader of Routes, and the views are the same when there is no context class loader.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Updates ClassGraph from 4.8.184 to 5.0.2 in UI unit testing. ClassGraph 4 is end of life; ClassGraph 5 is the JDK 17–24 line with the same API as ClassGraph 6, which needs JDK 25 and so cannot be used while Vaadin 25 supports JDK 21.
What changed
vaadin-testbench-unit-shared/pom.xml:io.github.classgraph:classgraph4.8.184 → 5.0.2 (it now brings inclassgraph-base,classgraph-vfsandclassgraph-classpathtransitively).BaseUIUnitTest.scanForTestersandRoutes.autoDiscoverViews: ClassGraph 5 scans nothing unless a source is enabled, so both scans now callenableClasspath().enableNonSystemModules(), which is what 4.x scanned by default.Routes:getClassesImplementingis renamed togetAllClassesImplementing(same transitive semantics).Routes: ClassGraph 5 no longer loads classes, so discovered routes and error routes are loaded by a new internalloadClassinUtils.kt: the thread context class loader first, then the class loader ofRoutes, without initializing the class, and anIllegalArgumentExceptionif the class is missing or not of the expected type (asScanResult.loadClass(name, type, false)did). If the context class loader found the class but could not link it, that error is attached as a suppressed exception.scanForTestersalready usedfindClassOrThrowand is unchanged, so testers keep their existing class loader order.@Route,HasErrorParameter) are still matched withoutenableExternalClasses().Test summary
mvn test -pl vaadin-testbench-unit-shared,vaadin-testbench-unit,vaadin-testbench-unit-junit5,vaadin-testbench-unit-quarkus: all pass (4, 245, 869 and 14 tests), including the existing route discovery (routesTestBatch,DiscoverRoutesIn*) andTesterScanTestscans.HasErrorParameteronly through its superclass) compiled into a package only the context class loader sees, with a view whose static initializer throws; a child-first context class loader whose copies of the views win over the class loader ofRoutes; and discovery without a context class loader.loadClasstests for a class of the wrong type, a missing class, and a linkage error from the context class loader.mvn spotless:checkpasses for the changed modules.Working on behalf of @Artur-