Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

This PR implements Phase 2 Java language support and enhances the existing Python analyzer.

Java Support:

  • Added tree-sitter-java dependency.
  • Created JavaParser to extract AST nodes (classes, methods, imports) and calculate cyclomatic complexity.
  • Created JavaSemanticSnapshotBuilder to generate project snapshots.
  • Supports extracting Fully Qualified Names (FQNs) by parsing package declarations.
  • Maps Spring/JPA annotations (e.g., @Service, @Entity) to semantic tags.
  • Configured default ignore paths for Java projects (target/, build/, etc.).

Python Enhancements:

  • Updated PythonParser to extract class attributes (fields), including type annotations and default values.
  • Added line number tracking to ImportNode for better traceability.
  • Implemented code sampling in PythonSemanticSnapshotBuilder to capture snippets of high-complexity functions for AI context.
  • Updated AST models (ClassNode, ImportNode) to support new fields.

Testing:

  • Verified Java parsing and snapshot generation with unit tests.
  • Verified Python field extraction and import line numbers with unit tests.

PR created automatically by Jules for task 6484950900759385627 started by @turtacn

- Add `tree-sitter-java` dependency.
- Implement `JavaParser` in `codesage/analyzers/java_parser.py` with AST extraction (classes, methods, imports) and complexity calculation.
- Implement `JavaSemanticSnapshotBuilder` in `codesage/semantic_digest/java_snapshot_builder.py` supporting package-aware FQN and annotation tags.
- Update `codesage/analyzers/parser_factory.py` to register `JavaParser`.
- Update `codesage/config/defaults.py` with Java file extensions and ignore paths.
- Enhance `PythonParser` in `codesage/analyzers/python_parser.py`:
  - Extract class attributes (fields).
  - Add line numbers to import nodes.
  - Fix type extraction for annotated assignments.
- Update `codesage/analyzers/ast_models.py`:
  - Add `fields` to `ClassNode`.
  - Add `lineno` to `ImportNode`.
- Enhance `PythonSemanticSnapshotBuilder` to support code sampling for high-complexity functions.
- Fix metric calculation to avoid double-counting methods in Java snapshots.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@turtacn turtacn merged commit 3ac37aa into master Nov 23, 2025
1 check failed
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.

2 participants