Repository navigation
Conversation
Changed Files
|
Contributor
No docs changes detected for 68d3657 |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the replacement of ClassGraph-based wildcard import checks with direct JDK lookups.
No open issues 🎉
What changed in this PR
Replaces ClassGraph-based Groovy wildcard import checking with direct JDK lookups, removing engine-table’s runtime dependency on ClassGraph.
Changes:
- Checks named-module packages and classloader directory resources without force-loading a class.
- Adds rejection cases for nonexistent wildcard packages under classpath and JDK prefixes.
- Documents lookup limitations, including jars without directory entries.
| File | Description |
|---|---|
engine/table/src/test/java/io/deephaven/engine/util/scripts/TestGroovyDeephavenSession.java |
Adds invalid wildcard import cases and updates package-lookup comments. |
engine/table/src/main/java/io/deephaven/engine/util/GroovyDeephavenSession.java |
Replaces ClassGraph scanning with module and classloader resource lookups. |
engine/table/build.gradle |
Removes the ClassGraph implementation dependency. |
Review effort: Balanced
cpwright
marked this pull request as ready for review
October 30, 2026 22:35
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.
Groovy console wildcard imports (
import some.pkg.*) are checked before they are added to the session's imports. When the package is neither a class nor already defined by the classloader, the check used ClassGraph to scan the classpath and system modules for a class in that package, and then force-loaded that class. That was the only production use of ClassGraph. ClassGraph 4.x is end of life, and 5.x/6.x are incompatible rewrites (DH-24159).This replaces the scan with two direct JDK lookups:
ModuleLayer.boot().modules(), matchingModule.getPackages()exactly.groovyShell.getClassLoader().getResources("pkg/name/"), which finds the package's directory entry in jars and class directories, including jars added to the Groovy classloader.engine-tableno longer depends on ClassGraph, so it is gone from the server's runtime classpath (checked for both the Python and-Pgroovyserver-jetty-appruntime classpaths).Behavior differences
testUnloadedWildcardPackageImportchecks this: for a package from a JDK module, a jar and a test class directory, none with a class loaded, it importspkg.*and then uses a class from it by simple name.allowUnknownGroovyPackageImports=false(the default) its wildcard import is rejected with a warning. None of the 259 third-party jars on theserver-jetty-appruntime classpath lack directory entries, and Gradle-built project jars include them.acceptPackageswas recursive, and the directory lookup matches the same way (a package with only subpackages is accepted). The module lookup is exact.io.github.classgraphclasses without supplying the jar will fail.Test-only ClassGraph 5
extensions-classgraphis removed. It was an off-by-default example that put ClassGraph in the Groovy console's scope.:serverused it only to get ClassGraph onto its test classpath, soserver/build.gradlenow declarestestImplementation libs.classgraphdirectly.TestFinalDefaultis ported to ClassGraph 5.0.0 (from 4.8.198), its only remaining user. 5.x scans nothing untilenableClasspath(), hides supertypes outside the accepted classes unlessenableExternalClasses(), dropsloadClass/loadClassAndGetMethod(replaced withClass.forNameand a descriptor match), and renames the subclass/implementor accessors.getClassesWithMethodAnnotationnow also returns classes that only inherit an annotated method, so the reported class count counts classes that declare one. The scan verifies the same 70 classes and 202@FinalDefaultmethods as 4.x, and the 15 negative cases still fail as expected. 5.0.1 is two days old, so it is not used yet.Testing
TestGroovyDeephavenSession(18 tests) passes. With the new lookup stubbed tofalse,testUnloadedWildcardPackageImportandtestIsValidImportStringfail, so the tests depend on it.testUnloadedWildcardPackageImportnow uses a class from each imported package (javax.sql.rowset,groovy.time, and a test-source package) rather than only checking the import is accepted.java.utilwas replaced because Groovy imports it by default.io.deephaven.engine.xxx.util.*) and a JDK module prefix (java.util.xxx.*).🤖 Generated with Claude Code
https://claude.ai/code/session_01HgjU6C7M294opKCLJ8T9sj