A DESCRIPTION OF THE PROBLEM :
Currently the documentation for java.lang.reflect.ParameterizedType.getOwnerType() says:
> If this type is a top-level type, null is returned.
> ...
> Returns: [...] If this type is a top-level type, null is returned
Both sentences are incorrect, or at least incomplete. There are other cases where the result can be null, for example for local classes.
Maybe the documentation from AnnotatedParameterizedType.getAnnotatedOwnerType() should be copied which seems to be more complete regarding when the result can be null. However, maybe the documentation for getAnnotatedOwnerType() is actually also wrong / misleading because there should not be any (Annotated)ParameterizedType for primitive types, void and anonymous types (for anonymous types only the generic supertype can be parameterized?), should there?
---------- BEGIN SOURCE ----------
void test() {
class Local<T> {}
ParameterizedType paramType = (ParameterizedType) new Local<Integer>() {}.getClass().getGenericSuperclass();
System.out.println(paramType);
// Prints `null` as owner, even though the type is not a top-level type
System.out.println("Owner type: " + paramType.getOwnerType());
}
---------- END SOURCE ----------