hg: jdk7/tl/langtools: 6979683: inconsistent interaction of reference cast with box/unbox conversions leaves out a useful case

Rémi Forax forax at univ-mlv.fr
Thu Sep 2 11:50:37 PDT 2010


Le 02/09/2010 20:21, Ulf Zibis a écrit :
> Hi,
>
> is Bug ID: 6775385 NPE caused by ConditionalExpression and auto-boxing 
> failure <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6775385>
> concerned by this bug ?
>
> -Ulf

I don't think so, section 15.25 of JLS3 is clear.
For a conditional ?:, if one parameter is a primitive and the other is a 
wrapper
of a numeric type, the wrapper must be unboxed.

Rémi

>
>
> Am 02.09.2010 03:54, schrieb John Rose:
>> On Sep 1, 2010, at 6:31 PM, Neal Gafter wrote:
>>
>>      
>>> I also can't find any general rule about casting being allowed to do the reverse of multi-step conversions, which seems to be your "bottom line" justification.
>>>        
>> By your reading, what is the spec. support for (Object)(int)x? (I.e., (Object)n, where 'n' is 'int'?)
>>
>> I think the spec. support for (Object)(int) is the use of combined steps from the first para. of 5.5.
>>
>> If that is the case, there is no reason to deny (int)(Object) its place in the twilight.
>>
>> (Yes, I agree the spec. is gray here.  There is an umbrella proposal to bring clarity to it, mentioned in the final paragraph of my bug report.)
>>
>> Do you have an alternative reading of the spec. that allows (Object)(int) but not (int)(Object)?
>>
>> Best,
>> -- John
>>
>>      

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20100902/5f18b405/attachment.html 


More information about the compiler-dev mailing list