Analyze this program:
public class DumbMethodsNFE {
// Based on com.daffodilwoods.daffodildb.utils.field.FieldLiteral
public void crash(String msg) {
new java.math.BigDecimal(Double.POSITIVE_INFINITY);
if ("Infinite or NaN".equals(msg)) {}
}
}
Result:
Exception analyzing DumbMethodsNFE using detector edu.umd.cs.findbugs.detect.DumbMethods
java.lang.NumberFormatException: Infinite or NaN
At java.math.BigDecimal.<init>(Unknown Source)
At java.math.BigDecimal.<init>(Unknown Source)
At edu.umd.cs.findbugs.detect.DumbMethods.sawOpcode(DumbMethods.java:1033)
At edu.umd.cs.findbugs.visitclass.DismantleBytecode.visit(DismantleBytecode.java:835)
At edu.umd.cs.findbugs.detect.DumbMethods.visit(DumbMethods.java:1178)
...</init></init>
This fixes the problem, by the way:
Thanks. Fix committed, please verify: http://code.google.com/p/findbugs/source/detail?r=85b84f4c8231f59d57b2617669f3e295b849b489
Regards,
Andrey
Commit 1103397 passes all my tests (> 10 MLoC Java, compiled with Java 7 and below + 16K classes from Java API compiled with Java 8)