edu.umd.cs.findbugs.detect
public class NumberConstructor extends BytecodeScanningDetector
new Integer(int)
is guaranteed to always result in a
new object whereas Integer.valueOf(int)
allows caching of
values to be done by the javac, JVM class library or JIT.
Currently only the JVM class library seems to do caching in the range of
-128 to 127. There does not seem to be any caching for float and double
which is why those are reported as low priority.
All invokes of Number constructor with a constant argument are
flagged as high priority and invokes with unknwon value are normal priority.
Constructor Summary | |
---|---|
NumberConstructor(BugReporter bugReporter)
Constructs a NC detector given the reporter to report bugs on |
Parameters: bugReporter the sync of bug reports