ITypeParameter is not an IAnnotatable [message #255197] |
Wed, 23 July 2008 13:50  |
Eclipse User |
|
|
|
I try to use the jdt annotation API, and I stumble as I can't get any
annotations from method parameters.
IField, ILocalVariable, IMethod, IPackageDeclaration, IType are all
IAnnotatable but ITypeParameter is not.
Why is this, better how could I get the annotation from a parameter ?
greetings, urs.
|
|
|
Re: ITypeParameter is not an IAnnotatable [message #255302 is a reply to message #255197] |
Sat, 26 July 2008 12:26   |
Eclipse User |
|
|
|
"urs zeidler" <ich@urszeidler.de> wrote in message
news:g67r13$6nb$1@build.eclipse.org...
>I try to use the jdt annotation API, and I stumble as I can't get any
>annotations from method parameters.
> IField, ILocalVariable, IMethod, IPackageDeclaration, IType are all
> IAnnotatable but ITypeParameter is not.
>
> Why is this, better how could I get the annotation from a parameter ?
I don't believe ITypeParameter has anything to do with method parameters.
I think ITypeParameter describes type parameters, for instance 'T' in the
following declaration:
class Foo<T> {
T getT() { ... }
void putT(T t) { ... }
}
And type parameters are not annotatable, in the current definition of Java
(pending JSR-308).
Since IMethod.getParameterTypes returns type signatures rather than IType[],
I am not sure the Java Model will give you information at this level of
detail - I think you may have to use the DOM AST instead, or use APT.
|
|
|
Re: ITypeParameter is not an IAnnotatable [message #255318 is a reply to message #255302] |
Tue, 29 July 2008 03:34  |
Eclipse User |
|
|
|
Originally posted by: me.urszeidler.de
Walter Harley wrote:
>
> I don't believe ITypeParameter has anything to do with method parameters.
>
> I think ITypeParameter describes type parameters, for instance 'T' in the
> following declaration:
You are absolute right.
>
> And type parameters are not annotatable, in the current definition of Java
> (pending JSR-308).
Indeed.
>
> Since IMethod.getParameterTypes returns type signatures rather than IType[],
> I am not sure the Java Model will give you information at this level of
> detail - I think you may have to use the DOM AST instead, or use APT.
Yes ITypeParameter was the only interface about parameters in the range
of IMethode I found, that's why I mixed it up. And funny is I have
already worked with ITypeParameter in the same UML importer, but in an
other aspect (as template parameter, what they are).
So it looks to me as there is not annotation support on parameter.
That's really pity, I wanted to import the annotation as stereotypes in
an UML model import, now I can't cover parameters.
Perhaps I should open a feature request for it.
thanks for your answer, greetings, urs.
|
|
|
Powered by
FUDForum. Page generated in 0.21552 seconds