]> source.dussan.org Git - aspectj.git/commitdiff
passing tests for interface libraries. The behavior might be wrong (i.e., some shoul...
authorwisberg <wisberg>
Wed, 6 Aug 2003 01:53:16 +0000 (01:53 +0000)
committerwisberg <wisberg>
Wed, 6 Aug 2003 01:53:16 +0000 (01:53 +0000)
tests/ajcTests.xml
tests/new/interfaceLibrary/Client.java [new file with mode: 0644]
tests/new/interfaceLibrary/LibraryAspect.java [new file with mode: 0644]
tests/new/interfaceLibrary/aspectOnly.jar [new file with mode: 0644]
tests/new/interfaceLibrary/aspectedInterfaceOnly.jar [new file with mode: 0644]
tests/new/interfaceLibrary/aspectedInterfaceOnlyBinary.jar [new file with mode: 0644]
tests/new/interfaceLibrary/build.xml [new file with mode: 0644]
tests/new/interfaceLibrary/interfaceOnly.jar [new file with mode: 0644]
tests/new/interfaceLibrary/lib/LibraryInterface.java [new file with mode: 0644]

index 22f1019ee885aad6089b616ad71104f4638d8da3..82d4e6ed478c08d32292863123fa5ff0010c8199 100644 (file)
                </compile>
        </ajc-test>
 
+       <ajc-test dir="new/interfaceLibrary"
+               title="aspect-declared interface members in libraries - baseline">
+               <compile files="lib/LibraryInterface.java,
+                                               Client.java,
+                                               LibraryAspect.java"/>
+               <run class="Client"/>
+               </ajc-test>
+               
+       <ajc-test dir="new/interfaceLibrary"
+               comment="prove that LibraryAspect is required"
+               title="aspect-declared interface members in libraries - interfaceOnly.jar">
+               <compile 
+                       files="Client.java" 
+                       aspectpath="interfaceOnly.jar">
+                       <message kind="error" line="5"/>
+                       </compile>
+               </ajc-test>
+
+       <ajc-test dir="new/interfaceLibrary"
+               title="aspect-declared interface members in libraries - aspectOnly.jar">
+               <compile 
+                       files="lib/LibraryInterface.java,
+                                       Client.java" 
+                       aspectpath="aspectOnly.jar"/>
+               <run class="Client"/>
+               </ajc-test>
+               
+       <ajc-test dir="new/interfaceLibrary"
+               title="aspect-declared interface members in libraries - aspectedInterfaceOnly.jar"
+               comment="prove aspect is required even if interface is woven"
+               >
+               <compile 
+                       files="Client.java" 
+                       classpath="aspectedInterfaceOnly.jar">
+                       <message kind="error" line="9" text="LibraryInterface"/>
+                       </compile>
+               </ajc-test>
+
+       <ajc-test dir="new/interfaceLibrary"
+               title="aspect-declared interface members in libraries - aspectedInterfaceOnly.jar,aspectOnly.jar"
+               comment="weaving required for implementations of interface? 
+                        XXX Would prefer to support javac compiles of Client here, mimicked with classpath only"
+               >
+               <compile 
+                       files="Client.java" 
+                       classpath="aspectedInterfaceOnly.jar,aspectOnly.jar">
+                       <message kind="error" line="9"/>
+                       </compile>
+               </ajc-test>
+
+       <ajc-test dir="new/interfaceLibrary"
+               title="aspect-declared interface members in libraries - aspectedInterfaceOnlyBinary.jar,aspectOnly.jar"
+               comment="works if aspect is only on the classpath?, i.e., no weaving XXX need javac run"
+               >
+               <compile 
+                       files="Client.java" 
+                       classpath="aspectedInterfaceOnlyBinary.jar,aspectOnly.jar">
+                       <message kind="error" line="9"/>
+                       </compile>
+               </ajc-test>
+
+       <ajc-test dir="new/interfaceLibrary"
+               title="aspect-declared interface members in libraries - aspectedInterfaceOnly.jar,aspectpath=aspectOnly.jar"
+               comment="can weave to create library, and then weave clients"
+               >
+               <compile 
+                       files="Client.java" 
+                       classpath="aspectedInterfaceOnly.jar"
+                       aspectpath="aspectOnly.jar"/>
+               <run class="Client"/>
+               </ajc-test>
+
+       <ajc-test dir="new/interfaceLibrary"
+               title="aspect-declared interface members in libraries - aspectedInterfaceOnly.jar,aspectpath=aspectOnly.jar"
+               comment="works if source aspect and binary classpath woven with aspect? 
+                        should NOT warn about affected type not since affected type is already woven?"
+               >
+               <compile 
+                       files="Client.java,LibraryAspect.java" 
+                       classpath="aspectedInterfaceOnly.jar"/>
+                       
+               <run class="Client"/>
+               </ajc-test>
+               
 </suite>
diff --git a/tests/new/interfaceLibrary/Client.java b/tests/new/interfaceLibrary/Client.java
new file mode 100644 (file)
index 0000000..e53bfff
--- /dev/null
@@ -0,0 +1,9 @@
+
+
+public class Client {
+    public static void main(String[] a) {
+        new C().run();
+    }
+}
+
+class C implements lib.LibraryInterface {}
\ No newline at end of file
diff --git a/tests/new/interfaceLibrary/LibraryAspect.java b/tests/new/interfaceLibrary/LibraryAspect.java
new file mode 100644 (file)
index 0000000..34a6a36
--- /dev/null
@@ -0,0 +1,6 @@
+
+aspect LibraryAspect {
+    public void lib.LibraryInterface.run() {
+        System.err.println("LibraryAspect-defined run() for " + this);
+    }
+}
\ No newline at end of file
diff --git a/tests/new/interfaceLibrary/aspectOnly.jar b/tests/new/interfaceLibrary/aspectOnly.jar
new file mode 100644 (file)
index 0000000..4aaffb6
Binary files /dev/null and b/tests/new/interfaceLibrary/aspectOnly.jar differ
diff --git a/tests/new/interfaceLibrary/aspectedInterfaceOnly.jar b/tests/new/interfaceLibrary/aspectedInterfaceOnly.jar
new file mode 100644 (file)
index 0000000..9cb969b
Binary files /dev/null and b/tests/new/interfaceLibrary/aspectedInterfaceOnly.jar differ
diff --git a/tests/new/interfaceLibrary/aspectedInterfaceOnlyBinary.jar b/tests/new/interfaceLibrary/aspectedInterfaceOnlyBinary.jar
new file mode 100644 (file)
index 0000000..9cb969b
Binary files /dev/null and b/tests/new/interfaceLibrary/aspectedInterfaceOnlyBinary.jar differ
diff --git a/tests/new/interfaceLibrary/build.xml b/tests/new/interfaceLibrary/build.xml
new file mode 100644 (file)
index 0000000..d23e49e
--- /dev/null
@@ -0,0 +1,83 @@
+
+<project name="interfaceLibrary" default="build" basedir=".">
+
+
+    <target name="build" depends="init">
+       <iajc 
+               classpath="${aspectjrt.jar}"
+               outjar="interfaceOnly.jar"
+               srcdir="."
+               includes="lib/LibraryInterface.java"/>
+
+       <iajc 
+               classpath="${aspectjrt.jar}${path.separator}interfaceOnly.jar"
+               outjar="aspectOnly.jar"
+               srcdir="."
+               includes="LibraryAspect.java"/>
+
+       <iajc 
+               classpath="${aspectjrt.jar}"
+               aspectpath="aspectOnly.jar"
+               outjar="aspectedInterfaceOnly.jar"
+               srcdir="."
+               includes="lib/LibraryInterface.java"/>
+
+       <iajc 
+               classpath="${aspectjrt.jar}"
+               aspectpath="aspectOnly.jar"
+               injars="interfaceOnly.jar"
+               outjar="aspectedInterfaceOnlyBinary.jar"/>
+
+    </target>
+    
+    <target name="init"  depends="init.variables,init.taskdefs"/>
+
+    <target name="init.variables" 
+     description="init variables">
+     
+      <!-- required directories - run from examples or predefine -->
+      <property name="interfaceLibrary.dir"
+            location="${basedir}"/> 
+      <property name="aspectj.lib.dir"
+            location="${interfaceLibrary.dir}/../../../aj-build/dist/tools/lib"/> 
+
+      <!-- required libraries - install or predefine -->
+      <property name="aspectjrt.jar"
+            location="${aspectj.lib.dir}/aspectjrt.jar"/> 
+      <property name="aspectjtools.jar"
+            location="${aspectj.lib.dir}/aspectjtools.jar"/> 
+
+      <!-- checking required libraries -->
+      <available file="${aspectjtools.jar}"
+             property="aspectjtools.jar.available"/>
+      <available file="${aspectjrt.jar}"
+             property="aspectjrt.jar.available"/>
+
+    </target>
+
+    <target name="init.taskdefs" depends="init.variables, 
+         aspectjtools.jar.available,
+         aspectjrt.jar.available"
+         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>
+
+    <!-- targets to fail unless required libraries available -->
+
+    <target name="aspectjrt.jar.available" depends="init.variables" 
+          unless="aspectjrt.jar.available" >
+      <fail message="expecting aspectjrt.jar at ${aspectjrt.jar}"/>
+    </target>
+
+    <target name="aspectjtools.jar.available" depends="init.variables" 
+          unless="aspectjtools.jar.available" >
+      <fail message="expecting aspectjtools.jar at ${aspectjtools.jar}"/>
+    </target>
+
+</project>
diff --git a/tests/new/interfaceLibrary/interfaceOnly.jar b/tests/new/interfaceLibrary/interfaceOnly.jar
new file mode 100644 (file)
index 0000000..ede6fc8
Binary files /dev/null and b/tests/new/interfaceLibrary/interfaceOnly.jar differ
diff --git a/tests/new/interfaceLibrary/lib/LibraryInterface.java b/tests/new/interfaceLibrary/lib/LibraryInterface.java
new file mode 100644 (file)
index 0000000..a712c5a
--- /dev/null
@@ -0,0 +1,6 @@
+
+package lib;
+
+public interface LibraryInterface {
+//    void run();
+}
\ No newline at end of file