Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-core-dev] ecj output of Elements.getAllMembers() differs from javac

The Javac behavior looks correct to me. I can't find anything specific to generic methods, the API doc does specify  "All methods _declared_ in this type".
Can you please report this as a bug so we can take it from there?

Thanks,
Jay



From:        "Arlo O'Keeffe" <mailtoarlo@xxxxxxxxx>
To:        jdt-core-dev@xxxxxxxxxxx
Date:        02/20/2015 04:39 PM
Subject:        [jdt-core-dev] ecj output of Elements.getAllMembers() differs from        javac
Sent by:        jdt-core-dev-bounces@xxxxxxxxxxx




Hello everyone,

I am currently writing an annotation processor for classes that use generics. Since I am new to APT and am not sure whether this is an actual issue I am asking here first.

Given the following interfaces:

interface Test2<T extends java.io.Serializable> { String test(T test); }
interface Test extends Test2<Long> { }

Calling Elements.getAllMembers() on Test's TypeElement in javac returns:

String test(T)

In ecj it returns:

String test(String)

Is this the intended behavior?

I realize that ecj's output is "more correct" but javac's output can be later used for reflection. E.g. calling getMethod with a String argument type doesn't work due to type erasure.

Am I using the wrong method? Should I traverse the supertypes "manually" instead?

If required I can upload some test code to github that demonstrates this.

Thanks in advance,

Arlo

--
Arlo O'Keeffe_______________________________________________
jdt-core-dev mailing list
jdt-core-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jdt-core-dev

Back to the top