Summary: | [generics] compile error with declare parents and generics | ||
---|---|---|---|
Product: | [Tools] AspectJ | Reporter: | Christophe Delhorbe <cdelhorb> |
Component: | Compiler | Assignee: | aspectj inbox <aspectj-inbox> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | ||
Version: | 1.5.2 | ||
Target Milestone: | 1.5.3 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Christophe Delhorbe
2006-07-09 09:51:04 EDT
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. |