@@ -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()); | |||
} | |||
} |
@@ -12,6 +12,6 @@ public aspect IdentifiableAspect { | |||
} | |||
public static void main(String []argv) { | |||
new Bean(); | |||
Bean b = new Bean(); | |||
} | |||
} |
@@ -0,0 +1,2 @@ | |||
public class Bean {} |
@@ -0,0 +1,5 @@ | |||
public interface Identifiable<T> { | |||
T getId(); | |||
void setId(T t); | |||
} |
@@ -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"); | |||
} | |||
} |
@@ -0,0 +1,2 @@ | |||
public interface LongIdentifiable extends Identifiable<Long> { | |||
} |
@@ -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"); |
@@ -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 |