Fix Java D2D mapping when compiled .class name differs from source fi… #2012
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.
Problem
The current Deploy-to-Develop (D2D) Java mapping assumes that a compiled .class file name always matches its source .java filename.
This assumption breaks for some projects (e.g. Lombok), where:
The declared class name does not match the source file name
As a result, valid Java sources are not mapped to their compiled .class files
Example from Lombok:
Tasks.class ← source file is DelombokTask.java
AnnotationProcessorHider.class ← source file is AnnotationProcessor.java
This causes these .class files to be reported as having no corresponding source mapping.
Solution
This PR improves Java D2D mapping by:
Extracting the declared class name from .java source files
Using the declared class name (instead of only the filename) to build the JVM mapping index
Allowing .class files to correctly map even when the source filename differs
The change is limited to Java JVM mapping logic and does not affect other ecosystems.
Related issue
Fixes: Compiled .class May Differ from Source Filename – map_deploy_to_devel (Java)
🔗 #1993