Hello everyone,
Background on this e-mail can be found especially at this posting:
http://dev.eclipse.org/mhonarc/lists/aspectj-users/msg11631.html
as well as at this bug report:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=298665
But I will try to recap everything here.
Essentially I tried creating an Eclipse AspectJ project with just one
MyAspect.aj file (in the default namespace) with the following contents
(toy example):
public aspect MyAspect
{
public interface MyInterface
{
}
declare parents: MyObject implements MyInterface;
public boolean MyInterface.instanceOf(Class<? extends
Object>
c)
{
return c.isInstance(this);
}
}
class MyObject
{
}
class Main
{
public static void main(String[] args)
{
new MyObject().instanceOf(MyObject.class);
}
}
I get, over "instanceOf" in the main method, the following
error: "The method
instanceOf(Class<Object>) from the type MyObject refers to the
missing type Object". Notice that it is declared as Class<?
extends Object> but during weaving becomes Class<Object>.
Here is my setup:
* Mac OS X 10.4 Tiger
* Eclipse Galileo
* Mac OS X JavaVM 1.5.0 (J2SE-1.5)
* AspectJ 1.6.6
* AJDT 2.0.1
I downloaded the standalone aspectj-1.6.6.jar at
http://www.eclipse.org/aspectj/, installed it correctly, and ran the
command "ajc -1.5 MyAspect.aj -showWeaveInfo" and it didn't give me
that error (or any other error). What it did give me was the following:
Type 'MyAspect$MyInterface' (MyAspect.aj) has
intertyped method from 'MyAspect' (MyAspect.aj:'boolean
MyAspect$MyInterface.instanceOf(java.lang.Class<? extends
java.lang.Object>)')
Extending interface set for type 'MyObject' (MyAspect.aj) to
include 'MyAspect$MyInterface' (MyAspect.aj)
Type 'MyObject' (MyAspect.aj) has intertyped method from
'MyAspect' (MyAspect.aj:'boolean
MyAspect$MyInterface.instanceOf(java.lang.Class<? extends
java.lang.Object>)')
So I think there is a disconnect between how ajc behaves on the command
line and how ajdt behaves in Eclipse. I'd be particularly curious to
know if there are any setups possible that would get Eclipse to weave
this properly. Right now I am removing a ton of generics from my
project, but you can obviously understand that I would prefer to keep
them around if at all possible. :)
Thank you,
-Michel
|