Unused field not reported due to assumed reflection#2326
Unused field not reported due to assumed reflection#2326iloveeclipse merged 1 commit intospotbugs:masterfrom
Conversation
|
@iloveeclipse I don't see how to lower the confidence of the bug. Just the priority (++ is lowering it). I don't see the bug reported in Eclipse, when the code believes there can be reflection. I assume due to the lowered priority. |
There was a problem hiding this comment.
Please do two things:
- add a trivial test to spotbugs-tests/src/test/java/edu/umd/cs/findbugs/detect
- add an entry to the CHANGELOG.md file
Beside this, I think we should be fine.
Dirty code should be properly reported, and by filtering on prio one can define what one will see what not.
Not reporting such obvious thing makes people assume that SpotBugs is stupid, which isn't the case in general :-)
This change ensures an unused field is reported despite assumptions on reflection use for the defining class. In reflective classes, the priority of the created problem is lowered. Fixes: spotbugs#2325
iloveeclipse
left a comment
There was a problem hiding this comment.
New with "reflective" class usage we report
Rank: Of Concern (20), confidence: Low
Pattern: UUF_UNUSED_FIELD
Same but without "reflective" class usage
Rank: Of Concern (18), confidence: Normal
Pattern: UUF_UNUSED_FIELD
So one should be able to sort that out.
Thanks, LGTM
|
With this change, we now generate The latter also generates Is it worth opening a new issue for that? |
This change ensures an unused field is reported despite assumptions on reflection use for the defining class.
If reflection is assumed, the priority of the created spotbugs problem is lowered.
Fixes: #2325
Make sure these boxes are checked before submitting your PR -- thank you!
CHANGELOG.mdif you have changed SpotBugs code