Hi,
On Sat, Mar 1, 2014 at 12:16 AM, John Rose <john.r.r...@oracle.com> wrote: > On Feb 25, 2014, at 3:13 AM, Ali Ebrahimi <ali.ebrahimi1...@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... > Oh, sorry, this is my bad. I mean this: public <T extends AccessibleObject&Member> T reflectAs(Class<? super T> expected, MethodHandles.Lookup lookup) > > I think we considered AccessibleObject but rejected it as not buying > anything significant compared with Member which is an interface. > > Perhaps > > public <T extends Member & AnnotatedElement> T reflectAs... > I considered this case, but unfortunately compiler accepts following test case with this signature: String ss = reflectAs(String.class, MethodHandles.lookup()); //OK!!!!!!! This seams as compiler bug, any way with <T extends AccessibleObject&Member> compiler catches error. Finally, one case that compiler accepts with both signature is: Object mo = reflectAs(Object.class, MethodHandles.lookup()); Maybe I'm wrong for this, Dan Smith can better interpret this. T inferred to Object and T is not within its bound (AccessibleObject&Member). Regards, Ali Ebrahimi
_______________________________________________ mlvm-dev mailing list mlvm-dev@openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev