Class NumberConstructor

All Implemented Interfaces:
Detector, Priorities, org.apache.bcel.classfile.Visitor

public class NumberConstructor extends OpcodeStackDetector
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