aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authoracolyer <acolyer>2004-04-02 12:03:40 +0000
committeracolyer <acolyer>2004-04-02 12:03:40 +0000
commit33d8ee9eededcd1219a6cbd1d063af005d40a3f7 (patch)
treed30f882cbab26f54b62dc1cddfab666d97d6bd3d /org.aspectj.ajdt.core
parentfc1c15110e8a9cfafabad0dcc4c10445725c9fb2 (diff)
downloadaspectj-33d8ee9eededcd1219a6cbd1d063af005d40a3f7.tar.gz
aspectj-33d8ee9eededcd1219a6cbd1d063af005d40a3f7.zip
fix for Bugzilla Bug 31460
Weaving class loader
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/testdata/src1/LTWAroundClosure.aj20
-rw-r--r--org.aspectj.ajdt.core/testdata/src1/LTWAspect.aj12
-rw-r--r--org.aspectj.ajdt.core/testdata/src1/LTWFieldITD.aj16
-rw-r--r--org.aspectj.ajdt.core/testdata/src1/LTWHelloWorld.java24
-rw-r--r--org.aspectj.ajdt.core/testdata/src1/LTWInterfaceITD.aj18
-rw-r--r--org.aspectj.ajdt.core/testdata/src1/LTWMethodITD.aj22
-rw-r--r--org.aspectj.ajdt.core/testdata/src1/LTWPerthis.aj13
-rw-r--r--org.aspectj.ajdt.core/testdata/src1/ltw/LTWPackageTest.java8
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BcweaverJarMaker.java82
9 files changed, 215 insertions, 0 deletions
diff --git a/org.aspectj.ajdt.core/testdata/src1/LTWAroundClosure.aj b/org.aspectj.ajdt.core/testdata/src1/LTWAroundClosure.aj
new file mode 100644
index 000000000..80af46fd7
--- /dev/null
+++ b/org.aspectj.ajdt.core/testdata/src1/LTWAroundClosure.aj
@@ -0,0 +1,20 @@
+import java.util.List;
+
+public aspect LTWAroundClosure {
+
+ pointcut println (List list) :
+ execution(* println()) && this(list);
+
+ void around (final List list) : println (list) {
+
+ Runnable runnable = new Runnable() {
+ public void run () {
+ System.err.println("LTWAroundClosure.run(" + thisJoinPointStaticPart + ")");
+ proceed(list);
+ }
+ };
+ runnable.run();
+ list.add("LTWAroundClosure");
+ }
+
+}
diff --git a/org.aspectj.ajdt.core/testdata/src1/LTWAspect.aj b/org.aspectj.ajdt.core/testdata/src1/LTWAspect.aj
new file mode 100644
index 000000000..1721b4ef7
--- /dev/null
+++ b/org.aspectj.ajdt.core/testdata/src1/LTWAspect.aj
@@ -0,0 +1,12 @@
+import java.util.List;
+
+public privileged aspect LTWAspect {
+
+ pointcut method (List list) :
+ execution(* LTWHelloWorld.*(..)) && this(list);
+
+ before (List list) : method (list) {
+ System.err.println("LTWAspect.method(" + thisJoinPointStaticPart + ")");
+ list.add("LTWAspect");
+ }
+}
diff --git a/org.aspectj.ajdt.core/testdata/src1/LTWFieldITD.aj b/org.aspectj.ajdt.core/testdata/src1/LTWFieldITD.aj
new file mode 100644
index 000000000..87f441544
--- /dev/null
+++ b/org.aspectj.ajdt.core/testdata/src1/LTWFieldITD.aj
@@ -0,0 +1,16 @@
+import java.util.List;
+
+public aspect LTWFieldITD {
+
+ private int LTWHelloWorld.intField = 999;
+
+ pointcut init (LTWHelloWorld hw) :
+ execution(LTWHelloWorld.new()) && this(hw);
+
+ after (LTWHelloWorld hw) : init (hw) {
+ System.err.println("LTWFieldITD.init(" + thisJoinPointStaticPart + ")");
+ hw.intField = 999999;
+ hw.add(getClass().getName());
+ }
+
+}
diff --git a/org.aspectj.ajdt.core/testdata/src1/LTWHelloWorld.java b/org.aspectj.ajdt.core/testdata/src1/LTWHelloWorld.java
new file mode 100644
index 000000000..ec533506d
--- /dev/null
+++ b/org.aspectj.ajdt.core/testdata/src1/LTWHelloWorld.java
@@ -0,0 +1,24 @@
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Properties;
+
+public class LTWHelloWorld extends ArrayList {
+
+ private String message = "Hello World!";
+
+ public void println () {
+ System.out.println(message);
+ }
+
+ public static void main(String[] args) {
+ LTWHelloWorld hw = new LTWHelloWorld();
+ hw.println();
+ for (int i = 0; i < args.length; i++) {
+ String jp = args[i];
+ if (!hw.contains(jp)) {
+ throw new RuntimeException(jp + " missing");
+ }
+ }
+ }
+
+}
diff --git a/org.aspectj.ajdt.core/testdata/src1/LTWInterfaceITD.aj b/org.aspectj.ajdt.core/testdata/src1/LTWInterfaceITD.aj
new file mode 100644
index 000000000..e7fa6a46a
--- /dev/null
+++ b/org.aspectj.ajdt.core/testdata/src1/LTWInterfaceITD.aj
@@ -0,0 +1,18 @@
+import java.util.List;
+
+public privileged aspect LTWInterfaceITD {
+
+ declare parents : LTWHelloWorld implements Runnable;
+
+ public void LTWHelloWorld.run () {
+ add("LTWInterfaceITD");
+ }
+
+ pointcut init (LTWHelloWorld hw) :
+ execution(LTWHelloWorld.new()) && this(hw);
+
+ after (LTWHelloWorld hw) : init (hw) {
+ System.err.println("LTWInterfaceITD.init(" + thisJoinPointStaticPart + ")");
+ hw.run();
+ }
+}
diff --git a/org.aspectj.ajdt.core/testdata/src1/LTWMethodITD.aj b/org.aspectj.ajdt.core/testdata/src1/LTWMethodITD.aj
new file mode 100644
index 000000000..35049f04f
--- /dev/null
+++ b/org.aspectj.ajdt.core/testdata/src1/LTWMethodITD.aj
@@ -0,0 +1,22 @@
+import java.util.List;
+
+public privileged aspect LTWMethodITD {
+
+ public String LTWHelloWorld.getMessage () {
+ return message;
+ }
+
+ public void LTWHelloWorld.setMessage (String newMessage) {
+ message = newMessage;
+ }
+
+ pointcut init (LTWHelloWorld hw) :
+ execution(LTWHelloWorld.new()) && this(hw);
+
+ after (LTWHelloWorld hw) : init (hw) {
+ System.err.println("LTWMethodITD.init(" + thisJoinPointStaticPart + ")");
+ hw.getMessage();
+ hw.setMessage("Hello LTWMethodITD");
+ hw.add(getClass().getName());
+ }
+} \ No newline at end of file
diff --git a/org.aspectj.ajdt.core/testdata/src1/LTWPerthis.aj b/org.aspectj.ajdt.core/testdata/src1/LTWPerthis.aj
new file mode 100644
index 000000000..955d72096
--- /dev/null
+++ b/org.aspectj.ajdt.core/testdata/src1/LTWPerthis.aj
@@ -0,0 +1,13 @@
+import java.util.List;
+
+public aspect LTWPerthis perthis(this(LTWHelloWorld)) {
+
+ pointcut println (List list) :
+ execution(* println()) && this(list);
+
+ before (List list) : println (list) {
+ System.err.println("LTWPerthis.println(" + thisJoinPointStaticPart + ")");
+ list.add(getClass().getName());
+ }
+
+}
diff --git a/org.aspectj.ajdt.core/testdata/src1/ltw/LTWPackageTest.java b/org.aspectj.ajdt.core/testdata/src1/ltw/LTWPackageTest.java
new file mode 100644
index 000000000..e749db20c
--- /dev/null
+++ b/org.aspectj.ajdt.core/testdata/src1/ltw/LTWPackageTest.java
@@ -0,0 +1,8 @@
+package ltw;
+
+public class LTWPackageTest {
+
+ public static void main(String[] args) {
+ }
+
+}
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BcweaverJarMaker.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BcweaverJarMaker.java
index 25e621ca1..b6dfb5184 100644
--- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BcweaverJarMaker.java
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BcweaverJarMaker.java
@@ -36,6 +36,8 @@ public class BcweaverJarMaker {
makeTestJars();
+
+ makeURLWeavingClassLoaderJars();
}
public static void makeJar0() throws IOException {
@@ -179,5 +181,85 @@ public class BcweaverJarMaker {
CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS);
}
+ public static void makeURLWeavingClassLoaderJars() throws IOException {
+ List args = new ArrayList();
+
+ /*
+ * Vanilla classes
+ */
+ args.add("-classpath");
+ args.add("../lib/test/aspectjrt.jar;../lib/test/testing-client.jar" +
+ File.pathSeparator + System.getProperty("aspectjrt.path"));
+ args.add("-outjar");
+ args.add("../weaver/testdata/ltw-classes.jar");
+ args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/LTWHelloWorld.java");
+ args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/ltw/LTWPackageTest.java");
+ CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS);
+
+ /*
+ * Woven classes
+ */
+ args = new ArrayList();
+ args.add("-classpath");
+ args.add("../lib/test/aspectjrt.jar;../lib/test/testing-client.jar;../weaver/testdata/ltw-classes.jar" +
+ File.pathSeparator + System.getProperty("aspectjrt.path"));
+ args.add("-outjar");
+ args.add("../weaver/testdata/ltw-woven.jar");
+ args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/LTWHelloWorld.java");
+ args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/LTWAspect.aj");
+ CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS);
+
+ /*
+ * Advice
+ */
+ args = new ArrayList();
+ args.add("-classpath");
+ args.add("../lib/test/aspectjrt.jar;../lib/test/testing-client.jar;../weaver/testdata/ltw-classes.jar" +
+ File.pathSeparator + System.getProperty("aspectjrt.path"));
+ args.add("-outjar");
+ args.add("../weaver/testdata/ltw-aspects.jar");
+ args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/LTWAspect.aj");
+ CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS);
+
+ /*
+ * Around closure advice
+ */
+ args = new ArrayList();
+ args.add("-classpath");
+ args.add("../lib/test/aspectjrt.jar;../lib/test/testing-client.jar;../weaver/testdata/ltw-classes.jar" +
+ File.pathSeparator + System.getProperty("aspectjrt.path"));
+ args.add("-outjar");
+ args.add("../weaver/testdata/ltw-acaspects.jar");
+ args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/LTWAroundClosure.aj");
+ CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS);
+
+ /*
+ * ITD
+ */
+ args = new ArrayList();
+ args.add("-Xlint:ignore");
+ args.add("-classpath");
+ args.add("../lib/test/aspectjrt.jar;../lib/test/testing-client.jar;../weaver/testdata/ltw-classes.jar" +
+ File.pathSeparator + System.getProperty("aspectjrt.path"));
+ args.add("-outjar");
+ args.add("../weaver/testdata/ltw-itdaspects.jar");
+ args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/LTWInterfaceITD.aj");
+ args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/LTWFieldITD.aj");
+ /* Uncomment when bug #55341 fixed */
+// args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/LTWMethodITD.aj");
+ CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS);
+
+ /*
+ * perXXX()
+ */
+ args = new ArrayList();
+ args.add("-classpath");
+ args.add("../lib/test/aspectjrt.jar;../lib/test/testing-client.jar;../weaver/testdata/ltw-classes.jar" +
+ File.pathSeparator + System.getProperty("aspectjrt.path"));
+ args.add("-outjar");
+ args.add("../weaver/testdata/ltw-peraspects.jar");
+ args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/LTWPerthis.aj");
+ CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS);
+ }
}