java.lang.__Value ??

Srikanth srikanth.adayapalam at oracle.com
Mon Nov 23 08:40:31 UTC 2015


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