Bug 235829 - Weaving error: can't determine implemented interfaces
Summary: Weaving error: can't determine implemented interfaces
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Linux
: P3 blocker (vote)
Target Milestone: 1.6.1   Edit
Assignee: AJDT-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-05 10:06 EDT by charles CLA
Modified: 2008-06-06 00:27 EDT (History)
1 user (show)

See Also:


Attachments
An AJDT project that recreates the bug (578.95 KB, application/zip)
2008-06-05 12:56 EDT, charles CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description charles CLA 2008-06-05 10:06:48 EDT
To reproduce the bug. Use Eclipse 3.3 and the AJDT 1.5.2 and 1.5.3 (dev build), and open the attached source as an AJDT project

I'm pretty sure this is a bug because AJDT 1.5.0 produces no error on the same code.

can't determine implemented interfaces of missing type dstm2.factory.ofree.Adapter$Getter
when weaving type dstm2.factory.ofree.Adapter
when weaving classes 
when weaving 
when batch building BuildConfig[/home/charlesz/eclipse/dstm] #Files=64
 [Xlint:cantFindType]	dstm/src/dstm2/factory/ofree	Adapter.java	Unknown	1212674178104	30172
Comment 1 Andrew Clement CLA 2008-06-05 11:42:43 EDT
this is an AspectJ issue.
Comment 2 Andrew Clement CLA 2008-06-05 11:43:40 EDT
I cant see any attached source Charles?
Comment 3 charles CLA 2008-06-05 12:56:49 EDT
Created attachment 103785 [details]
An AJDT project that recreates the bug
Comment 4 Andrew Clement CLA 2008-06-05 13:55:18 EDT
yikes that is some exciting generics!
Comment 5 Andrew Clement CLA 2008-06-05 14:02:31 EDT
Looks like it might be a base JDT compiler bug.  Here is the simple case:

a/Adapter.java
---
package a;

public interface Adapter<T> {
  interface Setter<V> {}

  public <V> Setter<V> makeSetter();
}
---
a/b/Adapter.java
---
package a.b;

public class Adapter<T> implements a.Adapter<T> {

  public <V> Adapter.Setter<V> makeSetter() {
    return new Adapter.Setter<V>() {};
  }

}
---

On compilation the generic signature of the inner type a.b.Adapter$1 (representing the type returned by the makeSetter method) should be:

Ljava/lang/Object;La/Adapter$Setter<TV>; 

but when using the AspectJ compiler the package name is wrong and it becomes:

Ljava/lang/Object;La/b/Adapter$Setter<TV>;

and so that leads to a missing type message.

I just created a pure Java project in eclipse 3.3.2 - and this was broken, it generated the wrong signature.
Comment 6 Andrew Clement CLA 2008-06-05 14:04:13 EDT
also broken in eclipse 3.4rc1
Comment 7 Andrew Clement CLA 2008-06-05 16:10:39 EDT
I raised it as JDT bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=235921

I implemented a fix that seems to work but will let those guys determine if it is a good change or not.

In the interim I will probably commit my change to our tree so that Charles can compile his app.
Comment 8 Andrew Clement CLA 2008-06-06 00:27:39 EDT
My fix for this is committed - it will be in the next dev build - hopefully tomorrow.

If you need a quick workaround, change the name of either your interface or implementation, so they aren't both called Adapter - or qualify the reference to Setter/Getter in the implementation class with the package name of the adapter interface ( public pkg.Adapter.Setter makeSetter(...)).

I might review the change based on what the JDT guys say but AspectJ now compiles your application just fine.