Summary: | [generics]"abort trouble" when loading generic class using loadtime weaving | ||
---|---|---|---|
Product: | [Tools] AspectJ | Reporter: | Calum MacLean <cnmaclean> |
Component: | Compiler | Assignee: | Andrew Clement <aclement> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | ||
Version: | 1.5.0RC2 | ||
Target Milestone: | 1.5.1 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Calum MacLean
2005-12-20 11:11:29 EST
Thanks for the clear report - I prefer when you include the code inline rather than as attachments - but other committers may feel differently :) And thanks for the pointer on not having 1.5.0 as a version against which bugs can be reported - I've submitted a request to eclipse.org to get that fixed. Here is a smaller, standalone program that also fails in the same way, without LTW: ===8<================ import java.io.*; aspect MyAspect { before(): execution(* MyOtherClass.read()) { } } class MyClass<T,E> implements MyInterface<T> { public static void main(String[] arg) { } public T read() throws IOException { return null; } public void exceptionDetected(E e) { } } interface MyInterface<T> { public T read() throws IOException; } class MyOtherClass { public void read() { } } ===8<================ as i suspected, the bug is related to using different numbers of type variables in the class and the interface. What is being expressed is valid, but we don't cope well with it. Changing MyInterface to add a redundant type variable is a workaround: interface MyInterface<T,X> { public T read() throws IOException; } class MyClass<T,E> implements MyInterface<T,E> { ... } Fix checked in. The problem is just parameterizing a types super interfaces using the collapsed bounds of the types own type variables - here the erasures for the type variables are Object and Object when the superinterface only takes one type parameter. We now use the correct bounds for parameterizing the superinterface. Possibly could do with more testcases that experiment in the area of parameterizing types with type variables. fixes checked into HEAD. fix available. |