Questions about type annotation on type casts.
Srikanth
srikanth.adayapalam at oracle.com
Fri Dec 11 03:50:06 UTC 2015
On Friday 11 December 2015 05:55 AM, Alex Buckley wrote:
> On 12/9/2015 8:19 PM, Srikanth wrote:
>> While working on https://bugs.openjdk.java.net/browse/JDK-8144168,
>> a few questions have surfaced regarding code generation for a type
>> annotated cast.
>> So what exactly intended to be the value of the offset item for a cast ?
>> ATM, javac seems to interpret this as the offset of the first
>> instruction of chunk
>> of code generated to evaluate the the expression being typecast, while
>> ECJ makes the offset point to the checkcast instruction itself.
>
> If javac implements a cast operator via checkcast (for a reference
> target type) or {i,l,f,d}2{b,s,i,l,f,d} (for a primitive target type),
> then that's the answer.
>
> If javac does not implement a cast operator at all (usually because
> the target type is identical to the type of the expression being cast,
Thanks, I think I have the answers to my questions.
"... If javac does not implement a cast operator at all (usually because
the target type is identical to the type of the expression being cast ..."
At first glance, this strategy appears to lead to loss of information,
but I presume what is not expressly available can in fact be
recovered by analysis of bytecodes.
Srikanth
More information about the compiler-dev
mailing list