diff options
author | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-08 03:14:13 +0200 |
---|---|---|
committer | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-08 03:14:13 +0200 |
commit | f33600d4d5507f3aa02d7cacfc34fe910d6b858f (patch) | |
tree | 797427a7536d5e9fc927faceec4963754ab0133b /weaver | |
parent | c1c373f4278426308689db61f7758185e8f0401b (diff) | |
download | aspectj-f33600d4d5507f3aa02d7cacfc34fe910d6b858f.tar.gz aspectj-f33600d4d5507f3aa02d7cacfc34fe910d6b858f.zip |
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 <eclipse@larsgrefer.de>
Diffstat (limited to 'weaver')
5 files changed, 11 insertions, 11 deletions
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<Integer> 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<Integer> 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<Integer>(); 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(); |