summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraclement <aclement>2006-03-27 21:16:39 +0000
committeraclement <aclement>2006-03-27 21:16:39 +0000
commit638db357bdf26a8afb6699c84002762fa7d4e518 (patch)
treec5d0b3916c49dc856dd0a5e1d50b1840575e0364 /tests
parent6c4770cba1ff07c1d5a406b34f0cfc44a3e05ebe (diff)
downloadaspectj-638db357bdf26a8afb6699c84002762fa7d4e518.tar.gz
aspectj-638db357bdf26a8afb6699c84002762fa7d4e518.zip
test and fixes for 98901, comment 29
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs151/pr98901/Failing.java28
-rw-r--r--tests/bugs151/pr98901/Failing2.java28
-rw-r--r--tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java4
-rw-r--r--tests/src/org/aspectj/systemtest/ajc151/ajc151.xml22
4 files changed, 80 insertions, 2 deletions
diff --git a/tests/bugs151/pr98901/Failing.java b/tests/bugs151/pr98901/Failing.java
new file mode 100644
index 000000000..b4103f9e1
--- /dev/null
+++ b/tests/bugs151/pr98901/Failing.java
@@ -0,0 +1,28 @@
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@interface TestAnnotation {
+ public boolean value() default true;
+}
+
+aspect TestAspect {
+ declare parents: Failing implements TestInterface;
+// this also does not work (even when removing annotation in the following ITD)
+// declare @method: public void TestInterface.foo(): @TestAnnotation;
+ @TestAnnotation
+ public void TestInterface.foo() {
+ System.err.println("foo");
+ }
+}
+
+interface TestInterface {
+ public void foo();
+}
+
+public class Failing {
+ public static void main(String[] args) throws Exception {
+ System.err.println("On TestInterface:"+TestInterface.class.getDeclaredMethod("foo").getAnnotation(TestAnnotation.class));
+ System.err.println("On Failing:"+Failing.class.getDeclaredMethod("foo").getAnnotation(TestAnnotation.class));
+ }
+} \ No newline at end of file
diff --git a/tests/bugs151/pr98901/Failing2.java b/tests/bugs151/pr98901/Failing2.java
new file mode 100644
index 000000000..1daeb4498
--- /dev/null
+++ b/tests/bugs151/pr98901/Failing2.java
@@ -0,0 +1,28 @@
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@interface TestAnnotation {
+ public boolean value() default true;
+}
+
+aspect TestAspect {
+ declare parents: Failing2 implements TestInterface;
+
+ declare @method: public void TestInterface.foo(): @TestAnnotation;
+
+ public void TestInterface.foo() {
+ System.err.println("foo");
+ }
+}
+
+interface TestInterface {
+ public void foo();
+}
+
+public class Failing2 {
+ public static void main(String[] args) throws Exception {
+ System.err.println("On TestInterface:"+TestInterface.class.getDeclaredMethod("foo").getAnnotation(TestAnnotation.class));
+ System.err.println("On Failing2:"+Failing2.class.getDeclaredMethod("foo").getAnnotation(TestAnnotation.class));
+ }
+} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
index f078ae9d2..67b749677 100644
--- a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
@@ -24,7 +24,9 @@ import org.aspectj.systemtest.ajc150.GenericsTests;
import org.aspectj.testing.XMLBasedAjcTestCase;
public class Ajc151Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
-
+
+ public void testAnnotationsAndItds_pr98901() { runTest("annotations and itds");}
+ public void testAnnotationsAndItds_pr98901_2() { runTest("annotations and itds - 2");}
public void testCircularGenerics_pr133307() { runTest("circular generics");}
// public void testDeca() { runTest("doubly annotating a method with declare");}
// public void testDeca2() { runTest("doubly annotating a method with declare - 2");}
diff --git a/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml b/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml
index c1d6610d9..96e6d9313 100644
--- a/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml
+++ b/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml
@@ -3,10 +3,30 @@
<!-- AspectJ v1.5.1 Tests -->
<suite>
+ <ajc-test dir="bugs151/pr98901" title="annotations and itds">
+ <compile files="Failing.java" options="-1.5"/>
+ <run class="Failing">
+ <stderr>
+ <line text="On TestInterface:@TestAnnotation(value=true)"/>
+ <line text="On Failing:@TestAnnotation(value=true)"/>
+ </stderr>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs151/pr98901" title="annotations and itds - 2">
+ <compile files="Failing2.java" options="-1.5"/>
+ <run class="Failing2">
+ <stderr>
+ <line text="On TestInterface:@TestAnnotation(value=true)"/>
+ <line text="On Failing2:@TestAnnotation(value=true)"/>
+ </stderr>
+ </run>
+ </ajc-test>
+
<ajc-test dir="bugs151/pr132926" pr="132926" title="crashing on annotation type resolving with asm - 1">
<compile files="InputAnnotation.java,AffectedType.java" options="-1.5"/>
</ajc-test>
-
+
<ajc-test dir="bugs151/pr132926" pr="132926" title="crashing on annotation type resolving with asm - 2">
<compile files="InputAnnotation.java" outjar="foo.jar" options="-1.5"/>
<compile files="AffectedType.java" classpath="foo.jar" options="-1.5"/>