[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Issue with generics
|
This does appear to be a bug with generics. I am able to get your
program to compile by removing the type parameters on your method
declarations:
public aspect MyAspect
{
public interface MyInterface
{
public boolean instanceOf(Class c);
}
declare parents: MyObject implements MyInterface;
public boolean MyInterface.instanceOf(Class c)
{
return c.isInstance(this);
}
}
class MyObject
{
}
class Main
{
public static void main(String[] args)
{
new MyObject().instanceOf(Object.class);
}
}
I'd suggest that you raise a bug for this in bugzilla.
On Tue, Dec 29, 2009 at 11:40 PM, Michel Parisien
<codingkriggs@xxxxxxxxx> wrote:
> Hello,
>
> I have a problem that I tried boiling down to as small a code sample as
> possible. The following gives me the error "The method instanceOf(Class<?
> extends Object>) is ambiguous for the type MyObject" on the "instanceOf"
> method call in the main method:
>
> public aspect MyAspect
> {
> public interface MyInterface
> {
> public boolean instanceOf(Class<? extends Object> c);
> }
>
> 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(Object.class);
> }
> }
>
> First, I wonder if this fails to compile for everyone or if it is just me.
> Second, since I suspect I may have a compatibility issue, here are my specs:
>
> * Mac OS X 10.4 Tiger
> * Eclipse Galileo
> * Mac OS X JavaVM 1.5.0 (J2SE-1.5)
> * AspectJ 1.6.6
>
> If the problem is with the code, I'd like to know the "better" way to
> accomplish the above.
>
> I would appreciate any help you could give,
>
> -Michel
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>