Repository navigation
Skip non-existent classpath entries when scanning with Reflections - #968
Conversation
Gradle puts source set output directories on the classpath even when they were never created, e.g. build/classes/java/main in Kotlin-only projects. These entries made Reflections log NullPointerException and ReflectionsException stack traces for every scan. Signed-off-by: Jun Sekine <jun@sakamo.to>
6ff9be5 to
7ff972d
Compare
|
@jsoizo Thank you for contributing to gauge-java. Your pull request has been labeled as a release candidate 🎉🎉. Merging this PR will trigger a release. Please bump up the version as part of this PR.Instructions to bump the version can found at CONTRIBUTING.md If the CONTRIBUTING.md file does not exist or does not include instructions about bumping up the version, please looks previous commits in git history to see what changes need to be done. |
chadlwilson
left a comment
There was a problem hiding this comment.
If you could remove the unnecessarily noisy LLM comment and bump up the version, I think this is fine.
There was a problem hiding this comment.
🟡 Changes recommended
Check converted files with exists() in both production paths.
2 open findings
What changed in this PR
This PR filters missing classpath entries to reduce Reflections scan warnings in Kotlin-only Gradle projects.
Changes:
- Filters classpath URLs.
- Restricts custom VFS URL handling.
- Adds regression coverage for missing entries.
Review found that both existence checks only verify file conversion, so missing paths may still trigger warnings.
| File | Summary |
|---|---|
src/test/java/com/thoughtworks/gauge/ClasspathHelperTest.java |
Tests missing classpath entry filtering. |
src/main/java/com/thoughtworks/gauge/scan/ClasspathScanner.java |
Updates custom URL matching. |
src/main/java/com/thoughtworks/gauge/ClasspathHelper.java |
Filters classpath entries. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: Jun Sekine <jun@sakamo.to>
|
Thank you for the feedback. I've removed the unnecessary comment.
I am not sure if I have understood your intention correctly, so please let me ask. Details |
|
Yes, like the bot comment alludes to 👍 |
Signed-off-by: Jun Sekine <jun@sakamo.to>
|
@chadlwilson I've pushed a fix that bumps the version. |
|
Could you look a the copilot comments and see if they have a point, or are nonsense? |

Problem
In Kotlin-only Gradle projects, the gauge Gradle plugin puts source set output dirs that were never created (e.g.
build/classes/java/main,build/resources/main) on the classpath. Reflections receives them as-is, and every scan logs two stack traces per missing dir:NullPointerExceptionfrom the customUrlTypeinClasspathScanner(Vfs.getFilereturnsnull)ReflectionsException: could not create Vfs.Dir from url, no matching UrlType was foundStack traces (one missing dir; repeated for each missing dir and each scan)
Steps are still discovered, so this is noise only, but it shows up on every run.
Changes
ClasspathHelper.getUrls(): skip classpath entries that don't exist (covers bothClasspathScannerandParameterParsingChain)ClasspathScanner: the customUrlTypeno longer matches non-existent filesClasspathHelperTestVerification
Kotlin-only Gradle sample (
org.gauge3.0.0, Kotlin 2.1.21,slf4j-simple),./gradlew gauge: