From: Andy Clement Date: Wed, 14 Feb 2018 20:54:11 +0000 (-0800) Subject: more generics and missing @Overrides X-Git-Tag: V1_9_0_RC4~10 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0beba191741575756c5316bbbb27c2111a5d5d7b;p=aspectj.git more generics and missing @Overrides --- diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/ArgsWeaveTestCase.java b/weaver/testsrc/org/aspectj/weaver/bcel/ArgsWeaveTestCase.java index 8e7f72f4f..1108c3574 100644 --- a/weaver/testsrc/org/aspectj/weaver/bcel/ArgsWeaveTestCase.java +++ b/weaver/testsrc/org/aspectj/weaver/bcel/ArgsWeaveTestCase.java @@ -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 l = new ArrayList(); + List 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); } }; diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/AroundWeaveTestCase.java b/weaver/testsrc/org/aspectj/weaver/bcel/AroundWeaveTestCase.java index 5f8412c25..a9d1fe9b4 100644 --- a/weaver/testsrc/org/aspectj/weaver/bcel/AroundWeaveTestCase.java +++ b/weaver/testsrc/org/aspectj/weaver/bcel/AroundWeaveTestCase.java @@ -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 l = new ArrayList<>(); // the afterReturning was taken out to avoid circular advice dependency diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java b/weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java index 109d7ed06..f6f3ab40e 100644 --- a/weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java +++ b/weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java @@ -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 addLexicalOrder(List 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; }