edu.umd.cs.findbugs.detect

Class NumberConstructor

public class NumberConstructor extends BytecodeScanningDetector

Detector to find calls to Number constructors with base type argument in Java 5 or newer bytecode. Using 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.

Author: Mikko Tiihonen

Constructor Summary
NumberConstructor(BugReporter bugReporter)
Constructs a NC detector given the reporter to report bugs on

Constructor Detail

NumberConstructor

public NumberConstructor(BugReporter bugReporter)
Constructs a NC detector given the reporter to report bugs on

Parameters: bugReporter the sync of bug reports

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.