From f33600d4d5507f3aa02d7cacfc34fe910d6b858f Mon Sep 17 00:00:00 2001 From: Lars Grefer Date: Sat, 8 Aug 2020 03:14:13 +0200 Subject: [PATCH] Unnecessary boxing Reports explicit boxing, i.e. wrapping of primitive values in objects. Explicit manual boxing is unnecessary under Java 5 and newer, and can be safely removed. Signed-off-by: Lars Grefer --- .../main/java/org/aspectj/asm/AsmManager.java | 6 +++--- .../apache/bcel/classfile/ConstantPool.java | 4 ++-- .../aspectj/apache/bcel/generic/Instruction.java | 2 +- .../context/CompilationAndWeavingContext.java | 4 ++-- .../lookup/EclipseAnnotationConvertor.java | 2 +- .../ajdt/internal/core/builder/AjState.java | 2 +- .../src/test/java/AroundAMain.java | 4 ++-- .../internal/compiler/batch/IncrementalCase.java | 2 +- .../java/org/aspectj/tools/ajc/AjAST5Test.java | 6 +++--- .../org/aspectj/weaver/ResolvedTypeMunger.java | 6 +++--- .../src/main/java/org/aspectj/weaver/Shadow.java | 2 +- .../src/main/java/org/aspectj/weaver/World.java | 2 +- .../weaver/patterns/ModifiersPattern.java | 5 +++-- .../aspectj/weaver/patterns/WildTypePattern.java | 4 ++-- .../aspectj/weaver/patterns/ArgsTestCase.java | 16 ++++++++-------- .../aspectj/runtime/internal/Conversions.java | 14 +++++++------- .../internal/tools/ant/taskdefs/Ajctest.java | 4 ++-- .../aspectj/testing/harness/bridge/JavaRun.java | 4 ++-- .../java/org/aspectj/testing/util/LinkCheck.java | 2 +- .../aspectj/systemtest/ajc154/Ajc154Tests.java | 2 +- .../aspectj/weaver/bcel/AnnotationAccessVar.java | 4 ++-- .../org/aspectj/weaver/bcel/BcelClassWeaver.java | 6 +++--- .../java/org/aspectj/weaver/bcel/BcelShadow.java | 2 +- .../org/aspectj/weaver/bcel/LazyMethodGen.java | 4 ++-- .../aspectj/weaver/tools/cache/SimpleCache.java | 6 +++--- 25 files changed, 58 insertions(+), 57 deletions(-) diff --git a/asm/src/main/java/org/aspectj/asm/AsmManager.java b/asm/src/main/java/org/aspectj/asm/AsmManager.java index 6972dda3a..d1b7ed3f2 100644 --- a/asm/src/main/java/org/aspectj/asm/AsmManager.java +++ b/asm/src/main/java/org/aspectj/asm/AsmManager.java @@ -162,7 +162,7 @@ public class AsmManager implements IStructureModel { entries.add(peNode); ISourceLocation sourceLoc = peNode.getSourceLocation(); if (null != sourceLoc) { - Integer hash = new Integer(sourceLoc.getLine()); + Integer hash = sourceLoc.getLine(); List existingEntry = annotations.get(hash); if (existingEntry != null) { entries.addAll(existingEntry); @@ -1189,9 +1189,9 @@ public class AsmManager implements IStructureModel { String node = ipe.getKind().toString(); Integer ctr = nodeTypeCount.get(node); if (ctr == null) { - nodeTypeCount.put(node, new Integer(1)); + nodeTypeCount.put(node, 1); } else { - ctr = new Integer(ctr.intValue() + 1); + ctr = ctr.intValue() + 1; nodeTypeCount.put(node, ctr); } } diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ConstantPool.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ConstantPool.java index 0430e28ba..410891212 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ConstantPool.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ConstantPool.java @@ -465,7 +465,7 @@ public class ConstantPool implements Node { String typeSignature = ((ConstantUtf8) pool[cnat.getSignatureIndex()]).getValue(); if (!typeSignature.equals(searchSignature)) continue; - fieldCache.put(k, new Integer(i)); + fieldCache.put(k, i); return i; } } @@ -793,7 +793,7 @@ public class ConstantPool implements Node { String typeSignature = ((ConstantUtf8) pool[cnat.getSignatureIndex()]).getValue(); if (!typeSignature.equals(searchSignature)) continue; - methodCache.put(key, new Integer(i)); + methodCache.put(key, i); return i; } } diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/Instruction.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/Instruction.java index 113be06ee..3fa40ac0f 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/Instruction.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/Instruction.java @@ -342,7 +342,7 @@ public class Instruction implements Cloneable, Serializable, Constants { case ICONST_3: case ICONST_4: case ICONST_5: - return new Integer(opcode - ICONST_0); + return opcode - ICONST_0; default: throw new IllegalStateException("Not implemented yet for " + getName()); } diff --git a/bridge/src/main/java/org/aspectj/bridge/context/CompilationAndWeavingContext.java b/bridge/src/main/java/org/aspectj/bridge/context/CompilationAndWeavingContext.java index 28a414acd..6117b96a9 100644 --- a/bridge/src/main/java/org/aspectj/bridge/context/CompilationAndWeavingContext.java +++ b/bridge/src/main/java/org/aspectj/bridge/context/CompilationAndWeavingContext.java @@ -123,7 +123,7 @@ public class CompilationAndWeavingContext { } public static void registerFormatter(int phaseId, ContextFormatter aFormatter) { - formatterMap.put(new Integer(phaseId), aFormatter); + formatterMap.put(phaseId, aFormatter); } /** @@ -195,7 +195,7 @@ public class CompilationAndWeavingContext { } private static ContextFormatter getFormatter(ContextStackEntry entry) { - Integer key = new Integer(entry.phaseId); + Integer key = entry.phaseId; if (formatterMap.containsKey(key)) { return formatterMap.get(key); } else { diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseAnnotationConvertor.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseAnnotationConvertor.java index 3d2fb727f..93a5019f3 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseAnnotationConvertor.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseAnnotationConvertor.java @@ -155,7 +155,7 @@ public class EclipseAnnotationConvertor { Constant c = defaultValue.constant; if (c instanceof IntConstant) { IntConstant iConstant = (IntConstant) c; - return new SimpleAnnotationValue(ElementValue.PRIMITIVE_INT, new Integer(iConstant.intValue())); + return new SimpleAnnotationValue(ElementValue.PRIMITIVE_INT, iConstant.intValue()); } else if (c instanceof BooleanConstant) { BooleanConstant iConstant = (BooleanConstant) c; return new SimpleAnnotationValue(ElementValue.PRIMITIVE_BOOLEAN, iConstant.booleanValue()); diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjState.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjState.java index 7e08c02a7..4c38f125c 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjState.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjState.java @@ -1536,7 +1536,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe // System.err.println("Detected a structural change in " + thisTime.getFilename()); printStructuralChanges(thisTime.getFilename(),reader, existingStructure); } - structuralChangesSinceLastFullBuild.put(thisTime.getFilename(), new Long(currentBuildTime)); + structuralChangesSinceLastFullBuild.put(thisTime.getFilename(), currentBuildTime); recordTypeChanged(new String(reader.getName()).replace('/', '.')); } } diff --git a/org.aspectj.ajdt.core/src/test/java/AroundAMain.java b/org.aspectj.ajdt.core/src/test/java/AroundAMain.java index d9a2929d0..9dce77d1e 100644 --- a/org.aspectj.ajdt.core/src/test/java/AroundAMain.java +++ b/org.aspectj.ajdt.core/src/test/java/AroundAMain.java @@ -25,7 +25,7 @@ public class AroundAMain {//extends TestCase { @Override public Object run(Object[] args) throws Throwable { // System.out.println("run with: " + Arrays.asList(args)); - return new Integer(10); + return 10; } }; @@ -33,7 +33,7 @@ public class AroundAMain {//extends TestCase { "ajc$perSingletonInstance"); Reflection.invoke(Class.forName("AroundA"), instance, "ajc$around$AroundA$1$73ebb943", // was $AroundA$46 - new Integer(10), true, closure); + 10, true, closure); Reflection.invoke(Class.forName("AroundA"), instance, "ajc$around$AroundA$2$a758212d", // Was $AroundA$c5 "hello there", closure); diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/IncrementalCase.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/IncrementalCase.java index 6b96c9469..82682bb29 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/IncrementalCase.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/IncrementalCase.java @@ -174,7 +174,7 @@ public class IncrementalCase { // XXX NOT bound to junit - bridge tests? IMessageHolder compilerMessages, StringBuffer commandLine, IMessageHandler handler) { - log("verifyCompile - iteration ", new Integer(iteration), handler); + log("verifyCompile - iteration ", iteration, handler); log("verifyCompile - def ", def, handler); log("verifyCompile - command ", commandLine.toString(), handler); log("verifyCompile - messages ", compilerMessages, handler); diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjAST5Test.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjAST5Test.java index c41e07fe1..560d7d244 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjAST5Test.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjAST5Test.java @@ -62,7 +62,7 @@ public class AjAST5Test extends AjASTTestCase { } else if (o instanceof SimplePropertyDescriptor) { SimplePropertyDescriptor element = (SimplePropertyDescriptor) o; if (element.getId().equals("privileged")) { - Boolean b = new Boolean(true); + Boolean b = Boolean.TRUE; d.setStructuralProperty(element, b); assertEquals("AspectDeclaration's isPrivileged property should" + " now be a boolean", b, d.getStructuralProperty(element)); @@ -89,7 +89,7 @@ public class AjAST5Test extends AjASTTestCase { if (o instanceof SimplePropertyDescriptor) { SimplePropertyDescriptor element = (SimplePropertyDescriptor) o; if (element.getId().equals("aspect")) { - Boolean b = new Boolean(true); + Boolean b = Boolean.TRUE; d.setStructuralProperty(element, b); assertEquals("AjTypeDeclaration's aspect property should" + " now be a SignaturePattern", b, d.getStructuralProperty(element)); @@ -140,7 +140,7 @@ public class AjAST5Test extends AjASTTestCase { } else if (o instanceof SimplePropertyDescriptor) { SimplePropertyDescriptor element = (SimplePropertyDescriptor) o; if (element.getId().equals("isExtends")) { - Boolean b = new Boolean(true); + Boolean b = Boolean.TRUE; d.setStructuralProperty(element, b); assertEquals("DeclareParentsDeclaration's isExtends property should" + " now be a boolean", b, d.getStructuralProperty(element)); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedTypeMunger.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedTypeMunger.java index 2ba3cbc36..289547bbc 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedTypeMunger.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedTypeMunger.java @@ -259,11 +259,11 @@ public abstract class ResolvedTypeMunger { } else { s.writeByte(0); ObjectOutputStream oos = new ObjectOutputStream(s); - oos.writeObject(new Boolean(location != null)); + oos.writeObject(location != null); if (location != null) { oos.writeObject(location.getSourceFile()); - oos.writeObject(new Integer(location.getLine())); - oos.writeObject(new Integer(location.getOffset())); + oos.writeObject(location.getLine()); + oos.writeObject(location.getOffset()); } oos.flush(); oos.close(); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java index fc2b1d4d1..1892e8940 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java @@ -596,7 +596,7 @@ public abstract class Shadow { // Ask the world if it knows about precedence between these Integer order = getIWorld().getPrecedenceIfAny(adviceA.concreteAspect, adviceB.concreteAspect); - if (order != null && order.equals(new Integer(0))) { + if (order != null && order.equals(0)) { String key = adviceA.getDeclaringAspect() + ":" + adviceB.getDeclaringAspect(); String possibleExistingKey = adviceB.getDeclaringAspect() + ":" + adviceA.getDeclaringAspect(); if (!clashingAspects.contains(possibleExistingKey)) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/World.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/World.java index 3b69a5d73..32648268e 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/World.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/World.java @@ -1453,7 +1453,7 @@ public abstract class World implements Dump.INode { } } } - cachedResults.put(key, new Integer(order)); + cachedResults.put(key, order); return order; } } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ModifiersPattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ModifiersPattern.java index 6c1d0557e..83ad90528 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ModifiersPattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ModifiersPattern.java @@ -33,10 +33,11 @@ public class ModifiersPattern extends PatternNode { int flag = 1; while (flag <= Modifier.STRICT) { String flagName = Modifier.toString(flag); - modifierFlags.put(flagName, new Integer(flag)); + modifierFlags.put(flagName, flag); flag = flag << 1; } - modifierFlags.put("synthetic", new Integer(0x1000 /* Modifier.SYNTHETIC */)); + /* Modifier.SYNTHETIC */ + modifierFlags.put("synthetic", 0x1000); } public ModifiersPattern(int requiredModifiers, int forbiddenModifiers) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java index 39d4a387b..c766d30ba 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java @@ -1023,7 +1023,7 @@ public class WildTypePattern extends TypePattern { if ((tvs.length < minRequiredTypeParameters) || (!foundEllipsis && minRequiredTypeParameters != tvs.length)) { // issue message "does not match because wrong no of type params" String msg = WeaverMessages.format(WeaverMessages.INCORRECT_NUMBER_OF_TYPE_ARGUMENTS, genericType.getName(), - new Integer(tvs.length)); + tvs.length); if (requireExactType) { scope.message(MessageUtil.error(msg, getSourceLocation())); } else { @@ -1092,7 +1092,7 @@ public class WildTypePattern extends TypePattern { parameterName = ((TypeVariableReference) ut).getTypeVariable().getDisplayName(); } String msg = WeaverMessages.format(WeaverMessages.VIOLATES_TYPE_VARIABLE_BOUNDS, parameterName, - new Integer(i + 1), tvs[i].getDisplayName(), genericType.getName()); + i + 1, tvs[i].getDisplayName(), genericType.getName()); if (requireExactType) { scope.message(MessageUtil.error(msg, sLoc)); } else { diff --git a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ArgsTestCase.java b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ArgsTestCase.java index 705674cb3..b60cad835 100644 --- a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ArgsTestCase.java +++ b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ArgsTestCase.java @@ -116,15 +116,15 @@ public class ArgsTestCase extends TestCase { Method oneIntegerM = A.class.getMethod("anInteger", new Class[] { Integer.class }); if (LangUtil.is15VMOrGreater()) { - checkMatches(oneInt.matchesMethodExecution(oneIntM), new A(), new A(), new Object[] { new Integer(5) }); - checkMatches(oneInt.matchesMethodExecution(oneIntegerM), new A(), new A(), new Object[] { new Integer(5) }); - checkMatches(oneInteger.matchesMethodExecution(oneIntM), new A(), new A(), new Object[] { new Integer(5) }); - checkMatches(oneInteger.matchesMethodExecution(oneIntegerM), new A(), new A(), new Object[] { new Integer(5) }); + checkMatches(oneInt.matchesMethodExecution(oneIntM), new A(), new A(), new Object[] {5}); + checkMatches(oneInt.matchesMethodExecution(oneIntegerM), new A(), new A(), new Object[] {5}); + checkMatches(oneInteger.matchesMethodExecution(oneIntM), new A(), new A(), new Object[] {5}); + checkMatches(oneInteger.matchesMethodExecution(oneIntegerM), new A(), new A(), new Object[] {5}); } else { - checkMatches(oneInt.matchesMethodExecution(oneIntM), new A(), new A(), new Object[] { new Integer(5) }); - checkNoMatch(oneInt.matchesMethodExecution(oneIntegerM), new A(), new A(), new Object[] { new Integer(5) }); - checkNoMatch(oneInteger.matchesMethodExecution(oneIntM), new A(), new A(), new Object[] { new Integer(5) }); - checkMatches(oneInteger.matchesMethodExecution(oneIntegerM), new A(), new A(), new Object[] { new Integer(5) }); + checkMatches(oneInt.matchesMethodExecution(oneIntM), new A(), new A(), new Object[] {5}); + checkNoMatch(oneInt.matchesMethodExecution(oneIntegerM), new A(), new A(), new Object[] {5}); + checkNoMatch(oneInteger.matchesMethodExecution(oneIntM), new A(), new A(), new Object[] {5}); + checkMatches(oneInteger.matchesMethodExecution(oneIntegerM), new A(), new A(), new Object[] {5}); } } catch (Exception ex) { diff --git a/runtime/src/main/java/org/aspectj/runtime/internal/Conversions.java b/runtime/src/main/java/org/aspectj/runtime/internal/Conversions.java index 13e8d9edd..6fb5f916f 100644 --- a/runtime/src/main/java/org/aspectj/runtime/internal/Conversions.java +++ b/runtime/src/main/java/org/aspectj/runtime/internal/Conversions.java @@ -20,25 +20,25 @@ public final class Conversions { // we might want to keep a cache of small integers around public static Object intObject(int i) { - return new Integer(i); + return i; } public static Object shortObject(short i) { - return new Short(i); + return i; } public static Object byteObject(byte i) { - return new Byte(i); + return i; } public static Object charObject(char i) { - return new Character(i); + return i; } public static Object longObject(long i) { - return new Long(i); + return i; } public static Object floatObject(float i) { - return new Float(i); + return i; } public static Object doubleObject(double i) { - return new Double(i); + return i; } public static Object booleanObject(boolean i) { return i; diff --git a/testing/src/test/java/org/aspectj/internal/tools/ant/taskdefs/Ajctest.java b/testing/src/test/java/org/aspectj/internal/tools/ant/taskdefs/Ajctest.java index 67e73ed6c..bbe264846 100644 --- a/testing/src/test/java/org/aspectj/internal/tools/ant/taskdefs/Ajctest.java +++ b/testing/src/test/java/org/aspectj/internal/tools/ant/taskdefs/Ajctest.java @@ -812,7 +812,7 @@ public class Ajctest extends Task implements PropertyChangeListener { List bothargs = new Vector<>(args); bothargs.addAll(testset.args); List> argcombo = argcombo(bothargs); - argcombos.add(new Integer(argcombo.size())); + argcombos.add(argcombo.size()); testsetToArgcombo.put(testset, argcombo); } while (!testsetToArgcombo.isEmpty()) { @@ -1786,7 +1786,7 @@ public class Ajctest extends Task implements PropertyChangeListener { public void add(Failure f, String taskname, String type, int num, long time) { model.addRow(new Object[]{taskname, type, - new Integer(num), date(time)}); + num, date(time)}); failures.add(f); } } diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/JavaRun.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/JavaRun.java index db7428816..92aaec667 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/JavaRun.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/JavaRun.java @@ -208,7 +208,7 @@ public class JavaRun implements IAjcRun { } if (thrown instanceof RunSecurityManager.ExitCalledException) { int i = ((RunSecurityManager.ExitCalledException) thrown).exitCode; - status.finish(new Integer(i)); + status.finish(i); } else if (thrown instanceof RunSecurityManager.AwtUsedException) { MessageUtil.fail(status, "test code should not use the AWT event queue"); throw (RunSecurityManager.AwtUsedException) thrown; @@ -224,7 +224,7 @@ public class JavaRun implements IAjcRun { } } catch (RunSecurityManager.ExitCalledException e) { // XXX need to update run validator (a) to accept null result or (b) to require zero result, and set 0 if completed normally - status.finish(new Integer(e.exitCode)); + status.finish(e.exitCode); } catch (ClassNotFoundException e) { String[] classes = FileUtil.listFiles(sandbox.classesDir); MessageUtil.info(status, "sandbox.classes: " + Arrays.asList(classes)); diff --git a/testing/src/test/java/org/aspectj/testing/util/LinkCheck.java b/testing/src/test/java/org/aspectj/testing/util/LinkCheck.java index fd1edaf6f..d7f6de21a 100644 --- a/testing/src/test/java/org/aspectj/testing/util/LinkCheck.java +++ b/testing/src/test/java/org/aspectj/testing/util/LinkCheck.java @@ -382,7 +382,7 @@ public class LinkCheck { } private void checkingLinks(int i) { - info("checkingLinks", new Integer(i)); + info("checkingLinks", i); } private void checkingLink(Link link) { diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc154/Ajc154Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc154/Ajc154Tests.java index 6fde74765..ddf37d42a 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc154/Ajc154Tests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc154/Ajc154Tests.java @@ -237,7 +237,7 @@ public class Ajc154Tests extends org.aspectj.testing.XMLBasedAjcTestCase { // Damage the line number table, entry 2 (Line7:5) so it points to an invalid (not on an instruction boundary) position of 6 Field ff = LineNumber.class.getDeclaredField("startPC"); ff.setAccessible(true); - ff.set(oneWeWant.getLineNumberTable().getLineNumberTable()[2], new Integer(6)); + ff.set(oneWeWant.getLineNumberTable().getLineNumberTable()[2], 6); // oneWeWant.getLineNumberTable().getLineNumberTable()[2].setStartPC(6); // Should be 'rounded down' when transforming it into a MethodGen, new position will be '5' diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/AnnotationAccessVar.java b/weaver/src/main/java/org/aspectj/weaver/bcel/AnnotationAccessVar.java index 88a67d666..a6ed94b79 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/AnnotationAccessVar.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/AnnotationAccessVar.java @@ -210,14 +210,14 @@ public class AnnotationAccessVar extends BcelVar { } private void buildArray(InstructionList il, InstructionFactory fact, Type arrayElementType, Type[] arrayEntries, int dim) { - il.append(fact.createConstant(Integer.valueOf(arrayEntries == null ? 0 : arrayEntries.length))); + il.append(fact.createConstant(arrayEntries == null ? 0 : arrayEntries.length)); il.append(fact.createNewArray(arrayElementType, (short) dim)); if (arrayEntries == null) { return; } for (int i = 0; i < arrayEntries.length; i++) { il.append(InstructionFactory.createDup(1)); - il.append(fact.createConstant(Integer.valueOf(i))); + il.append(fact.createConstant(i)); switch (arrayEntries[i].getType()) { case Constants.T_ARRAY: il.append(fact.createConstant(new ObjectType(arrayEntries[i].getSignature()))); // FIXME should be getName() and not diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java index 36cd2686e..2e0b8e5f3 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java @@ -1560,7 +1560,7 @@ class BcelClassWeaver implements IClassWeaver { private boolean doesAlreadyHaveAnnotation(ResolvedMember rm, DeclareAnnotation deca, List reportedProblems, boolean reportError) { if (rm.hasAnnotation(deca.getAnnotationType())) { if (reportError && world.getLint().elementAlreadyAnnotated.isEnabled()) { - Integer uniqueID = new Integer(rm.hashCode() * deca.hashCode()); + Integer uniqueID = rm.hashCode() * deca.hashCode(); if (!reportedProblems.contains(uniqueID)) { reportedProblems.add(uniqueID); world.getLint().elementAlreadyAnnotated.signal(new String[] { rm.toString(), @@ -1577,10 +1577,10 @@ class BcelClassWeaver implements IClassWeaver { List reportedProblems) { if (rm != null && rm.hasAnnotation(deca.getAnnotationType())) { if (world.getLint().elementAlreadyAnnotated.isEnabled()) { - Integer uniqueID = new Integer(rm.hashCode() * deca.hashCode()); + Integer uniqueID = rm.hashCode() * deca.hashCode(); if (!reportedProblems.contains(uniqueID)) { reportedProblems.add(uniqueID); - reportedProblems.add(new Integer(itdfieldsig.hashCode() * deca.hashCode())); + reportedProblems.add(itdfieldsig.hashCode() * deca.hashCode()); world.getLint().elementAlreadyAnnotated.signal(new String[] { itdfieldsig.toString(), deca.getAnnotationType().toString() }, rm.getSourceLocation(), new ISourceLocation[] { deca.getSourceLocation() }); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java index e92667b2e..362c8be9d 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java @@ -2942,7 +2942,7 @@ public class BcelShadow extends Shadow { aroundClosureInstance.appendStore(closureInstantiation, fact); // stick the bitflags on the stack and call the variant of linkClosureAndJoinPoint that takes an int - closureInstantiation.append(fact.createConstant(Integer.valueOf(bitflags))); + closureInstantiation.append(fact.createConstant(bitflags)); if (needAroundClosureStacking) { closureInstantiation.append(Utility.createInvoke(getFactory(), getWorld(), new MemberImpl(Member.METHOD, UnresolvedType.forName("org.aspectj.runtime.internal.AroundClosure"), diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java index 049257d48..97f805273 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java @@ -1345,11 +1345,11 @@ public final class LazyMethodGen implements Traceable { if (slots == null) { slots = new HashSet(); duplicatedLocalMap.put(start, slots); - } else if (slots.contains(new Integer(tag.getSlot()))) { + } else if (slots.contains(tag.getSlot())) { // we already have a var starting at this tag with this slot continue; } - slots.add(Integer.valueOf(tag.getSlot())); + slots.add(tag.getSlot()); Type t = tag.getRealType(); if (t == null) { t = BcelWorld.makeBcelType(UnresolvedType.forSignature(tag.getType())); diff --git a/weaver/src/main/java/org/aspectj/weaver/tools/cache/SimpleCache.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/SimpleCache.java index 45d718a14..69cb1a576 100644 --- a/weaver/src/main/java/org/aspectj/weaver/tools/cache/SimpleCache.java +++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/SimpleCache.java @@ -324,7 +324,7 @@ public class SimpleCache { } defineClassMethod.setAccessible(true); clazz = defineClassMethod.invoke(loader, new Object[] { name, - bytes, new Integer(0), new Integer(bytes.length) }); + bytes, 0, bytes.length}); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof LinkageError) { e.printStackTrace(); @@ -354,8 +354,8 @@ public class SimpleCache { } defineClassWithProtectionDomainMethod.setAccessible(true); clazz = defineClassWithProtectionDomainMethod.invoke(loader, - new Object[] { name, bytes, Integer.valueOf(0), - new Integer(bytes.length), protectionDomain }); + new Object[] { name, bytes, 0, + bytes.length, protectionDomain }); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof LinkageError) { e.printStackTrace(); -- 2.39.5