Signature of MethodHandleInfo.reflectAs is not specific enough
john.r.rose at oracle.com
Fri Feb 28 20:46:58 UTC 2014
On Feb 25, 2014, at 3:13 AM, Ali Ebrahimi <ali.ebrahimi1781 at gmail.com> wrote:
> I know, this is too late, but I want to share my suggestion:
> public <T extends AccessibleObject&AnnotatedElement> T reflectAs(Class<? super T> expected, MethodHandles.Lookup lookup)
Isn't this the same as
public <T extends AccessibleObject> T reflectAs...
I think we considered AccessibleObject but rejected it as not buying anything significant compared with Member which is an interface.
public <T extends Member & AnnotatedElement> T reflectAs...
with both interfaces, would have been slightly better.
As the API is written (and yes it is too late to change) I don't think there are any use cases (at least with ground types) which require an extra cast.
Thank you for looking at it.
More information about the core-libs-dev