Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering
“This instanceof test will always return false, since the value being checked is guaranteed to be null. Although this is safe, make sure it isn't an indication of some misunderstanding or some other logic error. ” – 2013-12-16
The value that is checked with an instanceOf operation is ensured to be null (With the help of points-to-analysis). Therefore, there is probably a logical error in the code. No sample fix can be given.
<code Java>
if(a instanceof String){ System.out.println("BUUG!"); }
</Code>
<code Java>
private static Object returnsNotNull(){ return new Object(); }
Object o = null; o = returnsNotNull(); boolean b = o instanceof Object; System.out.println(b);
</Code>
No fix provided.
Benchmark project | Precision | Recall | ||||
---|---|---|---|---|---|---|
FB | JT | Delta | FB | JT | Delta | |
MDSE Lab | 100% | 66% | - | 66% | 33% | -% |
Apache Tomcat | 100% | 100% | 0 | 100% | 100% | 0% |
Argo UML | 100% | 100% | 0 | 100% | 100% | 0% |
AWT | 100% | 100% | 0 | 100% | 100% | 0% |
Jakarta | 100% | 100% | 0 | 100% | 100% | 0% |
Java IO | 100% | 100% | 0 | 100% | 100% | 0% |
JHotDraw | 100% | 100% | 0 | 100% | 100% | 0% |
jrefactory | 100% | 100% | 0 | 100% | 100% | 0% |
JServlet | 100% | 100% | 0 | 100% | 100% | 0% |
JUnit | 100% | 100% | 0 | 100% | 100% | 0% |
Lexi | 100% | 100% | 0 | 100% | 100% | 0% |
Mapper XML | 100% | 100% | 0 | 100% | 100% | 0% |
nutch | 100% | 100% | 0 | 100% | 100% | 0% |
PMD | 100% | 100% | 0 | 100% | 100% | 0% |
quickuml | 100% | 100% | 0 | 100% | 100% | 0% |
FB = FindBugs, JT = JTransformer, Delta = JTransformer - FindBug