Community
Participate
Working Groups
Using aspectJ 1.5 and JDK 6b2, this code : public class MyClass {} public aspect BCSAspect { declare parents : MyClass extends java.beans.context.BeanContextSupport; } gives a compile error saying that the method toArray([[T) must be implemented in MyClass, whereas toArray(Object) is implemented in BeanContextSupport.
Recreated on Java5 - it is related to the signature of that toArray() method and the inheritance hierarchy that exists in BeanContextSupport. Here is the failing pure java case (no java beans): import java.util.*; interface I extends Collection { } class B implements I { public Object[] toArray(Object[] os) { return os; } public boolean add(Object o) { return false; } public boolean addAll(Collection c) { return false; } public void clear() { } public boolean contains(Object o) { return false; } public boolean containsAll(Collection c) { return false; } public boolean isEmpty() { return false; } public Iterator iterator() { return null; } public boolean remove(Object o) { return false; } public boolean removeAll(Collection c) { return false; } public boolean retainAll(Collection c) { return false; } public int size() { return 0; } public Object[] toArray() { return null; } } class C { } aspect X { declare parents: C extends B; } ajc -1.5 Foo.java Foo.java:23 [error] The type C must implement the inherited abstract method java.util.Collection.toArray([TT;) class C { } see also: java\util\Collection.java::0 see also: Foo.java:26::0 the problem appears to be that interface I uses Collection in its raw form, so through interface I we should see 'Object[] I.toArray(Object[])' - and that is implemented correctly by the class. But the original generic method from Collection is leaking through, it doesn't get converted to a raw form, and it comes through as 'T[] toArray([TT;)'.
testcase and fix committed. On collecting generic members and translating them to their raw form, we overlooked the form 'array of type variable'.
fix available in latest AJ dev build.