import org.aspectj.weaver.Advice;
import org.aspectj.weaver.AdviceKind;
import org.aspectj.weaver.MemberImpl;
+import org.aspectj.weaver.TestUtils;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.UnresolvedType;
BcelAdvice munger = new BcelAdvice(
AdviceKind.stringToKind("before"),
makePointcutAll(),
- MemberImpl.methodFromString("static void Aspect.ajc_before(org.aspectj.lang.JoinPoint$StaticPart)"),
+ TestUtils.methodFromString("static void Aspect.ajc_before(org.aspectj.lang.JoinPoint$StaticPart)"),
Advice.ThisJoinPointStaticPart, -1, -1, null, null);
weaveTest("HelloWorld", "StaticTjpBeforeHelloWorld", munger);
BcelAdvice munger = new BcelAdvice(
AdviceKind.stringToKind("before"),
makePointcutAll(),
- MemberImpl.methodFromString("static void Aspect.ajc_before(org.aspectj.lang.JoinPoint$StaticPart)"),
+ TestUtils.methodFromString("static void Aspect.ajc_before(org.aspectj.lang.JoinPoint$StaticPart)"),
Advice.ThisEnclosingJoinPointStaticPart, -1, -1, null, null);
weaveTest("HelloWorld", "StaticEnclosingTjpBeforeHelloWorld", munger);
BcelAdvice munger = new BcelAdvice(
AdviceKind.stringToKind("before"),
makePointcutAll(),
- MemberImpl.methodFromString("static void Aspect.ajc_before(org.aspectj.lang.JoinPoint)"),
+ TestUtils.methodFromString("static void Aspect.ajc_before(org.aspectj.lang.JoinPoint)"),
Advice.ThisJoinPoint, -1, -1, null, null);
weaveTest("HelloWorld", "TjpBeforeHelloWorld", munger);
BcelAdvice munger = new BcelAdvice(
AdviceKind.stringToKind("around"),
makePointcutAll(),
- MemberImpl.methodFromString("static java.lang.Object Aspect.ajc_around(org.aspectj.runtime.internal.AroundClosure, org.aspectj.lang.JoinPoint)"),
+ TestUtils.methodFromString("static java.lang.Object Aspect.ajc_around(org.aspectj.runtime.internal.AroundClosure, org.aspectj.lang.JoinPoint)"),
Advice.ThisJoinPoint | Advice.ExtraArgument, -1, -1, null, null);
weaveTest("HelloWorld", "TjpAroundHelloWorld", munger);
BcelAdvice munger1 = new BcelAdvice(
AdviceKind.stringToKind("around"),
makePointcutAll(),
- MemberImpl.methodFromString("static java.lang.Object Aspect.ajc_around(org.aspectj.runtime.internal.AroundClosure, org.aspectj.lang.JoinPoint)"),
+ TestUtils.methodFromString("static java.lang.Object Aspect.ajc_around(org.aspectj.runtime.internal.AroundClosure, org.aspectj.lang.JoinPoint)"),
Advice.ThisJoinPoint | Advice.ExtraArgument, -1, -1, null,
rtx);
BcelAdvice munger2 = new BcelAdvice(
AdviceKind.stringToKind("around"),
makePointcutAll(),
- MemberImpl.methodFromString("static java.lang.Object Aspect.ajc_around(org.aspectj.runtime.internal.AroundClosure, org.aspectj.lang.JoinPoint)"),
+ TestUtils.methodFromString("static java.lang.Object Aspect.ajc_around(org.aspectj.runtime.internal.AroundClosure, org.aspectj.lang.JoinPoint)"),
Advice.ThisJoinPoint | Advice.ExtraArgument, -1, -1, null,
rtx);
ResolvedType trace = world.resolve(UnresolvedType.forName("Trace"),true);
assertTrue("Couldnt find type Trace",!trace.isMissing());
fieldsTest(trace, Member.NONE);
- /*Member constr = */MemberImpl.methodFromString("void Trace.<init>()");
+ /*Member constr = */TestUtils.methodFromString("void Trace.<init>()");
//XXX need attribute fix -
//methodsTest(trace, new Member[] { constr });
mungersTest(trace,
new ShadowMunger[] {
- world.shadowMunger("before(foo): traced(foo) -> void Trace.ajc_before_4(java.lang.Object))",
+ TestUtils.shadowMunger(world,"before(foo): traced(foo) -> void Trace.ajc_before_4(java.lang.Object))",
0),
- world.shadowMunger("afterReturning(foo): traced(foo) -> void Trace.ajc_afterreturning_3(java.lang.Object, java.lang.Object))",
+ TestUtils.shadowMunger(world,"afterReturning(foo): traced(foo) -> void Trace.ajc_afterreturning_3(java.lang.Object, java.lang.Object))",
Advice.ExtraArgument),
- world.shadowMunger("around(): execution(* doit(..)) -> java.lang.Object Trace.ajc_around_2(org.aspectj.runtime.internal.AroundClosure))",
+ TestUtils.shadowMunger(world,"around(): execution(* doit(..)) -> java.lang.Object Trace.ajc_around_2(org.aspectj.runtime.internal.AroundClosure))",
Advice.ExtraArgument),
- world.shadowMunger("around(foo): traced(foo) -> java.lang.Object Trace.ajc_around_1(java.lang.Object, org.aspectj.runtime.internal.AroundClosure))",
+ TestUtils.shadowMunger(world,"around(foo): traced(foo) -> java.lang.Object Trace.ajc_around_1(java.lang.Object, org.aspectj.runtime.internal.AroundClosure))",
Advice.ExtraArgument),
});
--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.weaver.bcel;
+
+import java.io.File;
+import java.io.IOException;
+
+
+//XXX delete very soon
+public class ZipFileWeaver {
+ File inFile;
+ public ZipFileWeaver(File inFile) {
+ super();
+ this.inFile = inFile;
+ }
+
+ public void weave(BcelWeaver weaver, File outFile) throws IOException {
+ int count = 0;
+ long startTime = System.currentTimeMillis();
+ weaver.addJarFile(inFile, new File("."),false);
+ weaver.weave(outFile);
+ long stopTime = System.currentTimeMillis();
+
+
+ System.out.println("handled " + count + " entries, in " +
+ (stopTime-startTime)/1000. + " seconds");
+ }
+}