removed unneeded boxing

master
Egor.Ushakov 8 years ago
parent a62cc3f709
commit 7575bb57de
  1. 4
      src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java
  2. 12
      src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java
  3. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.java
  4. 12
      src/org/jetbrains/java/decompiler/modules/decompiler/SecondaryFunctionsHelper.java
  5. 6
      src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DominatorTreeExceptionFilter.java
  6. 26
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java
  7. 6
      src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAConstructorSparseEx.java
  8. 6
      src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAUConstructorSparseEx.java
  9. 8
      src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java
  10. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarProcessor.java
  11. 10
      src/org/jetbrains/java/decompiler/struct/consts/ConstantPool.java
  12. 10
      src/org/jetbrains/java/decompiler/util/VBStyleCollection.java

@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -256,7 +256,7 @@ public class ControlFlowGraph implements CodeConstants {
for (int i = 0; i < len; i++) {
// exception blocks
if (excSet.contains(new Integer(i))) {
if (excSet.contains(i)) {
inststates[i] = 1;
}

@ -313,16 +313,16 @@ public class ExprProcessor implements CodeConstants {
break;
case opc_lconst_0:
case opc_lconst_1:
pushEx(stack, exprlist, new ConstExprent(VarType.VARTYPE_LONG, new Long(instr.opcode - opc_lconst_0), bytecode_offsets));
pushEx(stack, exprlist, new ConstExprent(VarType.VARTYPE_LONG, Long.valueOf(instr.opcode - opc_lconst_0), bytecode_offsets));
break;
case opc_fconst_0:
case opc_fconst_1:
case opc_fconst_2:
pushEx(stack, exprlist, new ConstExprent(VarType.VARTYPE_FLOAT, new Float(instr.opcode - opc_fconst_0), bytecode_offsets));
pushEx(stack, exprlist, new ConstExprent(VarType.VARTYPE_FLOAT, Float.valueOf(instr.opcode - opc_fconst_0), bytecode_offsets));
break;
case opc_dconst_0:
case opc_dconst_1:
pushEx(stack, exprlist, new ConstExprent(VarType.VARTYPE_DOUBLE, new Double(instr.opcode - opc_dconst_0), bytecode_offsets));
pushEx(stack, exprlist, new ConstExprent(VarType.VARTYPE_DOUBLE, Double.valueOf(instr.opcode - opc_dconst_0), bytecode_offsets));
break;
case opc_ldc:
case opc_ldc_w:
@ -840,13 +840,13 @@ public class ExprProcessor implements CodeConstants {
defaultVal = new ConstExprent(VarType.VARTYPE_NULL, null, null);
}
else if (arrType.type == CodeConstants.TYPE_FLOAT) {
defaultVal = new ConstExprent(VarType.VARTYPE_FLOAT, new Float(0), null);
defaultVal = new ConstExprent(VarType.VARTYPE_FLOAT, Float.valueOf(0), null);
}
else if (arrType.type == CodeConstants.TYPE_LONG) {
defaultVal = new ConstExprent(VarType.VARTYPE_LONG, new Long(0), null);
defaultVal = new ConstExprent(VarType.VARTYPE_LONG, Long.valueOf(0), null);
}
else if (arrType.type == CodeConstants.TYPE_DOUBLE) {
defaultVal = new ConstExprent(VarType.VARTYPE_DOUBLE, new Double(0), null);
defaultVal = new ConstExprent(VarType.VARTYPE_DOUBLE, Double.valueOf(0), null);
}
else { // integer types
defaultVal = new ConstExprent(0, true, null);

@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -744,7 +744,7 @@ public class IfHelper {
public void addChild(IfNode child, int type) {
succs.add(child);
edgetypes.add(new Integer(type));
edgetypes.add(type);
}
}
}

@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -262,10 +262,10 @@ public class SecondaryFunctionsHelper {
if (lstOperands.get(0).type == Exprent.EXPRENT_CONST) {
int val = ((ConstExprent)lstOperands.get(0)).getIntValue();
if (val == 0) {
return new ConstExprent(VarType.VARTYPE_BOOLEAN, new Integer(1), fexpr.bytecode);
return new ConstExprent(VarType.VARTYPE_BOOLEAN, Integer.valueOf(1), fexpr.bytecode);
}
else {
return new ConstExprent(VarType.VARTYPE_BOOLEAN, new Integer(0), fexpr.bytecode);
return new ConstExprent(VarType.VARTYPE_BOOLEAN, Integer.valueOf(0), fexpr.bytecode);
}
}
break;
@ -300,8 +300,8 @@ public class SecondaryFunctionsHelper {
FunctionExprent iff = new FunctionExprent(FunctionExprent.FUNCTION_IIF, Arrays.asList(
new FunctionExprent(FunctionExprent.FUNCTION_LT, Arrays.asList(new VarExprent(var, type, varProc),
ConstExprent.getZeroConstant(type.type)), null),
new ConstExprent(VarType.VARTYPE_INT, new Integer(-1), null),
new ConstExprent(VarType.VARTYPE_INT, new Integer(1), null)), null);
new ConstExprent(VarType.VARTYPE_INT, Integer.valueOf(-1), null),
new ConstExprent(VarType.VARTYPE_INT, Integer.valueOf(1), null)), null);
FunctionExprent head = new FunctionExprent(FunctionExprent.FUNCTION_EQ, Arrays.asList(
new AssignmentExprent(new VarExprent(var, type, varProc),
@ -312,7 +312,7 @@ public class SecondaryFunctionsHelper {
varProc.setVarType(new VarVersionPair(var, 0), type);
return new FunctionExprent(FunctionExprent.FUNCTION_IIF, Arrays.asList(
head, new ConstExprent(VarType.VARTYPE_INT, new Integer(0), null), iff), fexpr.bytecode);
head, new ConstExprent(VarType.VARTYPE_INT, Integer.valueOf(0), null), iff), fexpr.bytecode);
}
break;
case Exprent.EXPRENT_ASSIGNMENT: // check for conditional assignment

@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -157,14 +157,14 @@ public class DominatorTreeExceptionFilter {
if (range.contains(id)) {
Integer exit = null;
Integer exit;
if (!range.contains(childid)) {
exit = childid;
}
else {
// exit = map.containsKey(handler)?-1:mapChild.get(handler); FIXME: Eclipse bug?
exit = map.containsKey(handler) ? new Integer(-1) : mapChild.get(handler);
exit = map.containsKey(handler) ? -1 : mapChild.get(handler);
}
if (exit != null) {

@ -36,14 +36,14 @@ public class ConstExprent extends Exprent {
private static final Map<Integer, String> CHAR_ESCAPES;
static {
CHAR_ESCAPES = new HashMap<>();
CHAR_ESCAPES.put(new Integer(0x8), "\\b"); /* \u0008: backspace BS */
CHAR_ESCAPES.put(new Integer(0x9), "\\t"); /* \u0009: horizontal tab HT */
CHAR_ESCAPES.put(new Integer(0xA), "\\n"); /* \u000a: linefeed LF */
CHAR_ESCAPES.put(new Integer(0xC), "\\f"); /* \u000c: form feed FF */
CHAR_ESCAPES.put(new Integer(0xD), "\\r"); /* \u000d: carriage return CR */
//CHAR_ESCAPES.put(new Integer(0x22), "\\\""); /* \u0022: double quote " */
CHAR_ESCAPES.put(new Integer(0x27), "\\\'"); /* \u0027: single quote ' */
CHAR_ESCAPES.put(new Integer(0x5C), "\\\\"); /* \u005c: backslash \ */
CHAR_ESCAPES.put(0x8, "\\b"); /* \u0008: backspace BS */
CHAR_ESCAPES.put(0x9, "\\t"); /* \u0009: horizontal tab HT */
CHAR_ESCAPES.put(0xA, "\\n"); /* \u000a: linefeed LF */
CHAR_ESCAPES.put(0xC, "\\f"); /* \u000c: form feed FF */
CHAR_ESCAPES.put(0xD, "\\r"); /* \u000d: carriage return CR */
//CHAR_ESCAPES.put(0x22, "\\\""); /* \u0022: double quote " */
CHAR_ESCAPES.put(0x27, "\\\'"); /* \u0027: single quote ' */
CHAR_ESCAPES.put(0x5C, "\\\\"); /* \u005c: backslash \ */
}
private VarType constType;
@ -51,7 +51,7 @@ public class ConstExprent extends Exprent {
private final boolean boolPermitted;
public ConstExprent(int val, boolean boolPermitted, Set<Integer> bytecodeOffsets) {
this(guessType(val, boolPermitted), new Integer(val), boolPermitted, bytecodeOffsets);
this(guessType(val, boolPermitted), Integer.valueOf(val), boolPermitted, bytecodeOffsets);
}
public ConstExprent(VarType constType, Object value, Set<Integer> bytecodeOffsets) {
@ -347,13 +347,13 @@ public class ConstExprent extends Exprent {
public static ConstExprent getZeroConstant(int type) {
switch (type) {
case CodeConstants.TYPE_INT:
return new ConstExprent(VarType.VARTYPE_INT, new Integer(0), null);
return new ConstExprent(VarType.VARTYPE_INT, Integer.valueOf(0), null);
case CodeConstants.TYPE_LONG:
return new ConstExprent(VarType.VARTYPE_LONG, new Long(0), null);
return new ConstExprent(VarType.VARTYPE_LONG, Long.valueOf(0), null);
case CodeConstants.TYPE_DOUBLE:
return new ConstExprent(VarType.VARTYPE_DOUBLE, new Double(0), null);
return new ConstExprent(VarType.VARTYPE_DOUBLE, Double.valueOf(0), null);
case CodeConstants.TYPE_FLOAT:
return new ConstExprent(VarType.VARTYPE_FLOAT, new Float(0), null);
return new ConstExprent(VarType.VARTYPE_FLOAT, Float.valueOf(0), null);
}
throw new RuntimeException("Invalid argument: " + type);

@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -288,10 +288,10 @@ public class SSAConstructorSparseEx {
private Integer getNextFreeVersion(Integer var) {
Integer nextver = lastversion.get(var);
if (nextver == null) {
nextver = new Integer(1);
nextver = 1;
}
else {
nextver = new Integer(nextver.intValue() + 1);
nextver++;
}
lastversion.put(var, nextver);
return nextver;

@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -501,10 +501,10 @@ public class SSAUConstructorSparseEx {
Integer nextver = lastversion.get(var);
if (nextver == null) {
nextver = new Integer(1);
nextver = 1;
}
else {
nextver = new Integer(nextver.intValue() + 1);
nextver++;
}
lastversion.put(var, nextver);

@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -289,9 +289,9 @@ public class VarDefinitionHelper {
for (Integer index : childVars) {
Integer count = mapCount.get(index);
if (count == null) {
count = new Integer(0);
count = 0;
}
mapCount.put(index, new Integer(count.intValue() + 1));
mapCount.put(index, count + 1);
}
condlst = getAllVars(currVars);
@ -302,7 +302,7 @@ public class VarDefinitionHelper {
// this statement
for (VarExprent var : condlst) {
mapCount.put(new Integer(var.getIndex()), new Integer(2));
mapCount.put(var.getIndex(), 2);
}

@ -74,7 +74,7 @@ public class VarProcessor {
}
Integer counter = mapNames.get(name);
mapNames.put(name, counter == null ? counter = new Integer(0) : ++counter);
mapNames.put(name, counter == null ? counter = 0 : ++counter);
if (counter > 0) {
name += String.valueOf(counter);

@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -56,21 +56,21 @@ public class ConstantPool implements NewClassNameBuilder {
break;
case CodeConstants.CONSTANT_Integer:
pool.add(new PrimitiveConstant(CodeConstants.CONSTANT_Integer, new Integer(in.readInt())));
pool.add(new PrimitiveConstant(CodeConstants.CONSTANT_Integer, Integer.valueOf(in.readInt())));
break;
case CodeConstants.CONSTANT_Float:
pool.add(new PrimitiveConstant(CodeConstants.CONSTANT_Float, new Float(in.readFloat())));
pool.add(new PrimitiveConstant(CodeConstants.CONSTANT_Float, Float.valueOf(in.readFloat())));
break;
case CodeConstants.CONSTANT_Long:
pool.add(new PrimitiveConstant(CodeConstants.CONSTANT_Long, new Long(in.readLong())));
pool.add(new PrimitiveConstant(CodeConstants.CONSTANT_Long, Long.valueOf(in.readLong())));
pool.add(null);
i++;
break;
case CodeConstants.CONSTANT_Double:
pool.add(new PrimitiveConstant(CodeConstants.CONSTANT_Double, new Double(in.readDouble())));
pool.add(new PrimitiveConstant(CodeConstants.CONSTANT_Double, Double.valueOf(in.readDouble())));
pool.add(null);
i++;
break;

@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -100,7 +100,7 @@ public class VBStyleCollection<E, K> extends ArrayList<E> {
public void addWithKeyAndIndex(int index, E element, K key) {
addToListIndex(index, 1);
map.put(key, new Integer(index));
map.put(key, index);
super.add(index, element);
lstKeys.add(index, key);
}
@ -164,12 +164,12 @@ public class VBStyleCollection<E, K> extends ArrayList<E> {
K key = lstKeys.get(index1);
if (key != null) {
map.put(key, new Integer(index1));
map.put(key, index1);
}
key = lstKeys.get(index2);
if (key != null) {
map.put(key, new Integer(index2));
map.put(key, index2);
}
}
@ -197,7 +197,7 @@ public class VBStyleCollection<E, K> extends ArrayList<E> {
for (int i = lstKeys.size() - 1; i >= index; i--) {
K obj = lstKeys.get(i);
if (obj != null) {
map.put(obj, new Integer(i + diff));
map.put(obj, i + diff);
}
}
}

Loading…
Cancel
Save