aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2005-11-17 08:37:16 +0000
committeraclement <aclement>2005-11-17 08:37:16 +0000
commita7e84c66fc7ced725454c0135fffdb237c899403 (patch)
tree9df092ffd44b9141b15669cff9f8f0f5b1ec00e5
parentabb5d6c097d8c0ec8f33dc95342732855148bb18 (diff)
downloadaspectj-a7e84c66fc7ced725454c0135fffdb237c899403.tar.gz
aspectj-a7e84c66fc7ced725454c0135fffdb237c899403.zip
more tests - for 115237 and alexs bug on the list.
-rw-r--r--tests/bugs150/pr115237.aj36
-rw-r--r--tests/java5/generics/bugs/lists/case1/IdentifiableAspect.java2
-rw-r--r--tests/java5/generics/bugs/lists/case3/Bean.java2
-rw-r--r--tests/java5/generics/bugs/lists/case3/Identifiable.java5
-rw-r--r--tests/java5/generics/bugs/lists/case3/IdentifiableAspect.java20
-rw-r--r--tests/java5/generics/bugs/lists/case3/LongIdentifiable.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java1
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ajc150.xml11
8 files changed, 78 insertions, 1 deletions
diff --git a/tests/bugs150/pr115237.aj b/tests/bugs150/pr115237.aj
new file mode 100644
index 000000000..f1a019b2c
--- /dev/null
+++ b/tests/bugs150/pr115237.aj
@@ -0,0 +1,36 @@
+public class pr115237 {
+ public static void main(String[] args) {
+ C c = new C();
+ c.go();
+ A a = A.aspectOf(c);
+ // ok, illegal - aspectOf only on concrete aspects?
+ // AA aa = AA.aspectOf(c);
+
+ // hmm - n/a for parameterized types?
+ BB capt = BB.aspectOf(c); // unexpected compile error here
+ //System.out.println("A " + a + " capt " + capt);
+ }
+ static class C {
+ void go() {}
+ }
+
+ abstract static aspect AA pertarget(pc()) {
+ abstract pointcut pc();
+ before() : pc() {
+ System.out.println("go()");
+ }
+ }
+ static aspect A extends AA {
+ pointcut pc() : call(void C.go());
+ }
+
+ abstract static aspect BB<T> pertarget(pc()) {
+ abstract pointcut pc();
+ before() : pc() {
+ System.out.println("go()");
+ }
+ }
+ static aspect B extends BB<C> {
+ pointcut pc() : call(void C.go());
+ }
+}
diff --git a/tests/java5/generics/bugs/lists/case1/IdentifiableAspect.java b/tests/java5/generics/bugs/lists/case1/IdentifiableAspect.java
index 32fe42390..7b150fa59 100644
--- a/tests/java5/generics/bugs/lists/case1/IdentifiableAspect.java
+++ b/tests/java5/generics/bugs/lists/case1/IdentifiableAspect.java
@@ -12,6 +12,6 @@ public aspect IdentifiableAspect {
}
public static void main(String []argv) {
- new Bean();
+ Bean b = new Bean();
}
}
diff --git a/tests/java5/generics/bugs/lists/case3/Bean.java b/tests/java5/generics/bugs/lists/case3/Bean.java
new file mode 100644
index 000000000..6444e4a92
--- /dev/null
+++ b/tests/java5/generics/bugs/lists/case3/Bean.java
@@ -0,0 +1,2 @@
+
+public class Bean {}
diff --git a/tests/java5/generics/bugs/lists/case3/Identifiable.java b/tests/java5/generics/bugs/lists/case3/Identifiable.java
new file mode 100644
index 000000000..645ee36de
--- /dev/null
+++ b/tests/java5/generics/bugs/lists/case3/Identifiable.java
@@ -0,0 +1,5 @@
+public interface Identifiable<T> {
+ T getId();
+
+ void setId(T t);
+}
diff --git a/tests/java5/generics/bugs/lists/case3/IdentifiableAspect.java b/tests/java5/generics/bugs/lists/case3/IdentifiableAspect.java
new file mode 100644
index 000000000..a9cb3f73f
--- /dev/null
+++ b/tests/java5/generics/bugs/lists/case3/IdentifiableAspect.java
@@ -0,0 +1,20 @@
+public aspect IdentifiableAspect {
+ declare parents: Bean implements LongIdentifiable;
+
+ private Long LongIdentifiable.m_id;
+
+ public Long LongIdentifiable.getId() {
+ return m_id;
+ }
+
+ public void LongIdentifiable.setId(Long id) {
+ m_id= id;
+ }
+
+ public static void main(String []argv) {
+ Bean b = new Bean();
+ b.setId(37L);
+ long l = b.getId();
+ if (l!=37L) throw new RuntimeException("id should be 37");
+ }
+}
diff --git a/tests/java5/generics/bugs/lists/case3/LongIdentifiable.java b/tests/java5/generics/bugs/lists/case3/LongIdentifiable.java
new file mode 100644
index 000000000..37fa76252
--- /dev/null
+++ b/tests/java5/generics/bugs/lists/case3/LongIdentifiable.java
@@ -0,0 +1,2 @@
+public interface LongIdentifiable extends Identifiable<Long> {
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
index 7d0865b5f..83c1b59cc 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
@@ -210,6 +210,7 @@ public class GenericsTests extends XMLBasedAjcTestCase {
public void testGenericsOverrides_1() { runTest("generics and ITD overrides - 1"); }
public void testGenericsOverrides_2() { runTest("generics and ITD overrides - 2"); }
+ public void testGenericsOverrides_3() { runTest("generics and ITD overrides - 3"); }
public void testPR88606() {
runTest("Parameterized types on introduced fields not correctly recognized");
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
index 545495004..971e0ee48 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
@@ -138,6 +138,11 @@
<message kind="error" line="12" text="Cannot make inter-type declarations on type variables"/>
</compile>
</ajc-test>
+
+ <ajc-test dir="bugs150" title="aspectOf and generic aspects">
+ <compile files="pr115237.aj" options="-1.5"/>
+ <run class="pr115237"/>
+ </ajc-test>
<ajc-test dir="bugs150/pr114343/case2" title="field-get, generics and around advice - 2">
<compile files="Test.java,TTT.java,TestAspect.java" options="-1.5"/>
@@ -201,6 +206,12 @@
<compile files="Identifiable.java,Bean.java,LongIdentifiable.java,IdentifiableAspect.java" options="-1.5">
</compile>
<run class="IdentifiableAspect"/>
+ </ajc-test>
+
+ <ajc-test dir="java5/generics/bugs/lists/case3" title="generics and ITD overrides - 3">
+ <compile files="Identifiable.java,Bean.java,LongIdentifiable.java,IdentifiableAspect.java" options="-1.5">
+ </compile>
+ <run class="IdentifiableAspect"/>
</ajc-test>
<!-- Currently a warning doesn't occur if the annotation is already on the field