Reports "unboxing", e.g. explicit unwrapping of wrapped primitive values. Unboxing is unnecessary under Java 5 and newer, and can be safely removed.
Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
if (ctr == null) {
nodeTypeCount.put(node, 1);
} else {
- ctr = ctr.intValue() + 1;
+ ctr = ctr + 1;
nodeTypeCount.put(node, ctr);
}
}
String existingHandle = object.getHandleIdentifier();
int suffixPosition = existingHandle.indexOf('!');
if (suffixPosition != -1) {
- count = new Integer(existingHandle.substring(suffixPosition + 1)).intValue() + 1;
+ count = new Integer(existingHandle.substring(suffixPosition + 1)) + 1;
} else {
if (count == 1) {
count = 2;
String existingHandle = object.getHandleIdentifier();
int suffixPosition = existingHandle.indexOf('!');
if (suffixPosition != -1) {
- count = new Integer(existingHandle.substring(suffixPosition + 1)).intValue() + 1;
+ count = new Integer(existingHandle.substring(suffixPosition + 1)) + 1;
} else {
if (count == 1) {
count = 2;
String existingHandle = object.getHandleIdentifier();
int suffixPosition = existingHandle.indexOf('!');
if (suffixPosition != -1) {
- count = new Integer(existingHandle.substring(suffixPosition + 1)).intValue() + 1;
+ count = new Integer(existingHandle.substring(suffixPosition + 1)) + 1;
} else {
if (count == 1) {
count = 2;
int suffixPosition = existingHandle.lastIndexOf('!');
int lastSquareBracket = existingHandle.lastIndexOf('['); // type delimiter
if (suffixPosition != -1 && lastSquareBracket < suffixPosition) { // pr260384
- count = new Integer(existingHandle.substring(suffixPosition + 1)).intValue() + 1;
+ count = new Integer(existingHandle.substring(suffixPosition + 1)) + 1;
} else {
if (count == 1) {
count = 2;
int suffixPosition = existingHandle.lastIndexOf('!');
int lastSquareBracket = existingHandle.lastIndexOf('['); // type delimiter
if (suffixPosition != -1 && lastSquareBracket < suffixPosition) { // pr260384
- count = new Integer(existingHandle.substring(suffixPosition + 1)).intValue() + 1;
+ count = new Integer(existingHandle.substring(suffixPosition + 1)) + 1;
} else {
if (count == 1) {
count = 2;
String existingHandle = object.getHandleIdentifier();
int suffixPosition = existingHandle.indexOf('!');
if (suffixPosition != -1) {
- count = new Integer(existingHandle.substring(suffixPosition + 1)).intValue() + 1;
+ count = new Integer(existingHandle.substring(suffixPosition + 1)) + 1;
} else {
if (count == 1) {
count = 2;
if (b == null) {
return false;
}
- return b.booleanValue();
+ return b;
}
public String[] getRemovedAnnotationTypes() {
String k = new StringBuffer().append(searchClassname).append(searchFieldname).append(searchSignature).toString();
Integer pos = fieldCache.get(k);
if (pos != null)
- return pos.intValue();
+ return pos;
for (int i = 1; i < poolSize; i++) {
Constant c = pool[i];
if (c != null && c.tag == Constants.CONSTANT_Fieldref) {
String key = new StringBuffer().append(searchClassname).append(searchMethodName).append(searchSignature).toString();
Integer cached = methodCache.get(key);
if (cached != null)
- return cached.intValue();
+ return cached;
searchClassname = searchClassname.replace('.', '/');
for (int i = 1; i < poolSize; i++) {
Constant c = pool[i];
case Constants.T_BYTE:
case Constants.T_BOOLEAN:
case Constants.T_SHORT:
- return cp.addInteger(((Integer) value).intValue());
+ return cp.addInteger((Integer) value);
case Constants.T_FLOAT:
- return cp.addFloat(((Float) value).floatValue());
+ return cp.addFloat((Float) value);
case Constants.T_DOUBLE:
- return cp.addDouble(((Double) value).doubleValue());
+ return cp.addDouble((Double) value);
case Constants.T_LONG:
- return cp.addLong(((Long) value).longValue());
+ return cp.addLong((Long) value);
case Constants.T_REFERENCE:
return cp.addString(((String) value));
Long l = structuralChangesSinceLastFullBuild.get(file.getAbsolutePath());
long strucModTime = -1;
if (l != null) {
- strucModTime = l.longValue();
+ strucModTime = l;
} else {
strucModTime = this.lastSuccessfulFullBuildTime;
}
for (Map.Entry<String, Long> entry : entries) {
Long l = entry.getValue();
if (l != null) {
- long lvalue = l.longValue();
+ long lvalue = l;
if (lvalue > lastSuccessfulBuildTime) {
if (listenerDefined()) {
getListener().recordDecision(
if (-1 != loc)
s = s.substring(loc + 1);
try {
- exp[i] = Integer.valueOf(s).intValue();
+ exp[i] = Integer.valueOf(s);
sb.append(exp[i] + ((i < (exp.length - 1)) ? ", " : ""));
} catch (NumberFormatException e) {
info(handler, "bad " + label + ":" + expected[i]);
private static boolean getBoolean(String name, boolean def) {
String defaultValue = String.valueOf(def);
String value = System.getProperty(name, defaultValue);
- return Boolean.valueOf(value).booleanValue();
+ return Boolean.valueOf(value);
}
/*
File f = (File) ois.readObject();
Integer ii = (Integer) ois.readObject();
Integer offset = (Integer) ois.readObject();
- ret = new SourceLocation(f, ii.intValue());
- ret.setOffset(offset.intValue());
+ ret = new SourceLocation(f, ii);
+ ret.setOffset(offset);
}
} else {
boolean validLocation = b == 2;
super(kind);
switch (kind) {
case AnnotationValue.PRIMITIVE_BYTE:
- theByte = ((Byte) value).byteValue();
+ theByte = (Byte) value;
break;
case AnnotationValue.PRIMITIVE_CHAR:
- theChar = ((Character) value).charValue();
+ theChar = (Character) value;
break;
case AnnotationValue.PRIMITIVE_INT:
- theInt = ((Integer) value).intValue();
+ theInt = (Integer) value;
break;
case AnnotationValue.STRING:
theString = (String) value;
break;
case AnnotationValue.PRIMITIVE_DOUBLE:
- theDouble = ((Double) value).doubleValue();
+ theDouble = (Double) value;
break;
case AnnotationValue.PRIMITIVE_FLOAT:
- theFloat = ((Float) value).floatValue();
+ theFloat = (Float) value;
break;
case AnnotationValue.PRIMITIVE_LONG:
- theLong = ((Long) value).longValue();
+ theLong = (Long) value;
break;
case AnnotationValue.PRIMITIVE_SHORT:
- theShort = ((Short) value).shortValue();
+ theShort = (Short) value;
break;
case AnnotationValue.PRIMITIVE_BOOLEAN:
- theBoolean = ((Boolean) value).booleanValue();
+ theBoolean = (Boolean) value;
break;
default:
throw new BCException("Not implemented for this kind: " + whatKindIsThis(kind));
public int compareByPrecedence(ResolvedType firstAspect, ResolvedType secondAspect) {
PrecedenceCacheKey key = new PrecedenceCacheKey(firstAspect, secondAspect);
if (cachedResults.containsKey(key)) {
- return (cachedResults.get(key)).intValue();
+ return cachedResults.get(key);
} else {
int order = 0;
DeclarePrecedence orderer = null; // Records the declare
if (flag == null) {
return -1;
}
- return flag.intValue();
+ return flag;
}
public Object accept(PatternNodeVisitor visitor, Object data) {
protected static boolean getBoolean(String name, boolean def) {
String defaultValue = String.valueOf(def);
String value = System.getProperty(name,defaultValue);
- return Boolean.valueOf(value).booleanValue();
+ return Boolean.valueOf(value);
}
static {
*/
public static boolean hasAspect(Class<?> aspectClass) throws NoAspectBoundException {
try {
- return ((Boolean)getSingletonOrThreadHasAspect(aspectClass).invoke(null, EMPTY_OBJECT_ARRAY)).booleanValue();
+ return (Boolean) getSingletonOrThreadHasAspect(aspectClass).invoke(null, EMPTY_OBJECT_ARRAY);
} catch (Exception e) {
return false;
}
*/
public static boolean hasAspect(Class<?> aspectClass, Object perObject) throws NoAspectBoundException {
try {
- return ((Boolean)getPerObjectHasAspect(aspectClass).invoke(null, new Object[]{perObject})).booleanValue();
+ return (Boolean) getPerObjectHasAspect(aspectClass).invoke(null, new Object[]{perObject});
} catch (Exception e) {
return false;
}
*/
public static boolean hasAspect(Class<?> aspectClass, Class<?> perTypeWithin) throws NoAspectBoundException {
try {
- return ((Boolean)getPerTypeWithinHasAspect(aspectClass).invoke(null, new Object[]{perTypeWithin})).booleanValue();
+ return (Boolean) getPerTypeWithinHasAspect(aspectClass).invoke(null, new Object[]{perTypeWithin});
} catch (Exception e) {
return false;
}
*/
public static boolean hasAspect(Class aspectClass) throws NoAspectBoundException {
try {
- return ((Boolean)getSingletonOrThreadHasAspect(aspectClass).invoke(null, EMPTY_OBJECT_ARRAY)).booleanValue();
+ return (Boolean) getSingletonOrThreadHasAspect(aspectClass).invoke(null, EMPTY_OBJECT_ARRAY);
} catch (Exception e) {
return false;
}
*/
public static boolean hasAspect(Class aspectClass, Object perObject) throws NoAspectBoundException {
try {
- return ((Boolean)getPerObjectHasAspect(aspectClass).invoke(null, new Object[]{perObject})).booleanValue();
+ return (Boolean) getPerObjectHasAspect(aspectClass).invoke(null, new Object[]{perObject});
} catch (Exception e) {
return false;
}
*/
public static boolean hasAspect(Class aspectClass, Class perTypeWithin) throws NoAspectBoundException {
try {
- return ((Boolean)getPerTypeWithinHasAspect(aspectClass).invoke(null, new Object[]{perTypeWithin})).booleanValue();
+ return (Boolean) getPerTypeWithinHasAspect(aspectClass).invoke(null, new Object[]{perTypeWithin});
} catch (Exception e) {
return false;
}
if (o == null) {
return 0;
} else if (o instanceof Character) {
- return ((Character)o).charValue();
+ return (Character) o;
} else {
throw new ClassCastException(o.getClass().getName() +
" can not be converted to char");
if (o == null) {
return false;
} else if (o instanceof Boolean) {
- return ((Boolean)o).booleanValue();
+ return (Boolean) o;
} else {
throw new ClassCastException(o.getClass().getName() +
" can not be converted to boolean");
if (null == javac) {
throw new IllegalStateException("null javac");
}
- if (!((Boolean) inSelfCall.get()).booleanValue()
+ if (!(Boolean) inSelfCall.get()
&& afterCleaningDirs()) {
// if we are not re-calling ourself and we cleaned dirs,
// then re-call javac to get the list of all source files.
Project.MSG_WARN));
System.setOut(logstr);
System.setErr(logstr);
- return ((Integer)main.getMethod
- ("compile", new Class[]{String[].class}).invoke
- (main.newInstance(), new Object[]{
- removeUnsupported(cline, logstr)
- })).intValue() == AJC_COMPILER_SUCCESS;
+ return (Integer) main.getMethod
+ ("compile", new Class[]{String[].class}).invoke
+ (main.newInstance(), new Object[]{
+ removeUnsupported(cline, logstr)
+ }) == AJC_COMPILER_SUCCESS;
} catch (Exception e) {
if (e instanceof BuildException) {
throw (BuildException)e;
}
Object value = result.status.getResult();
if ((value instanceof Boolean)
- && !((Boolean) value).booleanValue()) {
+ && !(Boolean) value) {
System.exit(-1);
}
}
if (clearTestAfterRun.isEmpty()) {
return false;
}
- boolean result = clearTestAfterRun.peek().booleanValue();
+ boolean result = clearTestAfterRun.peek();
if (pop) {
clearTestAfterRun.pop();
}
compilerOption,
result);
}
- return result.booleanValue();
+ return result;
}
}
} // CompilerRun.Spec.CRSOptions
static {
long delay = 10l;
try {
- delay = Long.getLong(DELAY_NAME).longValue();
+ delay = Long.getLong(DELAY_NAME);
if ((delay > 40000) || (delay < 0)) {
delay = 10l;
}
description.setLength(0);
description.append((prefix + " " + suffix).trim());
try {
- result.setBugId(Integer.valueOf(pr).intValue());
+ result.setBugId(Integer.valueOf(pr));
} catch (NumberFormatException e) {
throw new Error("unable to convert " + pr + " for " + result
+ " at " + lineReader);
AjcTest.Spec test = new AjcTest.Spec();
test.setDescription(title);
test.setTestDirOffset(dir);
- test.setBugId(Integer.valueOf(pr).intValue());
+ test.setBugId(Integer.valueOf(pr));
test.setSourceLocation(sourceLocation);
//AjcTest test = new AjcTest(title, dir, pr, sourceLocation);
file = new File("XXX"); //XXX
}
- int line = Integer.valueOf(getAttributeString(child, "line")).intValue();
+ int line = Integer.valueOf(getAttributeString(child, "line"));
ISourceLocation sourceLocation = new SourceLocation(file, line, line, 0);
/** @return true if integer instanceof Integer with acceptable intValue */
public final boolean isValid(Object integer) {
return ((integer instanceof Integer)
- && (acceptInt(((Integer) integer).intValue())));
+ && (acceptInt((Integer) integer)));
}
/** @return true if min <= value < max */
public static final ObjectChecker ANY_ZERO = new ObjectChecker() {
public boolean isValid(Object input) {
if (input instanceof Integer) {
- return (0 == ((Integer) input).intValue());
+ return (0 == (Integer) input);
} else {
return true;
}
if (null != sourceLocation) {
throw new IllegalStateException("cannot set line after creating source location");
}
- this.line = Integer.valueOf(line).intValue();
+ this.line = Integer.valueOf(line);
SourceLocation.validLine(this.line);
}
}
private int convert(String in) {
- return Integer.valueOf(in).intValue();
+ return Integer.valueOf(in);
}
public String getLocationContext() {
java.lang.reflect.Method isBridge
= java.lang.reflect.Method.class.getMethod("isBridge", noparms);
Boolean result = (Boolean) isBridge.invoke(m, new Object[0]);
- return result.booleanValue();
+ return result;
} catch (Throwable t) {
return false;
}
try {
String value = System.getProperty(propertyName);
if (null != value) {
- return Boolean.valueOf(value).booleanValue();
+ return Boolean.valueOf(value);
}
} catch (Throwable t) {
// default below