java.lang.__Value ??
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Mon Nov 23 11:25:52 UTC 2015
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).
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