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;
/**.
}
public void testLots() throws IOException {
- List<Advice> l = new ArrayList();
+ List<ShadowMunger> l = new ArrayList<>();
BcelAdvice p1 =
makeArgsMunger("before");
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);
}
};
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 {
{
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();
}
throws IOException
{
- List l = new ArrayList();
+ List<ShadowMunger> l = new ArrayList<>();
// the afterReturning was taken out to avoid circular advice dependency
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;
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;
super(name);
}
+ @Override
public void setUp() throws Exception {
outDir = BcweaverTests.getOutdir();
outDirPath = outDir.getAbsolutePath();
}
+ @Override
public void tearDown() throws Exception {
super.tearDown();
BcweaverTests.removeOutDir();
}
}
- 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;
}