aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher/src/main/java
diff options
context:
space:
mode:
authorLars Grefer <eclipse@larsgrefer.de>2020-08-08 03:06:37 +0200
committerLars Grefer <eclipse@larsgrefer.de>2020-08-08 03:06:37 +0200
commit72194b7982ddfa8e9864d0a9934905bb76b90f33 (patch)
treeebed806c358c1a3960c5d6be4c13b26ca41809df /org.aspectj.matcher/src/main/java
parentc3289ab86bfb2c97cf34147239b3dde46de92a7c (diff)
downloadaspectj-72194b7982ddfa8e9864d0a9934905bb76b90f33.tar.gz
aspectj-72194b7982ddfa8e9864d0a9934905bb76b90f33.zip
'for' loop replaceable with enhanced 'for' loop
Reports for loops which iterate over collections or arrays, and can be replaced with an enhanced for loop (i.e. the foreach iteration syntax). Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
Diffstat (limited to 'org.aspectj.matcher/src/main/java')
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractAnnotationAJ.java5
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java4
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/AjAttribute.java6
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/ArrayReferenceType.java4
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/BoundedReferenceType.java8
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.java23
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembersSet.java54
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/Dump.java10
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/Lint.java4
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/MemberImpl.java4
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/MethodDelegateTypeMunger.java3
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/ReferenceType.java54
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedMemberImpl.java43
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedType.java90
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java43
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/SignatureUtils.java8
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/StandardAnnotation.java10
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeFactory.java4
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeVariable.java33
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeVariableReferenceType.java6
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/UnresolvedType.java11
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/Utils.java6
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPatternList.java28
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPointcut.java7
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java6
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsPointcut.java10
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/Bindings.java6
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactAnnotationFieldTypePattern.java3
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java9
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExposedState.java4
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/HasMemberTypePattern.java3
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NamePattern.java4
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PointcutRewriter.java3
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SignaturePattern.java17
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SimpleScope.java9
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternList.java26
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternQuestions.java9
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypeVariablePattern.java8
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypeVariablePatternList.java14
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java18
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java48
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/StandardPointcutParser.java4
42 files changed, 314 insertions, 355 deletions
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractAnnotationAJ.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractAnnotationAJ.java
index 503d6b3b5..e098251d1 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractAnnotationAJ.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractAnnotationAJ.java
@@ -121,10 +121,9 @@ public abstract class AbstractAnnotationAJ implements AnnotationAJ {
*/
private final AnnotationAJ retrieveAnnotationOnAnnotation(UnresolvedType requiredAnnotationSignature) {
AnnotationAJ[] annos = type.getAnnotations();
- for (int i = 0; i < annos.length; i++) {
- AnnotationAJ a = annos[i];
+ for (AnnotationAJ a : annos) {
if (a.getTypeSignature().equals(requiredAnnotationSignature.getSignature())) {
- return annos[i];
+ return a;
}
}
return null;
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java
index 7f3fb60ee..bdddec51e 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java
@@ -120,8 +120,8 @@ public abstract class AbstractReferenceTypeDelegate implements ReferenceTypeDele
AbstractReferenceTypeDelegate outerObjectType = (AbstractReferenceTypeDelegate) outerDelegate;
if (outerObjectType.isNested()) {
GenericSignature.FormalTypeParameter[] parentParams = outerObjectType.getFormalTypeParametersFromOuterClass();
- for (int i = 0; i < parentParams.length; i++) {
- typeParameters.add(parentParams[i]);
+ for (GenericSignature.FormalTypeParameter parentParam : parentParams) {
+ typeParameters.add(parentParam);
}
}
GenericSignature.ClassSignature outerSig = outerObjectType.getGenericClassTypeSignature();
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AjAttribute.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AjAttribute.java
index 781227141..e76c88f88 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AjAttribute.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AjAttribute.java
@@ -374,9 +374,9 @@ public abstract class AjAttribute {
}
s.writeInt(lineBreaks.length);
int previous = 0;
- for (int i = 0, max = lineBreaks.length; i < max; i++) {
- s.writeShort(lineBreaks[i] - previous);
- previous = lineBreaks[i];
+ for (int lineBreak : lineBreaks) {
+ s.writeShort(lineBreak - previous);
+ previous = lineBreak;
}
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ArrayReferenceType.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ArrayReferenceType.java
index aa4fa55c0..81acaadfe 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ArrayReferenceType.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ArrayReferenceType.java
@@ -119,8 +119,8 @@ public class ArrayReferenceType extends ReferenceType {
public TypeVariable[] getTypeVariables() {
if (this.typeVariables == null && componentType.getTypeVariables() != null) {
this.typeVariables = componentType.getTypeVariables();
- for (int i = 0; i < this.typeVariables.length; i++) {
- this.typeVariables[i].resolve(world);
+ for (TypeVariable typeVariable : this.typeVariables) {
+ typeVariable.resolve(world);
}
}
return this.typeVariables;
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/BoundedReferenceType.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/BoundedReferenceType.java
index e0a7a680e..ad434575a 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/BoundedReferenceType.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/BoundedReferenceType.java
@@ -131,14 +131,14 @@ public class BoundedReferenceType extends ReferenceType {
if (kind==SUPER){
ret.append("-");
ret.append(lowerBound.getSignatureForAttribute());
- for (int i=0;i<additionalInterfaceBounds.length;i++) {
- ret.append(additionalInterfaceBounds[i].getSignatureForAttribute());
+ for (ReferenceType additionalInterfaceBound : additionalInterfaceBounds) {
+ ret.append(additionalInterfaceBound.getSignatureForAttribute());
}
} else if (kind==EXTENDS) {
ret.append("+");
ret.append(upperBound.getSignatureForAttribute());
- for (int i=0;i<additionalInterfaceBounds.length;i++) {
- ret.append(additionalInterfaceBounds[i].getSignatureForAttribute());
+ for (ReferenceType additionalInterfaceBound : additionalInterfaceBounds) {
+ ret.append(additionalInterfaceBound.getSignatureForAttribute());
}
} else if (kind==UNBOUND) {
ret.append("*");
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.java
index 8e41c0a82..b6ddd2e6e 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.java
@@ -186,8 +186,7 @@ public class CrosscuttingMembers {
}
// Check we haven't already got a munger for this:
String signatureToLookFor = typeToExpose.getSignature();
- for (Iterator<ConcreteTypeMunger> iterator = typeMungers.iterator(); iterator.hasNext();) {
- ConcreteTypeMunger cTM = iterator.next();
+ for (ConcreteTypeMunger cTM : typeMungers) {
ResolvedTypeMunger rTM = cTM.getMunger();
if (rTM != null && rTM instanceof ExposeTypeMunger) {
String exposedType = ((ExposeTypeMunger) rTM).getExposedTypeSignature();
@@ -345,8 +344,7 @@ public class CrosscuttingMembers {
Set<Object> theseTypeMungers = new HashSet<Object>();
Set<Object> otherTypeMungers = new HashSet<Object>();
if (!careAboutShadowMungers) {
- for (Iterator<ConcreteTypeMunger> iter = typeMungers.iterator(); iter.hasNext();) {
- Object o = iter.next();
+ for (Object o : typeMungers) {
if (o instanceof ConcreteTypeMunger) {
ConcreteTypeMunger typeMunger = (ConcreteTypeMunger) o;
if (!typeMunger.existsToSupportShadowMunging()) {
@@ -357,8 +355,7 @@ public class CrosscuttingMembers {
}
}
- for (Iterator<ConcreteTypeMunger> iter = other.typeMungers.iterator(); iter.hasNext();) {
- Object o = iter.next();
+ for (Object o : other.typeMungers) {
if (o instanceof ConcreteTypeMunger) {
ConcreteTypeMunger typeMunger = (ConcreteTypeMunger) o;
if (!typeMunger.existsToSupportShadowMunging()) {
@@ -435,15 +432,13 @@ public class CrosscuttingMembers {
if (!careAboutShadowMungers) {
// this means we are in front end compilation and if the differences are purely mixin parents, we can continue OK
Set<DeclareParents> trimmedThis = new HashSet<DeclareParents>();
- for (Iterator<DeclareParents> iterator = declareParents.iterator(); iterator.hasNext();) {
- DeclareParents decp = iterator.next();
+ for (DeclareParents decp : declareParents) {
if (!decp.isMixin()) {
trimmedThis.add(decp);
}
}
Set<DeclareParents> trimmedOther = new HashSet<DeclareParents>();
- for (Iterator<DeclareParents> iterator = other.declareParents.iterator(); iterator.hasNext();) {
- DeclareParents decp = iterator.next();
+ for (DeclareParents decp : other.declareParents) {
if (!decp.isMixin()) {
trimmedOther.add(decp);
}
@@ -490,11 +485,11 @@ public class CrosscuttingMembers {
if (theseInlinedAroundMungers.size() != otherInlinedAroundMungers.size()) {
return false;
}
- for (Iterator<ShadowMunger> iter = theseInlinedAroundMungers.iterator(); iter.hasNext();) {
- Advice thisAdvice = (Advice) iter.next();
+ for (ShadowMunger theseInlinedAroundMunger : theseInlinedAroundMungers) {
+ Advice thisAdvice = (Advice) theseInlinedAroundMunger;
boolean foundIt = false;
- for (Iterator<ShadowMunger> iterator = otherInlinedAroundMungers.iterator(); iterator.hasNext();) {
- Advice otherAdvice = (Advice) iterator.next();
+ for (ShadowMunger otherInlinedAroundMunger : otherInlinedAroundMungers) {
+ Advice otherAdvice = (Advice) otherInlinedAroundMunger;
if (thisAdvice.equals(otherAdvice)) {
if (thisAdvice.getSignature() instanceof ResolvedMemberImpl) {
if (((ResolvedMemberImpl) thisAdvice.getSignature()).isEquivalentTo(otherAdvice.getSignature())) {
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembersSet.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembersSet.java
index 969f96ece..a3d97ea89 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembersSet.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembersSet.java
@@ -140,16 +140,14 @@ public class CrosscuttingMembersSet {
// System.err.println("Looking at descendants of "+aspectType.getName());
Set<ResolvedType> knownAspects = members.keySet();
Set<ResolvedType> toBeReplaced = new HashSet<ResolvedType>();
- for (Iterator<ResolvedType> it = knownAspects.iterator(); it.hasNext();) {
- ResolvedType candidateDescendant = it.next();
+ for (ResolvedType candidateDescendant : knownAspects) {
// allowMissing = true - if something is missing, it really probably is not a descendant
if ((candidateDescendant != aspectType) && (aspectType.isAssignableFrom(candidateDescendant, true))) {
toBeReplaced.add(candidateDescendant);
}
}
boolean change = false;
- for (Iterator<ResolvedType> it = toBeReplaced.iterator(); it.hasNext();) {
- ResolvedType next = it.next();
+ for (ResolvedType next : toBeReplaced) {
boolean thisChange = addOrReplaceAspect(next, inWeavePhase);
change = change || thisChange;
}
@@ -195,8 +193,8 @@ public class CrosscuttingMembersSet {
public List<ShadowMunger> getShadowMungers() {
if (shadowMungers == null) {
List<ShadowMunger> ret = new ArrayList<ShadowMunger>();
- for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
- ret.addAll(i.next().getShadowMungers());
+ for (CrosscuttingMembers crosscuttingMembers : members.values()) {
+ ret.addAll(crosscuttingMembers.getShadowMungers());
}
shadowMungers = ret;
}
@@ -283,8 +281,8 @@ public class CrosscuttingMembersSet {
public List<ConcreteTypeMunger> getLateTypeMungers() {
if (lateTypeMungers == null) {
List<ConcreteTypeMunger> ret = new ArrayList<ConcreteTypeMunger>();
- for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
- ret.addAll(i.next().getLateTypeMungers());
+ for (CrosscuttingMembers crosscuttingMembers : members.values()) {
+ ret.addAll(crosscuttingMembers.getLateTypeMungers());
}
lateTypeMungers = ret;
}
@@ -294,8 +292,8 @@ public class CrosscuttingMembersSet {
public List<DeclareSoft> getDeclareSofts() {
if (declareSofts == null) {
Set<DeclareSoft> ret = new HashSet<DeclareSoft>();
- for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
- ret.addAll(i.next().getDeclareSofts());
+ for (CrosscuttingMembers crosscuttingMembers : members.values()) {
+ ret.addAll(crosscuttingMembers.getDeclareSofts());
}
declareSofts = new ArrayList<DeclareSoft>();
declareSofts.addAll(ret);
@@ -306,8 +304,8 @@ public class CrosscuttingMembersSet {
public List<DeclareParents> getDeclareParents() {
if (declareParents == null) {
Set<DeclareParents> ret = new HashSet<DeclareParents>();
- for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
- ret.addAll(i.next().getDeclareParents());
+ for (CrosscuttingMembers crosscuttingMembers : members.values()) {
+ ret.addAll(crosscuttingMembers.getDeclareParents());
}
declareParents = new ArrayList<DeclareParents>();
declareParents.addAll(ret);
@@ -321,8 +319,8 @@ public class CrosscuttingMembersSet {
public List<DeclareAnnotation> getDeclareAnnotationOnTypes() {
if (declareAnnotationOnTypes == null) {
Set<DeclareAnnotation> ret = new LinkedHashSet<DeclareAnnotation>();
- for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
- ret.addAll(i.next().getDeclareAnnotationOnTypes());
+ for (CrosscuttingMembers crosscuttingMembers : members.values()) {
+ ret.addAll(crosscuttingMembers.getDeclareAnnotationOnTypes());
}
declareAnnotationOnTypes = new ArrayList<DeclareAnnotation>();
declareAnnotationOnTypes.addAll(ret);
@@ -336,8 +334,8 @@ public class CrosscuttingMembersSet {
public List<DeclareAnnotation> getDeclareAnnotationOnFields() {
if (declareAnnotationOnFields == null) {
Set<DeclareAnnotation> ret = new LinkedHashSet<DeclareAnnotation>();
- for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
- ret.addAll(i.next().getDeclareAnnotationOnFields());
+ for (CrosscuttingMembers crosscuttingMembers : members.values()) {
+ ret.addAll(crosscuttingMembers.getDeclareAnnotationOnFields());
}
declareAnnotationOnFields = new ArrayList<DeclareAnnotation>();
declareAnnotationOnFields.addAll(ret);
@@ -351,8 +349,8 @@ public class CrosscuttingMembersSet {
public List<DeclareAnnotation> getDeclareAnnotationOnMethods() {
if (declareAnnotationOnMethods == null) {
Set<DeclareAnnotation> ret = new LinkedHashSet<DeclareAnnotation>();
- for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
- ret.addAll(i.next().getDeclareAnnotationOnMethods());
+ for (CrosscuttingMembers crosscuttingMembers : members.values()) {
+ ret.addAll(crosscuttingMembers.getDeclareAnnotationOnMethods());
}
declareAnnotationOnMethods = new ArrayList<DeclareAnnotation>();
declareAnnotationOnMethods.addAll(ret);
@@ -367,8 +365,8 @@ public class CrosscuttingMembersSet {
public List<DeclareTypeErrorOrWarning> getDeclareTypeEows() {
if (declareTypeEows == null) {
Set<DeclareTypeErrorOrWarning> ret = new HashSet<DeclareTypeErrorOrWarning>();
- for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
- ret.addAll(i.next().getDeclareTypeErrorOrWarning());
+ for (CrosscuttingMembers crosscuttingMembers : members.values()) {
+ ret.addAll(crosscuttingMembers.getDeclareTypeErrorOrWarning());
}
declareTypeEows = new ArrayList<DeclareTypeErrorOrWarning>();
declareTypeEows.addAll(ret);
@@ -379,8 +377,8 @@ public class CrosscuttingMembersSet {
public List<Declare> getDeclareDominates() {
if (declareDominates == null) {
List<Declare> ret = new ArrayList<Declare>();
- for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
- ret.addAll(i.next().getDeclareDominates());
+ for (CrosscuttingMembers crosscuttingMembers : members.values()) {
+ ret.addAll(crosscuttingMembers.getDeclareDominates());
}
declareDominates = ret;
}
@@ -389,10 +387,8 @@ public class CrosscuttingMembersSet {
public ResolvedType findAspectDeclaringParents(DeclareParents p) {
Set<ResolvedType> keys = this.members.keySet();
- for (Iterator<ResolvedType> iter = keys.iterator(); iter.hasNext();) {
- ResolvedType element = iter.next();
- for (Iterator i = members.get(element).getDeclareParents().iterator(); i.hasNext();) {
- DeclareParents dp = (DeclareParents) i.next();
+ for (ResolvedType element : keys) {
+ for (DeclareParents dp : members.get(element).getDeclareParents()) {
if (dp.equals(p)) {
return element;
}
@@ -428,8 +424,7 @@ public class CrosscuttingMembersSet {
if (verificationList == null) {
return;
}
- for (Iterator<IVerificationRequired> iter = verificationList.iterator(); iter.hasNext();) {
- IVerificationRequired element = iter.next();
+ for (IVerificationRequired element : verificationList) {
element.verify();
}
verificationList = null;
@@ -440,8 +435,7 @@ public class CrosscuttingMembersSet {
public void write(CompressingDataOutputStream stream) throws IOException {
// stream.writeInt(serializationVersion);
stream.writeInt(shadowMungers.size());
- for (Iterator iterator = shadowMungers.iterator(); iterator.hasNext();) {
- ShadowMunger shadowMunger = (ShadowMunger) iterator.next();
+ for (ShadowMunger shadowMunger : shadowMungers) {
shadowMunger.write(stream);
}
// // private List /* ShadowMunger */shadowMungers = null;
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Dump.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Dump.java
index 0efd56782..6e48de0d2 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Dump.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Dump.java
@@ -372,8 +372,7 @@ public class Dump {
private void dumpCompilerMessages(IMessageHolder messageHolder) {
println("---- Compiler Messages ---");
if (messageHolder != null) {
- for (Iterator<IMessage> i = messageHolder.getUnmodifiableListView().iterator(); i.hasNext();) {
- IMessage message = i.next();
+ for (IMessage message : messageHolder.getUnmodifiableListView()) {
println(message.toString());
}
} else {
@@ -419,8 +418,8 @@ public class Dump {
return;
}
- for (int i = 0; i < array.length; i++) {
- print.println(array[i]);
+ for (Object o : array) {
+ print.println(o);
}
}
@@ -454,8 +453,7 @@ public class Dump {
if (list == null || list.isEmpty()) {
println(NULL_OR_EMPTY);
} else {
- for (Iterator i = list.iterator(); i.hasNext();) {
- Object o = i.next();
+ for (Object o : list) {
if (o instanceof Exception) {
println((Exception) o);
} else {
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Lint.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Lint.java
index aab34b8f6..7307ab93c 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Lint.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Lint.java
@@ -234,8 +234,8 @@ public class Lint {
@SuppressWarnings("rawtypes")
public void setFromProperties(Properties properties) {
- for (Iterator i = properties.entrySet().iterator(); i.hasNext();) {
- Map.Entry entry = (Map.Entry) i.next();
+ for (Map.Entry<Object, Object> objectObjectEntry : properties.entrySet()) {
+ Map.Entry entry = (Map.Entry) objectObjectEntry;
Kind kind = kinds.get(entry.getKey());
if (kind == null) {
MessageUtil.error(world.getMessageHandler(), WeaverMessages.format(WeaverMessages.XLINT_KEY_ERROR, entry.getKey()));
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MemberImpl.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MemberImpl.java
index fbf497ed2..9e608c9ad 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MemberImpl.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MemberImpl.java
@@ -127,8 +127,8 @@ public class MemberImpl implements Member {
public static String typesToSignature(UnresolvedType[] paramTypes) {
StringBuffer buf = new StringBuffer();
buf.append("(");
- for (int i = 0; i < paramTypes.length; i++) {
- buf.append(paramTypes[i].getSignature());
+ for (UnresolvedType paramType : paramTypes) {
+ buf.append(paramType.getSignature());
}
buf.append(")");
return buf.toString();
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MethodDelegateTypeMunger.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MethodDelegateTypeMunger.java
index bf8a76529..d07d8456f 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MethodDelegateTypeMunger.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MethodDelegateTypeMunger.java
@@ -114,8 +114,7 @@ public class MethodDelegateTypeMunger extends ResolvedTypeMunger {
public ResolvedMember getDelegateFactoryMethod(World w) {
ResolvedType aspectType = w.resolve(aspect);
ResolvedMember[] methods = aspectType.getDeclaredMethods();
- for (int i = 0; i < methods.length; i++) {
- ResolvedMember rm = methods[i];
+ for (ResolvedMember rm : methods) {
if (rm.getName().equals(factoryMethodName) && rm.getSignature().equals(factoryMethodSignature)) {
return rm;
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ReferenceType.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ReferenceType.java
index 7dc162a16..aad9a1dbe 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ReferenceType.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ReferenceType.java
@@ -225,8 +225,8 @@ public class ReferenceType extends ResolvedType {
return true;
}
if (annotationTypes != null) {
- for (int i = 0; i < annotationTypes.length; i++) {
- if (annotationTypes[i].equals(ofType)) {
+ for (ResolvedType annotationType : annotationTypes) {
+ if (annotationType.equals(ofType)) {
return true;
}
}
@@ -278,17 +278,17 @@ public class ReferenceType extends ResolvedType {
public AnnotationAJ getAnnotationOfType(UnresolvedType ofType) {
AnnotationAJ[] axs = getDelegate().getAnnotations();
if (axs != null) {
- for (int i = 0; i < axs.length; i++) {
- if (axs[i].getTypeSignature().equals(ofType.getSignature())) {
- return axs[i];
+ for (AnnotationAJ ax : axs) {
+ if (ax.getTypeSignature().equals(ofType.getSignature())) {
+ return ax;
}
}
}
if (annotations != null) {
String searchSig = ofType.getSignature();
- for (int i = 0; i < annotations.length; i++) {
- if (annotations[i].getTypeSignature().equals(searchSig)) {
- return annotations[i];
+ for (AnnotationAJ annotation : annotations) {
+ if (annotation.getTypeSignature().equals(searchSig)) {
+ return annotation;
}
}
}
@@ -386,9 +386,9 @@ public class ReferenceType extends ResolvedType {
// ??? needs to be Methods, not just declared methods? JLS 5.5 unclear
ResolvedMember[] a = getDeclaredMethods();
ResolvedMember[] b = other.getDeclaredMethods();
- for (int ai = 0, alen = a.length; ai < alen; ai++) {
- for (int bi = 0, blen = b.length; bi < blen; bi++) {
- if (!b[bi].isCompatibleWith(a[ai])) {
+ for (ResolvedMember member : a) {
+ for (ResolvedMember resolvedMember : b) {
+ if (!resolvedMember.isCompatibleWith(member)) {
return false;
}
}
@@ -507,11 +507,11 @@ public class ReferenceType extends ResolvedType {
if (((ReferenceType) this.getRawType()).isAssignableFrom(other)) {
boolean wildcardsAllTheWay = true;
ResolvedType[] myParameters = this.getResolvedTypeParameters();
- for (int i = 0; i < myParameters.length; i++) {
- if (!myParameters[i].isGenericWildcard()) {
+ for (ResolvedType myParameter : myParameters) {
+ if (!myParameter.isGenericWildcard()) {
wildcardsAllTheWay = false;
} else {
- BoundedReferenceType boundedRT = (BoundedReferenceType) myParameters[i];
+ BoundedReferenceType boundedRT = (BoundedReferenceType) myParameter;
if (boundedRT.isExtends() || boundedRT.isSuper()) {
wildcardsAllTheWay = false;
}
@@ -910,8 +910,8 @@ public class ReferenceType extends ResolvedType {
public TypeVariable[] getTypeVariables() {
if (typeVariables == null) {
typeVariables = getDelegate().getTypeVariables();
- for (int i = 0; i < this.typeVariables.length; i++) {
- typeVariables[i].resolve(world);
+ for (TypeVariable typeVariable : this.typeVariables) {
+ typeVariable.resolve(world);
}
}
return typeVariables;
@@ -1131,8 +1131,8 @@ public class ReferenceType extends ResolvedType {
ret.append(PARAMETERIZED_TYPE_IDENTIFIER);
ret.append(rawSignature.substring(1, rawSignature.length() - 1));
ret.append("<");
- for (int i = 0; i < someParameters.length; i++) {
- ret.append(someParameters[i].getSignature());
+ for (ResolvedType someParameter : someParameters) {
+ ret.append(someParameter.getSignature());
}
ret.append(">;");
return ret.toString();
@@ -1144,18 +1144,18 @@ public class ReferenceType extends ResolvedType {
String rawSig = aGenericType.getErasureSignature();
ret.append(rawSig.substring(0, rawSig.length() - 1));
ret.append("<");
- for (int i = 0; i < someParameters.length; i++) {
- if (someParameters[i] instanceof ReferenceType) {
- ret.append(((ReferenceType) someParameters[i])
+ for (UnresolvedType someParameter : someParameters) {
+ if (someParameter instanceof ReferenceType) {
+ ret.append(((ReferenceType) someParameter)
.getSignatureForAttribute());
- } else if (someParameters[i] instanceof Primitive) {
- ret.append(((Primitive) someParameters[i])
+ } else if (someParameter instanceof Primitive) {
+ ret.append(((Primitive) someParameter)
.getSignatureForAttribute());
} else {
throw new IllegalStateException(
"DebugFor325731: expected a ReferenceType or Primitive but was "
- + someParameters[i] + " of type "
- + someParameters[i].getClass().getName());
+ + someParameter + " of type "
+ + someParameter.getClass().getName());
}
}
ret.append(">;");
@@ -1200,8 +1200,8 @@ public class ReferenceType extends ResolvedType {
} else {
ResolvedType[] existing = getDelegate().getDeclaredInterfaces();
if (existing != null) {
- for (int i = 0; i < existing.length; i++) {
- if (existing[i].equals(newParent)) {
+ for (ResolvedType resolvedType : existing) {
+ if (resolvedType.equals(newParent)) {
return; // already has this interface
}
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedMemberImpl.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedMemberImpl.java
index 84e382422..90fd3ece3 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedMemberImpl.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedMemberImpl.java
@@ -289,8 +289,8 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Reso
return backingGenericMember.hasAnnotation(ofType);
}
if (annotationTypes != null) {
- for (int i = 0, max = annotationTypes.length; i < max; i++) {
- if (annotationTypes[i].equals(ofType)) {
+ for (ResolvedType annotationType : annotationTypes) {
+ if (annotationType.equals(ofType)) {
return true;
}
}
@@ -434,8 +434,8 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Reso
s.writeByte(0);
} else {
s.writeByte(typeVariables.length);
- for (int i = 0; i < typeVariables.length; i++) {
- typeVariables[i].write(s);
+ for (TypeVariable typeVariable : typeVariables) {
+ typeVariable.write(s);
}
}
String gsig = getGenericSignature();
@@ -445,11 +445,11 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Reso
s.writeByte(0xff);
} else {
s.writeByte(parameterTypes.length);
- for (int i = 0; i < parameterTypes.length; i++) {
+ for (UnresolvedType parameterType : parameterTypes) {
if (s.canCompress()) {
- s.writeCompressedSignature(parameterTypes[i].getSignature());
+ s.writeCompressedSignature(parameterType.getSignature());
} else {
- UnresolvedType array_element = parameterTypes[i];
+ UnresolvedType array_element = parameterType;
array_element.write(s);
}
}
@@ -471,16 +471,16 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Reso
StringBuffer sb = new StringBuffer();
if (typeVariables != null) {
sb.append("<");
- for (int i = 0; i < typeVariables.length; i++) {
- sb.append(typeVariables[i].getSignatureForAttribute()); // need
+ for (TypeVariable typeVariable : typeVariables) {
+ sb.append(typeVariable.getSignatureForAttribute()); // need
// a
// 'getSignatureForAttribute()'
}
sb.append(">");
}
sb.append("(");
- for (int i = 0; i < parameterTypes.length; i++) {
- ResolvedType ptype = (ResolvedType) parameterTypes[i];
+ for (UnresolvedType parameterType : parameterTypes) {
+ ResolvedType ptype = (ResolvedType) parameterType;
sb.append(ptype.getSignatureForAttribute());
}
sb.append(")");
@@ -492,14 +492,13 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Reso
StringBuffer sb = new StringBuffer();
if (typeVariables != null) {
sb.append("<");
- for (int i = 0; i < typeVariables.length; i++) {
- sb.append(typeVariables[i].getSignature());
+ for (TypeVariable typeVariable : typeVariables) {
+ sb.append(typeVariable.getSignature());
}
sb.append(">");
}
sb.append("(");
- for (int i = 0; i < parameterTypes.length; i++) {
- UnresolvedType ptype = parameterTypes[i];
+ for (UnresolvedType ptype : parameterTypes) {
sb.append(ptype.getSignature());
}
sb.append(")");
@@ -509,8 +508,8 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Reso
public static void writeArray(ResolvedMember[] members, CompressingDataOutputStream s) throws IOException {
s.writeInt(members.length);
- for (int i = 0, len = members.length; i < len; i++) {
- members[i].write(s);
+ for (ResolvedMember member : members) {
+ member.write(s);
}
}
@@ -1058,8 +1057,8 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Reso
}
StringBuffer sig = new StringBuffer();
UnresolvedType[] myParameterTypes = getGenericParameterTypes();
- for (int i = 0; i < myParameterTypes.length; i++) {
- appendSigWithTypeVarBoundsRemoved(myParameterTypes[i], sig, new HashSet<UnresolvedType>());
+ for (UnresolvedType myParameterType : myParameterTypes) {
+ appendSigWithTypeVarBoundsRemoved(myParameterType, sig, new HashSet<UnresolvedType>());
}
myParameterSignatureWithBoundsRemoved = sig.toString();
return myParameterSignatureWithBoundsRemoved;
@@ -1239,9 +1238,9 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Reso
public TypeVariable getTypeVariableNamed(String name) {
// Check locally...
if (typeVariables != null) {
- for (int i = 0; i < typeVariables.length; i++) {
- if (typeVariables[i].getName().equals(name)) {
- return typeVariables[i];
+ for (TypeVariable typeVariable : typeVariables) {
+ if (typeVariable.getName().equals(name)) {
+ return typeVariable;
}
}
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedType.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedType.java
index 98400ebdc..a5a5eea5d 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedType.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedType.java
@@ -437,8 +437,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
}
// Go through the interfaces on the way back down
ResolvedType[] interfaces = resolvedType.getDeclaredInterfaces();
- for (int i = 0; i < interfaces.length; i++) {
- ResolvedType iface = interfaces[i];
+ for (ResolvedType anInterface : interfaces) {
+ ResolvedType iface = anInterface;
if (!genericsAware && iface.isParameterizedOrGenericType()) {
iface = iface.getRawType();
}
@@ -487,8 +487,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
}
// Go through the interfaces on the way back down
ResolvedType[] interfaces = resolvedType.getDeclaredInterfaces();
- for (int i = 0; i < interfaces.length; i++) {
- ResolvedType iface = interfaces[i];
+ for (ResolvedType anInterface : interfaces) {
+ ResolvedType iface = anInterface;
if (!genericsAware && (iface.isParameterizedType() || iface.isGenericType())) {
iface = iface.getRawType();
}
@@ -562,8 +562,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
if (!type.isMissing()) {
ResolvedMember[] methods = type.getDeclaredMethods();
if (methods != null) {
- for (int i = 0; i < methods.length; i++) {
- ResolvedMember method = methods[i];
+ for (ResolvedMember method : methods) {
if (matches(method, m)) {
return method;
}
@@ -584,8 +583,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
// Queue any interfaces not already checked:
ResolvedType[] superinterfaces = type.getDeclaredInterfaces();
if (superinterfaces != null) {
- for (int i = 0; i < superinterfaces.length; i++) {
- ResolvedType interf = superinterfaces[i];
+ for (ResolvedType interf : superinterfaces) {
if (!typesTolookat.contains(interf)) {
typesTolookat.add(interf);
}
@@ -612,8 +610,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
* return null if not found
*/
private ResolvedMember lookupMember(Member m, ResolvedMember[] a) {
- for (int i = 0; i < a.length; i++) {
- ResolvedMember f = a[i];
+ for (ResolvedMember f : a) {
if (matches(f, m)) {
return f;
}
@@ -833,8 +830,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
while (typeIterator.hasNext()) {
ResolvedType ty = typeIterator.next();
// System.out.println("super: " + ty + ", " + );
- for (Iterator<Declare> i = ty.getDeclares().iterator(); i.hasNext();) {
- Declare dec = i.next();
+ for (Declare dec : ty.getDeclares()) {
if (dec.isAdviceLike()) {
if (includeAdviceLike) {
ret.add(dec);
@@ -1031,8 +1027,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
methods = getGenericType().getDeclaredMethods();
}
Map<String, UnresolvedType> typeVariableMap = getAjMemberParameterizationMap();
- for (int i = 0, len = methods.length; i < len; i++) {
- ShadowMunger munger = methods[i].getAssociatedShadowMunger();
+ for (ResolvedMember method : methods) {
+ ShadowMunger munger = method.getAssociatedShadowMunger();
if (munger != null) {
if (ajMembersNeedParameterization()) {
// munger.setPointcut(munger.getPointcut().parameterizeWith(
@@ -1041,7 +1037,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
if (munger instanceof Advice) {
Advice advice = (Advice) munger;
// update to use the parameterized signature...
- UnresolvedType[] ptypes = methods[i].getGenericParameterTypes();
+ UnresolvedType[] ptypes = method.getGenericParameterTypes();
UnresolvedType[] newPTypes = new UnresolvedType[ptypes.length];
for (int j = 0; j < ptypes.length; j++) {
if (ptypes[j] instanceof TypeVariableReferenceType) {
@@ -1081,9 +1077,9 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
private ResolvedMember[] filterInJavaVisible(ResolvedMember[] ms) {
List<ResolvedMember> l = new ArrayList<ResolvedMember>();
- for (int i = 0, len = ms.length; i < len; i++) {
- if (!ms[i].isAjSynthetic() && ms[i].getAssociatedShadowMunger() == null) {
- l.add(ms[i]);
+ for (ResolvedMember m : ms) {
+ if (!m.isAjSynthetic() && m.getAssociatedShadowMunger() == null) {
+ l.add(m);
}
}
return l.toArray(new ResolvedMember[l.size()]);
@@ -1398,8 +1394,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
if (ret == null) {
// try interfaces then, but only ITDs now...
ResolvedType[] superInterfaces = onType.getDeclaredInterfaces();
- for (int i = 0; i < superInterfaces.length; i++) {
- ret = superInterfaces[i].lookupMethodInITDs(member);
+ for (ResolvedType superInterface : superInterfaces) {
+ ret = superInterface.lookupMethodInITDs(member);
if (ret != null) {
return ret;
}
@@ -1646,8 +1642,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
}
ResolvedType[] superIs = getDeclaredInterfaces();
- for (int i = 0; i < superIs.length; i++) {
- ResolvedType superI = superIs[i];
+ for (ResolvedType superI : superIs) {
if (superI.genericTypeEquals(lookingFor)) {
return superI;
}
@@ -2128,17 +2123,18 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
ResolvedType runtimeException = world.resolve("java.lang.RuntimeException");
ResolvedType error = world.resolve("java.lang.Error");
- outer: for (int i = 0, leni = childExceptions.length; i < leni; i++) {
+ outer:
+ for (ResolvedType childException : childExceptions) {
// System.err.println("checking: " + childExceptions[i]);
- if (runtimeException.isAssignableFrom(childExceptions[i])) {
+ if (runtimeException.isAssignableFrom(childException)) {
continue;
}
- if (error.isAssignableFrom(childExceptions[i])) {
+ if (error.isAssignableFrom(childException)) {
continue;
}
- for (int j = 0, lenj = parentExceptions.length; j < lenj; j++) {
- if (parentExceptions[j].isAssignableFrom(childExceptions[i])) {
+ for (ResolvedType parentException : parentExceptions) {
+ if (parentException.isAssignableFrom(childException)) {
continue outer;
}
}
@@ -2439,9 +2435,9 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
}
private void addPointcutsResolvingConflicts(List<ResolvedMember> acc, List<ResolvedMember> added, boolean isOverriding) {
- for (Iterator<ResolvedMember> i = added.iterator(); i.hasNext();) {
- ResolvedPointcutDefinition toAdd = (ResolvedPointcutDefinition) i.next();
- for (Iterator<ResolvedMember> j = acc.iterator(); j.hasNext();) {
+ for (ResolvedMember resolvedMember : added) {
+ ResolvedPointcutDefinition toAdd = (ResolvedPointcutDefinition) resolvedMember;
+ for (Iterator<ResolvedMember> j = acc.iterator(); j.hasNext(); ) {
ResolvedPointcutDefinition existing = (ResolvedPointcutDefinition) j.next();
if (toAdd == null || existing == null || existing == toAdd) {
continue;
@@ -2527,8 +2523,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
return this;
}
boolean workToDo = false;
- for (int i = 0; i < typeParameters.length; i++) {
- if (typeParameters[i].isTypeVariableReference() || (typeParameters[i] instanceof BoundedReferenceType) || typeParameters[i].isParameterizedType()) {
+ for (UnresolvedType typeParameter : typeParameters) {
+ if (typeParameter.isTypeVariableReference() || (typeParameter instanceof BoundedReferenceType) || typeParameter.isParameterizedType()) {
workToDo = true;
}
}
@@ -2720,22 +2716,22 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
return false;
}
- for (int i = 0; i < typeParameters.length; i++) {
- ResolvedType aType = (ResolvedType) typeParameters[i];
+ for (UnresolvedType typeParameter : typeParameters) {
+ ResolvedType aType = (ResolvedType) typeParameter;
if (aType.isTypeVariableReference()
- // Changed according to the problems covered in bug 222648
- // Don't care what kind of type variable - the fact that there
- // is one
- // at all means we can't risk caching it against we get confused
- // later
- // by another variation of the parameterization that just
- // happens to
- // use the same type variable name
-
- // assume the worst - if its definetly not a type declared one,
- // it could be anything
- // && ((TypeVariableReference)aType).getTypeVariable().
- // getDeclaringElementKind()!=TypeVariable.TYPE
+ // Changed according to the problems covered in bug 222648
+ // Don't care what kind of type variable - the fact that there
+ // is one
+ // at all means we can't risk caching it against we get confused
+ // later
+ // by another variation of the parameterization that just
+ // happens to
+ // use the same type variable name
+
+ // assume the worst - if its definetly not a type declared one,
+ // it could be anything
+ // && ((TypeVariableReference)aType).getTypeVariable().
+ // getDeclaringElementKind()!=TypeVariable.TYPE
) {
parameterizedWithTypeVariable = FuzzyBoolean.YES;
return true;
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java
index cde7e5163..fc2b1d4d1 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java
@@ -350,11 +350,11 @@ public abstract class Shadow {
*/
public static int howMany(int i) {
int count = 0;
- for (int j = 0; j < SHADOW_KINDS.length; j++) {
- if ((i & SHADOW_KINDS[j].bit) != 0) {
- count++;
- }
- }
+ for (Kind shadowKind : SHADOW_KINDS) {
+ if ((i & shadowKind.bit) != 0) {
+ count++;
+ }
+ }
return count;
}
@@ -487,11 +487,11 @@ public abstract class Shadow {
*/
protected boolean checkMunger(ShadowMunger munger) {
if (munger.mustCheckExceptions()) {
- for (Iterator<ResolvedType> i = munger.getThrownExceptions().iterator(); i.hasNext();) {
- if (!checkCanThrow(munger, i.next())) {
- return false;
- }
- }
+ for (ResolvedType resolvedType : munger.getThrownExceptions()) {
+ if (!checkCanThrow(munger, resolvedType)) {
+ return false;
+ }
+ }
}
return true;
}
@@ -522,11 +522,11 @@ public abstract class Shadow {
private boolean isDeclaredException(ResolvedType resolvedTypeX, Member member) {
ResolvedType[] excs = getIWorld().resolve(member.getExceptions(getIWorld()));
- for (int i = 0, len = excs.length; i < len; i++) {
- if (excs[i].isAssignableFrom(resolvedTypeX)) {
- return true;
- }
- }
+ for (ResolvedType exc : excs) {
+ if (exc.isAssignableFrom(resolvedTypeX)) {
+ return true;
+ }
+ }
return false;
}
@@ -608,13 +608,12 @@ public abstract class Shadow {
}
}
}
- for (Iterator<String> iter = clashingAspects.iterator(); iter.hasNext();) {
- String element = iter.next();
- String aspect1 = element.substring(0, element.indexOf(":"));
- String aspect2 = element.substring(element.indexOf(":") + 1);
- getIWorld().getLint().unorderedAdviceAtShadow.signal(new String[] { this.toString(), aspect1, aspect2 },
- this.getSourceLocation(), null);
- }
+ for (String element : clashingAspects) {
+ String aspect1 = element.substring(0, element.indexOf(":"));
+ String aspect2 = element.substring(element.indexOf(":") + 1);
+ getIWorld().getLint().unorderedAdviceAtShadow.signal(new String[]{this.toString(), aspect1, aspect2},
+ this.getSourceLocation(), null);
+ }
}
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/SignatureUtils.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/SignatureUtils.java
index d32f7d99f..b88084a47 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/SignatureUtils.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/SignatureUtils.java
@@ -219,8 +219,8 @@ public class SignatureUtils {
if (types == null)
return "";
StringBuffer buf = new StringBuffer();
- for (int i = 0, len = types.length; i < len; i++) {
- buf.append(makeString(types[i]));
+ for (UnresolvedType type : types) {
+ buf.append(makeString(type));
buf.append(':');
}
return buf.toString();
@@ -230,8 +230,8 @@ public class SignatureUtils {
if (names == null)
return "";
StringBuffer buf = new StringBuffer();
- for (int i = 0, len = names.length; i < len; i++) {
- buf.append(names[i]);
+ for (String name : names) {
+ buf.append(name);
buf.append(':');
}
return buf.toString();
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/StandardAnnotation.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/StandardAnnotation.java
index 475b0977f..5c898552d 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/StandardAnnotation.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/StandardAnnotation.java
@@ -81,8 +81,7 @@ public class StandardAnnotation extends AbstractAnnotationAJ {
if (nvPairs == null) {
return false;
}
- for (int i = 0; i < nvPairs.size(); i++) {
- AnnotationNameValuePair pair = nvPairs.get(i);
+ for (AnnotationNameValuePair pair : nvPairs) {
if (pair.getName().equals(n)) {
return true;
}
@@ -97,8 +96,7 @@ public class StandardAnnotation extends AbstractAnnotationAJ {
if (nvPairs == null) {
return false;
}
- for (int i = 0; i < nvPairs.size(); i++) {
- AnnotationNameValuePair pair = nvPairs.get(i);
+ for (AnnotationNameValuePair pair : nvPairs) {
if (pair.getName().equals(n)) {
if (pair.getValue().stringify().equals(v)) {
return true;
@@ -119,8 +117,8 @@ public class StandardAnnotation extends AbstractAnnotationAJ {
ArrayAnnotationValue aav = (ArrayAnnotationValue) nvp.getValue();
AnnotationValue[] avs = aav.getValues();
Set<String> targets = new HashSet<String>();
- for (int i = 0; i < avs.length; i++) {
- EnumAnnotationValue value = (EnumAnnotationValue)avs[i];
+ for (AnnotationValue av : avs) {
+ EnumAnnotationValue value = (EnumAnnotationValue) av;
targets.add(value.getValue());
}
return targets;
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeFactory.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeFactory.java
index e565e5bc8..2a578e392 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeFactory.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeFactory.java
@@ -366,8 +366,8 @@ public class TypeFactory {
parameterizedSig.append(baseTypeSignature.substring(1, baseTypeSignature.length() - 1));
if (arguments.length > 0) {
parameterizedSig.append("<");
- for (int i = 0; i < arguments.length; i++) {
- parameterizedSig.append(arguments[i].getSignature());
+ for (UnresolvedType argument : arguments) {
+ parameterizedSig.append(argument.getSignature());
}
parameterizedSig.append(">");
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeVariable.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeVariable.java
index d67bbd8dc..d9bd8c50c 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeVariable.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeVariable.java
@@ -113,9 +113,9 @@ public class TypeVariable {
UnresolvedType declaring = (UnresolvedType) declaringElement;
ReferenceType rd = (ReferenceType) declaring.resolve(world);
TypeVariable[] tVars = rd.getTypeVariables();
- for (int i = 0; i < tVars.length; i++) {
- if (tVars[i].getName().equals(getName())) {
- resolvedTVar = tVars[i];
+ for (TypeVariable tVar : tVars) {
+ if (tVar.getName().equals(getName())) {
+ resolvedTVar = tVar;
break;
}
}
@@ -123,9 +123,9 @@ public class TypeVariable {
// look for type variable on method...
ResolvedMember declaring = (ResolvedMember) declaringElement;
TypeVariable[] tvrts = declaring.getTypeVariables();
- for (int i = 0; i < tvrts.length; i++) {
- if (tvrts[i].getName().equals(getName())) {
- resolvedTVar = tvrts[i];
+ for (TypeVariable tvrt : tvrts) {
+ if (tvrt.getName().equals(getName())) {
+ resolvedTVar = tvrt;
// if (tvrts[i].isTypeVariableReference()) {
// TypeVariableReferenceType tvrt = (TypeVariableReferenceType) tvrts[i].resolve(inSomeWorld);
// TypeVariable tv = tvrt.getTypeVariable();
@@ -187,8 +187,8 @@ public class TypeVariable {
return false;
}
// candidate is a subtype of all superInterfaces
- for (int i = 0; i < superInterfaces.length; i++) {
- if (!isASubtypeOf(superInterfaces[i], candidate)) {
+ for (UnresolvedType superInterface : superInterfaces) {
+ if (!isASubtypeOf(superInterface, candidate)) {
return false;
}
}
@@ -230,10 +230,10 @@ public class TypeVariable {
ret.append(" extends ");
ret.append(getFirstBound().getName());
if (superInterfaces != null) {
- for (int i = 0; i < superInterfaces.length; i++) {
- if (!getFirstBound().equals(superInterfaces[i])) {
+ for (UnresolvedType superInterface : superInterfaces) {
+ if (!getFirstBound().equals(superInterface)) {
ret.append(" & ");
- ret.append(superInterfaces[i].getName());
+ ret.append(superInterface.getName());
}
}
}
@@ -258,9 +258,9 @@ public class TypeVariable {
sb.append(superclass.getSignature());
}
if (superInterfaces.length != 0) {
- for (int i = 0; i < superInterfaces.length; i++) {
+ for (UnresolvedType superInterface : superInterfaces) {
sb.append(":");
- UnresolvedType iBound = superInterfaces[i];
+ UnresolvedType iBound = superInterface;
sb.append(iBound.getSignature());
}
}
@@ -278,9 +278,9 @@ public class TypeVariable {
sb.append(((ReferenceType)superclass).getSignatureForAttribute());
}
if (superInterfaces.length != 0) {
- for (int i = 0; i < superInterfaces.length; i++) {
+ for (UnresolvedType superInterface : superInterfaces) {
sb.append(":");
- ResolvedType iBound = (ResolvedType) superInterfaces[i];
+ ResolvedType iBound = (ResolvedType) superInterface;
sb.append(iBound.getSignatureForAttribute());
}
}
@@ -325,8 +325,7 @@ public class TypeVariable {
s.writeInt(0);
} else {
s.writeInt(superInterfaces.length);
- for (int i = 0; i < superInterfaces.length; i++) {
- UnresolvedType ibound = superInterfaces[i];
+ for (UnresolvedType ibound : superInterfaces) {
ibound.write(s);
}
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeVariableReferenceType.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeVariableReferenceType.java
index 1e867ab5e..43c3b5cdd 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeVariableReferenceType.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeVariableReferenceType.java
@@ -100,11 +100,11 @@ public class TypeVariableReferenceType extends ReferenceType implements TypeVari
typeVariable.resolve(world);
ResolvedType annotationType = ResolvedType.ANNOTATION.resolve(world);
UnresolvedType[] ifBounds = typeVariable.getSuperInterfaces();// AdditionalBounds();
- for (int i = 0; i < ifBounds.length; i++) {
- if (((ReferenceType) ifBounds[i]).isAnnotation()) {
+ for (UnresolvedType ifBound : ifBounds) {
+ if (((ReferenceType) ifBound).isAnnotation()) {
return true;
}
- if (ifBounds[i].equals(annotationType)) {
+ if (ifBound.equals(annotationType)) {
return true; // annotation itself does not have the annotation flag set in Java!
}
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/UnresolvedType.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/UnresolvedType.java
index 0be8e3900..155bc0955 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/UnresolvedType.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/UnresolvedType.java
@@ -875,12 +875,11 @@ public class UnresolvedType implements Traceable, TypeVariableDeclaringElement {
if (vars == null || vars.length == 0) {
return null;
}
- for (int i = 0; i < vars.length; i++) {
- TypeVariable aVar = vars[i];
- if (aVar.getName().equals(name)) {
- return aVar;
- }
- }
+ for (TypeVariable aVar : vars) {
+ if (aVar.getName().equals(name)) {
+ return aVar;
+ }
+ }
return null;
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Utils.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Utils.java
index 8053af0c0..501ffa418 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Utils.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Utils.java
@@ -25,12 +25,12 @@ public class Utils {
return false;
}
// Go through the annotation types on the advice
- for (int i = 0; i < anns.length; i++) {
- if (UnresolvedType.SUPPRESS_AJ_WARNINGS.getSignature().equals(anns[i].getTypeSignature())) {
+ for (AnnotationAJ ann : anns) {
+ if (UnresolvedType.SUPPRESS_AJ_WARNINGS.getSignature().equals(ann.getTypeSignature())) {
// Two possibilities:
// 1. there are no values specified (i.e. @SuppressAjWarnings)
// 2. there are values specified (i.e. @SuppressAjWarnings("A") or @SuppressAjWarnings({"A","B"})
- String value = anns[i].getStringFormOfValue("value");
+ String value = ann.getStringFormOfValue("value");
// Slightly lazy, just doing a string indexof
if (value == null || value.indexOf(lintkey) != -1) {
return true;
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPatternList.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPatternList.java
index 0b93b48d1..2cc737347 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPatternList.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPatternList.java
@@ -42,8 +42,8 @@ public class AnnotationPatternList extends PatternNode {
public AnnotationPatternList(AnnotationTypePattern[] arguments) {
this.typePatterns = arguments;
- for (int i = 0; i < arguments.length; i++) {
- if (arguments[i] == AnnotationTypePattern.ELLIPSIS) {
+ for (AnnotationTypePattern argument : arguments) {
+ if (argument == AnnotationTypePattern.ELLIPSIS) {
ellipsisCount++;
}
}
@@ -68,8 +68,8 @@ public class AnnotationPatternList extends PatternNode {
}
public void resolve(World inWorld) {
- for (int i = 0; i < typePatterns.length; i++) {
- typePatterns[i].resolve(inWorld);
+ for (AnnotationTypePattern typePattern : typePatterns) {
+ typePattern.resolve(inWorld);
}
}
@@ -85,11 +85,11 @@ public class AnnotationPatternList extends PatternNode {
// now work through the args and the patterns, skipping at ellipsis
FuzzyBoolean ret = FuzzyBoolean.YES;
int argsIndex = 0;
- for (int i = 0; i < typePatterns.length; i++) {
- if (typePatterns[i] == AnnotationTypePattern.ELLIPSIS) {
+ for (AnnotationTypePattern typePattern : typePatterns) {
+ if (typePattern == AnnotationTypePattern.ELLIPSIS) {
// match ellipsisMatchCount args
argsIndex += numArgsMatchedByEllipsis;
- } else if (typePatterns[i] == AnnotationTypePattern.ANY) {
+ } else if (typePattern == AnnotationTypePattern.ANY) {
argsIndex++;
} else {
// match the argument type at argsIndex with the ExactAnnotationTypePattern
@@ -97,7 +97,7 @@ public class AnnotationPatternList extends PatternNode {
if (someArgs[argsIndex].isPrimitiveType()) {
return FuzzyBoolean.NO; // can never match
}
- ExactAnnotationTypePattern ap = (ExactAnnotationTypePattern) typePatterns[i];
+ ExactAnnotationTypePattern ap = (ExactAnnotationTypePattern) typePattern;
FuzzyBoolean matches = ap.matchesRuntimeType(someArgs[argsIndex]);
if (matches == FuzzyBoolean.NO) {
return FuzzyBoolean.MAYBE; // could still match at runtime
@@ -175,8 +175,8 @@ public class AnnotationPatternList extends PatternNode {
public int hashCode() {
int result = 41;
- for (int i = 0, len = typePatterns.length; i < len; i++) {
- result = 37 * result + typePatterns[i].hashCode();
+ for (AnnotationTypePattern typePattern : typePatterns) {
+ result = 37 * result + typePattern.hashCode();
}
return result;
}
@@ -194,8 +194,8 @@ public class AnnotationPatternList extends PatternNode {
public void write(CompressingDataOutputStream s) throws IOException {
s.writeShort(typePatterns.length);
- for (int i = 0; i < typePatterns.length; i++) {
- typePatterns[i].write(s);
+ for (AnnotationTypePattern typePattern : typePatterns) {
+ typePattern.write(s);
}
writeLocation(s);
}
@@ -206,8 +206,8 @@ public class AnnotationPatternList extends PatternNode {
public Object traverse(PatternNodeVisitor visitor, Object data) {
Object ret = accept(visitor, data);
- for (int i = 0; i < typePatterns.length; i++) {
- typePatterns[i].traverse(visitor, ret);
+ for (AnnotationTypePattern typePattern : typePatterns) {
+ typePattern.traverse(visitor, ret);
}
return ret;
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPointcut.java
index e829d3772..2f70523cd 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPointcut.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPointcut.java
@@ -141,8 +141,8 @@ public class AnnotationPointcut extends NameBindingPointcut {
if (kind == Shadow.FieldGet || kind == Shadow.FieldSet) {
// FIXME asc should include supers with getInterTypeMungersIncludingSupers ?
List mungers = rMember.getDeclaringType().resolve(shadow.getIWorld()).getInterTypeMungers();
- for (Iterator iter = mungers.iterator(); iter.hasNext();) {
- ConcreteTypeMunger typeMunger = (ConcreteTypeMunger) iter.next();
+ for (Object munger : mungers) {
+ ConcreteTypeMunger typeMunger = (ConcreteTypeMunger) munger;
if (typeMunger.getMunger() instanceof NewFieldTypeMunger) {
ResolvedMember fakerm = typeMunger.getSignature();
if (fakerm.equals(member)) {
@@ -162,8 +162,7 @@ public class AnnotationPointcut extends NameBindingPointcut {
private ResolvedMember findMethod(ResolvedType aspectType, ResolvedMember ajcMethod) {
ResolvedMember decMethods[] = aspectType.getDeclaredMethods();
- for (int i = 0; i < decMethods.length; i++) {
- ResolvedMember member = decMethods[i];
+ for (ResolvedMember member : decMethods) {
if (member.equals(ajcMethod)) {
return member;
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java
index db612b8cd..f7351b5d7 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java
@@ -182,9 +182,9 @@ public class ArgsAnnotationPointcut extends NameBindingPointcut {
public List<BindingPattern> getBindingAnnotationTypePatterns() {
List<BindingPattern> l = new ArrayList<BindingPattern>();
AnnotationTypePattern[] pats = arguments.getAnnotationPatterns();
- for (int i = 0; i < pats.length; i++) {
- if (pats[i] instanceof BindingAnnotationTypePattern) {
- l.add((BindingPattern)pats[i]);
+ for (AnnotationTypePattern pat : pats) {
+ if (pat instanceof BindingAnnotationTypePattern) {
+ l.add((BindingPattern) pat);
}
}
return l;
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsPointcut.java
index 56b1a4dc5..98c78d54d 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsPointcut.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsPointcut.java
@@ -89,8 +89,8 @@ public class ArgsPointcut extends NameBindingPointcut {
// want to ignore.
if (shadow.getKind() == Shadow.AdviceExecution) {
int numExtraArgs = 0;
- for (int i = 0; i < argumentsToMatchAgainst.length; i++) {
- String argumentSignature = argumentsToMatchAgainst[i].getSignature();
+ for (ResolvedType resolvedType : argumentsToMatchAgainst) {
+ String argumentSignature = resolvedType.getSignature();
if (argumentSignature.startsWith(ASPECTJ_JP_SIGNATURE_PREFIX)
|| argumentSignature.startsWith(ASPECTJ_SYNTHETIC_SIGNATURE_PREFIX)) {
numExtraArgs++;
@@ -124,9 +124,9 @@ public class ArgsPointcut extends NameBindingPointcut {
public List<BindingTypePattern> getBindingTypePatterns() {
List<BindingTypePattern> l = new ArrayList<BindingTypePattern>();
TypePattern[] pats = arguments.getTypePatterns();
- for (int i = 0; i < pats.length; i++) {
- if (pats[i] instanceof BindingTypePattern) {
- l.add((BindingTypePattern)pats[i]);
+ for (TypePattern pat : pats) {
+ if (pat instanceof BindingTypePattern) {
+ l.add((BindingTypePattern) pat);
}
}
return l;
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/Bindings.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/Bindings.java
index 4853dd049..3b095c467 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/Bindings.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/Bindings.java
@@ -97,9 +97,9 @@ public class Bindings {
public UnresolvedType[] getUsedFormalTypes() {
UnresolvedType[] ret = new UnresolvedType[bindings.length];
int index = 0;
- for (int i = 0, len = bindings.length; i < len; i++) {
- if (bindings[i] != null) {
- ret[index++] = ((BindingTypePattern) bindings[i]).getExactType();
+ for (BindingPattern binding : bindings) {
+ if (binding != null) {
+ ret[index++] = ((BindingTypePattern) binding).getExactType();
}
}
UnresolvedType[] newRet = new UnresolvedType[index];
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactAnnotationFieldTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactAnnotationFieldTypePattern.java
index 627b622eb..bef0d145c 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactAnnotationFieldTypePattern.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactAnnotationFieldTypePattern.java
@@ -106,8 +106,7 @@ public class ExactAnnotationFieldTypePattern extends ExactAnnotationTypePattern
ResolvedMember[] annotationFields = theAnnotationType.getDeclaredMethods();
field = null;
boolean looksAmbiguous = false;
- for (int i = 0; i < annotationFields.length; i++) {
- ResolvedMember resolvedMember = annotationFields[i];
+ for (ResolvedMember resolvedMember : annotationFields) {
if (resolvedMember.getReturnType().equals(formalBinding.getType())) {
if (field != null) {
boolean haveProblem = true;
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java
index b51d72df9..8105a4f1d 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java
@@ -220,11 +220,11 @@ public class ExactAnnotationTypePattern extends AnnotationTypePattern {
if (parameterAnnotations == null) {
return FuzzyBoolean.NO;
}
- for (int i = 0; i < parameterAnnotations.length; i++) {
- if (annotationType.equals(parameterAnnotations[i])) {
+ for (ResolvedType parameterAnnotation : parameterAnnotations) {
+ if (annotationType.equals(parameterAnnotation)) {
// Are we also matching annotation values?
if (annotationValues != null) {
- parameterAnnotations[i]
+ parameterAnnotation
.getWorld()
.getMessageHandler()
.handleMessage(
@@ -383,8 +383,7 @@ public class ExactAnnotationTypePattern extends AnnotationTypePattern {
} else {
s.writeInt(annotationValues.size());
Set<String> key = annotationValues.keySet();
- for (Iterator<String> keys = key.iterator(); keys.hasNext();) {
- String k = keys.next();
+ for (String k : key) {
s.writeUTF(k);
s.writeUTF(annotationValues.get(k));
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExposedState.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExposedState.java
index 2a9807118..8ff7849af 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExposedState.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExposedState.java
@@ -53,8 +53,8 @@ public class ExposedState {
}
public boolean isFullySetUp() {
- for (int i = 0; i < vars.length; i++) {
- if (vars[i] == null)
+ for (Var var : vars) {
+ if (var == null)
return false;
}
return true;
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/HasMemberTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/HasMemberTypePattern.java
index 2b1f28fd4..c84cf3eee 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/HasMemberTypePattern.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/HasMemberTypePattern.java
@@ -104,8 +104,7 @@ public class HasMemberTypePattern extends TypePattern {
}
// try itds before we give up (this doesnt find annotations - the signature returned may not include them)
List<ConcreteTypeMunger> mungers = type.getInterTypeMungersIncludingSupers();
- for (Iterator<ConcreteTypeMunger> iter = mungers.iterator(); iter.hasNext();) {
- ConcreteTypeMunger munger = iter.next();
+ for (ConcreteTypeMunger munger : mungers) {
Member member = munger.getSignature();
if (signaturePattern.matches(member, type.getWorld(), false)) {
if (!Modifier.isPublic(member.getModifiers())) {
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NamePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NamePattern.java
index 561b99197..52331d13e 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NamePattern.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NamePattern.java
@@ -32,8 +32,8 @@ public class NamePattern extends PatternNode {
public NamePattern(char[] pattern) {
this.pattern = pattern;
- for (int i = 0, len = pattern.length; i < len; i++) {
- if (pattern[i] == '*') {
+ for (char c : pattern) {
+ if (c == '*') {
starCount++;
}
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PointcutRewriter.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PointcutRewriter.java
index 81ff33bab..72e552ab4 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PointcutRewriter.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PointcutRewriter.java
@@ -330,8 +330,7 @@ public class PointcutRewriter {
SortedSet<Pointcut> nodes = new TreeSet<Pointcut>(new PointcutEvaluationExpenseComparator());
collectAndNodes(apc, nodes);
// look for A and !A, or IfFalse
- for (Iterator<Pointcut> iter = nodes.iterator(); iter.hasNext();) {
- Pointcut element = iter.next();
+ for (Pointcut element : nodes) {
if (element instanceof NotPointcut) {
Pointcut body = ((NotPointcut) element).getNegatedPointcut();
if (nodes.contains(body)) {
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SignaturePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SignaturePattern.java
index 365b5b7a7..4541d1579 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SignaturePattern.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SignaturePattern.java
@@ -140,8 +140,7 @@ public class SignaturePattern extends PatternNode implements ISignaturePattern {
patternNode.traverse(visitor, null);
if (visitor.containedIncorrectTargetKind()) {
Set<ExactAnnotationTypePattern> keys = visitor.getIncorrectTargetKinds().keySet();
- for (Iterator<ExactAnnotationTypePattern> iter = keys.iterator(); iter.hasNext();) {
- PatternNode node = iter.next();
+ for (PatternNode node : keys) {
AnnotationTargetKind[] targetKinds = visitor.getIncorrectTargetKinds().get(node);
reportUnmatchedTargetKindMessage(targetKinds, node, scope, false);
}
@@ -208,12 +207,12 @@ public class SignaturePattern extends PatternNode implements ISignaturePattern {
return data;
}
List<AnnotationTargetKind> incorrectTargets = new ArrayList<AnnotationTargetKind>();
- for (int i = 0; i < targetKinds.length; i++) {
- if (targetKinds[i].getName().equals(kind.getName())
- || (targetKinds[i].getName().equals("PARAMETER") && node.isForParameterAnnotationMatch())) {
+ for (AnnotationTargetKind targetKind : targetKinds) {
+ if (targetKind.getName().equals(kind.getName())
+ || (targetKind.getName().equals("PARAMETER") && node.isForParameterAnnotationMatch())) {
return data;
}
- incorrectTargets.add(targetKinds[i]);
+ incorrectTargets.add(targetKind);
}
if (incorrectTargets.isEmpty()) {
return data;
@@ -227,8 +226,7 @@ public class SignaturePattern extends PatternNode implements ISignaturePattern {
}
// exception here is if parameter annotations are allowed
if (parameterTargettingAnnotationsAllowed) {
- for (int i = 0; i < targetKinds.length; i++) {
- AnnotationTargetKind annotationTargetKind = targetKinds[i];
+ for (AnnotationTargetKind annotationTargetKind : targetKinds) {
if (annotationTargetKind.getName().equals("PARAMETER") && node.isForParameterAnnotationMatch()) {
return data;
}
@@ -724,8 +722,7 @@ public class SignaturePattern extends PatternNode implements ISignaturePattern {
private ResolvedMember findMethod(ResolvedType aspectType, ResolvedMember ajcMethod) {
ResolvedMember decMethods[] = aspectType.getDeclaredMethods();
- for (int i = 0; i < decMethods.length; i++) {
- ResolvedMember member = decMethods[i];
+ for (ResolvedMember member : decMethods) {
if (member.equals(ajcMethod)) {
return member;
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SimpleScope.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SimpleScope.java
index 119103d84..1dfe1f6ec 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SimpleScope.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SimpleScope.java
@@ -40,8 +40,7 @@ public class SimpleScope implements IScope {
}
public UnresolvedType lookupType(String name, IHasPosition location) {
- for (int i = 0; i < importedNames.length; i++) {
- String importedName = importedNames[i];
+ for (String importedName : importedNames) {
// make sure we're matching against the type name rather than part of it
// if (importedName.endsWith("." + name)) {
if (importedName.endsWith(name)) {
@@ -104,9 +103,9 @@ public class SimpleScope implements IScope {
}
public FormalBinding lookupFormal(String name) {
- for (int i = 0, len = bindings.length; i < len; i++) {
- if (bindings[i].getName().equals(name)) {
- return bindings[i];
+ for (FormalBinding binding : bindings) {
+ if (binding.getName().equals(name)) {
+ return binding;
}
}
return null;
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternList.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternList.java
index da9d6e15a..040d6dbe2 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternList.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternList.java
@@ -51,8 +51,8 @@ public class TypePatternList extends PatternNode {
public TypePatternList(TypePattern[] arguments) {
this.typePatterns = arguments;
- for (int i = 0; i < arguments.length; i++) {
- if (arguments[i] == TypePattern.ELLIPSIS) {
+ for (TypePattern argument : arguments) {
+ if (argument == TypePattern.ELLIPSIS) {
ellipsisCount++;
}
}
@@ -452,8 +452,7 @@ public class TypePatternList extends PatternNode {
}
public void postRead(ResolvedType enclosingType) {
- for (int i = 0; i < typePatterns.length; i++) {
- TypePattern p = typePatterns[i];
+ for (TypePattern p : typePatterns) {
p.postRead(enclosingType);
}
}
@@ -479,8 +478,8 @@ public class TypePatternList extends PatternNode {
@Override
public int hashCode() {
int result = 41;
- for (int i = 0, len = typePatterns.length; i < len; i++) {
- result = 37 * result + typePatterns[i].hashCode();
+ for (TypePattern typePattern : typePatterns) {
+ result = 37 * result + typePattern.hashCode();
}
return result;
}
@@ -521,8 +520,8 @@ public class TypePatternList extends PatternNode {
@Override
public void write(CompressingDataOutputStream s) throws IOException {
s.writeShort(typePatterns.length);
- for (int i = 0; i < typePatterns.length; i++) {
- typePatterns[i].write(s);
+ for (TypePattern typePattern : typePatterns) {
+ typePattern.write(s);
}
// writeLocation(s);
}
@@ -533,8 +532,8 @@ public class TypePatternList extends PatternNode {
public List<UnresolvedType> getExactTypes() {
List<UnresolvedType> ret = new ArrayList<UnresolvedType>();
- for (int i = 0; i < typePatterns.length; i++) {
- UnresolvedType t = typePatterns[i].getExactType();
+ for (TypePattern typePattern : typePatterns) {
+ UnresolvedType t = typePattern.getExactType();
if (!ResolvedType.isMissing(t)) {
ret.add(t);
}
@@ -550,15 +549,14 @@ public class TypePatternList extends PatternNode {
@Override
public Object traverse(PatternNodeVisitor visitor, Object data) {
Object ret = accept(visitor, data);
- for (int i = 0; i < typePatterns.length; i++) {
- typePatterns[i].traverse(visitor, ret);
+ for (TypePattern typePattern : typePatterns) {
+ typePattern.traverse(visitor, ret);
}
return ret;
}
public boolean areAllExactWithNoSubtypesAllowed() {
- for (int i = 0; i < typePatterns.length; i++) {
- TypePattern array_element = typePatterns[i];
+ for (TypePattern array_element : typePatterns) {
if (!(array_element instanceof ExactTypePattern)) {
return false;
} else {
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternQuestions.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternQuestions.java
index d4bdf2e58..8289d306e 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternQuestions.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternQuestions.java
@@ -37,11 +37,10 @@ public class TypePatternQuestions {
}
public Question anyChanges() {
- for (Iterator<Map.Entry<Question,FuzzyBoolean>> i = questionsAndAnswers.entrySet().iterator(); i.hasNext(); ) {
- Map.Entry<Question,FuzzyBoolean> entry = i.next();
- Question question = (Question)entry.getKey();
- FuzzyBoolean expectedAnswer = (FuzzyBoolean)entry.getValue();
-
+ for (Map.Entry<Question, FuzzyBoolean> entry : questionsAndAnswers.entrySet()) {
+ Question question = (Question) entry.getKey();
+ FuzzyBoolean expectedAnswer = (FuzzyBoolean) entry.getValue();
+
FuzzyBoolean currentAnswer = question.ask();
//System.out.println(question + ":" + currentAnswer);
if (currentAnswer != expectedAnswer) {
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypeVariablePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypeVariablePattern.java
index c2d4bd0ec..57377abb5 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypeVariablePattern.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypeVariablePattern.java
@@ -163,8 +163,8 @@ public class TypeVariablePattern extends PatternNode {
hashCode = hashCode * 37 + lowerBound.hashCode();
}
if (interfaceBounds != null) {
- for (int i = 0; i < interfaceBounds.length; i++) {
- hashCode = 37 * hashCode + interfaceBounds[i].hashCode();
+ for (TypePattern interfaceBound : interfaceBounds) {
+ hashCode = 37 * hashCode + interfaceBound.hashCode();
}
}
return hashCode;
@@ -207,8 +207,8 @@ public class TypeVariablePattern extends PatternNode {
s.writeInt(0);
} else {
s.writeInt(interfaceBounds.length);
- for (int i = 0; i < interfaceBounds.length; i++) {
- interfaceBounds[i].write(s);
+ for (TypePattern interfaceBound : interfaceBounds) {
+ interfaceBound.write(s);
}
}
s.writeBoolean(hasLowerBound());
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypeVariablePatternList.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypeVariablePatternList.java
index 7bbe67872..85dca44b4 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypeVariablePatternList.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypeVariablePatternList.java
@@ -35,9 +35,9 @@ public class TypeVariablePatternList extends PatternNode {
}
public TypeVariablePattern lookupTypeVariable(String name) {
- for (int i = 0; i < patterns.length; i++) {
- if (patterns[i].getName().equals(name)) {
- return patterns[i];
+ for (TypeVariablePattern pattern : patterns) {
+ if (pattern.getName().equals(name)) {
+ return pattern;
}
}
return null;
@@ -49,8 +49,8 @@ public class TypeVariablePatternList extends PatternNode {
public void write(CompressingDataOutputStream s) throws IOException {
s.writeInt(patterns.length);
- for (int i = 0; i < patterns.length; i++) {
- patterns[i].write(s);
+ for (TypeVariablePattern pattern : patterns) {
+ pattern.write(s);
}
writeLocation(s);
}
@@ -75,8 +75,8 @@ public class TypeVariablePatternList extends PatternNode {
public Object traverse(PatternNodeVisitor visitor, Object data) {
Object ret = accept(visitor, data);
- for (int i = 0; i < patterns.length; i++) {
- patterns[i].traverse(visitor, ret);
+ for (TypeVariablePattern pattern : patterns) {
+ pattern.traverse(visitor, ret);
}
return ret;
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
index 0941462d1..35f2dc674 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
@@ -93,8 +93,7 @@ public class WildAnnotationTypePattern extends AnnotationTypePattern {
}
String v = annotationValues.get(k);
boolean validKey = false;
- for (int i = 0; i < ms.length; i++) {
- ResolvedMember resolvedMember = ms[i];
+ for (ResolvedMember resolvedMember : ms) {
if (resolvedMember.getName().equals(key) && resolvedMember.isAbstract()) {
validKey = true;
ResolvedType t = resolvedMember.getReturnType().resolve(scope.getWorld());
@@ -239,8 +238,8 @@ public class WildAnnotationTypePattern extends AnnotationTypePattern {
// }
// replacementValues.put(k, rt.getSignature());
} else {
- scope.message(MessageUtil.error(WeaverMessages.format(WeaverMessages.UNSUPPORTED_ANNOTATION_VALUE_TYPE,t), getSourceLocation()));
- replacementValues.put(k,"");
+ scope.message(MessageUtil.error(WeaverMessages.format(WeaverMessages.UNSUPPORTED_ANNOTATION_VALUE_TYPE, t), getSourceLocation()));
+ replacementValues.put(k, "");
}
}
}
@@ -265,8 +264,8 @@ public class WildAnnotationTypePattern extends AnnotationTypePattern {
}
if (isForParameterAnnotationMatch()) {
if (parameterAnnotations != null && parameterAnnotations.length != 0) {
- for (int i = 0; i < parameterAnnotations.length; i++) {
- if (typePattern.matches(parameterAnnotations[i], TypePattern.STATIC).alwaysTrue()) {
+ for (ResolvedType parameterAnnotation : parameterAnnotations) {
+ if (typePattern.matches(parameterAnnotation, TypePattern.STATIC).alwaysTrue()) {
return FuzzyBoolean.YES;
}
}
@@ -276,8 +275,8 @@ public class WildAnnotationTypePattern extends AnnotationTypePattern {
// matched by the typePattern.
ResolvedType[] annTypes = annotated.getAnnotationTypes();
if (annTypes != null && annTypes.length != 0) {
- for (int i = 0; i < annTypes.length; i++) {
- if (typePattern.matches(annTypes[i], TypePattern.STATIC).alwaysTrue()) {
+ for (ResolvedType annType : annTypes) {
+ if (typePattern.matches(annType, TypePattern.STATIC).alwaysTrue()) {
return FuzzyBoolean.YES;
}
}
@@ -368,8 +367,7 @@ public class WildAnnotationTypePattern extends AnnotationTypePattern {
} else {
s.writeInt(annotationValues.size());
Set<String> key = annotationValues.keySet();
- for (Iterator<String> keys = key.iterator(); keys.hasNext();) {
- String k = keys.next();
+ for (String k : key) {
s.writeUTF(k);
s.writeUTF(annotationValues.get(k));
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java
index 9081c5c02..3dad2ce6b 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java
@@ -101,8 +101,8 @@ public class WildTypePattern extends TypePattern {
this.namePatterns = namePatterns;
this.dim = dim;
ellipsisCount = 0;
- for (int i = 0; i < namePatterns.length; i++) {
- if (namePatterns[i] == NamePattern.ELLIPSIS) {
+ for (NamePattern namePattern : namePatterns) {
+ if (namePattern == NamePattern.ELLIPSIS) {
ellipsisCount++;
}
}
@@ -341,14 +341,13 @@ public class WildTypePattern extends TypePattern {
// we've already ruled out "*", and no other name pattern should match an anonymous type
return false;
}
- for (int i = 0, len = knownMatches.length; i < len; i++) {
- if (knownMatches[i].equals(targetTypeName)) {
+ for (String knownMatch : knownMatches) {
+ if (knownMatch.equals(targetTypeName)) {
return true;
}
}
} else {
- for (int i = 0, len = knownMatches.length; i < len; i++) {
- String knownMatch = knownMatches[i];
+ for (String knownMatch : knownMatches) {
// String knownPrefix = knownMatches[i] + "$";
// if (targetTypeName.startsWith(knownPrefix)) {
if (targetTypeName.startsWith(knownMatch) && targetTypeName.length() > knownMatch.length()
@@ -363,8 +362,7 @@ public class WildTypePattern extends TypePattern {
// if any prefixes match, strip the prefix and check that the rest matches
// assumes that prefixes have a dot at the end
- for (int i = 0, len = importedPrefixes.length; i < len; i++) {
- String prefix = importedPrefixes[i];
+ for (String prefix : importedPrefixes) {
// System.err.println("prefix match? " + prefix + " to " + targetTypeName);
if (targetTypeName.startsWith(prefix)) {
@@ -965,8 +963,8 @@ public class WildTypePattern extends TypePattern {
canCreateExactTypePattern = false;
}
if (additionalInterfaceBounds != null) {
- for (int i = 0; i < additionalInterfaceBounds.length; i++) {
- if (ResolvedType.isMissing(additionalInterfaceBounds[i].getExactType())) {
+ for (TypePattern additionalInterfaceBound : additionalInterfaceBounds) {
+ if (ResolvedType.isMissing(additionalInterfaceBound.getExactType())) {
canCreateExactTypePattern = false;
}
}
@@ -1012,9 +1010,9 @@ public class WildTypePattern extends TypePattern {
int minRequiredTypeParameters = typeParameters.size();
boolean foundEllipsis = false;
TypePattern[] typeParamPatterns = typeParameters.getTypePatterns();
- for (int i = 0; i < typeParamPatterns.length; i++) {
- if (typeParamPatterns[i] instanceof WildTypePattern) {
- WildTypePattern wtp = (WildTypePattern) typeParamPatterns[i];
+ for (TypePattern typeParamPattern : typeParamPatterns) {
+ if (typeParamPattern instanceof WildTypePattern) {
+ WildTypePattern wtp = (WildTypePattern) typeParamPattern;
if (wtp.ellipsisCount > 0) {
foundEllipsis = true;
minRequiredTypeParameters--;
@@ -1160,16 +1158,16 @@ public class WildTypePattern extends TypePattern {
// if (namePatterns.length != 1) return CollectionUtil.NO_STRINGS;
List<String> ret = new ArrayList<String>();
- for (int i = 0, len = possibleMatches.length; i < len; i++) {
- char[][] names = splitNames(possibleMatches[i], true); // ??? not most efficient
+ for (String possibleMatch : possibleMatches) {
+ char[][] names = splitNames(possibleMatch, true); // ??? not most efficient
if (namePatterns[0].matches(names[names.length - 1])) {
- ret.add(possibleMatches[i]);
+ ret.add(possibleMatch);
continue;
}
- if (possibleMatches[i].indexOf("$") != -1) {
- names = splitNames(possibleMatches[i], false); // ??? not most efficient
+ if (possibleMatch.indexOf("$") != -1) {
+ names = splitNames(possibleMatch, false); // ??? not most efficient
if (namePatterns[0].matches(names[names.length - 1])) {
- ret.add(possibleMatches[i]);
+ ret.add(possibleMatch);
}
}
}
@@ -1282,8 +1280,8 @@ public class WildTypePattern extends TypePattern {
@Override
public int hashCode() {
int result = 17;
- for (int i = 0, len = namePatterns.length; i < len; i++) {
- result = 37 * result + namePatterns[i].hashCode();
+ for (NamePattern namePattern : namePatterns) {
+ result = 37 * result + namePattern.hashCode();
}
result = 37 * result + annotationPattern.hashCode();
if (upperBound != null) {
@@ -1302,8 +1300,8 @@ public class WildTypePattern extends TypePattern {
s.writeByte(TypePattern.WILD);
s.writeByte(VERSION);
s.writeShort(namePatterns.length);
- for (int i = 0; i < namePatterns.length; i++) {
- namePatterns[i].write(s);
+ for (NamePattern namePattern : namePatterns) {
+ namePattern.write(s);
}
s.writeBoolean(includeSubtypes);
s.writeInt(dim);
@@ -1327,8 +1325,8 @@ public class WildTypePattern extends TypePattern {
}
s.writeInt(additionalInterfaceBounds == null ? 0 : additionalInterfaceBounds.length);
if (additionalInterfaceBounds != null) {
- for (int i = 0; i < additionalInterfaceBounds.length; i++) {
- additionalInterfaceBounds[i].write(s);
+ for (TypePattern additionalInterfaceBound : additionalInterfaceBounds) {
+ additionalInterfaceBound.write(s);
}
}
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/StandardPointcutParser.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/StandardPointcutParser.java
index e549325af..afc14188d 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/StandardPointcutParser.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/StandardPointcutParser.java
@@ -149,8 +149,8 @@ public class StandardPointcutParser {
*/
private StandardPointcutParser(Set/* <PointcutPrimitives> */supportedPointcutKinds, World world) {
supportedPrimitives = supportedPointcutKinds;
- for (Iterator iter = supportedPointcutKinds.iterator(); iter.hasNext();) {
- PointcutPrimitive element = (PointcutPrimitive) iter.next();
+ for (Object supportedPointcutKind : supportedPointcutKinds) {
+ PointcutPrimitive element = (PointcutPrimitive) supportedPointcutKind;
if ((element == PointcutPrimitive.IF) || (element == PointcutPrimitive.CFLOW)
|| (element == PointcutPrimitive.CFLOW_BELOW)) {
throw new UnsupportedOperationException("Cannot handle if, cflow, and cflowbelow primitives");