feat: add early module import validation for Java#1758
Open
aseembits93 wants to merge 1 commit intoomni-javafrom
Open
feat: add early module import validation for Java#1758aseembits93 wants to merge 1 commit intoomni-javafrom
aseembits93 wants to merge 1 commit intoomni-javafrom
Conversation
Prevent wasted API calls by validating Java module structure (source root, build config, package declaration) before optimization. Adds JavaFunctionOptimizer with auto-correction of misconfigured module roots, matching the pattern from Python and JavaScript implementations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
can_be_optimized()check for Java that validates module structure (source root, build config, package declaration) before making expensive API callsJavaFunctionOptimizersubclass with auto-correction of misconfigured module roots viatry_correct_module_root()function_optimizer_classdispatch inoptimizer.pyinstead of hardcodedFunctionOptimizer, matching the Python and JavaScript patternChanges
codeflash/code_utils/config_java_validation.pyvalidate_java_module_resolution()andinfer_java_module_root()codeflash/languages/java/function_optimizer.pyJavaFunctionOptimizerwith validation, context extraction, and method overridescodeflash/languages/java/support.pyfunction_optimizer_classpropertycodeflash/optimization/optimizer.pyfunction_optimizer_classdispatchtests/code_utils/test_config_java_validation.pytests/test_languages/test_java/test_java_function_optimizer_validation.pyTest plan
test_config_java_validation.py)test_java_function_optimizer_validation.py)🤖 Generated with Claude Code