Cope with missing annotation parameter #691
Merged
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.
This is a quick fix for #686
When
@SuppressWarnings("unchecked")
is used on a class or method, theTreePathScanner
will scan yielding all nodes before scanning the class/method so all those nodes can be used when emitting symbol info e.g. the following nodes for the annotation are all present...But when the annotation is added to a variable then the scanner yields...
then it scans the variable and then the rest of the annotation. I've no idea why it does it in this order. Notice the
value
node is missing.This PR simply stops the link to
value
being added. It's unused anyway sincevalue
doesn't appear in the code and therefore can't be linked to. The reason it's being checked is thatjavac
implicitly adds it during the scan.If the code actually contains
value
e.g.@SuppressWarnings(value = "unchecked")
then the annotation is scanned before the variable and adds the link correctly. So I don't think this fix should be an issue.Test plan
I've added no tests for this. Should I add the reproducer code in the issue as a new snapshot test?