[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-mlvm-dev
Subject:    Re: Signature of MethodHandleInfo.reflectAs is not specific enough
From:       Ali Ebrahimi <ali.ebrahimi1781 () gmail ! com>
Date:       2014-03-01 10:29:52
Message-ID: CAA0cW5B5=gBvowx-tQM1-ZgYVK7YoHiehFfBHSvuMrW6HUz-tA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi,


On Sat, Mar 1, 2014 at 12:16 AM, John Rose <john.r.rose@oracle.com> wrote:

> On Feb 25, 2014, at 3:13 AM, Ali Ebrahimi <ali.ebrahimi1781@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

[Attachment #5 (text/html)]

<div dir="ltr">Hi,<br><div class="gmail_extra"><br><br><div class="gmail_quote">On \
Sat, Mar 1, 2014 at 12:16 AM, John Rose <span dir="ltr">&lt;<a \
href="mailto:john.r.rose@oracle.com" \
target="_blank">john.r.rose@oracle.com</a>&gt;</span> wrote:<br> <blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div \
class=""><div><div>On Feb 25, 2014, at 3:13 AM, Ali Ebrahimi &lt;<a \
href="mailto:ali.ebrahimi1781@gmail.com" \
target="_blank">ali.ebrahimi1781@gmail.com</a>&gt; wrote:</div> <br><blockquote \
type="cite"><span style="font-family:Helvetica;font-size:medium;font-style:normal;font \
-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-inden \
t:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline!important;float:none">I \
know, this is too late, but I want to share my suggestion:</span><br \
style="font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;fo \
nt-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
 <br style="font-family:Helvetica;font-size:medium;font-style:normal;font-variant:norm \
al;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
 <span style="font-family:Helvetica;font-size:medium;font-style:normal;font-variant:no \
rmal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text- \
transform:none;white-space:normal;word-spacing:0px;display:inline!important;float:none">public \
&lt;T extends AccessibleObject&amp;AnnotatedElement&gt; T reflectAs(Class&lt;? super \
T&gt; expected, MethodHandles.Lookup lookup)</span><br \
style="font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;fo \
nt-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
 </blockquote><br></div></div><div>Isn&#39;t this the same as \
</div><div><br></div><div>public &lt;T extends AccessibleObject&gt; T \
reflectAs...</div></div></blockquote><div>Oh, sorry, this is my bad.<br></div><div>I \
mean this:<br> <br> <span \
style="font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;fo \
nt-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transfo \
rm:none;white-space:normal;word-spacing:0px;display:inline!important;float:none">public \
&lt;T extends AccessibleObject&amp;Member&gt; T reflectAs(Class&lt;? super T&gt; \
expected, MethodHandles.Lookup lookup)<br> <br></span></div><div> </div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div \
style="word-wrap:break-word"><div></div><div><br></div><div>I think we considered \
AccessibleObject but rejected it as not buying anything significant compared with \
Member which is an interface.</div> <div><br></div><div>Perhaps \
</div><div><br></div><div><div>public &lt;T extends Member &amp; AnnotatedElement&gt; \
T reflectAs...</div></div></div></blockquote><div>I considered this case, but \
<span>unfortunately compiler accepts following test case with this signature:<br> \
</span></div><div> String ss = reflectAs(String.class, MethodHandles.lookup()); \
//OK!!!!!!!<br></div><div>This seams as compiler bug, any way with <span \
style="font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;fo \
nt-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transfo \
rm:none;white-space:normal;word-spacing:0px;display:inline!important;float:none">&lt;T \
extends AccessibleObject&amp;Member&gt; compiler catches error.<br> \
</span></div><div><br><br></div><div>Finally, one case that compiler accepts with \
both signature is:<br><br>Object mo = reflectAs(Object.class, \
MethodHandles.lookup());<br><br></div><div>Maybe I&#39;m wrong for this, Dan Smith \
can better interpret this.<br> </div><div>T inferred to Object and T is not within \
its bound (AccessibleObject&amp;Member).<br></div></div><br><br></div><div \
class="gmail_extra">Regards,<br></div><div class="gmail_extra">Ali \
Ebrahimi<br></div></div>



_______________________________________________
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic