From 7575bb57de1020a16eb85138a024a71f05e0fdd2 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Tue, 25 Apr 2017 19:15:59 +0300 Subject: [PATCH] removed unneeded boxing --- .../decompiler/code/cfg/ControlFlowGraph.java | 4 +-- .../modules/decompiler/ExprProcessor.java | 12 ++++----- .../modules/decompiler/IfHelper.java | 4 +-- .../decompiler/SecondaryFunctionsHelper.java | 12 ++++----- .../DominatorTreeExceptionFilter.java | 6 ++--- .../modules/decompiler/exps/ConstExprent.java | 26 +++++++++---------- .../sforms/SSAConstructorSparseEx.java | 6 ++--- .../sforms/SSAUConstructorSparseEx.java | 6 ++--- .../decompiler/vars/VarDefinitionHelper.java | 8 +++--- .../modules/decompiler/vars/VarProcessor.java | 2 +- .../struct/consts/ConstantPool.java | 10 +++---- .../decompiler/util/VBStyleCollection.java | 10 +++---- 12 files changed, 53 insertions(+), 53 deletions(-) diff --git a/src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java b/src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java index 4706bf6..da6e145 100644 --- a/src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java +++ b/src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.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; } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java index f6005ba..04e3c26 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java @@ -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); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.java index 3a88aca..0b5d14e 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.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. @@ -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); } } } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/SecondaryFunctionsHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/SecondaryFunctionsHelper.java index f95d2c3..4c5abe7 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/SecondaryFunctionsHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/SecondaryFunctionsHelper.java @@ -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 diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DominatorTreeExceptionFilter.java b/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DominatorTreeExceptionFilter.java index 59b6b15..0cee74c 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DominatorTreeExceptionFilter.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DominatorTreeExceptionFilter.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. @@ -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) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java index d4ed0c3..f649d80 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java @@ -36,14 +36,14 @@ public class ConstExprent extends Exprent { private static final Map 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 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 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); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAConstructorSparseEx.java b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAConstructorSparseEx.java index 7aff2d2..19ef39a 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAConstructorSparseEx.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAConstructorSparseEx.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. @@ -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; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAUConstructorSparseEx.java b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAUConstructorSparseEx.java index 5beb232..fe22e61 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAUConstructorSparseEx.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAUConstructorSparseEx.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. @@ -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); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java index a0a14cb..0cad643 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.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. @@ -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); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarProcessor.java index 728addf..bfcd894 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarProcessor.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarProcessor.java @@ -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); diff --git a/src/org/jetbrains/java/decompiler/struct/consts/ConstantPool.java b/src/org/jetbrains/java/decompiler/struct/consts/ConstantPool.java index 8f07b4c..68dffc6 100644 --- a/src/org/jetbrains/java/decompiler/struct/consts/ConstantPool.java +++ b/src/org/jetbrains/java/decompiler/struct/consts/ConstantPool.java @@ -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; diff --git a/src/org/jetbrains/java/decompiler/util/VBStyleCollection.java b/src/org/jetbrains/java/decompiler/util/VBStyleCollection.java index 000581d..f4d6d5a 100644 --- a/src/org/jetbrains/java/decompiler/util/VBStyleCollection.java +++ b/src/org/jetbrains/java/decompiler/util/VBStyleCollection.java @@ -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 extends ArrayList { 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 extends ArrayList { 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 extends ArrayList { 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); } } }