-
Notifications
You must be signed in to change notification settings - Fork 578
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
A false negative about the rule BC_IMPOSSIBLE_DOWNCAST_OF_TOARRAY #1759
Comments
SpotBugs surely detects this problem. I made a test case in this commit d280e0f. |
Hi, @KengoTODA. I have re-tested this case, but Spotbugs indeed doesn't report this bug. I run spotbugs by CLI and the command is spotbugs -textui -effort:max -xml:withMessages -output ./result.xml case.class The testing result file is here. |
could you share a full |
@KengoTODA Hi Kengo, thanks for your reply. I have created a repo for reproducing this issue. Link is here. Thanks! |
@KengoTODA Hi, Kengo! I have tested this case by javac 11.0.11 and javac 1.8.0_171. Other environment variables are identical. And...SpotBugs can report this bug! This seems very interesting and I think it may be caused by different java versions. I am testing it with more java versions. |
It seems that the class file built with Java 8 has an additional
If we delete the cast Bytecode built with Java 11
Bytecode built with Java 8Use
|
|
Hi Kengo, I have tested Java 9 by this JDK (Link), Spotbugs can report this problem, so |
SpotBugs Version: 4.4.2
Rule: BC_IMPOSSIBLE_DOWNCAST_OF_TOARRAY
Hi! I find a false negative about this rule. SpotBugs should have reported a warning at line 4. This program can lead to a running exception.
Code Sample
Expected outcome:
SpotBugs should report a violation at line 4, but doesn't. This is a false-negative.
Running SpotBugs through: [CLI]
The text was updated successfully, but these errors were encountered: