]> source.dussan.org Git - aspectj.git/commitdiff
polish
authorAndy Clement <aclement@pivotal.io>
Fri, 16 Dec 2016 23:47:55 +0000 (15:47 -0800)
committerAndy Clement <aclement@pivotal.io>
Fri, 16 Dec 2016 23:47:55 +0000 (15:47 -0800)
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java

index d534405daccc9b72f00c348a5b4be79078e28a18..1a66c72b3388ad185705bfe20295998e5f586f2b 100644 (file)
@@ -697,8 +697,7 @@ public class BcelWeaver {
        // if numFormals > 0 then every branch of a disjunction must bind each
        // formal once and only once.
        // in addition, the left and right branches of a disjunction must hold on
-       // join point kinds in
-       // common.
+       // join point kinds in common.
        private void validateBindings(Pointcut dnfPointcut, Pointcut userPointcut, int numFormals, String[] names) {
                if (numFormals == 0) {
                        return; // nothing to check
@@ -740,8 +739,7 @@ public class BcelWeaver {
                int kindsInCommon = left.couldMatchKinds() & right.couldMatchKinds();
                if (kindsInCommon != Shadow.NO_SHADOW_KINDS_BITS && couldEverMatchSameJoinPoints(left, right)) {
                        // we know that every branch binds every formal, so there is no
-                       // ambiguity
-                       // if each branch binds it in exactly the same way...
+                       // ambiguity if each branch binds it in exactly the same way...
                        List<String> ambiguousNames = new ArrayList<String>();
                        for (int i = 0; i < numFormals; i++) {
                                if (leftBindings[i] == null) {
@@ -802,10 +800,9 @@ public class BcelWeaver {
                        validateSingleBranchRecursion(and.getLeft(), userPointcut, foundFormals, names, bindings);
                        validateSingleBranchRecursion(and.getRight(), userPointcut, foundFormals, names, bindings);
                } else if (pc instanceof NameBindingPointcut) {
-                       List/* BindingTypePattern */btps = ((NameBindingPointcut) pc).getBindingTypePatterns();
-                       for (Iterator iter = btps.iterator(); iter.hasNext();) {
-                               BindingTypePattern btp = (BindingTypePattern) iter.next();
-                               int index = btp.getFormalIndex();
+                       List<BindingTypePattern> bindingTypePatterns = ((NameBindingPointcut) pc).getBindingTypePatterns();
+                       for (BindingTypePattern bindingTypePattern: bindingTypePatterns) {
+                               int index = bindingTypePattern.getFormalIndex();
                                bindings[index] = pc;
                                if (foundFormals[index]) {
                                        raiseAmbiguousBindingError(names[index], userPointcut);
@@ -813,10 +810,9 @@ public class BcelWeaver {
                                        foundFormals[index] = true;
                                }
                        }
-                       List/* BindingPattern */baps = ((NameBindingPointcut) pc).getBindingAnnotationTypePatterns();
-                       for (Iterator iter = baps.iterator(); iter.hasNext();) {
-                               BindingPattern bap = (BindingPattern) iter.next();
-                               int index = bap.getFormalIndex();
+                       List<BindingPattern> bindingAnnotationTypePatterns = ((NameBindingPointcut) pc).getBindingAnnotationTypePatterns();
+                       for (BindingPattern bindingAnnotationTypePattern: bindingAnnotationTypePatterns) {
+                               int index = bindingAnnotationTypePattern.getFormalIndex();
                                bindings[index] = pc;
                                if (foundFormals[index]) {
                                        raiseAmbiguousBindingError(names[index], userPointcut);
@@ -912,13 +908,9 @@ public class BcelWeaver {
                                .getSourceContext().makeSourceLocation(userPointcut), null);
        }
 
-       /**
-        * @param name
-        * @param userPointcut
-        */
-       private void raiseAmbiguousBindingError(String name, Pointcut userPointcut) {
-               world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.AMBIGUOUS_BINDING, name), userPointcut
-                               .getSourceContext().makeSourceLocation(userPointcut), null);
+       private void raiseAmbiguousBindingError(String name, Pointcut pointcut) {
+               world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.AMBIGUOUS_BINDING, name), pointcut
+                               .getSourceContext().makeSourceLocation(pointcut), null);
        }
 
        /**