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>
entries.add(peNode);
ISourceLocation sourceLoc = peNode.getSourceLocation();
if (null != sourceLoc) {
- Integer hash = new Integer(sourceLoc.getLine());
+ Integer hash = sourceLoc.getLine();
List<IProgramElement> existingEntry = annotations.get(hash);
if (existingEntry != null) {
entries.addAll(existingEntry);
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);
}
}
String typeSignature = ((ConstantUtf8) pool[cnat.getSignatureIndex()]).getValue();
if (!typeSignature.equals(searchSignature))
continue;
- fieldCache.put(k, new Integer(i));
+ fieldCache.put(k, i);
return i;
}
}
String typeSignature = ((ConstantUtf8) pool[cnat.getSignatureIndex()]).getValue();
if (!typeSignature.equals(searchSignature))
continue;
- methodCache.put(key, new Integer(i));
+ methodCache.put(key, i);
return i;
}
}
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());
}
}
public static void registerFormatter(int phaseId, ContextFormatter aFormatter) {
- formatterMap.put(new Integer(phaseId), aFormatter);
+ formatterMap.put(phaseId, aFormatter);
}
/**
}
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 {
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());
// 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('/', '.'));
}
}
@Override
public Object run(Object[] args) throws Throwable {
// System.out.println("run with: " + Arrays.asList(args));
- return new Integer(10);
+ return 10;
}
};
"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);
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);
} 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));
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));
} 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));
} 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();
// 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)) {
}
}
}
- cachedResults.put(key, new Integer(order));
+ cachedResults.put(key, order);
return order;
}
}
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) {
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 {
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 {
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) {
// 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;
List<Argument> bothargs = new Vector<>(args);
bothargs.addAll(testset.args);
List<List<Arg>> argcombo = argcombo(bothargs);
- argcombos.add(new Integer(argcombo.size()));
+ argcombos.add(argcombo.size());
testsetToArgcombo.put(testset, argcombo);
}
while (!testsetToArgcombo.isEmpty()) {
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);
}
}
}
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;
}
} 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));
}
private void checkingLinks(int i) {
- info("checkingLinks", new Integer(i));
+ info("checkingLinks", i);
}
private void checkingLink(Link link) {
// 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'
}
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
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(),
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() });
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"),
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()));
}
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();
}
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();