</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>
--- /dev/null
+
+
+public class Client {
+ public static void main(String[] a) {
+ new C().run();
+ }
+}
+
+class C implements lib.LibraryInterface {}
\ No newline at end of file
--- /dev/null
+
+aspect LibraryAspect {
+ public void lib.LibraryInterface.run() {
+ System.err.println("LibraryAspect-defined run() for " + this);
+ }
+}
\ No newline at end of file
--- /dev/null
+
+<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>
--- /dev/null
+
+package lib;
+
+public interface LibraryInterface {
+// void run();
+}
\ No newline at end of file