Skip to content

feat(jdk-codemodel): resolve method references and parameter symbols to their descriptors#106

Merged
deer merged 1 commit into
mainfrom
more_source_resolution
Jul 6, 2026
Merged

feat(jdk-codemodel): resolve method references and parameter symbols to their descriptors#106
deer merged 1 commit into
mainfrom
more_source_resolution

Conversation

@deer

@deer deer commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

visitMemberReference now resolves method references (e.g. Foo::bar) to a ResolvedMethod trait and stamps a usage-site SourceLocation.FilePosition, matching what visitMethodInvocation already does, by sharing the resolveMethod lookup between MethodInvocationTree and MemberReferenceTree through a common resolveMethod(Element) helper.

Symbol.Parameter now carries the resolved FormalParameterDescriptor instead of a bare TypeUsage, closing usage-to-declaration navigation for parameters the same way Symbol.Field already does for fields; resolution walks the enclosing ExecutableElement (method or constructor) and matches it against the CodeModel by name, arity, and parameter types before indexing into its FormalParameterDescriptors, correctly leaving lambda parameters unresolved since they aren't part of the enclosing executable's own parameter list.

CatchClause also gets its exception parameter stamped with a declaration-site SourceLocation, mirroring the treatment EnhancedFor already gives its loop variable. parametersMatch was generalized from MethodDescriptor to CallableDescriptor so the same matching logic serves both methods and constructors.

@deer deer merged commit 0b2a01d into main Jul 6, 2026
1 check passed
@deer deer deleted the more_source_resolution branch July 6, 2026 06:37
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