Skip to content

Conversation

@mr-raj12
Copy link

@mr-raj12 mr-raj12 commented Jan 5, 2026

Summary

  • Extracts class/interface/enum names from Java source files during scanning
  • Stores class names in extra_data["java_classes"]
  • Indexes both filename-based and class-name-based paths for D2D matching

Problem

When a Java source file contains class declarations with names different from the filename (e.g., DelombokTask.java containing class Tasks), the compiled .class file uses the class name (Tasks.class), not the filename. The D2D mapping was failing to find the source file for these cases.

Test plan

  • Added unit tests for class name extraction in test_jvm.py
  • Added integration test for D2D mapping in test_d2d.py
  • Verified existing tests still pass

Closes #1993

Signed-off-by: Mrityunjay Raj mr.raj.earth@gmail.com

When a Java source file contains class declarations with names different
from the filename (e.g., DelombokTask.java containing class Tasks), the
compiled .class file uses the class name (Tasks.class), not the filename.

This fix:
- Extracts class/interface/enum names from Java source files during scanning
- Stores class names in extra_data["java_classes"]
- Indexes both filename-based and class-name-based paths for matching
- Enables correct D2D mapping for these edge cases

Closes aboutcode-org#1993

Signed-off-by: Mrityunjay Raj <mr.raj.earth@gmail.com>
@mr-raj12 mr-raj12 force-pushed the fix-java-class-mapping branch from a9c801c to 557ce0c Compare January 5, 2026 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compiled .class May Differ from Source Filename - map_deploy_to_devel (Java)

1 participant