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

Report bug SA_FIELD_SELF_ASSIGNMENT in nested classes as well #2161

Merged
merged 6 commits into from Sep 5, 2022

Conversation

baloghadamsoftware
Copy link
Contributor

Bug SA_FIELD_SELF_ASSIGNMENT was not reported in nested classes, only in the outer class. This lead to inconsistent behavior. See issue (#2142). This PR fixes this issue.


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

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

Ádám Balogh and others added 2 commits September 1, 2022 13:56
Bug `SA_FIELD_SELF_ASSIGNMENT` was not reported in nested classes, only in the outer class. This lead to inconsistent behavior. See issue ([spotbugs#2142](spotbugs#2142)). This PR fixes this issue.
@KengoTODA KengoTODA mentioned this pull request Sep 1, 2022
1 task
public void afterOpcode(int seen) {
super.afterOpcode(seen);

if (seen == Const.GETFIELD && parentInstanceLoadFromRegister > -1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you replace this magic number -1 with a static final int field?
Better to tell our intention to who is reading our code.

Balogh, Ádám and others added 3 commits September 2, 2022 10:48
…fAssignment.java

Co-authored-by: Kengo TODA <skypencil+github@gmail.com>
…fAssignment.java

Co-authored-by: Kengo TODA <skypencil+github@gmail.com>
@baloghadamsoftware
Copy link
Contributor Author

Thank you for your comments, @KengoTODA! I think I fixed every one of them now.

KengoTODA
KengoTODA previously approved these changes Sep 3, 2022
Copy link
Member

@KengoTODA KengoTODA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@KengoTODA KengoTODA requested a review from a team September 3, 2022 13:30
ThrawnCA
ThrawnCA previously approved these changes Sep 4, 2022
@KengoTODA KengoTODA dismissed stale reviews from ThrawnCA and themself via 5028812 September 5, 2022 01:24
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.

None yet

3 participants