Skip to content

fix(hierarchical, jdk): capture cast types, instanceof bindings, and new-object type args in source AST#8

Merged
deer merged 1 commit intomainfrom
fixes
Apr 7, 2026
Merged

fix(hierarchical, jdk): capture cast types, instanceof bindings, and new-object type args in source AST#8
deer merged 1 commit intomainfrom
fixes

Conversation

@deer
Copy link
Copy Markdown
Collaborator

@deer deer commented Apr 7, 2026

Fixes three source-tree capture gaps in JdkExpressionConverter and cleans up a wasteful double-traversal in HierarchicalTypeDescriptor.

  • visitTypeCast: Resolves the cast target type via trees.getTypeMirror() instead of always emitting UnknownTypeUsage. Falls back to UnknownTypeUsage when type context is unavailable.
  • visitInstanceOf: Captures pattern-binding variable names from Java 16+ instanceof patterns (e.g. obj instanceof String s). Added Optional bindingVariable to InstanceOf.
  • visitNewClass: Splits parameterized class expressions (e.g. new ArrayList()) into a bare type name and a separate type-arguments list instead of collapsing everything into a single identifier string. Added Stream typeArguments to NewObject. Note: anonymous class bodies remain untracked (separate architectural concern).
  • formsDiamondPattern: Collects parents() into a set once rather than calling the stream twice.

Each converter fix is covered by a new integration test in ExpressionCaptureFidelityTests.

@deer deer merged commit e04596e into main Apr 7, 2026
1 check passed
@deer deer deleted the fixes branch April 7, 2026 15:50
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.

1 participant