From 93ce335dc0dad2f420d1b7b1d426ad7bfa3574ad Mon Sep 17 00:00:00 2001 From: Lars Grefer Date: Sat, 8 Aug 2020 03:16:40 +0200 Subject: Unnecessary unboxing 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 --- .../main/java/org/aspectj/apache/bcel/classfile/ConstantPool.java | 4 ++-- .../src/main/java/org/aspectj/apache/bcel/generic/FieldGen.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'bcel-builder') 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 410891212..de8f9c650 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 @@ -444,7 +444,7 @@ public class ConstantPool implements Node { 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) { @@ -771,7 +771,7 @@ public class ConstantPool implements Node { 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]; diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/FieldGen.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/FieldGen.java index 50b9ac496..086f276ee 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/FieldGen.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/FieldGen.java @@ -189,16 +189,16 @@ public class FieldGen extends FieldGenOrMethodGen { 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)); -- cgit v1.2.3