Re: Signature of MethodHandleInfo.reflectAs is not specific enough

2014-03-01 Thread Ali Ebrahimi
Hi, On Sat, Mar 1, 2014 at 12:16 AM, John Rose wrote: > On Feb 25, 2014, at 3:13 AM, Ali Ebrahimi > wrote: > > I know, this is too late, but I want to share my suggestion: > > public T reflectAs(Class super T> expected, MethodHandles.Lookup lookup) > > > Isn't this the same as > > public T r

Re: Signature of MethodHandleInfo.reflectAs is not specific enough

2014-02-28 Thread John Rose
On Feb 25, 2014, at 3:13 AM, Ali Ebrahimi wrote: > I know, this is too late, but I want to share my suggestion: > > public T reflectAs(Class super T> expected, MethodHandles.Lookup lookup) Isn't this the same as public T reflectAs... ? I think we considered AccessibleObject but rejected i

Re: Signature of MethodHandleInfo.reflectAs is not specific enough

2014-02-25 Thread Ali Ebrahimi
Hi, I know, this is too late, but I want to share my suggestion: public T reflectAs(Class expected, MethodHandles.Lookup lookup) Member mr = reflectAs(Member.class, MethodHandles.lookup()); AnnotatedElement ae = reflectAs(AnnotatedElement.class, MethodHandles.lookup()); AnnotatedElement am =

Re: Signature of MethodHandleInfo.reflectAs is not specific enough

2013-11-11 Thread Ali Ebrahimi
Hi, I know this is not fully type safe, in fact java generics is not fully type safe. We don't have any better solution with current language support. if we had: or we had better solutions: public T reflectAs(Class expected, Lookup lookup) public R reflectAs(Class expected, Lookup lookup) but

Re: Signature of MethodHandleInfo.reflectAs is not specific enough

2013-11-11 Thread Peter Levart
On 11/11/2013 08:14 AM, Peter Levart wrote: > The method could simply be: > > public T reflect(Lookup lookup); But if one needs to hint the compiler, explicit type parameters can be used as an escape hatch as always: > > Object o = info.reflect(lookup); > Well, well, explicit type param

Re: Signature of MethodHandleInfo.reflectAs is not specific enough

2013-11-10 Thread Peter Levart
On 11/11/2013 02:24 AM, Ali Ebrahimi wrote: This is another workaround: public R reflectAs(Classsuper T> expected, Lookup lookup); info.reflectAs(Member.class, lookup);//works info.reflectAs(AnnotatedElement.class, lookup);//works info.reflectAs(Member.class, lookup);//works info.reflectAs(An

Re: Signature of MethodHandleInfo.reflectAs is not specific enough

2013-11-10 Thread Ali Ebrahimi
This is another workaround: public R reflectAs(Class expected, Lookup lookup); info.reflectAs(Member.class, lookup);//works info.reflectAs(AnnotatedElement.class, lookup);//works info.reflectAs(Member.class, lookup);//works info.reflectAs(AnnotatedElement.class, lookup);//works info.reflectAs(

Signature of MethodHandleInfo.reflectAs is not specific enough

2013-11-10 Thread Remi Forax
The is a stupid issue with the signature of MethodHandleInfo.reflectAs, j.l.r.Field, Method or Constructor implement two interfaces Member and AnnotatedElement, with the current signature, the code info.reflectAs(Member.class, lookup) works but the code info.reflectAs(AnnotatedElement.class,