aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2008-06-04 21:22:43 +0000
committeraclement <aclement>2008-06-04 21:22:43 +0000
commit9c2055688d87b9d38c5705ce26334f4794ae84f2 (patch)
tree02d05c92852f28816fdf099ae2ff858d3bf9a7b0
parentaf275059397b3297df67ad5c5ffd3e707ebd3041 (diff)
downloadaspectj-9c2055688d87b9d38c5705ce26334f4794ae84f2.tar.gz
aspectj-9c2055688d87b9d38c5705ce26334f4794ae84f2.zip
231396: refactoring AspectJ: PMD reported - real bug in Utility
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java4
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/Utility.java34
2 files changed, 17 insertions, 21 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
index 5d3998858..3fe9e54ed 100644
--- a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
+++ b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
@@ -1181,11 +1181,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(Integer.valueOf(tag.getSlot()))) {
// we already have a var starting at this tag with this slot
continue;
}
- slots.add(new Integer(tag.getSlot()));
+ slots.add(Integer.valueOf(tag.getSlot()));
Type t = tag.getRealType();
if (t==null) {
t = BcelWorld.makeBcelType(UnresolvedType.forSignature(tag.getType()));
diff --git a/weaver/src/org/aspectj/weaver/bcel/Utility.java b/weaver/src/org/aspectj/weaver/bcel/Utility.java
index 0c65844c6..68193a060 100644
--- a/weaver/src/org/aspectj/weaver/bcel/Utility.java
+++ b/weaver/src/org/aspectj/weaver/bcel/Utility.java
@@ -62,10 +62,6 @@ import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.UnresolvedType;
public class Utility {
-
- private Utility() {
- super();
- }
/*
* Ensure we report a nice source location - particular in the case
@@ -507,26 +503,26 @@ public class Utility {
return il;
}
- public static Instruction createConstant(
- InstructionFactory fact,
- int i) {
+ public static Instruction createConstant(InstructionFactory fact,int value) {
Instruction inst;
- switch(i) {
+ switch (value) {
case -1: inst = InstructionConstants.ICONST_M1; break;
case 0: inst = InstructionConstants.ICONST_0; break;
case 1: inst = InstructionConstants.ICONST_1; break;
case 2: inst = InstructionConstants.ICONST_2; break;
case 3: inst = InstructionConstants.ICONST_3; break;
case 4: inst = InstructionConstants.ICONST_4; break;
- case 5: inst = InstructionConstants.ICONST_5; break;
- }
- if (i <= Byte.MAX_VALUE && i >= Byte.MIN_VALUE) {
- inst = new InstructionByte(Constants.BIPUSH,(byte)i);
- } else if (i <= Short.MAX_VALUE && i >= Short.MIN_VALUE) {
- inst = new InstructionShort(Constants.SIPUSH,(short)i);
- } else {
- int ii = fact.getClassGen().getConstantPool().addInteger(i);
- inst = new InstructionCP(i<=Constants.MAX_BYTE?Constants.LDC:Constants.LDC_W,ii);
+ case 5: inst = InstructionConstants.ICONST_5; break;
+ default:
+ if (value <= Byte.MAX_VALUE && value >= Byte.MIN_VALUE) {
+ inst = new InstructionByte(Constants.BIPUSH,(byte)value);
+ } else if (value <= Short.MAX_VALUE && value >= Short.MIN_VALUE) {
+ inst = new InstructionShort(Constants.SIPUSH,(short)value);
+ } else {
+ int ii = fact.getClassGen().getConstantPool().addInteger(value);
+ inst = new InstructionCP(value<=Constants.MAX_BYTE?Constants.LDC:Constants.LDC_W,ii);
+ }
+ break;
}
return inst;
}
@@ -748,7 +744,7 @@ public class Utility {
// 1. there are no values specified (i.e. @SuppressAjWarnings)
// 2. there are values specified (i.e. @SuppressAjWarnings("A") or @SuppressAjWarnings({"A","B"})
List vals = anns[i].getBcelAnnotation().getValues();
- if (vals == null || vals.size()==0) { // (1)
+ if (vals == null || vals.isEmpty()) { // (1)
suppressed = true;
} else { // (2)
// We know the value is an array value
@@ -780,7 +776,7 @@ public class Utility {
// 1. there are no values specified (i.e. @SuppressAjWarnings)
// 2. there are values specified (i.e. @SuppressAjWarnings("A") or @SuppressAjWarnings({"A","B"})
List vals = anns[i].getBcelAnnotation().getValues();
- if (vals == null || vals.size()==0) { // (1)
+ if (vals == null || vals.isEmpty()) { // (1)
suppressedWarnings.addAll(lint.allKinds());
} else { // (2)
// We know the value is an array value