aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.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/org/aspectj/weaver/CrosscuttingMembers.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/org/aspectj/weaver/CrosscuttingMembers.java')
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.java23
1 files changed, 9 insertions, 14 deletions
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())) {