diff --git a/src/main/gov/nasa/jpf/jvm/ClassFile.java b/src/main/gov/nasa/jpf/jvm/ClassFile.java index d3dbdb52..017010a4 100644 --- a/src/main/gov/nasa/jpf/jvm/ClassFile.java +++ b/src/main/gov/nasa/jpf/jvm/ClassFile.java @@ -955,7 +955,7 @@ protected void parseCp(int cpCount) throws ClassParseException { dataIdx[i] = j++; int iVal = (data[j++]&0xff)<<24 | (data[j++]&0xff)<<16 | (data[j++]&0xff)<<8 | (data[j++]&0xff); - values[i] = new Integer(iVal); + values[i] = iVal; break; case CONSTANT_FLOAT: // Float_info { u1 tag; u4 bytes; } @@ -963,14 +963,14 @@ protected void parseCp(int cpCount) throws ClassParseException { int iBits = (data[j++]&0xff)<<24 | (data[j++]&0xff)<<16 | (data[j++]&0xff)<<8 | (data[j++]&0xff); float fVal = Float.intBitsToFloat(iBits); - values[i] = new Float(fVal); + values[i] = fVal; break; case CONSTANT_LONG: // Long_info { u1 tag; u4 high_bytes; u4 low_bytes; } dataIdx[i] = j++; long lVal = (data[j++]&0xffL)<<56 | (data[j++]&0xffL)<<48 | (data[j++]&0xffL)<<40 | (data[j++]&0xffL)<<32 | (data[j++]&0xffL)<<24 | (data[j++]&0xffL)<<16 | (data[j++]&0xffL)<<8 | (data[j++]&0xffL); - values[i] = new Long(lVal); + values[i] = lVal; dataIdx[++i] = -1; // 8 byte cpValue occupy 2 index slots break; @@ -981,7 +981,7 @@ protected void parseCp(int cpCount) throws ClassParseException { long lBits = (data[j++]&0xffL)<<56 | (data[j++]&0xffL)<<48 | (data[j++]&0xffL)<<40 | (data[j++]&0xffL)<<32 | (data[j++]&0xffL)<<24 | (data[j++]&0xffL)<<16 | (data[j++]&0xffL)<<8 | (data[j++]&0xffL); double dVal = Double.longBitsToDouble(lBits); - values[i] = new Double(dVal); + values[i] = dVal; dataIdx[++i] = -1; // 8 byte cpValue occupy 2 index slots break; diff --git a/src/main/gov/nasa/jpf/jvm/JVMNativeStackFrame.java b/src/main/gov/nasa/jpf/jvm/JVMNativeStackFrame.java index 7daed559..62f37646 100644 --- a/src/main/gov/nasa/jpf/jvm/JVMNativeStackFrame.java +++ b/src/main/gov/nasa/jpf/jvm/JVMNativeStackFrame.java @@ -70,33 +70,33 @@ public void setArguments (ThreadInfo ti){ case Types.T_SHORT: ival = callerFrame.peek(stackOffset); - a[j] = new Short((short) ival); + a[j] = (short) ival; break; case Types.T_INT: ival = callerFrame.peek(stackOffset); - a[j] = new Integer(ival); + a[j] = ival; break; case Types.T_LONG: lval = callerFrame.peekLong(stackOffset); stackOffset++; // 2 stack words - a[j] = new Long(lval); + a[j] = lval; break; case Types.T_FLOAT: ival = callerFrame.peek(stackOffset); - a[j] = new Float(Types.intToFloat(ival)); + a[j] = Types.intToFloat(ival); break; case Types.T_DOUBLE: lval = callerFrame.peekLong(stackOffset); stackOffset++; // 2 stack words - a[j] = new Double(Types.longToDouble(lval)); + a[j] = Types.longToDouble(lval); break; @@ -104,7 +104,7 @@ public void setArguments (ThreadInfo ti){ // NOTE - we have to store T_REFERENCE as an Integer, because // it shows up in our native method as an 'int' ival = callerFrame.peek(stackOffset); - a[j] = new Integer(ival); + a[j] = ival; } stackOffset++; @@ -114,10 +114,10 @@ public void setArguments (ThreadInfo ti){ a[0] = ti.getMJIEnv(); if (nmi.isStatic()) { - a[1] = new Integer( nmi.getClassInfo().getClassObjectRef()); + a[1] = nmi.getClassInfo().getClassObjectRef(); } else { int thisRef = callerFrame.getCalleeThis(nmi); - a[1] = new Integer( thisRef); + a[1] = thisRef; setThis(thisRef); } diff --git a/src/main/gov/nasa/jpf/jvm/bytecode/DRETURN.java b/src/main/gov/nasa/jpf/jvm/bytecode/DRETURN.java index ec536d14..5fb24157 100644 --- a/src/main/gov/nasa/jpf/jvm/bytecode/DRETURN.java +++ b/src/main/gov/nasa/jpf/jvm/bytecode/DRETURN.java @@ -40,7 +40,7 @@ public Object getReturnValue(ThreadInfo ti) { ret = frame.peekLong(); } - return new Double(Types.longToDouble(ret)); + return Types.longToDouble(ret); } @Override diff --git a/src/main/gov/nasa/jpf/jvm/bytecode/FRETURN.java b/src/main/gov/nasa/jpf/jvm/bytecode/FRETURN.java index 4609a76d..c0f21cc6 100644 --- a/src/main/gov/nasa/jpf/jvm/bytecode/FRETURN.java +++ b/src/main/gov/nasa/jpf/jvm/bytecode/FRETURN.java @@ -60,7 +60,7 @@ public Float getReturnValue (ThreadInfo ti) { ret = frame.peekFloat(); } - return new Float(ret); + return ret; } @Override diff --git a/src/main/gov/nasa/jpf/jvm/bytecode/IRETURN.java b/src/main/gov/nasa/jpf/jvm/bytecode/IRETURN.java index 339280ff..3133b104 100644 --- a/src/main/gov/nasa/jpf/jvm/bytecode/IRETURN.java +++ b/src/main/gov/nasa/jpf/jvm/bytecode/IRETURN.java @@ -60,7 +60,7 @@ public Object getReturnValue(ThreadInfo ti) { ret = frame.peek(); } - return new Integer(ret); + return ret; } @Override diff --git a/src/main/gov/nasa/jpf/jvm/bytecode/LRETURN.java b/src/main/gov/nasa/jpf/jvm/bytecode/LRETURN.java index c41b915d..f97e2376 100644 --- a/src/main/gov/nasa/jpf/jvm/bytecode/LRETURN.java +++ b/src/main/gov/nasa/jpf/jvm/bytecode/LRETURN.java @@ -38,7 +38,7 @@ public Object getReturnValue(ThreadInfo ti) { ret = frame.peekLong(); } - return new Long(ret); + return ret; } @Override diff --git a/src/main/gov/nasa/jpf/listener/DeadlockAnalyzer.java b/src/main/gov/nasa/jpf/listener/DeadlockAnalyzer.java index e434d175..e7682816 100644 --- a/src/main/gov/nasa/jpf/listener/DeadlockAnalyzer.java +++ b/src/main/gov/nasa/jpf/listener/DeadlockAnalyzer.java @@ -96,7 +96,7 @@ Instruction getReportInsn(ThreadInfo ti){ } void printLocOn (PrintWriter pw) { - pw.print(String.format("%6d", new Integer(stateId))); + pw.print(String.format("%6d", stateId)); if (insn != null) { pw.print(String.format(" %18.18s ", insn.getMnemonic())); diff --git a/src/main/gov/nasa/jpf/listener/Perturbator.java b/src/main/gov/nasa/jpf/listener/Perturbator.java index 0eaac2b7..a01ebd17 100644 --- a/src/main/gov/nasa/jpf/listener/Perturbator.java +++ b/src/main/gov/nasa/jpf/listener/Perturbator.java @@ -367,7 +367,7 @@ public void executeInstruction (VM vm, ThreadInfo ti, Instruction insnToExecute) // pop the callee stackframe and modify the caller stackframe // note that we don't need to enter in order to get the perturbation base // value because its already on the operand stack - ChoiceGenerator cg = e.perturbator.createChoiceGenerator("perturbReturn", ti.getTopFrame(), new Integer(0)); + ChoiceGenerator cg = e.perturbator.createChoiceGenerator("perturbReturn", ti.getTopFrame(), 0); if (ss.setNextChoiceGenerator(cg)){ ti.skipInstruction(insnToExecute); } @@ -434,7 +434,7 @@ public void instructionExecuted(VM vm, ThreadInfo ti, Instruction nextInsn, Inst } } else { // first time around, create&set the CG and reexecute - ChoiceGenerator cg = p.perturbator.createChoiceGenerator( "perturbGetField", frame, new Integer(0)); + ChoiceGenerator cg = p.perturbator.createChoiceGenerator( "perturbGetField", frame, 0); if (ss.setNextChoiceGenerator(cg)){ assert savedFrame != null; // we could more efficiently restore the stackframe diff --git a/src/main/gov/nasa/jpf/util/DynamicIntArray.java b/src/main/gov/nasa/jpf/util/DynamicIntArray.java index 3163921d..fb3ec0ae 100644 --- a/src/main/gov/nasa/jpf/util/DynamicIntArray.java +++ b/src/main/gov/nasa/jpf/util/DynamicIntArray.java @@ -49,7 +49,7 @@ public boolean hasNext() { @Override public Integer next() { - return new Integer(get(i++)); + return get(i++); } @Override diff --git a/src/main/gov/nasa/jpf/util/SimplePool.java b/src/main/gov/nasa/jpf/util/SimplePool.java index 52ad32a3..74277ed6 100644 --- a/src/main/gov/nasa/jpf/util/SimplePool.java +++ b/src/main/gov/nasa/jpf/util/SimplePool.java @@ -164,20 +164,20 @@ public void add(E e) { public static void main(String[] args) { SimplePool pool = new SimplePool(4); for (int i = 0; i < 1000000; i += 42) { - Integer o = new Integer(i); + Integer o = i; Integer p = pool.pool(o); if (o != p) throw new RuntimeException(); Integer q = pool.pool(p); if (q != p) throw new RuntimeException(); } for (int i = 0; i < 1000000; i += 42) { - Integer o = new Integer(i); + Integer o = i; Integer p = pool.pool(o); if (o == p) throw new RuntimeException(); if (!o.equals(p)) throw new RuntimeException(); } for (int i = 1; i < 1000000; i += 42) { - Integer o = new Integer(i); + Integer o = i; Integer p = pool.pool(o); if (o != p) throw new RuntimeException(); } diff --git a/src/main/gov/nasa/jpf/util/SparseObjVector.java b/src/main/gov/nasa/jpf/util/SparseObjVector.java index 684fc28e..bbe90f4d 100644 --- a/src/main/gov/nasa/jpf/util/SparseObjVector.java +++ b/src/main/gov/nasa/jpf/util/SparseObjVector.java @@ -211,7 +211,7 @@ public static void main(String[] args) { // add some for (int i = -4200; i < 4200; i += 10) { - vect.set(i, new Integer(i)); + vect.set(i, i); } // check for added & non-added @@ -230,7 +230,7 @@ public static void main(String[] args) { // add some more for (int i = -4201; i < 4200; i += 10) { - vect.set(i, new Integer(i)); + vect.set(i, i); } // check all added @@ -268,10 +268,10 @@ public static void main(String[] args) { // add even more for (int i = -4203; i < 4200; i += 10) { - vect.set(i, new Integer(i)); + vect.set(i, i); } for (int i = -4204; i < 4200; i += 10) { - vect.set(i, new Integer(i)); + vect.set(i, i); } } } diff --git a/src/main/gov/nasa/jpf/util/WeakPool.java b/src/main/gov/nasa/jpf/util/WeakPool.java index 9676390e..f0e071fd 100644 --- a/src/main/gov/nasa/jpf/util/WeakPool.java +++ b/src/main/gov/nasa/jpf/util/WeakPool.java @@ -193,20 +193,20 @@ public void add(E e) { public static void main(String[] args) { WeakPool pool = new WeakPool(4); for (int i = 0; i < 1000000; i += 42) { - Integer o = new Integer(i); + Integer o = i; Integer p = pool.pool(o); if (o != p) throw new RuntimeException(); Integer q = pool.pool(p); if (q != p) throw new RuntimeException(); } for (int i = 0; i < 1000000; i += 42) { - Integer o = new Integer(i); + Integer o = i; Integer p = pool.pool(o); if (o == p) throw new RuntimeException(); if (!o.equals(p)) throw new RuntimeException(); } for (int i = 1; i < 1000000; i += 42) { - Integer o = new Integer(i); + Integer o = i; Integer p = pool.pool(o); if (o != p) throw new RuntimeException(); } diff --git a/src/main/gov/nasa/jpf/vm/BooleanFieldInfo.java b/src/main/gov/nasa/jpf/vm/BooleanFieldInfo.java index 6b368173..8c51b022 100644 --- a/src/main/gov/nasa/jpf/vm/BooleanFieldInfo.java +++ b/src/main/gov/nasa/jpf/vm/BooleanFieldInfo.java @@ -55,7 +55,7 @@ public boolean isBooleanField() { @Override public Object getValueObject (Fields f){ int i = f.getIntValue(storageOffset); - return new Boolean(i != 0); + return i != 0; } @Override diff --git a/src/main/gov/nasa/jpf/vm/ByteFieldInfo.java b/src/main/gov/nasa/jpf/vm/ByteFieldInfo.java index 41f17dd0..48c14f4c 100644 --- a/src/main/gov/nasa/jpf/vm/ByteFieldInfo.java +++ b/src/main/gov/nasa/jpf/vm/ByteFieldInfo.java @@ -63,7 +63,7 @@ public String valueToString (Fields f) { @Override public Object getValueObject (Fields f){ int i = f.getIntValue(storageOffset); - return new Byte((byte)i); + return (byte) i; } @Override diff --git a/src/main/gov/nasa/jpf/vm/CharFieldInfo.java b/src/main/gov/nasa/jpf/vm/CharFieldInfo.java index 53c10b6a..e11c4d4c 100644 --- a/src/main/gov/nasa/jpf/vm/CharFieldInfo.java +++ b/src/main/gov/nasa/jpf/vm/CharFieldInfo.java @@ -64,7 +64,7 @@ public String valueToString (Fields f) { @Override public Object getValueObject (Fields f){ int i = f.getIntValue(storageOffset); - return new Character((char)i); + return (char) i; } } \ No newline at end of file diff --git a/src/main/gov/nasa/jpf/vm/DoubleFieldInfo.java b/src/main/gov/nasa/jpf/vm/DoubleFieldInfo.java index 8cf6809d..2ffec951 100644 --- a/src/main/gov/nasa/jpf/vm/DoubleFieldInfo.java +++ b/src/main/gov/nasa/jpf/vm/DoubleFieldInfo.java @@ -67,7 +67,7 @@ public String valueToString (Fields f) { @Override public Object getValueObject (Fields f){ double d = f.getDoubleValue(storageOffset); - return new Double(d); + return d; } @Override diff --git a/src/main/gov/nasa/jpf/vm/FloatFieldInfo.java b/src/main/gov/nasa/jpf/vm/FloatFieldInfo.java index 0247d66c..46aa3a69 100644 --- a/src/main/gov/nasa/jpf/vm/FloatFieldInfo.java +++ b/src/main/gov/nasa/jpf/vm/FloatFieldInfo.java @@ -61,7 +61,7 @@ public String valueToString (Fields f) { @Override public Object getValueObject (Fields f){ float v = f.getFloatValue(storageOffset); - return new Float(v); + return v; } @Override diff --git a/src/main/gov/nasa/jpf/vm/IntegerFieldInfo.java b/src/main/gov/nasa/jpf/vm/IntegerFieldInfo.java index 9c5ca798..b77c5aba 100644 --- a/src/main/gov/nasa/jpf/vm/IntegerFieldInfo.java +++ b/src/main/gov/nasa/jpf/vm/IntegerFieldInfo.java @@ -62,7 +62,7 @@ public String valueToString (Fields f) { @Override public Object getValueObject (Fields f){ int i = f.getIntValue(storageOffset); - return new Integer(i); + return i; } @Override diff --git a/src/main/gov/nasa/jpf/vm/LongFieldInfo.java b/src/main/gov/nasa/jpf/vm/LongFieldInfo.java index 11c9c096..719e6391 100644 --- a/src/main/gov/nasa/jpf/vm/LongFieldInfo.java +++ b/src/main/gov/nasa/jpf/vm/LongFieldInfo.java @@ -66,7 +66,7 @@ public String valueToString (Fields f) { @Override public Object getValueObject (Fields f){ long v = f.getLongValue(storageOffset); - return new Long(v); + return v; } @Override diff --git a/src/main/gov/nasa/jpf/vm/MJIEnv.java b/src/main/gov/nasa/jpf/vm/MJIEnv.java index 51be523c..c7d74e1b 100644 --- a/src/main/gov/nasa/jpf/vm/MJIEnv.java +++ b/src/main/gov/nasa/jpf/vm/MJIEnv.java @@ -844,31 +844,31 @@ public Boolean getBooleanObject (int objref){ } public Byte getByteObject (int objref){ - return new Byte(getByteField(objref, "value")); + return getByteField(objref, "value"); } public Character getCharObject (int objref){ - return new Character(getCharField(objref, "value")); + return getCharField(objref, "value"); } public Short getShortObject (int objref){ - return new Short(getShortField(objref, "value")); + return getShortField(objref, "value"); } public Integer getIntegerObject (int objref){ - return new Integer(getIntField(objref, "value")); + return getIntField(objref, "value"); } public Long getLongObject (int objref){ - return new Long(getLongField(objref, "value")); + return getLongField(objref, "value"); } public Float getFloatObject (int objref){ - return new Float(getFloatField(objref, "value")); + return getFloatField(objref, "value"); } public Double getDoubleObject (int objref){ - return new Double(getDoubleField(objref, "value")); + return getDoubleField(objref, "value"); } // danger - the returned arrays could be used to modify contents of stored objects diff --git a/src/main/gov/nasa/jpf/vm/NativeMethodInfo.java b/src/main/gov/nasa/jpf/vm/NativeMethodInfo.java index 24ee41f7..ff21336b 100644 --- a/src/main/gov/nasa/jpf/vm/NativeMethodInfo.java +++ b/src/main/gov/nasa/jpf/vm/NativeMethodInfo.java @@ -235,33 +235,33 @@ protected Object[] getArguments (ThreadInfo ti) { case Types.T_SHORT: ival = caller.peek(stackOffset); - a[j] = new Short((short) ival); + a[j] = (short) ival; break; case Types.T_INT: ival = caller.peek(stackOffset); - a[j] = new Integer(ival); + a[j] = ival; break; case Types.T_LONG: lval = caller.peekLong(stackOffset); stackOffset++; // 2 stack words - a[j] = new Long(lval); + a[j] = lval; break; case Types.T_FLOAT: ival = caller.peek(stackOffset); - a[j] = new Float(Types.intToFloat(ival)); + a[j] = Types.intToFloat(ival); break; case Types.T_DOUBLE: lval = caller.peekLong(stackOffset); stackOffset++; // 2 stack words - a[j] = new Double(Types.longToDouble(lval)); + a[j] = Types.longToDouble(lval); break; @@ -269,7 +269,7 @@ protected Object[] getArguments (ThreadInfo ti) { // NOTE - we have to store T_REFERENCE as an Integer, because // it shows up in our native method as an 'int' ival = caller.peek(stackOffset); - a[j] = new Integer(ival); + a[j] = ival; } stackOffset++; @@ -277,9 +277,9 @@ protected Object[] getArguments (ThreadInfo ti) { //--- set our standard MJI header arguments if (isStatic()) { - a[1] = new Integer(ci.getClassObjectRef()); + a[1] = ci.getClassObjectRef(); } else { - a[1] = new Integer(ti.getCalleeThis(this)); + a[1] = ti.getCalleeThis(this); } a[0] = ti.getMJIEnv(); diff --git a/src/main/gov/nasa/jpf/vm/ShortFieldInfo.java b/src/main/gov/nasa/jpf/vm/ShortFieldInfo.java index 01459cb9..9eaff003 100644 --- a/src/main/gov/nasa/jpf/vm/ShortFieldInfo.java +++ b/src/main/gov/nasa/jpf/vm/ShortFieldInfo.java @@ -62,7 +62,7 @@ public boolean isNumericField(){ @Override public Object getValueObject (Fields f){ int i = f.getIntValue(storageOffset); - return new Short((short)i); + return (short) i; } @Override diff --git a/src/main/gov/nasa/jpf/vm/StackFrame.java b/src/main/gov/nasa/jpf/vm/StackFrame.java index 0c642af2..918d68bd 100644 --- a/src/main/gov/nasa/jpf/vm/StackFrame.java +++ b/src/main/gov/nasa/jpf/vm/StackFrame.java @@ -244,19 +244,19 @@ public Object getLocalValueObject (LocalVarInfo lv) { case 'Z': return Boolean.valueOf(v != 0); case 'B': - return new Byte((byte) v); + return (byte) v; case 'C': - return new Character((char) v); + return (char) v; case 'S': - return new Short((short) v); + return (short) v; case 'I': - return new Integer(v); + return v; case 'J': - return new Long(Types.intsToLong(slots[slotIdx + 1], v)); // Java is big endian, Types expects low,high + return Types.intsToLong(slots[slotIdx + 1], v); // Java is big endian, Types expects low,high case 'F': - return new Float(Float.intBitsToFloat(v)); + return Float.intBitsToFloat(v); case 'D': - return new Double(Double.longBitsToDouble(Types.intsToLong(slots[slotIdx + 1], v))); + return Double.longBitsToDouble(Types.intsToLong(slots[slotIdx + 1], v)); default: // reference if (v >= 0) { return VM.getVM().getHeap().get(v); @@ -911,36 +911,36 @@ public Object[] getArgumentsValues (ThreadInfo ti, byte[] argTypes){ break; case Types.T_LONG: - args[i] = new Long(peekLong(off)); + args[i] = peekLong(off); off+=2; break; case Types.T_DOUBLE: - args[i] = new Double(Types.longToDouble(peekLong(off))); + args[i] = Types.longToDouble(peekLong(off)); off+=2; break; case Types.T_BOOLEAN: - args[i] = new Boolean(peek(off) != 0); + args[i] = peek(off) != 0; off++; break; case Types.T_BYTE: - args[i] = new Byte((byte)peek(off)); + args[i] = (byte) peek(off); off++; break; case Types.T_CHAR: - args[i] = new Character((char)peek(off)); + args[i] = (char) peek(off); off++; break; case Types.T_SHORT: - args[i] = new Short((short)peek(off)); + args[i] = (short) peek(off); off++; break; case Types.T_INT: - args[i] = new Integer(peek(off)); + args[i] = peek(off); off++; break; case Types.T_FLOAT: - args[i] = new Float(Types.intToFloat(peek(off))); + args[i] = Types.intToFloat(peek(off)); off++; break; default: diff --git a/src/main/gov/nasa/jpf/vm/choice/DoubleChoiceFromList.java b/src/main/gov/nasa/jpf/vm/choice/DoubleChoiceFromList.java index 5b3cf958..e8e12fc1 100644 --- a/src/main/gov/nasa/jpf/vm/choice/DoubleChoiceFromList.java +++ b/src/main/gov/nasa/jpf/vm/choice/DoubleChoiceFromList.java @@ -46,12 +46,12 @@ public Class getChoiceType() { @Override protected Double parseLiteral(String literal, int sign) { double val = Double.parseDouble(literal); - return new Double(val * sign); + return val * sign; } @Override protected Double newValue(Number num, int sign) { - return new Double(num.intValue() * sign); + return (double) (num.intValue() * sign); } /** diff --git a/src/main/gov/nasa/jpf/vm/choice/DoubleThresholdGenerator.java b/src/main/gov/nasa/jpf/vm/choice/DoubleThresholdGenerator.java index a13f1e03..d8728a68 100644 --- a/src/main/gov/nasa/jpf/vm/choice/DoubleThresholdGenerator.java +++ b/src/main/gov/nasa/jpf/vm/choice/DoubleThresholdGenerator.java @@ -63,9 +63,9 @@ public boolean hasMoreChoices () { @Override public Double getNextChoice () { if (count >=0) { - return new Double(values[count]); + return values[count]; } else { - return new Double(values[0]); + return values[0]; } } diff --git a/src/main/gov/nasa/jpf/vm/choice/FloatChoiceFromList.java b/src/main/gov/nasa/jpf/vm/choice/FloatChoiceFromList.java index ee7ea065..1d6e0cbb 100644 --- a/src/main/gov/nasa/jpf/vm/choice/FloatChoiceFromList.java +++ b/src/main/gov/nasa/jpf/vm/choice/FloatChoiceFromList.java @@ -42,12 +42,12 @@ public Class getChoiceType(){ @Override protected Float parseLiteral (String literal, int sign){ Float val = Float.parseFloat(literal); - return new Float( val * sign); + return val * sign; } @Override protected Float newValue (Number num, int sign){ - return new Float( num.intValue() * sign); + return (float) (num.intValue() * sign); } /** diff --git a/src/main/gov/nasa/jpf/vm/choice/IntChoiceFromList.java b/src/main/gov/nasa/jpf/vm/choice/IntChoiceFromList.java index ebb7706c..aa266654 100644 --- a/src/main/gov/nasa/jpf/vm/choice/IntChoiceFromList.java +++ b/src/main/gov/nasa/jpf/vm/choice/IntChoiceFromList.java @@ -50,12 +50,12 @@ public Class getChoiceType(){ @Override protected Integer parseLiteral (String literal, int sign){ int val = Integer.parseInt(literal); - return new Integer( val * sign); + return val * sign; } @Override protected Integer newValue (Number num, int sign){ - return new Integer( num.intValue() * sign); + return num.intValue() * sign; } /** diff --git a/src/main/gov/nasa/jpf/vm/choice/IntIntervalGenerator.java b/src/main/gov/nasa/jpf/vm/choice/IntIntervalGenerator.java index 8120c9bd..882326c9 100644 --- a/src/main/gov/nasa/jpf/vm/choice/IntIntervalGenerator.java +++ b/src/main/gov/nasa/jpf/vm/choice/IntIntervalGenerator.java @@ -106,7 +106,7 @@ public Integer getChoice (int idx){ @Override public Integer getNextChoice () { - return new Integer(next); + return next; } @Override diff --git a/src/main/gov/nasa/jpf/vm/choice/LongChoiceFromList.java b/src/main/gov/nasa/jpf/vm/choice/LongChoiceFromList.java index 10a77abd..88162343 100644 --- a/src/main/gov/nasa/jpf/vm/choice/LongChoiceFromList.java +++ b/src/main/gov/nasa/jpf/vm/choice/LongChoiceFromList.java @@ -41,12 +41,12 @@ public Class getChoiceType() { @Override protected Long parseLiteral(String literal, int sign) { long val = Long.parseLong(literal); - return new Long(val * sign); + return val * sign; } @Override protected Long newValue(Number num, int sign) { - return new Long(num.longValue() * sign); + return num.longValue() * sign; } /** diff --git a/src/main/gov/nasa/jpf/vm/choice/RandomIntIntervalGenerator.java b/src/main/gov/nasa/jpf/vm/choice/RandomIntIntervalGenerator.java index dfad9590..c0e32a85 100644 --- a/src/main/gov/nasa/jpf/vm/choice/RandomIntIntervalGenerator.java +++ b/src/main/gov/nasa/jpf/vm/choice/RandomIntIntervalGenerator.java @@ -111,7 +111,7 @@ public void advance (){ @Override public Integer getNextChoice () { - return new Integer(next); + return next; } @Override diff --git a/src/main/gov/nasa/jpf/vm/choice/RandomOrderIntCG.java b/src/main/gov/nasa/jpf/vm/choice/RandomOrderIntCG.java index e16528fd..cb4694e2 100644 --- a/src/main/gov/nasa/jpf/vm/choice/RandomOrderIntCG.java +++ b/src/main/gov/nasa/jpf/vm/choice/RandomOrderIntCG.java @@ -57,7 +57,7 @@ public Integer getChoice (int idx){ @Override public Integer getNextChoice() { - return new Integer(choices[nextIdx]); + return choices[nextIdx]; } @Override diff --git a/src/main/gov/nasa/jpf/vm/choice/RandomOrderLongCG.java b/src/main/gov/nasa/jpf/vm/choice/RandomOrderLongCG.java index 354a34d2..81670228 100644 --- a/src/main/gov/nasa/jpf/vm/choice/RandomOrderLongCG.java +++ b/src/main/gov/nasa/jpf/vm/choice/RandomOrderLongCG.java @@ -58,7 +58,7 @@ public Long getChoice (int idx){ @Override public Long getNextChoice() { - return new Long(choices[nextIdx]); + return choices[nextIdx]; } @Override diff --git a/src/main/gov/nasa/jpf/vm/choice/TypedObjectChoice.java b/src/main/gov/nasa/jpf/vm/choice/TypedObjectChoice.java index 14604ad7..20dcf335 100644 --- a/src/main/gov/nasa/jpf/vm/choice/TypedObjectChoice.java +++ b/src/main/gov/nasa/jpf/vm/choice/TypedObjectChoice.java @@ -115,9 +115,9 @@ public void reset () { @Override public Integer getNextChoice () { if ((count >= 0) && (count < values.length)) { - return new Integer(values[count]); + return values[count]; } else { - return new Integer(-1); + return -1; } } diff --git a/src/peers/gov/nasa/jpf/vm/JPF_java_io_RandomAccessFile.java b/src/peers/gov/nasa/jpf/vm/JPF_java_io_RandomAccessFile.java index da863e22..5e34d12c 100644 --- a/src/peers/gov/nasa/jpf/vm/JPF_java_io_RandomAccessFile.java +++ b/src/peers/gov/nasa/jpf/vm/JPF_java_io_RandomAccessFile.java @@ -44,7 +44,7 @@ public static boolean init (Config conf) { // get the mapped object if one exists private static int getMapping(MJIEnv env, int this_ptr) { int fn_ptr = env.getReferenceField(this_ptr,"filename"); - Object o = File2DataMap.get(new Integer(fn_ptr)); + Object o = File2DataMap.get(fn_ptr); if (o == null) return this_ptr; return ((Integer)o).intValue(); @@ -54,8 +54,8 @@ private static int getMapping(MJIEnv env, int this_ptr) { @MJI public void setDataMap____V (MJIEnv env, int this_ptr) { int fn_ptr = env.getReferenceField(this_ptr,"filename"); - if (!File2DataMap.containsKey(new Integer(fn_ptr))) - File2DataMap.put(new Integer(fn_ptr),new Integer(this_ptr)); + if (!File2DataMap.containsKey(fn_ptr)) + File2DataMap.put(fn_ptr, this_ptr); } static ClassInfo getDataRepresentationClassInfo (MJIEnv env) { diff --git a/src/peers/gov/nasa/jpf/vm/JPF_java_text_Format.java b/src/peers/gov/nasa/jpf/vm/JPF_java_text_Format.java index 56724814..dd51fd98 100644 --- a/src/peers/gov/nasa/jpf/vm/JPF_java_text_Format.java +++ b/src/peers/gov/nasa/jpf/vm/JPF_java_text_Format.java @@ -41,7 +41,7 @@ public static boolean init (Config conf){ static void putInstance (MJIEnv env, int objref, Format fmt) { int id = env.getIntField(objref, "id"); - formatters.put(new Integer(id), fmt); + formatters.put(id, fmt); } static Format getInstance (MJIEnv env, int objref) { diff --git a/src/tests/gov/nasa/jpf/test/java/lang/BoxObjectCacheTest.java b/src/tests/gov/nasa/jpf/test/java/lang/BoxObjectCacheTest.java index 73bd5742..9cfc18d3 100644 --- a/src/tests/gov/nasa/jpf/test/java/lang/BoxObjectCacheTest.java +++ b/src/tests/gov/nasa/jpf/test/java/lang/BoxObjectCacheTest.java @@ -129,6 +129,7 @@ public void testBooleanCache(){ } @Test + @SuppressWarnings("deprecation") public void testIntCacheBoxObject() throws SecurityException, NoSuchMethodException, IllegalAccessException, InvocationTargetException{ if (verifyNoPropertyViolation(JPF_ARGS)){ Integer i1 = Integer.valueOf( 1); // should be cached @@ -142,6 +143,7 @@ public void testIntCacheBoxObject() throws SecurityException, NoSuchMethodExcept } @Test + @SuppressWarnings("deprecation") public void testCharacterCacheBoxObject() throws SecurityException, NoSuchMethodException, IllegalAccessException, InvocationTargetException{ if (verifyNoPropertyViolation(JPF_ARGS)){ Character c1 = Character.valueOf( '?'); // should be cached @@ -155,6 +157,7 @@ public void testCharacterCacheBoxObject() throws SecurityException, NoSuchMethod } @Test + @SuppressWarnings("deprecation") public void testByteCacheBoxObject() throws SecurityException, NoSuchMethodException, IllegalAccessException, InvocationTargetException{ if (verifyNoPropertyViolation(JPF_ARGS)){ Byte b1 = Byte.valueOf( (byte)1); // should be cached @@ -168,6 +171,7 @@ public void testByteCacheBoxObject() throws SecurityException, NoSuchMethodExcep } @Test + @SuppressWarnings("deprecation") public void testShortCacheBoxObject() throws SecurityException, NoSuchMethodException, IllegalAccessException, InvocationTargetException{ if (verifyNoPropertyViolation(JPF_ARGS)){ Short s1 = Short.valueOf((short)1); // should be cached @@ -181,6 +185,7 @@ public void testShortCacheBoxObject() throws SecurityException, NoSuchMethodExce } @Test + @SuppressWarnings("deprecation") public void testLongCacheBoxObject() throws SecurityException, NoSuchMethodException, IllegalAccessException, InvocationTargetException{ if (verifyNoPropertyViolation(JPF_ARGS)){ Long l1 = Long.valueOf(1); // should be cached @@ -194,6 +199,7 @@ public void testLongCacheBoxObject() throws SecurityException, NoSuchMethodExcep } @Test + @SuppressWarnings("deprecation") public void testBooleanCacheBoxObject() throws SecurityException, NoSuchMethodException, IllegalAccessException, InvocationTargetException{ if (verifyNoPropertyViolation(JPF_ARGS)){ Boolean b1 = Boolean.valueOf(true); // should be cached diff --git a/src/tests/gov/nasa/jpf/test/java/lang/SystemTest.java b/src/tests/gov/nasa/jpf/test/java/lang/SystemTest.java index 836a1694..82cb0f01 100644 --- a/src/tests/gov/nasa/jpf/test/java/lang/SystemTest.java +++ b/src/tests/gov/nasa/jpf/test/java/lang/SystemTest.java @@ -125,7 +125,7 @@ public void testOverlappingSelfArrayCopy(){ public void testIncompatibleReferencesArrayCopy(){ if (verifyUnhandledException("java.lang.ArrayStoreException")){ String[] dst = new String[2]; - Object[] src = { "one", new Integer(2) }; + Object[] src = { "one", 2}; System.arraycopy(src,0,dst,0,src.length); } diff --git a/src/tests/gov/nasa/jpf/test/mc/basic/AttrsTest.java b/src/tests/gov/nasa/jpf/test/mc/basic/AttrsTest.java index ecdece1a..a7b881a6 100644 --- a/src/tests/gov/nasa/jpf/test/mc/basic/AttrsTest.java +++ b/src/tests/gov/nasa/jpf/test/mc/basic/AttrsTest.java @@ -361,6 +361,7 @@ int goModel (double d, int i) { } } + @SuppressWarnings("deprecation") @Test public void testInteger() { if (verifyNoPropertyViolation()) { int v = 42; @@ -391,7 +392,7 @@ int goModel (double d, int i) { @Test public void testObjectAttr(){ if (verifyNoPropertyViolation()){ - Integer o = new Integer(41); + Integer o = 41; Verify.setObjectAttribute(o, 42); boolean b = Verify.getBoolean(); diff --git a/src/tests/gov/nasa/jpf/test/mc/basic/OOMEInjectorTest.java b/src/tests/gov/nasa/jpf/test/mc/basic/OOMEInjectorTest.java index 3d4aac7e..8ef8441c 100644 --- a/src/tests/gov/nasa/jpf/test/mc/basic/OOMEInjectorTest.java +++ b/src/tests/gov/nasa/jpf/test/mc/basic/OOMEInjectorTest.java @@ -29,13 +29,13 @@ public class OOMEInjectorTest extends TestJPF { public void testDirectLoc () { if (verifyUnhandledException("java.lang.OutOfMemoryError", "+listener=.listener.OOMEInjector", "+oome.locations=OOMEInjectorTest.java:32")){ - Object o = new Integer(42); + Object o = 42; } } static int bar(int y){ - Integer res = new Integer(y); // this should fail + Integer res = y; // this should fail return res; } diff --git a/src/tests/gov/nasa/jpf/test/mc/data/ObjectStreamTest.java b/src/tests/gov/nasa/jpf/test/mc/data/ObjectStreamTest.java index dd488c42..1d278686 100644 --- a/src/tests/gov/nasa/jpf/test/mc/data/ObjectStreamTest.java +++ b/src/tests/gov/nasa/jpf/test/mc/data/ObjectStreamTest.java @@ -47,7 +47,7 @@ public void deleteFile(){ @Test public void testWriteReadInteger() { if (!isJPFRun()) { - Verify.writeObjectToFile(new Integer(123), osFileName); + Verify.writeObjectToFile(123, osFileName); } if (verifyNoPropertyViolation()) { diff --git a/src/tests/gov/nasa/jpf/test/vm/basic/ArrayTest.java b/src/tests/gov/nasa/jpf/test/vm/basic/ArrayTest.java index cd6e8b46..714d8fb7 100644 --- a/src/tests/gov/nasa/jpf/test/vm/basic/ArrayTest.java +++ b/src/tests/gov/nasa/jpf/test/vm/basic/ArrayTest.java @@ -76,7 +76,7 @@ public void testArrayStoreException() { if (verifyNoPropertyViolation()) { try { Object x[] = new String[1]; - x[0] = new Integer(42); + x[0] = 42; } catch (ArrayStoreException osx) { return; } @@ -91,7 +91,7 @@ public void testArrayStoreExceptionArraycopy() { boolean caught = false; try { - System.arraycopy(new Object[]{new Integer(42)}, 0, new String[2], 0, 1); + System.arraycopy(new Object[]{42}, 0, new String[2], 0, 1); } catch (ArrayStoreException x) { caught = true; } @@ -101,7 +101,7 @@ public void testArrayStoreExceptionArraycopy() { caught = false; try { - System.arraycopy(new Object[]{new Integer(42)}, 0, new int[2], 0, 1); + System.arraycopy(new Object[]{42}, 0, new int[2], 0, 1); } catch (ArrayStoreException x) { caught = true; } diff --git a/src/tests/gov/nasa/jpf/test/vm/basic/FieldTest.java b/src/tests/gov/nasa/jpf/test/vm/basic/FieldTest.java index 2fd8a31b..39397fc0 100644 --- a/src/tests/gov/nasa/jpf/test/vm/basic/FieldTest.java +++ b/src/tests/gov/nasa/jpf/test/vm/basic/FieldTest.java @@ -158,8 +158,8 @@ public class FieldTest extends TestFieldBase { base_D = _D; assert base_D == _D; - _o = new Integer(42); - assert _o.equals(new Integer(42)); + _o = 42; + assert _o.equals(42); base_o = _o; assert base_o.equals(_o); } @@ -202,8 +202,8 @@ public class FieldTest extends TestFieldBase { s_base_D = s_D; assert s_base_D == s_D; - s_o = new Integer(42); - assert s_o.equals(new Integer(42)); + s_o = 42; + assert s_o.equals(42); s_base_o = s_o; assert s_base_o.equals(s_o); } diff --git a/src/tests/gov/nasa/jpf/test/vm/basic/MethodTest.java b/src/tests/gov/nasa/jpf/test/vm/basic/MethodTest.java index 76e114eb..a2e75726 100644 --- a/src/tests/gov/nasa/jpf/test/vm/basic/MethodTest.java +++ b/src/tests/gov/nasa/jpf/test/vm/basic/MethodTest.java @@ -59,7 +59,7 @@ boolean baz (boolean p, byte b, char c, short s, int i, long l, float f, double assert l == 424242; assert f == 4.2f; assert d == 4.242; - assert o.equals(new Integer(42)); + assert o.equals(42); baseData = 44; @@ -113,7 +113,7 @@ public MethodTest () { assert l == 424242; assert f == 4.2f; assert d == 4.242; - assert o.equals(new Integer(42)); + assert o.equals(42); data = 43; @@ -146,7 +146,7 @@ public void testCtor() { public void testCall() { if (verifyNoPropertyViolation()) { MethodTest o = new MethodTest(); - assert o.foo(true, (byte) 4, '?', (short) 42, 4242, 424242, 4.2f, 4.242, new Integer(42)) == 4.242; + assert o.foo(true, (byte) 4, '?', (short) 42, 4242, 424242, 4.2f, 4.242, 42) == 4.242; assert o.data == 43; } } @@ -155,7 +155,7 @@ public void testCall() { public void testInheritedCall() { if (verifyNoPropertyViolation()) { MethodTest o = new MethodTest(); - assert o.baz(true, (byte) 4, '?', (short) 42, 4242, 424242, 4.2f, 4.242, new Integer(42)); + assert o.baz(true, (byte) 4, '?', (short) 42, 4242, 424242, 4.2f, 4.242, 42); assert o.baseData == 44; } } diff --git a/src/tests/gov/nasa/jpf/test/vm/reflection/FieldTest.java b/src/tests/gov/nasa/jpf/test/vm/reflection/FieldTest.java index 8daddbca..eaa230dc 100644 --- a/src/tests/gov/nasa/jpf/test/vm/reflection/FieldTest.java +++ b/src/tests/gov/nasa/jpf/test/vm/reflection/FieldTest.java @@ -28,7 +28,7 @@ public class FieldTest extends TestJPF { int instInt = 42; double instDouble = 42.0; double primField = 42.0; - Object refField = new Integer(42); + Object refField = 42; int[] arrayField = new int[]{42}; static int statInt = 43; @@ -102,7 +102,7 @@ public void testSetPrimitive() { double d = ((Double) f.get(this)).doubleValue(); assert d == 42.0; - f.set(this, new Double(43.0)); + f.set(this, 43.0); assert primField == 43.0; } catch (Throwable t) { @@ -122,7 +122,7 @@ public void testSetReference() { Object o = f.get(this); assert o == refField; - Object ob = new Double(43.0); + Object ob = 43.0; f.set(this, ob); assert ob == refField; diff --git a/src/tests/gov/nasa/jpf/test/vm/reflection/MethodTest.java b/src/tests/gov/nasa/jpf/test/vm/reflection/MethodTest.java index bc65abc5..df295031 100644 --- a/src/tests/gov/nasa/jpf/test/vm/reflection/MethodTest.java +++ b/src/tests/gov/nasa/jpf/test/vm/reflection/MethodTest.java @@ -84,7 +84,7 @@ public void testInstanceMethodInvoke() { Class cls = o.getClass(); Method m = cls.getMethod("foo", int.class, double.class, String.class); - Object res = m.invoke(o, new Integer(3), new Double(3.33), "Blah"); + Object res = m.invoke(o, 3, 3.33, "Blah"); double d = ((Double) res).doubleValue(); System.out.println("foo returned " + d); @@ -113,7 +113,7 @@ public void testStaticMethodInvoke() { Class cls = o.getClass(); Method m = cls.getMethod("harr", int.class); - Object res = m.invoke(null, new Integer(41)); + Object res = m.invoke(null, 41); int r = (Integer)res; System.out.println("harr returned " + r); diff --git a/src/tests/gov/nasa/jpf/util/ObjectListTest.java b/src/tests/gov/nasa/jpf/util/ObjectListTest.java index 5e71bea5..7f5099c9 100644 --- a/src/tests/gov/nasa/jpf/util/ObjectListTest.java +++ b/src/tests/gov/nasa/jpf/util/ObjectListTest.java @@ -36,7 +36,7 @@ public void testAdd(){ assertTrue( ObjectList.size(attr) == 1); assertTrue( attr != null && attr.equals("one")); - attr = ObjectList.add(attr, new Integer(2)); + attr = ObjectList.add(attr, 2); assertTrue( ObjectList.size(attr) == 2); assertTrue( attr != null && !(attr instanceof Integer)); } @@ -44,7 +44,7 @@ public void testAdd(){ @Test public void testListIteration() { - Object[] v = { new Integer(2), "one" }; + Object[] v = {2, "one" }; for (Object a: ObjectList.iterator(attr)){ fail("list should be empty"); @@ -62,7 +62,7 @@ public void testListIteration() { } attr = ObjectList.add(attr, "three"); - attr = ObjectList.add(attr, new Integer(4)); + attr = ObjectList.add(attr, 4); int i=0; for (Integer a = ObjectList.getFirst(attr, Integer.class); a!=null; a = ObjectList.getNext(attr, Integer.class, a)){ @@ -157,12 +157,12 @@ public void testReplace(){ String one = "one"; attr = ObjectList.add(attr, one); - Integer i1 = new Integer(1); + Integer i1 = 1; attr = ObjectList.replace(attr, one, i1); assertTrue(attr == i1); String two = "two"; - Integer i2 = new Integer(2); + Integer i2 = 2; attr = ObjectList.add(attr, two); attr = ObjectList.replace(attr, two, i2); Integer o = ObjectList.getFirst(attr, Integer.class); diff --git a/src/tests/gov/nasa/jpf/util/SparseClusterArrayTest.java b/src/tests/gov/nasa/jpf/util/SparseClusterArrayTest.java index d88f5c2d..dba4f751 100644 --- a/src/tests/gov/nasa/jpf/util/SparseClusterArrayTest.java +++ b/src/tests/gov/nasa/jpf/util/SparseClusterArrayTest.java @@ -59,14 +59,14 @@ public void testBasic() { int ref; ref = (1 << S1) | 42; - arr.set(ref, (v = new Integer(ref))); + arr.set(ref, (v = ref)); Object o = arr.get(ref); System.out.println(o); assert o.equals(v); ref = (2 << S1); - arr.set(ref, new Integer(ref)); + arr.set(ref, ref); System.out.println("cardinality = " + arr.cardinality()); assert arr.cardinality() == 2; @@ -78,7 +78,7 @@ public void testBasic() { @Test public void testNextNull () { - Object e = new Integer(42); + Object e = 42; SparseClusterArray arr = new SparseClusterArray(); int k; int limit = 10000000; @@ -173,9 +173,9 @@ public void testClusterNextNull () { public void testClone() { SparseClusterArray arr = new SparseClusterArray(); - arr.set(0, new Integer(0)); - arr.set(42, new Integer(42)); - arr.set(6762, new Integer(6762)); + arr.set(0, 0); + arr.set(42, 42); + arr.set(6762, 6762); arr.set(6762, null); Cloner cloner = new Cloner() { @@ -199,14 +199,14 @@ public Integer clone (Integer other) { public void testSnapshot() { SparseClusterArray arr = new SparseClusterArray(); - arr.set(0, new Integer(0)); - arr.set(42, new Integer(42)); - arr.set(4095, new Integer(4095)); - arr.set(4096, new Integer(4096)); - arr.set(7777, new Integer(7777)); - arr.set(67620, new Integer(67620)); + arr.set(0, 0); + arr.set(42, 42); + arr.set(4095, 4095); + arr.set(4096, 4096); + arr.set(7777, 7777); + arr.set(67620, 67620); arr.set(67620, null); - arr.set(7162827, new Integer(7162827)); + arr.set(7162827, 7162827); Transformer i2s = new Transformer() { @Override @@ -218,7 +218,7 @@ public String transform (Integer n) { Transformer s2i = new Transformer() { @Override public Integer transform (String s) { - return new Integer( Integer.parseInt(s)); + return Integer.parseInt(s); } }; @@ -230,8 +230,8 @@ public Integer transform (String s) { } arr.set(42,null); - arr.set(87, new Integer(87)); - arr.set(7162827, new Integer(-1)); + arr.set(87, 87); + arr.set(7162827, -1); arr.restore(snap, s2i); for (Integer i : arr) { @@ -251,17 +251,17 @@ public Integer transform (String s) { public void testChanges() { SparseClusterArray arr = new SparseClusterArray(); - arr.set(42, new Integer(42)); - arr.set(6276, new Integer(6276)); + arr.set(42, 42); + arr.set(6276, 6276); arr.trackChanges(); - arr.set(0, new Integer(0)); - arr.set(42, new Integer(-1)); - arr.set(4095, new Integer(4095)); - arr.set(4096, new Integer(4096)); - arr.set(7777, new Integer(7777)); - arr.set(7162827, new Integer(7162827)); + arr.set(0, 0); + arr.set(42, -1); + arr.set(4095, 4095); + arr.set(4096, 4096); + arr.set(7777, 7777); + arr.set(7162827, 7162827); Entry changes = arr.getChanges(); arr.revertChanges(changes); diff --git a/src/tests/java8/LambdaTest.java b/src/tests/java8/LambdaTest.java index b6ec6953..90f225fc 100644 --- a/src/tests/java8/LambdaTest.java +++ b/src/tests/java8/LambdaTest.java @@ -112,7 +112,7 @@ public void testLambdaArgument() { } } - static Integer io = new Integer(20); + static Integer io = 20; @Test public void testClosure() {