]> source.dussan.org Git - aspectj.git/commitdiff
more generics and missing @Overrides
authorAndy Clement <aclement@pivotal.io>
Wed, 14 Feb 2018 20:54:11 +0000 (12:54 -0800)
committerAndy Clement <aclement@pivotal.io>
Wed, 14 Feb 2018 20:54:11 +0000 (12:54 -0800)
weaver/testsrc/org/aspectj/weaver/bcel/ArgsWeaveTestCase.java
weaver/testsrc/org/aspectj/weaver/bcel/AroundWeaveTestCase.java
weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java

index 8e7f72f4fd94deeb649011171f3f0177023bd671..1108c35743081144289913cbfa202057609613bb 100644 (file)
@@ -22,11 +22,11 @@ import org.aspectj.apache.bcel.generic.InstructionFactory;
 import org.aspectj.apache.bcel.generic.InstructionHandle;
 import org.aspectj.apache.bcel.generic.InstructionList;
 import org.aspectj.apache.bcel.generic.Type;
-import org.aspectj.weaver.Advice;
 import org.aspectj.weaver.AdviceKind;
 import org.aspectj.weaver.MemberImpl;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.Shadow;
+import org.aspectj.weaver.ShadowMunger;
 import org.aspectj.weaver.UnresolvedType;
 
 /**.
@@ -55,7 +55,7 @@ public class ArgsWeaveTestCase extends WeaveTestCase {
     }  
 
     public void testLots() throws IOException {
-        List<Advice> l = new ArrayList();
+        List<ShadowMunger> l = new ArrayList<>();
         
         BcelAdvice p1 = 
             makeArgsMunger("before");
@@ -104,11 +104,13 @@ public class ArgsWeaveTestCase extends WeaveTestCase {
         return new BcelAdvice(AdviceKind.stringToKind(kindx), makePointcutNoZeroArg(),
                                MemberImpl.method(UnresolvedType.forName("Aspect"), 0, "foo", "()V"), 0, -1, -1, null,
                                rtx) {
-            public void specializeOn(Shadow shadow) {
+            @Override
+                       public void specializeOn(Shadow shadow) {
                 super.specializeOn(shadow);
                 shadow.getArgVar(0);
             }
-            public InstructionList getAdviceInstructions(BcelShadow shadow, BcelVar extraVar, InstructionHandle fk) {
+            @Override
+                       public InstructionList getAdviceInstructions(BcelShadow shadow, BcelVar extraVar, InstructionHandle fk) {
                 return getArgsAdviceTag(shadow, kindx);
             }
         };     
index 5f8412c2575cbe61d6dfb237d0174f8e86977e38..a9d1fe9b422bbf118205acaf564436f0883ff380 100644 (file)
@@ -15,9 +15,15 @@ package org.aspectj.weaver.bcel;
 
 import java.io.IOException;
 import java.lang.reflect.Modifier;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
 
-import org.aspectj.weaver.*;
+import org.aspectj.weaver.AdviceKind;
+import org.aspectj.weaver.Member;
+import org.aspectj.weaver.MemberImpl;
+import org.aspectj.weaver.Shadow;
+import org.aspectj.weaver.ShadowMunger;
+import org.aspectj.weaver.UnresolvedType;
 
 public class AroundWeaveTestCase extends WeaveTestCase {
        {
@@ -59,7 +65,8 @@ public class AroundWeaveTestCase extends WeaveTestCase {
                matchOnlyPrintln ? makePointcutPrintln() : makePointcutAll(),
                sig, 0, -1, -1, null, UnresolvedType.forName("Aspect").resolve(world))
            {
-            public void specializeOn(Shadow s) {
+            @Override
+                       public void specializeOn(Shadow s) {
                super.specializeOn(s);
                 ((BcelShadow) s).initializeForAroundClosure();
             }
@@ -74,7 +81,7 @@ public class AroundWeaveTestCase extends WeaveTestCase {
             throws IOException 
     {
                 
-        List l = new ArrayList();
+        List<ShadowMunger> l = new ArrayList<>();
 
                // the afterReturning was taken out to avoid circular advice dependency        
 
index 109d7ed062c8ae928b9de5d9e58d3deac985a4d7..f6f3ab40edcd9d2661698f1a8298eff366bf2fc2 100644 (file)
@@ -20,8 +20,6 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
-import junit.framework.TestCase;
-
 import org.aspectj.apache.bcel.Constants;
 import org.aspectj.apache.bcel.generic.InstructionFactory;
 import org.aspectj.apache.bcel.generic.InstructionList;
@@ -38,6 +36,8 @@ import org.aspectj.weaver.patterns.PerClause;
 import org.aspectj.weaver.patterns.Pointcut;
 import org.aspectj.weaver.patterns.SimpleScope;
 
+import junit.framework.TestCase;
+
 public abstract class WeaveTestCase extends TestCase {
 
        public boolean regenerate = false;
@@ -61,11 +61,13 @@ public abstract class WeaveTestCase extends TestCase {
                super(name);
        }
 
+       @Override
        public void setUp() throws Exception {
                outDir = BcweaverTests.getOutdir();
                outDirPath = outDir.getAbsolutePath();
        }
 
+       @Override
        public void tearDown() throws Exception {
                super.tearDown();
                BcweaverTests.removeOutDir();
@@ -279,11 +281,10 @@ public abstract class WeaveTestCase extends TestCase {
                }
        }
 
-       protected List addLexicalOrder(List l) {
+       protected List<ShadowMunger> addLexicalOrder(List<ShadowMunger> l) {
                int i = 10;
-               for (Iterator iter = l.iterator(); iter.hasNext();) {
-                       Advice element = (Advice) iter.next();
-                       element.setLexicalPosition(i += 10);
+               for (ShadowMunger element: l) {
+                       ((Advice)element).setLexicalPosition(i += 10);
                }
                return l;
        }