aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwisberg <wisberg>2003-09-29 19:12:55 +0000
committerwisberg <wisberg>2003-09-29 19:12:55 +0000
commit14306c01e5cb539ead70d98462beb567aa90d33e (patch)
tree1b3d3121e0102e0d5326691795d05df4b39b68bf
parent99ebf5fe2d58535da0dcff64f9a701de94a3e3c6 (diff)
downloadaspectj-14306c01e5cb539ead70d98462beb567aa90d33e.tar.gz
aspectj-14306c01e5cb539ead70d98462beb567aa90d33e.zip
presumed bug found on mailing list by Eric Jain, rendered both in harness and Ant (to show behavior with javac)
-rw-r--r--tests/ajcTestsFailing.xml14
-rw-r--r--tests/bugs/interfaceDefinition/Main.java8
-rw-r--r--tests/bugs/interfaceDefinition/build.xml71
-rw-r--r--tests/bugs/interfaceDefinition/pack/DefineInterface.java21
-rw-r--r--tests/bugs/interfaceDefinition/pack/InterfaceDefinition.java13
-rw-r--r--tests/bugs/interfaceDefinition/pack/MyInterface.java6
6 files changed, 132 insertions, 1 deletions
diff --git a/tests/ajcTestsFailing.xml b/tests/ajcTestsFailing.xml
index 3a66c89e0..b5be2713d 100644
--- a/tests/ajcTestsFailing.xml
+++ b/tests/ajcTestsFailing.xml
@@ -122,5 +122,17 @@
</compile>
<run class="org.aspectj.langlib.PointcutsCW"/>
</ajc-test>
-
+
+ <ajc-test dir="bugs/interfaceDefinition"
+ title="Use class implementing interface via aspect">
+ <compile
+ files="pack/DefineInterface.java,
+ pack/InterfaceDefinition.java,
+ pack/MyInterface.java"/>
+ <run class="pack.InterfaceDefinition"/>
+ <compile
+ includeClassesDir="true"
+ files="Main.java"/>
+ <run class="Main"/>
+ </ajc-test>
</suite>
diff --git a/tests/bugs/interfaceDefinition/Main.java b/tests/bugs/interfaceDefinition/Main.java
new file mode 100644
index 000000000..b9767acef
--- /dev/null
+++ b/tests/bugs/interfaceDefinition/Main.java
@@ -0,0 +1,8 @@
+
+public class Main implements pack.MyInterface {
+ public static void main(String[] args) {
+ new Main().m();
+ new pack.InterfaceDefinition.C().m();
+ }
+ public void m() { System.out.println("hello"); }
+}
diff --git a/tests/bugs/interfaceDefinition/build.xml b/tests/bugs/interfaceDefinition/build.xml
new file mode 100644
index 000000000..041f3f5c4
--- /dev/null
+++ b/tests/bugs/interfaceDefinition/build.xml
@@ -0,0 +1,71 @@
+
+<project name="interfaceDefinition" default="all" basedir=".">
+ <target name="info">
+ <echo>
+This reproduces a bug found on the mailing list by Eric Jain.
+When the implementation of a method is defined by an aspect,
+the implementing type does not appear to javac to have
+the method.
+</echo>
+ </target>
+ <target name="init">
+ <property name="example.dir"
+ location="${basedir}"/>
+ <property name="aspectj.lib.dir"
+ location="${basedir}/../../../aj-build/dist/tools/lib"/>
+
+ <property name="classes.dir"
+ location="${example.dir}/classes"/>
+ <property name="aspectjrt.jar"
+ location="${aspectj.lib.dir}/aspectjrt.jar"/>
+ <property name="aspectjtools.jar"
+ location="${aspectj.lib.dir}/aspectjtools.jar"/>
+
+ <property name="classes.dir"
+ location="${example.dir}/classes"/>
+ </target>
+
+ <target name="init.taskdefs" depends="init"
+ unless="taskdefs.init">
+ <!-- sets name of new task to iajc, old task to ajc -->
+ <taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
+ <classpath>
+ <pathelement path="${aspectjtools.jar}"/>
+ </classpath>
+ </taskdef>
+ <property name="taskdefs.init" value="true"/>
+ </target>
+
+ <target name="all" depends="init.taskdefs">
+ <mkdir dir="${classes.dir}"/>
+ <delete dir="${classes.dir}"/>
+ <mkdir dir="${classes.dir}"/>
+ <iajc destdir="${classes.dir}"
+ fork="true"
+ forkclasspath="${aspectjtools.jar}"
+ srcdir="${example.dir}"
+ includes="pack/MyInterface.java,pack/InterfaceDefinition.java"
+ classpath="${aspectjrt.jar}"/>
+ <java classname="pack.InterfaceDefinition">
+ <classpath>
+ <pathelement path="${aspectjrt.jar}"/>
+ <pathelement path="${classes.dir}"/>
+ </classpath>
+ </java>
+ <javac destdir="${classes.dir}"
+ srcdir="${example.dir}"
+ includes="Main.java">
+ <classpath>
+ <pathelement path="${aspectjrt.jar}"/>
+ <pathelement path="${classes.dir}"/>
+ </classpath>
+ </javac>
+ <java class="Main">
+ <classpath>
+ <pathelement path="${aspectjrt.jar}"/>
+ <pathelement path="${classes.dir}"/>
+ </classpath>
+ </java>
+
+ </target>
+</project> \ No newline at end of file
diff --git a/tests/bugs/interfaceDefinition/pack/DefineInterface.java b/tests/bugs/interfaceDefinition/pack/DefineInterface.java
new file mode 100644
index 000000000..0e3df5dc8
--- /dev/null
+++ b/tests/bugs/interfaceDefinition/pack/DefineInterface.java
@@ -0,0 +1,21 @@
+
+package pack;
+
+import org.aspectj.testing.Tester;
+
+public aspect DefineInterface {
+ declare parents: InterfaceDefinition.C implements MyInterface;
+ static {
+ Tester.expectEvent("m()");
+ Tester.expectEvent("p()");
+ }
+ public void MyInterface.m() {
+ Tester.event("m()");
+ }
+ before(MyInterface targ) : target(targ) && call(void run()) {
+ targ.m();
+ }
+ after() returning : execution(void main(String[])) {
+ Tester.checkAllEvents();
+ }
+}
diff --git a/tests/bugs/interfaceDefinition/pack/InterfaceDefinition.java b/tests/bugs/interfaceDefinition/pack/InterfaceDefinition.java
new file mode 100644
index 000000000..980afdc5e
--- /dev/null
+++ b/tests/bugs/interfaceDefinition/pack/InterfaceDefinition.java
@@ -0,0 +1,13 @@
+
+package pack;
+
+// User Eric Jain reported that interface was somehow bad...
+public class InterfaceDefinition {
+ public static void main(String[] args) {
+ new C().run();
+ }
+ public static
+ class C {
+ void run() {}
+ }
+}
diff --git a/tests/bugs/interfaceDefinition/pack/MyInterface.java b/tests/bugs/interfaceDefinition/pack/MyInterface.java
new file mode 100644
index 000000000..cc3863cdb
--- /dev/null
+++ b/tests/bugs/interfaceDefinition/pack/MyInterface.java
@@ -0,0 +1,6 @@
+
+package pack;
+
+public interface MyInterface {
+ void m();
+} \ No newline at end of file