diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ajcTests.xml | 30 | ||||
-rw-r--r-- | tests/ajcTestsFailing.xml | 30 | ||||
-rw-r--r-- | tests/bugs/interfaceLibrary/ClassClient.java | 14 | ||||
-rw-r--r-- | tests/bugs/interfaceLibrary/ClassClientCE.java | 9 | ||||
-rw-r--r-- | tests/bugs/interfaceLibrary/Client.java | 14 | ||||
-rw-r--r-- | tests/bugs/interfaceLibrary/ClientCE.java | 9 | ||||
-rw-r--r-- | tests/bugs/interfaceLibrary/LibraryAspect.java | 8 | ||||
-rw-r--r-- | tests/bugs/interfaceLibrary/LibraryClassAspect.java | 8 | ||||
-rw-r--r-- | tests/bugs/interfaceLibrary/build.xml | 70 | ||||
-rw-r--r-- | tests/bugs/interfaceLibrary/lib.jar | bin | 0 -> 1310 bytes | |||
-rw-r--r-- | tests/bugs/interfaceLibrary/lib/LibraryClass.java | 6 | ||||
-rw-r--r-- | tests/bugs/interfaceLibrary/lib/LibraryInterface.java | 6 | ||||
-rw-r--r-- | tests/bugs/interfaceLibrary/libClass.jar | bin | 0 -> 1485 bytes |
13 files changed, 204 insertions, 0 deletions
diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index 82d4e6ed4..2ae8559ae 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -6598,5 +6598,35 @@ <run class="Client"/> </ajc-test> + + <ajc-test + dir="bugs/interfaceLibrary" + title="exception clause for aspect-declared interface methods - positive"> + <compile files="Client.java,LibraryAspect.java,lib/LibraryInterface.java"/> + <run class="Client"/> + </ajc-test> + + <ajc-test + dir="bugs/interfaceLibrary" + title="exception clause for aspect-declared interface methods - negative"> + <compile files="ClientCE.java,LibraryAspect.java,lib/LibraryInterface.java"> + <message kind="error" file="ClientCE.java" line="5"/> + </compile> + </ajc-test> + + <ajc-test + dir="bugs/interfaceLibrary" + title="exception clause for aspect-declared class methods - positive"> + <compile files="ClassClient.java,LibraryClassAspect.java,lib/LibraryClass.java"/> + <run class="ClassClient"/> + </ajc-test> + + <ajc-test + dir="bugs/interfaceLibrary" + title="exception clause for aspect-declared class methods - negative"> + <compile files="ClassClientCE.java,LibraryClassAspect.java,lib/LibraryClass.java"> + <message kind="error" file="ClassClientCE.java" line="5"/> + </compile> + </ajc-test> </suite> diff --git a/tests/ajcTestsFailing.xml b/tests/ajcTestsFailing.xml index 1e2c145f1..55278a25e 100644 --- a/tests/ajcTestsFailing.xml +++ b/tests/ajcTestsFailing.xml @@ -12,4 +12,34 @@ <run class="Client"/> </ajc-test> + <ajc-test dir="bugs/interfaceLibrary" + pr="41175" + title="exception clause for aspect-declared interface methods - positive binary"> + <compile files="Client.java" aspectpath="lib.jar"/> + <run class="Client"/> + </ajc-test> + + <ajc-test dir="bugs/interfaceLibrary" + pr="41175" + title="exception clause for aspect-declared interface methods - negative binary"> + <compile files="ClientCE.java" aspectpath="lib.jar"> + <message kind="error" file="ClientCE.java" line="5"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/interfaceLibrary" + pr="41175" + title="exception clause for aspect-declared class methods - positive binary"> + <compile files="ClassClient.java" aspectpath="libClass.jar"/> + <run class="Client"/> + </ajc-test> + + <ajc-test dir="bugs/interfaceLibrary" + pr="41175" + title="exception clause for aspect-declared class methods - negative binary"> + <compile files="ClassClientCE.java" aspectpath="libClass.jar"> + <message kind="error" file="ClassClientCE.java" line="5"/> + </compile> + </ajc-test> + </suite> diff --git a/tests/bugs/interfaceLibrary/ClassClient.java b/tests/bugs/interfaceLibrary/ClassClient.java new file mode 100644 index 000000000..b3da33370 --- /dev/null +++ b/tests/bugs/interfaceLibrary/ClassClient.java @@ -0,0 +1,14 @@ + +import java.io.IOException; + +public class ClassClient { + public static void main(String[] a) { + try { + new C().run(); + throw new Error("test failed to throw IOException"); + } catch (IOException e) { + } + } +} + +class C extends lib.LibraryClass {}
\ No newline at end of file diff --git a/tests/bugs/interfaceLibrary/ClassClientCE.java b/tests/bugs/interfaceLibrary/ClassClientCE.java new file mode 100644 index 000000000..59006ba74 --- /dev/null +++ b/tests/bugs/interfaceLibrary/ClassClientCE.java @@ -0,0 +1,9 @@ + + +public class ClassClientCE { + public static void main(String[] a) { + new C().run(); // CE 5 expected: declare IOException + } +} + +class C extends lib.LibraryClass {}
\ No newline at end of file diff --git a/tests/bugs/interfaceLibrary/Client.java b/tests/bugs/interfaceLibrary/Client.java new file mode 100644 index 000000000..d18163963 --- /dev/null +++ b/tests/bugs/interfaceLibrary/Client.java @@ -0,0 +1,14 @@ + +import java.io.IOException; + +public class Client { + public static void main(String[] a) { + try { + new C().run(); + throw new Error("test failed to throw IOException"); + } catch (IOException e) { + } + } +} + +class C implements lib.LibraryInterface {}
\ No newline at end of file diff --git a/tests/bugs/interfaceLibrary/ClientCE.java b/tests/bugs/interfaceLibrary/ClientCE.java new file mode 100644 index 000000000..a92bd522e --- /dev/null +++ b/tests/bugs/interfaceLibrary/ClientCE.java @@ -0,0 +1,9 @@ + + +public class ClientCE { + public static void main(String[] a) { + new C().run(); // CE 5 expected: declare IOException + } +} + +class C implements lib.LibraryInterface {}
\ No newline at end of file diff --git a/tests/bugs/interfaceLibrary/LibraryAspect.java b/tests/bugs/interfaceLibrary/LibraryAspect.java new file mode 100644 index 000000000..bf1ddabf0 --- /dev/null +++ b/tests/bugs/interfaceLibrary/LibraryAspect.java @@ -0,0 +1,8 @@ + +import java.io.IOException; + +aspect LibraryAspect { + public void lib.LibraryInterface.run() throws IOException { + throw new IOException("LibraryAspect-defined run() for " + this); + } +}
\ No newline at end of file diff --git a/tests/bugs/interfaceLibrary/LibraryClassAspect.java b/tests/bugs/interfaceLibrary/LibraryClassAspect.java new file mode 100644 index 000000000..ff65af6e3 --- /dev/null +++ b/tests/bugs/interfaceLibrary/LibraryClassAspect.java @@ -0,0 +1,8 @@ + +import java.io.IOException; + +aspect LibraryClassAspect { + public void lib.LibraryClass.run() throws IOException { + throw new IOException("LibraryClassAspect-defined run() for " + this); + } +}
\ No newline at end of file diff --git a/tests/bugs/interfaceLibrary/build.xml b/tests/bugs/interfaceLibrary/build.xml new file mode 100644 index 000000000..d8d178dc1 --- /dev/null +++ b/tests/bugs/interfaceLibrary/build.xml @@ -0,0 +1,70 @@ + +<project name="interfaceLibrary" default="build" basedir="."> + + <!-- @testcase PR#41175 aspect-declared methods with exception clauses fail in binary libraries --> + <target name="build" depends="init"> + <iajc + classpath="${aspectjrt.jar}" + outjar="lib.jar" + srcdir="." + includes="LibraryAspect.java,lib/LibraryInterface.java"/> + + <iajc + classpath="${aspectjrt.jar}" + outjar="libClass.jar" + srcdir="." + includes="LibraryClassAspect.java,lib/LibraryClass.java"/> + + </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/bugs/interfaceLibrary/lib.jar b/tests/bugs/interfaceLibrary/lib.jar Binary files differnew file mode 100644 index 000000000..496514a29 --- /dev/null +++ b/tests/bugs/interfaceLibrary/lib.jar diff --git a/tests/bugs/interfaceLibrary/lib/LibraryClass.java b/tests/bugs/interfaceLibrary/lib/LibraryClass.java new file mode 100644 index 000000000..4fa031640 --- /dev/null +++ b/tests/bugs/interfaceLibrary/lib/LibraryClass.java @@ -0,0 +1,6 @@ + +package lib; + +public class LibraryClass { + +}
\ No newline at end of file diff --git a/tests/bugs/interfaceLibrary/lib/LibraryInterface.java b/tests/bugs/interfaceLibrary/lib/LibraryInterface.java new file mode 100644 index 000000000..38f339b08 --- /dev/null +++ b/tests/bugs/interfaceLibrary/lib/LibraryInterface.java @@ -0,0 +1,6 @@ + +package lib; + +public interface LibraryInterface { + +}
\ No newline at end of file diff --git a/tests/bugs/interfaceLibrary/libClass.jar b/tests/bugs/interfaceLibrary/libClass.jar Binary files differnew file mode 100644 index 000000000..720435d62 --- /dev/null +++ b/tests/bugs/interfaceLibrary/libClass.jar |