- Fix min/max_outer_loops → pytest_min/max_loops in Java test_run_and_parse
- Update test_replacement.py for new replace_function_definitions_for_language API
- Update JavaSupport.discover_functions signature to match protocol
- Migrate _get_java_sources_root/_fix_java_test_paths to JavaFunctionOptimizer
- Fix test_java_tests_project_rootdir to use set_current_language
Bug #2: Test file name mapping returns null for Java tests
Root cause: For Java projects, tests_project_rootdir was incorrectly set
to the project root instead of the actual tests directory. This caused
test file resolution to fail in parse_test_xml when parsing JUnit XML
from Maven Surefire, which doesn't include file attributes.
JavaScript already had this fix (line 654), but Java was missing it.
Fix: Add Java to the language check that sets tests_project_rootdir
equal to tests_root, ensuring instrumented test files can be found at
src/test/java/com/example/Test__perfinstrumented.java
Changes:
- Added is_java import to discover_unit_tests.py
- Added Java check: if is_java(): cfg.tests_project_rootdir = cfg.tests_root
- Added comprehensive test coverage with 2 test cases
Tests:
- test_java_tests_project_rootdir_set_to_tests_root: verifies fix for Java
- test_python_tests_project_rootdir_unchanged: verifies Python unchanged
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>