java.lang.__Value ??
Srikanth
srikanth.adayapalam at oracle.com
Mon Nov 23 11:39:55 UTC 2015
On Monday 23 November 2015 04:55 PM, Maurizio Cimadamore wrote:
> I think the current set of modifiers is being relied upon by the JVM;
> more specifically, it's easier for the VM if the root of all values
> doesn't extend j.l.Object (for now at least).
Hi Maurzio,
The current set of modifiers is wrong - as my previous mail showed,
having j.l.__Value as a final class will trigger verify errors.
Without knowing the rationale for the present state of affairs it also
looks odd to me that it would be tagged __ByValue and
that it is not abstract.
Presently, javac wires j.l.__Value to be a root and not extend j.l.O and
I am not at all suggesting this be changed.
[BTW, I misspoke about the explicit vs implicit mention of super types
in class files. There is no open question there]
Thanks!
Srikanth
>
> Maurizio
>
> On 23/11/15 08:40, Srikanth wrote:
>>
>> Hello !
>>
>> valhalla/src/java.base/share/classes/java/lang/__Value.java
>>
>> starts with:
>>
>> package java.lang;
>>
>> /**
>> * Base class of all value types in prototype implementation.
>> */
>> __ByValue final public class __Value {
>> // ...
>> }
>>
>> It seems to me that this class (a) should not be final (b) not carry
>> the decoration
>> __ByValue. (c) Is better named just Value rather than __Value - this
>> being a type
>> name in a name space controlled by JDK. (d) should perhaps be
>> declared abstract.
>>
>> Also,
>>
>> Given:
>>
>> __ByValue final class X {
>> public static void main(String [] args) {
>> System.out.println("Hello");
>> }
>> }
>>
>> at the moment the class file generated by javac[*] encodes an
>> explicit super type:
>>
>> final value class X extends java.lang.__Value
>>
>> It would appear the right behavior is to leave the supertype implicit
>> and be
>> inferred from the ACC_VALUE flag bit being set.
>>
>>
>> [*] The class file generated cannot be run as of now - since 'Q' in
>> signatures is not digested
>> by the VM yet. But using a modified version of javac that emits 'L'
>> even for value types
>> I am able to run the program above triggering:
>>
>> Exception in thread "main" java.lang.VerifyError: Cannot inherit from
>> final class
>>
>> Srikanth.
>
More information about the valhalla-dev
mailing list