java-types icon indicating copy to clipboard operation
java-types copied to clipboard

Type parameters as enclosed elements

Open ypoluektovich opened this issue 9 years ago • 1 comments

As of 1.0.1, TypeElementImpl considers type parameters to be "enclosed elements" that are to be returned by the getEnclosedElement() method. But the implementation used by javac (I tested openjdk and oracle versions, jdk 7 and 8) does not return type parameters as enclosed elements.

ypoluektovich avatar Oct 06 '15 12:10 ypoluektovich

Thanks for reporting this! Given that TypeParameterElement#getEnclosingElement () returns the "generic element" of the type parameter, it is currently unclear to me what the rationale behind the asymmetry of the javac behavior is. Though I agree that the javac behavior should be replicated here. Strictly speaking, another reason for going with with javac behavior is that TypeElement#getEnclosedElements() does not mention type parameters to be in the returned list (but only "fields, methods, constructors, and member types").

I'll ask on core-libs-dev for an explanation.

fschopp avatar Oct 06 '15 17:10 fschopp