On Sat, 31 Oct 2020 21:11:15 GMT, Rafael Winterhalter <winterhal...@openjdk.org> wrote:
>> A method's or constructor's owner type might carry annotations on its >> potential type parameters but is never represented as parameterized type >> what makes these parameters inaccessible at runtime, despite the presence of >> parameter type annotations. > > Rafael Winterhalter has refreshed the contents of this pull request, and > previous commits have been removed. The incremental views will show > differences compared to the previous content of the PR. Hi Rafael, Thanks for your patience and for the patch, I left a few comments. src/java.base/share/classes/java/lang/reflect/Constructor.java line 664: > 662: Type t; > 663: if (o != null || v.length > 0) { > 664: t = ParameterizedTypeImpl.make(enclosingClass, v, o); I think these should be instantiated by a GenericsFactory. Ideally you shouldn't have to import the reflective object directly. src/java.base/share/classes/java/lang/reflect/Constructor.java line 660: > 658: } > 659: > 660: TypeVariable<?>[] v = enclosingClass.getTypeParameters(); Can you push down most or all of this to resolveOwner? It can then either return a Class instance or an appropriate Type instance. src/java.base/share/classes/java/lang/reflect/Executable.java line 699: > 697: } > 698: Class<?> c = getDeclaringClass(); > 699: TypeVariable<?>[] v = c.getTypeParameters(); Same here, can this be pushed down to a common method that either returns a Class or resolves the appropriate Type instance? test/jdk/java/lang/annotation/typeAnnotations/TestReceiverTypeParameterizedConstructor.java line 52: > 50: Inner(TestReceiverTypeParameterizedConstructor<@TypeAnnotation T> > TestReceiverTypeParameterizedConstructor.this) { } > 51: } > 52: It might be good to add a case where the annotated type variable isn't on the immediate outer type like: class Inner2 { class TwiceInner { TwiceInner(TestReceiverTypeParameterizedConstructor<@TypeAnnotation T>.Inner2 TestReceiverTypeParameterizedConstructor.Inner2.this) { } } } Same for the method test. ------------- PR: https://git.openjdk.java.net/jdk/pull/851