java-types
java-types copied to clipboard
Type parameters as enclosed elements
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.
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.