feat(jdk-codemodel): resolve method references and parameter symbols to their descriptors#106
Merged
Conversation
…to their descriptors
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.
visitMemberReferencenow resolves method references (e.g.Foo::bar) to aResolvedMethodtrait and stamps a usage-siteSourceLocation.FilePosition, matching whatvisitMethodInvocationalready does, by sharing theresolveMethodlookup betweenMethodInvocationTreeandMemberReferenceTreethrough a commonresolveMethod(Element)helper.Symbol.Parameternow carries the resolvedFormalParameterDescriptorinstead of a bareTypeUsage, closing usage-to-declaration navigation for parameters the same waySymbol.Fieldalready does for fields; resolution walks the enclosingExecutableElement(method or constructor) and matches it against theCodeModelby name, arity, and parameter types before indexing into itsFormalParameterDescriptors, correctly leaving lambda parameters unresolved since they aren't part of the enclosing executable's own parameter list.CatchClausealso gets its exception parameter stamped with a declaration-siteSourceLocation, mirroring the treatmentEnhancedForalready gives its loop variable.parametersMatchwas generalized fromMethodDescriptortoCallableDescriptorso the same matching logic serves both methods and constructors.