Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat annotations on synthetic parameter properly #836

Merged
merged 2 commits into from
Dec 27, 2018

Conversation

KengoTODA
Copy link
Member

@KengoTODA KengoTODA commented Dec 24, 2018

Currently ClassParserUsingASM uses parameter index that doesn't consider the synthetic parameter like the reference from non-static inner class to outer class. This means that, SpotBugs treats annotation on the 1st parameter in source code (String in the test case) as annotation on the 1st parameter in bytecode (NonNullParameterOfInnerClassConstructor in the test case).

Unfortunately at the timing of visitParameterAnnotation(), the mBuilder doesn't know that the parameter is synthetic or not. So we need to count the number of synthetic parameters by number of actual parameters - number of annotatable parameters dynamically.

This PR fixes #772. It also closes #773.


Make sure these boxes are checked before submitting your PR -- thank you!

  • Added an entry into CHANGELOG.md if you have changed SpotBugs code

@KengoTODA KengoTODA added the bug label Dec 24, 2018
@KengoTODA KengoTODA added this to the SpotBugs 3.1.11 milestone Dec 24, 2018
@KengoTODA KengoTODA self-assigned this Dec 24, 2018
@KengoTODA
Copy link
Member Author

@spotbugs/core-devs please review this change, thank you!

@KengoTODA KengoTODA merged commit 24b7f91 into release-3.1 Dec 27, 2018
@KengoTODA KengoTODA deleted the ahubold-test-issue772 branch December 27, 2018 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants