Avoid using deprecated boxing constructors

Boxing a primitive using the constructor ("new Integer(4)") always
creates a distinct new boxed instance.  That's rarely what you need,
and in fact all of those constructors have been deprecated in Java 9.
Using the static "valueOf" method instead ("Integer.valueOf(4)") can
give better performance by reusing existing instances.  You no longer
get a unique boxed object, but generally that's OK.
This commit is contained in:
Ben Liblit 2018-06-04 13:16:36 -05:00
parent 32e105a3c0
commit 5336a08af2
41 changed files with 162 additions and 160 deletions

View File

@ -188,7 +188,7 @@ public class JDT2CAstUtils {
*/ */
public static Object defaultValueForType(ITypeBinding type) { public static Object defaultValueForType(ITypeBinding type) {
if (isLongOrLess(type)) if (isLongOrLess(type))
return new Integer(0); return Integer.valueOf(0);
else if (type.getBinaryName().equals("D") || type.getBinaryName().equals("F")) else if (type.getBinaryName().equals("D") || type.getBinaryName().equals("F"))
return new Double(0.0); return new Double(0.0);
else else

View File

@ -2305,7 +2305,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
private CAstNode getSwitchCaseConstant(SwitchCase n, WalkContext context) { private CAstNode getSwitchCaseConstant(SwitchCase n, WalkContext context) {
// TODO: enums // TODO: enums
Expression expr = n.getExpression(); Expression expr = n.getExpression();
Object constant = (expr == null) ? new Integer(0) : expr.resolveConstantExpressionValue(); // default case label of Object constant = (expr == null) ? Integer.valueOf(0) : expr.resolveConstantExpressionValue(); // default case label of
// "0" (what polyglot // "0" (what polyglot
// does). we also set // does). we also set
// SWITCH_DEFAULT // SWITCH_DEFAULT
@ -2562,7 +2562,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
/*------ indexDecl --------- int tmpindex = 0 ------*/ /*------ indexDecl --------- int tmpindex = 0 ------*/
final String tmpIndexName = "for temp index"; final String tmpIndexName = "for temp index";
CAstNode indexDeclNode = makeNode(context, fFactory, n, CAstNode.DECL_STMT, fFactory.makeConstant(new InternalCAstSymbol( CAstNode indexDeclNode = makeNode(context, fFactory, n, CAstNode.DECL_STMT, fFactory.makeConstant(new InternalCAstSymbol(
tmpIndexName, fTypeDict.getCAstTypeFor(ast.resolveWellKnownType("int")), true)), fFactory.makeConstant(new Integer(0))); tmpIndexName, fTypeDict.getCAstTypeFor(ast.resolveWellKnownType("int")), true)), fFactory.makeConstant(Integer.valueOf(0)));
/*------ cond ------------- tmpindex < tmparray.length ------*/ /*------ cond ------------- tmpindex < tmparray.length ------*/
CAstNode tmpArrayLengthNode = makeNode(context, fFactory, n, CAstNode.ARRAY_LENGTH, makeNode(context, fFactory, n, CAstNode tmpArrayLengthNode = makeNode(context, fFactory, n, CAstNode.ARRAY_LENGTH, makeNode(context, fFactory, n,

View File

@ -15,7 +15,7 @@ public class AnonymousClass {
} }
public static void main(String[] args) { public static void main(String[] args) {
final Integer base = new Integer(6); final Integer base = Integer.valueOf(6);
Foo f= new Foo() { Foo f= new Foo() {
int value = 3; int value = 3;
@ -34,7 +34,7 @@ public class AnonymousClass {
} }
public void method() { public void method() {
final Integer base = new Integer(7); final Integer base = Integer.valueOf(7);
abstract class FooImpl implements Foo { abstract class FooImpl implements Foo {
int y; int y;

View File

@ -12,6 +12,6 @@ public class ArrayLiteral1 {
public static void main(String[] args) { public static void main(String[] args) {
ArrayLiteral1 al1= new ArrayLiteral1(); ArrayLiteral1 al1= new ArrayLiteral1();
int[] a= new int[] { 0, 1, 2, 3, 5 }; int[] a= new int[] { 0, 1, 2, 3, 5 };
Object[] b= new Object[] { null, "hi", new Integer(55), new int[] { 3, 1, 4 } }; Object[] b= new Object[] { null, "hi", Integer.valueOf(55), new int[] { 3, 1, 4 } };
} }
} }

View File

@ -10,7 +10,7 @@
*****************************************************************************/ *****************************************************************************/
public class LocalClass { public class LocalClass {
public static void main(String[] args) { public static void main(String[] args) {
final Integer base = new Integer(6); final Integer base = Integer.valueOf(6);
class Foo { class Foo {
int value; int value;
@ -27,7 +27,7 @@ public class LocalClass {
} }
public void method() { public void method() {
final Integer base = new Integer(6); final Integer base = Integer.valueOf(6);
class Foo { class Foo {
int value; int value;

View File

@ -64,7 +64,7 @@ public class BasicsGenerics {
System.out.println(frenchy); System.out.println(frenchy);
System.out.println(sicilian); System.out.println(sicilian);
strs.add("hello"); strs.add("hello");
ints.add(new Integer(3)); ints.add(Integer.valueOf(3));
String qqq; String qqq;

View File

@ -47,8 +47,8 @@ public class ExplicitBoxingTest {
int a = 6; int a = 6;
a = a + a; a = a + a;
System.out.println(a); System.out.println(a);
Integer useless1 = new Integer(5+6); Integer useless1 = Integer.valueOf(5+6);
Integer aa = new Integer(a+a); Integer aa = Integer.valueOf(a+a);
int aaa = aa.intValue(); int aaa = aa.intValue();
System.out.println(aaa); System.out.println(aaa);

View File

@ -50,7 +50,7 @@ public class GenericArrays {
Object o = lsa; Object o = lsa;
Object[] oa = (Object[]) o; Object[] oa = (Object[]) o;
List<Integer> li = new ArrayList<>(); List<Integer> li = new ArrayList<>();
li.add(new Integer(3)); li.add(Integer.valueOf(3));
oa[1] = li; // correct oa[1] = li; // correct
String s = (String) lsa[1].get(0); // run time error, but cast is explicit String s = (String) lsa[1].get(0); // run time error, but cast is explicit

View File

@ -58,7 +58,7 @@ public class MoreOverriddenGenerics {
@Override @Override
public Long get() { public Long get() {
return new Long(6); return Long.valueOf(6);
} }
} }

View File

@ -46,7 +46,7 @@ public class OverridesOnePointFour {
@Override @Override
public Long get() { public Long get() {
return new Long(6); return Long.valueOf(6);
} }
} }

View File

@ -72,8 +72,8 @@ public class Wildcards {
printCollection2(e); printCollection2(e);
ArrayList<Integer> e3 = new ArrayList<>(); ArrayList<Integer> e3 = new ArrayList<>();
e3.add(new Integer(123)); e3.add(Integer.valueOf(123));
e3.add(new Integer(42)); e3.add(Integer.valueOf(42));
printCollection(e3); printCollection(e3);
printCollection1(e3); printCollection1(e3);

View File

@ -69,7 +69,7 @@ public class WebPageLoaderFactory extends JavaScriptLoaderFactory {
translateConditionOpcode(CAstOperator.OP_NE), translateConditionOpcode(CAstOperator.OP_NE),
null, null,
isDefined, isDefined,
context.currentScope().getConstantValue(new Integer(0)), context.currentScope().getConstantValue(Integer.valueOf(0)),
-1)); -1));
PreBasicBlock srcB = context.cfg().getCurrentBlock(); PreBasicBlock srcB = context.cfg().getCurrentBlock();

View File

@ -102,7 +102,7 @@ public class JavaScriptConstructorFunctions {
//S.addStatement(insts.PutInstruction(5, 4, "__proto__")); //S.addStatement(insts.PutInstruction(5, 4, "__proto__"));
S.getNextProgramCounter(); S.getNextProgramCounter();
S.addConstant(new Integer(8), new ConstantValue(value)); S.addConstant(Integer.valueOf(8), new ConstantValue(value));
S.addStatement(insts.PutInstruction(S.getNumberOfStatements(), 5, 8, "$value")); S.addStatement(insts.PutInstruction(S.getNumberOfStatements(), 5, 8, "$value"));
if (value instanceof String) { if (value instanceof String) {
S.addConstant(9, new ConstantValue(0)); S.addConstant(9, new ConstantValue(0));
@ -146,7 +146,7 @@ public class JavaScriptConstructorFunctions {
private IMethod makeValueConstructor(IClass cls, int nargs, Object value) { private IMethod makeValueConstructor(IClass cls, int nargs, Object value) {
if (nargs == 0 || nargs == 1) { if (nargs == 0 || nargs == 1) {
Object key = Pair.make(cls, new Integer(nargs)); Object key = Pair.make(cls, Integer.valueOf(nargs));
if (constructors.containsKey(key)) if (constructors.containsKey(key))
return constructors.get(key); return constructors.get(key);
@ -197,7 +197,7 @@ public class JavaScriptConstructorFunctions {
private IMethod makeObjectConstructor(IClass cls, int nargs) { private IMethod makeObjectConstructor(IClass cls, int nargs) {
if (nargs == 0 || nargs == 1) { if (nargs == 0 || nargs == 1) {
Object key = Pair.make(cls, new Integer(nargs)); Object key = Pair.make(cls, Integer.valueOf(nargs));
if (constructors.containsKey(key)) if (constructors.containsKey(key))
return constructors.get(key); return constructors.get(key);
@ -213,7 +213,7 @@ public class JavaScriptConstructorFunctions {
private IMethod makeObjectCall(IClass cls, int nargs) { private IMethod makeObjectCall(IClass cls, int nargs) {
assert nargs == 0; assert nargs == 0;
Object key = Pair.make(cls, new Integer(nargs)); Object key = Pair.make(cls, Integer.valueOf(nargs));
if (constructors.containsKey(key)) if (constructors.containsKey(key))
return constructors.get(key); return constructors.get(key);
@ -251,7 +251,7 @@ public class JavaScriptConstructorFunctions {
MethodReference ref = JavaScriptMethods.makeCtorReference(JavaScriptTypes.Array); MethodReference ref = JavaScriptMethods.makeCtorReference(JavaScriptTypes.Array);
JavaScriptSummary S = new JavaScriptSummary(ref, nargs + 1); JavaScriptSummary S = new JavaScriptSummary(ref, nargs + 1);
S.addConstant(new Integer(nargs + 3), new ConstantValue("prototype")); S.addConstant(Integer.valueOf(nargs + 3), new ConstantValue("prototype"));
S.addStatement(insts.PropertyRead(S.getNumberOfStatements(), nargs + 4, 1, nargs + 3)); S.addStatement(insts.PropertyRead(S.getNumberOfStatements(), nargs + 4, 1, nargs + 3));
S.getNextProgramCounter(); S.getNextProgramCounter();
@ -263,13 +263,13 @@ public class JavaScriptConstructorFunctions {
//S.addStatement(insts.PutInstruction(nargs + 5, nargs + 4, "__proto__")); //S.addStatement(insts.PutInstruction(nargs + 5, nargs + 4, "__proto__"));
S.getNextProgramCounter(); S.getNextProgramCounter();
S.addConstant(new Integer(nargs + 7), new ConstantValue(nargs)); S.addConstant(Integer.valueOf(nargs + 7), new ConstantValue(nargs));
S.addStatement(insts.PutInstruction(S.getNumberOfStatements(), nargs + 5, nargs + 7, "length")); S.addStatement(insts.PutInstruction(S.getNumberOfStatements(), nargs + 5, nargs + 7, "length"));
S.getNextProgramCounter(); S.getNextProgramCounter();
int vn = nargs + 9; int vn = nargs + 9;
for (int i = 0; i < nargs; i++, vn += 2) { for (int i = 0; i < nargs; i++, vn += 2) {
S.addConstant(new Integer(vn), new ConstantValue(i)); S.addConstant(Integer.valueOf(vn), new ConstantValue(i));
S.addStatement(insts.PropertyWrite(S.getNumberOfStatements(), nargs + 5, vn, i + 1)); S.addStatement(insts.PropertyWrite(S.getNumberOfStatements(), nargs + 5, vn, i + 1));
S.getNextProgramCounter(); S.getNextProgramCounter();
} }
@ -283,7 +283,7 @@ public class JavaScriptConstructorFunctions {
} }
private IMethod makeArrayConstructor(IClass cls, int nargs) { private IMethod makeArrayConstructor(IClass cls, int nargs) {
Object key = Pair.make(cls, new Integer(nargs)); Object key = Pair.make(cls, Integer.valueOf(nargs));
if (constructors.containsKey(key)) if (constructors.containsKey(key))
return constructors.get(key); return constructors.get(key);
@ -296,9 +296,9 @@ public class JavaScriptConstructorFunctions {
MethodReference ref = AstMethodReference.fnReference(JavaScriptTypes.String); MethodReference ref = AstMethodReference.fnReference(JavaScriptTypes.String);
JavaScriptSummary S = new JavaScriptSummary(ref, 1); JavaScriptSummary S = new JavaScriptSummary(ref, 1);
S.addConstant(new Integer(2), new ConstantValue("")); S.addConstant(Integer.valueOf(2), new ConstantValue(""));
S.addConstant(new Integer(3), new ConstantValue(0)); S.addConstant(Integer.valueOf(3), new ConstantValue(0));
S.addStatement(insts.PutInstruction(S.getNumberOfStatements(), 2, 3, "length")); S.addStatement(insts.PutInstruction(S.getNumberOfStatements(), 2, 3, "length"));
S.getNextProgramCounter(); S.getNextProgramCounter();
@ -328,7 +328,7 @@ public class JavaScriptConstructorFunctions {
private IMethod makeStringCall(IClass cls, int nargs) { private IMethod makeStringCall(IClass cls, int nargs) {
assert nargs == 0 || nargs == 1; assert nargs == 0 || nargs == 1;
Object key = Pair.make(cls, new Integer(nargs)); Object key = Pair.make(cls, Integer.valueOf(nargs));
if (constructors.containsKey(key)) if (constructors.containsKey(key))
return constructors.get(key); return constructors.get(key);
@ -341,7 +341,7 @@ public class JavaScriptConstructorFunctions {
MethodReference ref = AstMethodReference.fnReference(JavaScriptTypes.Number); MethodReference ref = AstMethodReference.fnReference(JavaScriptTypes.Number);
JavaScriptSummary S = new JavaScriptSummary(ref, 1); JavaScriptSummary S = new JavaScriptSummary(ref, 1);
S.addConstant(new Integer(2), new ConstantValue(0.0)); S.addConstant(Integer.valueOf(2), new ConstantValue(0.0));
S.addStatement(insts.ReturnInstruction(S.getNumberOfStatements(), 2, false)); S.addStatement(insts.ReturnInstruction(S.getNumberOfStatements(), 2, false));
S.getNextProgramCounter(); S.getNextProgramCounter();
@ -368,7 +368,7 @@ public class JavaScriptConstructorFunctions {
private IMethod makeNumberCall(IClass cls, int nargs) { private IMethod makeNumberCall(IClass cls, int nargs) {
assert nargs == 0 || nargs == 1; assert nargs == 0 || nargs == 1;
Object key = Pair.make(cls, new Integer(nargs)); Object key = Pair.make(cls, Integer.valueOf(nargs));
if (constructors.containsKey(key)) if (constructors.containsKey(key))
return constructors.get(key); return constructors.get(key);
@ -552,7 +552,7 @@ public class JavaScriptConstructorFunctions {
private IMethod makeFunctionObjectConstructor(IClass cls, int nargs) { private IMethod makeFunctionObjectConstructor(IClass cls, int nargs) {
JSInstructionFactory insts = (JSInstructionFactory)cls.getClassLoader().getInstructionFactory(); JSInstructionFactory insts = (JSInstructionFactory)cls.getClassLoader().getInstructionFactory();
Object key = Pair.make(cls, new Integer(nargs)); Object key = Pair.make(cls, Integer.valueOf(nargs));
if (constructors.containsKey(key)) if (constructors.containsKey(key))
return constructors.get(key); return constructors.get(key);
@ -601,7 +601,7 @@ public class JavaScriptConstructorFunctions {
assert nargs == 1; assert nargs == 1;
return makeValueConstructor(receiver, nargs, null); return makeValueConstructor(receiver, nargs, null);
} else if (receiver.getReference().equals(JavaScriptTypes.NumberObject)) } else if (receiver.getReference().equals(JavaScriptTypes.NumberObject))
return makeValueConstructor(receiver, nargs, new Integer(0)); return makeValueConstructor(receiver, nargs, Integer.valueOf(0));
else if (receiver.getReference().equals(JavaScriptTypes.Function)) else if (receiver.getReference().equals(JavaScriptTypes.Function))
return makeFunctionConstructor(callerIR, callStmt, receiver, nargs); return makeFunctionConstructor(callerIR, callStmt, receiver, nargs);
else if (cha.isSubclassOf(receiver, cha.lookupClass(JavaScriptTypes.CodeBody))) else if (cha.isSubclassOf(receiver, cha.lookupClass(JavaScriptTypes.CodeBody)))

View File

@ -321,35 +321,35 @@ public class JSAstTranslator extends AstTranslator {
if (name.equals("GlobalNaN")) { if (name.equals("GlobalNaN")) {
context.cfg().addInstruction( context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(), ((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
resultVal, context.currentScope().getConstantValue(new Float(Float.NaN)))); resultVal, context.currentScope().getConstantValue(Float.valueOf(Float.NaN))));
} else if (name.equals("GlobalInfinity")) { } else if (name.equals("GlobalInfinity")) {
context.cfg().addInstruction( context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(), ((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
resultVal, context.currentScope().getConstantValue(new Float(Float.POSITIVE_INFINITY)))); resultVal, context.currentScope().getConstantValue(Float.valueOf(Float.POSITIVE_INFINITY))));
} else if (name.equals("MathE")) { } else if (name.equals("MathE")) {
context.cfg().addInstruction( context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(), ((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
resultVal, context.currentScope().getConstantValue(new Double(Math.E)))); resultVal, context.currentScope().getConstantValue(Double.valueOf(Math.E))));
} else if (name.equals("MathPI")) { } else if (name.equals("MathPI")) {
context.cfg().addInstruction( context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(), ((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
resultVal, context.currentScope().getConstantValue(new Double(Math.PI)))); resultVal, context.currentScope().getConstantValue(Double.valueOf(Math.PI))));
} else if (name.equals("MathSQRT1_2")) { } else if (name.equals("MathSQRT1_2")) {
context.cfg().addInstruction( context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(), ((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
resultVal, context.currentScope().getConstantValue(new Double(Math.sqrt(.5))))); resultVal, context.currentScope().getConstantValue(Double.valueOf(Math.sqrt(.5)))));
} else if (name.equals("MathSQRT2")) { } else if (name.equals("MathSQRT2")) {
context.cfg().addInstruction( context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(), ((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
resultVal, context.currentScope().getConstantValue(new Double(Math.sqrt(2))))); resultVal, context.currentScope().getConstantValue(Double.valueOf(Math.sqrt(2)))));
} else if (name.equals("MathLN2")) { } else if (name.equals("MathLN2")) {
context.cfg().addInstruction( context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(), ((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
resultVal, context.currentScope().getConstantValue(new Double(Math.log(2))))); resultVal, context.currentScope().getConstantValue(Double.valueOf(Math.log(2)))));
} else if (name.equals("MathLN10")) { } else if (name.equals("MathLN10")) {
context.cfg().addInstruction( context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(), ((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
resultVal, context.currentScope().getConstantValue(new Double(Math.log(10))))); resultVal, context.currentScope().getConstantValue(Double.valueOf(Math.log(10)))));
} else if (name.equals("NewObject")) { } else if (name.equals("NewObject")) {
doNewObject(context, null, resultVal, "Object", null); doNewObject(context, null, resultVal, "Object", null);

View File

@ -26,7 +26,7 @@ public class JSConstantFoldingRewriter extends ConstantFoldingRewriter {
if (lhs instanceof String || rhs instanceof String) { if (lhs instanceof String || rhs instanceof String) {
return "" + lhs + rhs; return "" + lhs + rhs;
} else if (lhs instanceof Number && rhs instanceof Number) { } else if (lhs instanceof Number && rhs instanceof Number) {
return new Double(((Number)lhs).doubleValue() + ((Number)rhs).doubleValue()); return Double.valueOf(((Number)lhs).doubleValue() + ((Number)rhs).doubleValue());
} }
} else if (op == CAstOperator.OP_BIT_AND) { } else if (op == CAstOperator.OP_BIT_AND) {
@ -43,7 +43,7 @@ public class JSConstantFoldingRewriter extends ConstantFoldingRewriter {
} else if (op == CAstOperator.OP_DIV) { } else if (op == CAstOperator.OP_DIV) {
if (lhs instanceof Number && rhs instanceof Number) { if (lhs instanceof Number && rhs instanceof Number) {
return new Double(((Number)lhs).doubleValue() / ((Number)rhs).doubleValue()); return Double.valueOf(((Number)lhs).doubleValue() / ((Number)rhs).doubleValue());
} }
} else if (op == CAstOperator.OP_EQ) { } else if (op == CAstOperator.OP_EQ) {
@ -72,12 +72,12 @@ public class JSConstantFoldingRewriter extends ConstantFoldingRewriter {
} else if (op == CAstOperator.OP_MOD) { } else if (op == CAstOperator.OP_MOD) {
if (lhs instanceof Number && rhs instanceof Number) { if (lhs instanceof Number && rhs instanceof Number) {
return new Double(((Number)lhs).doubleValue() % ((Number)rhs).doubleValue()); return Double.valueOf(((Number)lhs).doubleValue() % ((Number)rhs).doubleValue());
} }
} else if (op == CAstOperator.OP_MUL) { } else if (op == CAstOperator.OP_MUL) {
if (lhs instanceof Number && rhs instanceof Number) { if (lhs instanceof Number && rhs instanceof Number) {
return new Double(((Number)lhs).doubleValue() * ((Number)rhs).doubleValue()); return Double.valueOf(((Number)lhs).doubleValue() * ((Number)rhs).doubleValue());
} }
} else if (op == CAstOperator.OP_NE) { } else if (op == CAstOperator.OP_NE) {
@ -98,7 +98,7 @@ public class JSConstantFoldingRewriter extends ConstantFoldingRewriter {
} else if (op == CAstOperator.OP_SUB) { } else if (op == CAstOperator.OP_SUB) {
if (lhs instanceof Number && rhs instanceof Number) { if (lhs instanceof Number && rhs instanceof Number) {
return new Double(((Number)lhs).doubleValue() - ((Number)rhs).doubleValue()); return Double.valueOf(((Number)lhs).doubleValue() - ((Number)rhs).doubleValue());
} }
} else if (op == CAstOperator.OP_URSH) { } else if (op == CAstOperator.OP_URSH) {

View File

@ -195,7 +195,7 @@ public abstract class TestCAstTranslator extends WalaTestCase {
for (Object name2 : cls.getDeclaredMethods()) { for (Object name2 : cls.getDeclaredMethods()) {
IMethod mth = (IMethod) name2; IMethod mth = (IMethod) name2;
Integer np = new Integer(mth.getNumberOfParameters()); Integer np = Integer.valueOf(mth.getNumberOfParameters());
Pair<String, String> key = Pair.make(cls.getName().toString(), mth.getName().toString()); Pair<String, String> key = Pair.make(cls.getName().toString(), mth.getName().toString());
if (mth.isStatic()) { if (mth.isStatic()) {

View File

@ -63,7 +63,7 @@ public abstract class CrossLanguageSSAPropagationCallGraphBuilder extends AstSSA
@Override @Override
protected InterestingVisitor makeInterestingVisitor(CGNode node, int vn) { protected InterestingVisitor makeInterestingVisitor(CGNode node, int vn) {
return interesting.get(getLanguage(node), new Integer(vn)); return interesting.get(getLanguage(node), Integer.valueOf(vn));
} }
@Override @Override

View File

@ -653,7 +653,7 @@ public class SSAConversion extends AbstractSSAConversion {
if (lexicalUses != null) { if (lexicalUses != null) {
System.err.print(("extra uses for " + instructions[i] + ": ")); System.err.print(("extra uses for " + instructions[i] + ": "));
for (int lexicalUse : lexicalUses) { for (int lexicalUse : lexicalUses) {
System.err.print((new Integer(lexicalUse).toString() + " ")); System.err.print((Integer.valueOf(lexicalUse).toString() + " "));
} }
System.err.println(""); System.err.println("");
} }

View File

@ -2691,7 +2691,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
@Override @Override
public final int setValue(CAstNode n, int v) { public final int setValue(CAstNode n, int v) {
results.put(n, new Integer(v)); results.put(n, Integer.valueOf(v));
return v; return v;
} }
@ -3538,7 +3538,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
+ " of loop " + CAstPrinter.print(n, context.top().getSourceMap()); + " of loop " + CAstPrinter.print(n, context.top().getSourceMap());
context.cfg().addInstruction( context.cfg().addInstruction(
insts.ConditionalBranchInstruction(context.cfg().currentInstruction, translateConditionOpcode(CAstOperator.OP_EQ), null, c.getValue(n.getChild(0)), context insts.ConditionalBranchInstruction(context.cfg().currentInstruction, translateConditionOpcode(CAstOperator.OP_EQ), null, c.getValue(n.getChild(0)), context
.currentScope().getConstantValue(new Integer(0)), -1)); .currentScope().getConstantValue(Integer.valueOf(0)), -1));
PreBasicBlock branchB = context.cfg().getCurrentBlock(); PreBasicBlock branchB = context.cfg().getCurrentBlock();
// loop body // loop body
@ -3832,7 +3832,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
CAstNode arg = n.getChild(0); CAstNode arg = n.getChild(0);
context.cfg().addInstruction( context.cfg().addInstruction(
insts.ConditionalBranchInstruction(currentInstruction, translateConditionOpcode(CAstOperator.OP_NE), null, c.getValue(arg), context insts.ConditionalBranchInstruction(currentInstruction, translateConditionOpcode(CAstOperator.OP_NE), null, c.getValue(arg), context
.currentScope().getConstantValue(new Integer(0)), -1)); .currentScope().getConstantValue(Integer.valueOf(0)), -1));
context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(arg)); context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(arg));
} else if (n.getChildCount() == 3) { } else if (n.getChildCount() == 3) {
CAstNode op = n.getChild(0); CAstNode op = n.getChild(0);
@ -3896,7 +3896,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
int currentInstruction = context.cfg().getCurrentInstruction(); int currentInstruction = context.cfg().getCurrentInstruction();
context.cfg().addInstruction( context.cfg().addInstruction(
insts.ConditionalBranchInstruction(currentInstruction, translateConditionOpcode(CAstOperator.OP_EQ), null, c.getValue(l), context.currentScope() insts.ConditionalBranchInstruction(currentInstruction, translateConditionOpcode(CAstOperator.OP_EQ), null, c.getValue(l), context.currentScope()
.getConstantValue(new Integer(0)), -1)); .getConstantValue(Integer.valueOf(0)), -1));
context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(l)); context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(l));
PreBasicBlock srcB = context.cfg().getCurrentBlock(); PreBasicBlock srcB = context.cfg().getCurrentBlock();
// true clause // true clause
@ -4036,7 +4036,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
protected void leaveArrayLiteralInitElement(CAstNode n, int i, WalkContext c, CAstVisitor<WalkContext> visitor) { protected void leaveArrayLiteralInitElement(CAstNode n, int i, WalkContext c, CAstVisitor<WalkContext> visitor) {
WalkContext context = c; WalkContext context = c;
arrayOpHandler.doArrayWrite(context, c.getValue(n.getChild(0)), n, arrayOpHandler.doArrayWrite(context, c.getValue(n.getChild(0)), n,
new int[] { context.currentScope().getConstantValue(new Integer(i - 1)) }, c.getValue(n.getChild(i))); new int[] { context.currentScope().getConstantValue(Integer.valueOf(i - 1)) }, c.getValue(n.getChild(i)));
} }
@Override @Override

View File

@ -186,32 +186,32 @@ public class CAstImpl implements CAst {
@Override @Override
public CAstNode makeConstant(char value) { public CAstNode makeConstant(char value) {
return makeConstant(new Character(value)); return makeConstant(Character.valueOf(value));
} }
@Override @Override
public CAstNode makeConstant(short value) { public CAstNode makeConstant(short value) {
return makeConstant(new Short(value)); return makeConstant(Short.valueOf(value));
} }
@Override @Override
public CAstNode makeConstant(int value) { public CAstNode makeConstant(int value) {
return makeConstant(new Integer(value)); return makeConstant(Integer.valueOf(value));
} }
@Override @Override
public CAstNode makeConstant(long value) { public CAstNode makeConstant(long value) {
return makeConstant(new Long(value)); return makeConstant(Long.valueOf(value));
} }
@Override @Override
public CAstNode makeConstant(float value) { public CAstNode makeConstant(float value) {
return makeConstant(new Float(value)); return makeConstant(Float.valueOf(value));
} }
@Override @Override
public CAstNode makeConstant(double value) { public CAstNode makeConstant(double value) {
return makeConstant(new Double(value)); return makeConstant(Double.valueOf(value));
} }
} }

View File

@ -17,12 +17,13 @@ org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=error org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
org.eclipse.jdt.core.compiler.problem.deadCode=error org.eclipse.jdt.core.compiler.problem.deadCode=error
org.eclipse.jdt.core.compiler.problem.deprecation=error org.eclipse.jdt.core.compiler.problem.deprecation=ignore
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.discouragedReference=error
@ -91,6 +92,7 @@ org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore

View File

@ -601,21 +601,21 @@ public class PrimitivesTest extends WalaTestCase {
@Test public void testSmallMap() { @Test public void testSmallMap() {
SmallMap<Integer, Integer> M = new SmallMap<>(); SmallMap<Integer, Integer> M = new SmallMap<>();
Integer I1 = new Integer(1); Integer I1 = Integer.valueOf(1);
Integer I2 = new Integer(2); Integer I2 = Integer.valueOf(2);
Integer I3 = new Integer(3); Integer I3 = Integer.valueOf(3);
M.put(I1, I1); M.put(I1, I1);
M.put(I2, I2); M.put(I2, I2);
M.put(I3, I3); M.put(I3, I3);
Integer I = M.get(new Integer(2)); Integer I = M.get(Integer.valueOf(2));
Assert.assertTrue(I != null); Assert.assertTrue(I != null);
Assert.assertTrue(I.equals(I2)); Assert.assertTrue(I.equals(I2));
I = M.get(new Integer(4)); I = M.get(Integer.valueOf(4));
Assert.assertTrue(I == null); Assert.assertTrue(I == null);
I = M.put(new Integer(2), new Integer(3)); I = M.put(Integer.valueOf(2), Integer.valueOf(3));
Assert.assertTrue(I.equals(I2)); Assert.assertTrue(I.equals(I2));
I = M.get(I2); I = M.get(I2);
Assert.assertTrue(I.equals(I3)); Assert.assertTrue(I.equals(I3));
@ -623,24 +623,24 @@ public class PrimitivesTest extends WalaTestCase {
@Test public void testBimodalMap() { @Test public void testBimodalMap() {
Map<Integer, Integer> M = new BimodalMap<>(3); Map<Integer, Integer> M = new BimodalMap<>(3);
Integer I1 = new Integer(1); Integer I1 = Integer.valueOf(1);
Integer I2 = new Integer(2); Integer I2 = Integer.valueOf(2);
Integer I3 = new Integer(3); Integer I3 = Integer.valueOf(3);
Integer I4 = new Integer(4); Integer I4 = Integer.valueOf(4);
Integer I5 = new Integer(5); Integer I5 = Integer.valueOf(5);
Integer I6 = new Integer(6); Integer I6 = Integer.valueOf(6);
M.put(I1, I1); M.put(I1, I1);
M.put(I2, I2); M.put(I2, I2);
M.put(I3, I3); M.put(I3, I3);
Integer I = M.get(new Integer(2)); Integer I = M.get(Integer.valueOf(2));
Assert.assertTrue(I != null); Assert.assertTrue(I != null);
Assert.assertTrue(I.equals(I2)); Assert.assertTrue(I.equals(I2));
I = M.get(new Integer(4)); I = M.get(Integer.valueOf(4));
Assert.assertTrue(I == null); Assert.assertTrue(I == null);
I = M.put(new Integer(2), new Integer(3)); I = M.put(Integer.valueOf(2), Integer.valueOf(3));
Assert.assertTrue(I.equals(I2)); Assert.assertTrue(I.equals(I2));
I = M.get(I2); I = M.get(I2);
Assert.assertTrue(I.equals(I3)); Assert.assertTrue(I.equals(I3));
@ -648,14 +648,14 @@ public class PrimitivesTest extends WalaTestCase {
M.put(I4, I4); M.put(I4, I4);
M.put(I5, I5); M.put(I5, I5);
M.put(I6, I6); M.put(I6, I6);
I = M.get(new Integer(4)); I = M.get(Integer.valueOf(4));
Assert.assertTrue(I != null); Assert.assertTrue(I != null);
Assert.assertTrue(I.equals(I4)); Assert.assertTrue(I.equals(I4));
I = M.get(new Integer(7)); I = M.get(Integer.valueOf(7));
Assert.assertTrue(I == null); Assert.assertTrue(I == null);
I = M.put(new Integer(2), new Integer(6)); I = M.put(Integer.valueOf(2), Integer.valueOf(6));
Assert.assertTrue(I.equals(I3)); Assert.assertTrue(I.equals(I3));
I = M.get(I2); I = M.get(I2);
Assert.assertTrue(I.equals(I6)); Assert.assertTrue(I.equals(I6));
@ -714,7 +714,7 @@ public class PrimitivesTest extends WalaTestCase {
// add 10 nodes // add 10 nodes
Integer[] nodes = new Integer[10]; Integer[] nodes = new Integer[10];
for (int i = 0; i < nodes.length; i++) for (int i = 0; i < nodes.length; i++)
G.addNode(nodes[i] = new Integer(i)); G.addNode(nodes[i] = Integer.valueOf(i));
// edges to i-1, i+1, i+2 // edges to i-1, i+1, i+2
for (int i = 0; i < nodes.length; i++) { for (int i = 0; i < nodes.length; i++) {
@ -738,7 +738,7 @@ public class PrimitivesTest extends WalaTestCase {
// add nodes // add nodes
Object[] nodes = new Object[11]; Object[] nodes = new Object[11];
for (int i = 0; i < nodes.length; i++) for (int i = 0; i < nodes.length; i++)
G.addNode(nodes[i] = new Integer(i)); G.addNode(nodes[i] = Integer.valueOf(i));
// add edges // add edges
G.addEdge(nodes[10], nodes[0]); G.addEdge(nodes[10], nodes[0]);
@ -861,7 +861,7 @@ public class PrimitivesTest extends WalaTestCase {
private static int countEquivalenceClasses(IntegerUnionFind uf) { private static int countEquivalenceClasses(IntegerUnionFind uf) {
HashSet<Integer> s = HashSetFactory.make(); HashSet<Integer> s = HashSetFactory.make();
for (int i = 0; i < uf.size(); i++) { for (int i = 0; i < uf.size(); i++) {
s.add(new Integer(uf.find(i))); s.add(Integer.valueOf(uf.find(i)));
} }
return s.size(); return s.size();
} }

View File

@ -71,7 +71,7 @@ public abstract class AbstractReflectionInterpreter implements SSAContextInterpr
protected int getLocalForType(TypeReference T) { protected int getLocalForType(TypeReference T) {
Integer I = typeIndexMap.get(T); Integer I = typeIndexMap.get(T);
if (I == null) { if (I == null) {
typeIndexMap.put(T, I = new Integer(indexLocal += 2)); typeIndexMap.put(T, I = Integer.valueOf(indexLocal += 2));
} }
return I.intValue(); return I.intValue();
} }

View File

@ -632,7 +632,7 @@ public class FactoryBypassInterpreter extends AbstractReflectionInterpreter {
Map<Integer, ConstantValue> constants = null; Map<Integer, ConstantValue> constants = null;
if (valueNumberForConstantOne > -1) { if (valueNumberForConstantOne > -1) {
constants = HashMapFactory.make(1); constants = HashMapFactory.make(1);
constants.put(new Integer(valueNumberForConstantOne), new ConstantValue(new Integer(1))); constants.put(Integer.valueOf(valueNumberForConstantOne), new ConstantValue(Integer.valueOf(1)));
} }
return new SyntheticIR(this, context, new InducedCFG(instrs, this, context), instrs, options, constants); return new SyntheticIR(this, context, new InducedCFG(instrs, this, context), instrs, options, constants);

View File

@ -187,7 +187,7 @@ public class ReflectiveInvocationInterpreter extends AbstractReflectionInterpret
for (int j = nextArg; j < nargs; j++) { for (int j = nextArg; j < nargs; j++) {
// load the next parameter into v_temp. // load the next parameter into v_temp.
int indexConst = nextLocal++; int indexConst = nextLocal++;
constants.put(new Integer(indexConst), new ConstantValue(nextParameter++)); constants.put(Integer.valueOf(indexConst), new ConstantValue(nextParameter++));
int temp = nextLocal++; int temp = nextLocal++;
m.addInstruction(null, insts.ArrayLoadInstruction(m.allInstructions.size(), temp, parametersVn, indexConst, TypeReference.JavaLangObject), false); m.addInstruction(null, insts.ArrayLoadInstruction(m.allInstructions.size(), temp, parametersVn, indexConst, TypeReference.JavaLangObject), false);
pc++; pc++;

View File

@ -520,7 +520,7 @@ public class TypeInference extends SSAInference<TypeVariable> implements FixedPo
if (!doPrimitives) { if (!doPrimitives) {
result = null; result = null;
} else { } else {
result = new DeclaredTypeOperator(language.getPrimitive(language.getConstantType(new Integer(1)))); result = new DeclaredTypeOperator(language.getPrimitive(language.getConstantType(Integer.valueOf(1))));
} }
} }
@ -622,7 +622,7 @@ public class TypeInference extends SSAInference<TypeVariable> implements FixedPo
@Override @Override
public void visitComparison(SSAComparisonInstruction instruction) { public void visitComparison(SSAComparisonInstruction instruction) {
if (doPrimitives) { if (doPrimitives) {
result = new DeclaredTypeOperator(language.getPrimitive(language.getConstantType(new Integer(0)))); result = new DeclaredTypeOperator(language.getPrimitive(language.getConstantType(Integer.valueOf(0))));
} }
} }

View File

@ -236,9 +236,9 @@ public class ZeroXInstanceKeys implements InstanceKeyFactory {
if (alloc != null) { if (alloc != null) {
Integer old = count.get(alloc); Integer old = count.get(alloc);
if (old == null) { if (old == null) {
count.put(alloc, new Integer(1)); count.put(alloc, Integer.valueOf(1));
} else { } else {
count.put(alloc, new Integer(old.intValue() + 1)); count.put(alloc, Integer.valueOf(old.intValue() + 1));
} }
} }
} }

View File

@ -828,7 +828,7 @@ public class PDG<T extends InstanceKey> implements NumberedGraph<Statement> {
for (int i = 0; i < instructions.length; i++) { for (int i = 0; i < instructions.length; i++) {
SSAInstruction s = instructions[i]; SSAInstruction s = instructions[i];
if (s != null) { if (s != null) {
result.put(s, new Integer(i)); result.put(s, Integer.valueOf(i));
} }
} }
} }

View File

@ -38,7 +38,7 @@ public class ReflectionSummary {
} }
private Set<TypeReference> findOrCreateSetForBCIndex(int bcIndex) { private Set<TypeReference> findOrCreateSetForBCIndex(int bcIndex) {
Integer I = new Integer(bcIndex); Integer I = Integer.valueOf(bcIndex);
Set<TypeReference> result = map.get(I); Set<TypeReference> result = map.get(I);
if (result == null) { if (result == null) {
result = HashSetFactory.make(10); result = HashSetFactory.make(10);
@ -51,7 +51,7 @@ public class ReflectionSummary {
if (cha == null) { if (cha == null) {
throw new IllegalArgumentException("null cha"); throw new IllegalArgumentException("null cha");
} }
Set<TypeReference> S = map.get(new Integer(bcIndex)); Set<TypeReference> S = map.get(Integer.valueOf(bcIndex));
if (S == null) { if (S == null) {
return null; return null;
} else { } else {
@ -68,6 +68,6 @@ public class ReflectionSummary {
} }
public Set<TypeReference> getTypesForProgramLocation(int bcIndex) { public Set<TypeReference> getTypesForProgramLocation(int bcIndex) {
return map.get(new Integer(bcIndex)); return map.get(Integer.valueOf(bcIndex));
} }
} }

View File

@ -106,8 +106,8 @@ public class SyntheticIR extends IR {
for (int j = 0; j < s.getNumberOfUses(); j++) { for (int j = 0; j < s.getNumberOfUses(); j++) {
int vn = s.getUse(j); int vn = s.getUse(j);
symbolTable.ensureSymbol(vn); symbolTable.ensureSymbol(vn);
if (constants != null && constants.containsKey(new Integer(vn))) if (constants != null && constants.containsKey(Integer.valueOf(vn)))
symbolTable.setConstantValue(vn, constants.get(new Integer(vn))); symbolTable.setConstantValue(vn, constants.get(Integer.valueOf(vn)));
} }
} }

View File

@ -123,22 +123,22 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
private final static Map<String, Integer> elementMap = HashMapFactory.make(14); private final static Map<String, Integer> elementMap = HashMapFactory.make(14);
static { static {
elementMap.put("classloader", new Integer(E_CLASSLOADER)); elementMap.put("classloader", Integer.valueOf(E_CLASSLOADER));
elementMap.put("method", new Integer(E_METHOD)); elementMap.put("method", Integer.valueOf(E_METHOD));
elementMap.put("class", new Integer(E_CLASS)); elementMap.put("class", Integer.valueOf(E_CLASS));
elementMap.put("package", new Integer(E_PACKAGE)); elementMap.put("package", Integer.valueOf(E_PACKAGE));
elementMap.put("call", new Integer(E_CALL)); elementMap.put("call", Integer.valueOf(E_CALL));
elementMap.put("new", new Integer(E_NEW)); elementMap.put("new", Integer.valueOf(E_NEW));
elementMap.put("poison", new Integer(E_POISON)); elementMap.put("poison", Integer.valueOf(E_POISON));
elementMap.put("summary-spec", new Integer(E_SUMMARY_SPEC)); elementMap.put("summary-spec", Integer.valueOf(E_SUMMARY_SPEC));
elementMap.put("return", new Integer(E_RETURN)); elementMap.put("return", Integer.valueOf(E_RETURN));
elementMap.put("putstatic", new Integer(E_PUTSTATIC)); elementMap.put("putstatic", Integer.valueOf(E_PUTSTATIC));
elementMap.put("aastore", new Integer(E_AASTORE)); elementMap.put("aastore", Integer.valueOf(E_AASTORE));
elementMap.put("putfield", new Integer(E_PUTFIELD)); elementMap.put("putfield", Integer.valueOf(E_PUTFIELD));
elementMap.put("getfield", new Integer(E_GETFIELD)); elementMap.put("getfield", Integer.valueOf(E_GETFIELD));
elementMap.put("throw", new Integer(E_ATHROW)); elementMap.put("throw", Integer.valueOf(E_ATHROW));
elementMap.put("constant", new Integer(E_CONSTANT)); elementMap.put("constant", Integer.valueOf(E_CONSTANT));
elementMap.put("aaload", new Integer(E_AALOAD)); elementMap.put("aaload", Integer.valueOf(E_AALOAD));
} }
// //
@ -493,7 +493,7 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
} }
int defNum = nextLocal; int defNum = nextLocal;
symbolTable.put(defVar, new Integer(nextLocal++)); symbolTable.put(defVar, Integer.valueOf(nextLocal++));
governingMethod.addStatement(insts.InvokeInstruction(governingMethod.getNumberOfStatements(), defNum, params, exceptionValue, site, null)); governingMethod.addStatement(insts.InvokeInstruction(governingMethod.getNumberOfStatements(), defNum, params, exceptionValue, site, null));
} else { } else {
@ -526,7 +526,7 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
defVar = "L" + nextLocal; defVar = "L" + nextLocal;
} }
int defNum = nextLocal; int defNum = nextLocal;
symbolTable.put(defVar, new Integer(nextLocal++)); symbolTable.put(defVar, Integer.valueOf(nextLocal++));
// create the allocation statement and add it to the method summary // create the allocation statement and add it to the method summary
NewSiteReference ref = NewSiteReference.make(governingMethod.getNextProgramCounter(), type); NewSiteReference ref = NewSiteReference.make(governingMethod.getNextProgramCounter(), type);
@ -602,7 +602,7 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
Assertions.UNREACHABLE("Must specify def for getfield " + governingMethod); Assertions.UNREACHABLE("Must specify def for getfield " + governingMethod);
} }
int defNum = nextLocal; int defNum = nextLocal;
symbolTable.put(defVar, new Integer(nextLocal++)); symbolTable.put(defVar, Integer.valueOf(nextLocal++));
// get the ref read from // get the ref read from
String R = atts.getValue(A_REF); String R = atts.getValue(A_REF);
@ -778,7 +778,7 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
Assertions.UNREACHABLE("Must specify def for getfield " + governingMethod); Assertions.UNREACHABLE("Must specify def for getfield " + governingMethod);
} }
int defNum = nextLocal; int defNum = nextLocal;
symbolTable.put(defVar, new Integer(nextLocal++)); symbolTable.put(defVar, Integer.valueOf(nextLocal++));
SSAArrayLoadInstruction S = insts.ArrayLoadInstruction(governingMethod.getNumberOfStatements(), defNum, refNumber.intValue(), 0, SSAArrayLoadInstruction S = insts.ArrayLoadInstruction(governingMethod.getNumberOfStatements(), defNum, refNumber.intValue(), 0,
type); type);
governingMethod.addStatement(S); governingMethod.addStatement(S);
@ -806,7 +806,7 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
} else { } else {
valueNumber = symbolTable.get(V_NULL); valueNumber = symbolTable.get(V_NULL);
if (valueNumber == null) { if (valueNumber == null) {
valueNumber = new Integer(nextLocal++); valueNumber = Integer.valueOf(nextLocal++);
symbolTable.put(V_NULL, valueNumber); symbolTable.put(V_NULL, valueNumber);
} }
} }
@ -825,17 +825,17 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
String var = atts.getValue(A_NAME); String var = atts.getValue(A_NAME);
if (var == null) if (var == null)
Assertions.UNREACHABLE("Must give name for constant"); Assertions.UNREACHABLE("Must give name for constant");
Integer valueNumber = new Integer(nextLocal++); Integer valueNumber = Integer.valueOf(nextLocal++);
symbolTable.put(var, valueNumber); symbolTable.put(var, valueNumber);
String typeString = atts.getValue(A_TYPE); String typeString = atts.getValue(A_TYPE);
String valueString = atts.getValue(A_VALUE); String valueString = atts.getValue(A_VALUE);
governingMethod.addConstant(valueNumber, (typeString.equals("int")) ? new ConstantValue(new Integer(valueString)) governingMethod.addConstant(valueNumber, (typeString.equals("int")) ? new ConstantValue(Integer.valueOf(valueString))
: (typeString.equals("long")) ? new ConstantValue(new Long(valueString)) : (typeString.equals("long")) ? new ConstantValue(Long.valueOf(valueString))
: (typeString.equals("short")) ? new ConstantValue(new Short(valueString)) : (typeString.equals("short")) ? new ConstantValue(Short.valueOf(valueString))
: (typeString.equals("float")) ? new ConstantValue(new Float(valueString)) : (typeString.equals("float")) ? new ConstantValue(Float.valueOf(valueString))
: (typeString.equals("double")) ? new ConstantValue(new Double(valueString)) : null); : (typeString.equals("double")) ? new ConstantValue(Double.valueOf(valueString)) : null);
} }
/** /**
@ -925,7 +925,7 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
symbolTable = HashMapFactory.make(5); symbolTable = HashMapFactory.make(5);
// create symbols for the parameters // create symbols for the parameters
for (int i = 0; i < nParams; i++) { for (int i = 0; i < nParams; i++) {
symbolTable.put("arg" + i, new Integer(i + 1)); symbolTable.put("arg" + i, Integer.valueOf(i + 1));
} }
int pn = 1; int pn = 1;

View File

@ -21,11 +21,11 @@ public class ConstantValue implements Value {
} }
public ConstantValue(int constant) { public ConstantValue(int constant) {
this(new Integer(constant)); this(Integer.valueOf(constant));
} }
public ConstantValue(double constant) { public ConstantValue(double constant) {
this(new Double(constant)); this(Double.valueOf(constant));
} }

View File

@ -125,10 +125,10 @@ public abstract class IR implements IRView {
callSiteMapping.add(((SSAAbstractInvokeInstruction) x).getCallSite().getProgramCounter(), i); callSiteMapping.add(((SSAAbstractInvokeInstruction) x).getCallSite().getProgramCounter(), i);
} }
if (x instanceof SSANewInstruction) { if (x instanceof SSANewInstruction) {
newSiteMapping.put(((SSANewInstruction) x).getNewSite(), new Integer(i)); newSiteMapping.put(((SSANewInstruction) x).getNewSite(), Integer.valueOf(i));
} }
if (x.isPEI()) { if (x.isPEI()) {
peiMapping.put(new ProgramCounter(cfg.getProgramCounter(i)), new Integer(i)); peiMapping.put(new ProgramCounter(cfg.getProgramCounter(i)), Integer.valueOf(i));
} }
} }
} }

View File

@ -147,11 +147,11 @@ public class SymbolTable implements Cloneable {
} }
public int getConstant(float f) { public int getConstant(float f) {
return findOrCreateConstant(new Float(f)); return findOrCreateConstant(Float.valueOf(f));
} }
public int getConstant(double d) { public int getConstant(double d) {
return findOrCreateConstant(new Double(d)); return findOrCreateConstant(Double.valueOf(d));
} }
public int getConstant(String s) { public int getConstant(String s) {

View File

@ -110,7 +110,7 @@ public class DeadAssignmentElimination {
int def = phi.getDef(); int def = phi.getDef();
if (DU.getNumberOfUses(def) == 0) { if (DU.getNumberOfUses(def) == 0) {
// the phi is certainly dead ... record this with a dataflow fact. // the phi is certainly dead ... record this with a dataflow fact.
trivialDead.add(new Integer(def)); trivialDead.add(Integer.valueOf(def));
} else { } else {
boolean maybeDead = true; boolean maybeDead = true;
for (SSAInstruction u : Iterator2Iterable.make(DU.getUses(def))) { for (SSAInstruction u : Iterator2Iterable.make(DU.getUses(def))) {
@ -123,7 +123,7 @@ public class DeadAssignmentElimination {
if (maybeDead) { if (maybeDead) {
// perhaps the phi is dead .. create a variable // perhaps the phi is dead .. create a variable
BooleanVariable B = new BooleanVariable(false); BooleanVariable B = new BooleanVariable(false);
vars.put(new Integer(def), B); vars.put(Integer.valueOf(def), B);
} }
} }
} }
@ -134,7 +134,7 @@ public class DeadAssignmentElimination {
BooleanVariable B = E.getValue(); BooleanVariable B = E.getValue();
for (SSAInstruction use : Iterator2Iterable.make(DU.getUses(def.intValue()))) { for (SSAInstruction use : Iterator2Iterable.make(DU.getUses(def.intValue()))) {
SSAPhiInstruction u = (SSAPhiInstruction) use; SSAPhiInstruction u = (SSAPhiInstruction) use;
Integer ud = new Integer(u.getDef()); Integer ud = Integer.valueOf(u.getDef());
if (trivialDead.contains(ud)) { if (trivialDead.contains(ud)) {
// do nothing ... u will not keep def live // do nothing ... u will not keep def live
} else { } else {

View File

@ -203,7 +203,7 @@ public class AppModelMethod {
nextLocal = nParams + 1; nextLocal = nParams + 1;
symbolTable = HashMapFactory.make(5); symbolTable = HashMapFactory.make(5);
for (int i = 0; i < nParams; i++) { for (int i = 0; i < nParams; i++) {
symbolTable.put("arg" + i, new Integer(i + 1)); symbolTable.put("arg" + i, Integer.valueOf(i + 1));
} }
} }

View File

@ -382,16 +382,16 @@ public class OfflineDynamicCallGraph {
final byte itemType = p.getItemType(i); final byte itemType = p.getItemType(i);
switch (itemType) { switch (itemType) {
case CONSTANT_Integer: case CONSTANT_Integer:
entries.put(new Integer(p.getCPInt(i)), i); entries.put(Integer.valueOf(p.getCPInt(i)), i);
break; break;
case CONSTANT_Long: case CONSTANT_Long:
entries.put(new Long(p.getCPLong(i)), i); entries.put(Long.valueOf(p.getCPLong(i)), i);
break; break;
case CONSTANT_Float: case CONSTANT_Float:
entries.put(new Float(p.getCPFloat(i)), i); entries.put(Float.valueOf(p.getCPFloat(i)), i);
break; break;
case CONSTANT_Double: case CONSTANT_Double:
entries.put(new Double(p.getCPDouble(i)), i); entries.put(Double.valueOf(p.getCPDouble(i)), i);
break; break;
case CONSTANT_Utf8: case CONSTANT_Utf8:
entries.put(p.getCPUtf8(i), i); entries.put(p.getCPUtf8(i), i);

View File

@ -318,7 +318,7 @@ public abstract class ConstantInstruction extends Instruction {
@Override @Override
final public Object getValue() { final public Object getValue() {
return new Float(getFloatValue()); return Float.valueOf(getFloatValue());
} }
@Override @Override
@ -390,7 +390,7 @@ public abstract class ConstantInstruction extends Instruction {
@Override @Override
final public Object getValue() { final public Object getValue() {
return new Double(getDoubleValue()); return Double.valueOf(getDoubleValue());
} }
@Override @Override

View File

@ -55,16 +55,16 @@ public abstract class Decoder implements Constants {
table[OP_aconst_null] = ConstantInstruction.make(TYPE_null, null); table[OP_aconst_null] = ConstantInstruction.make(TYPE_null, null);
for (int i = OP_iconst_m1; i <= OP_iconst_5; i++) { for (int i = OP_iconst_m1; i <= OP_iconst_5; i++) {
table[i] = ConstantInstruction.make(TYPE_int, new Integer(i - OP_iconst_m1 - 1)); table[i] = ConstantInstruction.make(TYPE_int, Integer.valueOf(i - OP_iconst_m1 - 1));
} }
for (int i = OP_lconst_0; i <= OP_lconst_1; i++) { for (int i = OP_lconst_0; i <= OP_lconst_1; i++) {
table[i] = ConstantInstruction.make(TYPE_long, new Long(i - OP_lconst_0)); table[i] = ConstantInstruction.make(TYPE_long, Long.valueOf(i - OP_lconst_0));
} }
for (int i = OP_fconst_0; i <= OP_fconst_2; i++) { for (int i = OP_fconst_0; i <= OP_fconst_2; i++) {
table[i] = ConstantInstruction.make(TYPE_float, new Float(i - OP_fconst_0)); table[i] = ConstantInstruction.make(TYPE_float, Float.valueOf(i - OP_fconst_0));
} }
for (int i = OP_dconst_0; i <= OP_dconst_1; i++) { for (int i = OP_dconst_0; i <= OP_dconst_1; i++) {
table[i] = ConstantInstruction.make(TYPE_double, new Double(i - OP_dconst_0)); table[i] = ConstantInstruction.make(TYPE_double, Double.valueOf(i - OP_dconst_0));
} }
for (int i = OP_iload_0; i <= OP_aload_3; i++) { for (int i = OP_iload_0; i <= OP_aload_3; i++) {

View File

@ -113,7 +113,7 @@ public class AddSerialVersion {
for (int f = 0; f < fields.length; f++) { for (int f = 0; f < fields.length; f++) {
int flags = r.getFieldAccessFlags(f); int flags = r.getFieldAccessFlags(f);
if ((flags & ClassConstants.ACC_PRIVATE) == 0 || (flags & (ClassConstants.ACC_STATIC | ClassConstants.ACC_TRANSIENT)) == 0) { if ((flags & ClassConstants.ACC_PRIVATE) == 0 || (flags & (ClassConstants.ACC_STATIC | ClassConstants.ACC_TRANSIENT)) == 0) {
fields[fieldCount] = new Integer(f); fields[fieldCount] = Integer.valueOf(f);
fieldNames[f] = r.getFieldName(f); fieldNames[f] = r.getFieldName(f);
fieldCount++; fieldCount++;
} }
@ -139,7 +139,7 @@ public class AddSerialVersion {
String name = r.getMethodName(m); String name = r.getMethodName(m);
int flags = r.getMethodAccessFlags(m); int flags = r.getMethodAccessFlags(m);
if (name.equals("<clinit>") || (flags & ClassConstants.ACC_PRIVATE) == 0) { if (name.equals("<clinit>") || (flags & ClassConstants.ACC_PRIVATE) == 0) {
methods[methodCount] = new Integer(m); methods[methodCount] = Integer.valueOf(m);
methodSigs[m] = name + r.getMethodType(m); methodSigs[m] = name + r.getMethodType(m);
if (name.equals("<clinit>")) { if (name.equals("<clinit>")) {
methodKinds[m] = 0; methodKinds[m] = 0;

View File

@ -265,40 +265,40 @@ public class ClassWriter implements ClassConstants {
byte t = cp.getItemType(i); byte t = cp.getItemType(i);
switch (t) { switch (t) {
case CONSTANT_String: case CONSTANT_String:
cachedCPEntries.put(new CWStringItem(cp.getCPString(i), CONSTANT_String), new Integer(i)); cachedCPEntries.put(new CWStringItem(cp.getCPString(i), CONSTANT_String), Integer.valueOf(i));
break; break;
case CONSTANT_Class: case CONSTANT_Class:
cachedCPEntries.put(new CWStringItem(cp.getCPClass(i), CONSTANT_Class), new Integer(i)); cachedCPEntries.put(new CWStringItem(cp.getCPClass(i), CONSTANT_Class), Integer.valueOf(i));
break; break;
case CONSTANT_MethodType: case CONSTANT_MethodType:
cachedCPEntries.put(new CWStringItem(cp.getCPMethodType(i), CONSTANT_MethodType), new Integer(i)); cachedCPEntries.put(new CWStringItem(cp.getCPMethodType(i), CONSTANT_MethodType), Integer.valueOf(i));
break; break;
case CONSTANT_MethodHandle: case CONSTANT_MethodHandle:
case CONSTANT_FieldRef: case CONSTANT_FieldRef:
case CONSTANT_InterfaceMethodRef: case CONSTANT_InterfaceMethodRef:
case CONSTANT_MethodRef: case CONSTANT_MethodRef:
cachedCPEntries.put(new CWRef(t, cp.getCPRefClass(i), cp.getCPRefName(i), cp.getCPRefType(i)), new Integer(i)); cachedCPEntries.put(new CWRef(t, cp.getCPRefClass(i), cp.getCPRefName(i), cp.getCPRefType(i)), Integer.valueOf(i));
break; break;
case CONSTANT_NameAndType: case CONSTANT_NameAndType:
cachedCPEntries.put(new CWNAT(cp.getCPNATName(i), cp.getCPNATType(i)), new Integer(i)); cachedCPEntries.put(new CWNAT(cp.getCPNATName(i), cp.getCPNATType(i)), Integer.valueOf(i));
break; break;
case CONSTANT_InvokeDynamic: case CONSTANT_InvokeDynamic:
cachedCPEntries.put(new CWInvokeDynamic(cp.getCPDynBootstrap(i), cp.getCPDynName(i), cp.getCPDynType(i)), new Integer(i)); cachedCPEntries.put(new CWInvokeDynamic(cp.getCPDynBootstrap(i), cp.getCPDynName(i), cp.getCPDynType(i)), Integer.valueOf(i));
break; break;
case CONSTANT_Integer: case CONSTANT_Integer:
cachedCPEntries.put(new Integer(cp.getCPInt(i)), new Integer(i)); cachedCPEntries.put(Integer.valueOf(cp.getCPInt(i)), Integer.valueOf(i));
break; break;
case CONSTANT_Float: case CONSTANT_Float:
cachedCPEntries.put(new Float(cp.getCPFloat(i)), new Integer(i)); cachedCPEntries.put(Float.valueOf(cp.getCPFloat(i)), Integer.valueOf(i));
break; break;
case CONSTANT_Long: case CONSTANT_Long:
cachedCPEntries.put(new Long(cp.getCPLong(i)), new Integer(i)); cachedCPEntries.put(Long.valueOf(cp.getCPLong(i)), Integer.valueOf(i));
break; break;
case CONSTANT_Double: case CONSTANT_Double:
cachedCPEntries.put(new Double(cp.getCPDouble(i)), new Integer(i)); cachedCPEntries.put(Double.valueOf(cp.getCPDouble(i)), Integer.valueOf(i));
break; break;
case CONSTANT_Utf8: case CONSTANT_Utf8:
cachedCPEntries.put(cp.getCPUtf8(i), new Integer(i)); cachedCPEntries.put(cp.getCPUtf8(i), Integer.valueOf(i));
break; break;
default: default:
throw new UnsupportedOperationException(String.format("unexpected constant-pool item type %s", t)); throw new UnsupportedOperationException(String.format("unexpected constant-pool item type %s", t));
@ -326,7 +326,7 @@ public class ClassWriter implements ClassConstants {
} else { } else {
int index = nextCPIndex; int index = nextCPIndex;
nextCPIndex += size; nextCPIndex += size;
i = new Integer(index); i = Integer.valueOf(index);
cachedCPEntries.put(o, i); cachedCPEntries.put(o, i);
newCPEntries.add(o); newCPEntries.add(o);
if (nextCPIndex > 0xFFFF) { if (nextCPIndex > 0xFFFF) {
@ -351,7 +351,7 @@ public class ClassWriter implements ClassConstants {
* @return the index of a constant pool item with the right value * @return the index of a constant pool item with the right value
*/ */
public int addCPInt(int i) { public int addCPInt(int i) {
return addCPEntry(new Integer(i), 1); return addCPEntry(Integer.valueOf(i), 1);
} }
/** /**
@ -360,7 +360,7 @@ public class ClassWriter implements ClassConstants {
* @return the index of a constant pool item with the right value * @return the index of a constant pool item with the right value
*/ */
public int addCPFloat(float f) { public int addCPFloat(float f) {
return addCPEntry(new Float(f), 1); return addCPEntry(Float.valueOf(f), 1);
} }
/** /**
@ -369,7 +369,7 @@ public class ClassWriter implements ClassConstants {
* @return the index of a constant pool item with the right value * @return the index of a constant pool item with the right value
*/ */
public int addCPLong(long l) { public int addCPLong(long l) {
return addCPEntry(new Long(l), 2); return addCPEntry(Long.valueOf(l), 2);
} }
/** /**
@ -378,7 +378,7 @@ public class ClassWriter implements ClassConstants {
* @return the index of a constant pool item with the right value * @return the index of a constant pool item with the right value
*/ */
public int addCPDouble(double d) { public int addCPDouble(double d) {
return addCPEntry(new Double(d), 2); return addCPEntry(Double.valueOf(d), 2);
} }
private int addCPString(String s, byte type) { private int addCPString(String s, byte type) {