[constables] RFR of constants API

Vicente Romero vicente.romero at oracle.com
Tue May 15 21:31:43 UTC 2018

Hi all,

I've run javadoc [1] for the three following packages: java.lang, 
java.lang.invoke, and the new java.lang.invoke.constant. The highlights:

- java.lang.invoke.constant: The ConstantDesc hierarchy, which models 
"descriptors" for constant values. (Interfaces in the ConstantDesc 
hierarchy correspond to the various kinds of constant pool entry in JVMS 
4.4. Just as the JVM resolves a constant pool entry in order to yield a 
value, you can ask a ConstantDesc object to resolve itself in order to 
yield the value "described" by the object.) Also, the factory interface 
Constable, which an ordinary class can implement in order to map its 
constant values to descriptors.

- java.lang.invoke: MethodHandle, MethodType, and VarHandle implement 
Constable. Also, new types that model type descriptors, field 
descriptors, and method descriptors from JVMS 4.3. Also, the Intrinsics 
class with methods to instruct the compiler to generate `ldc` and 
`invokedynamic` bytecodes.

- java.lang: Class, String, Integer, etc implement Constable. Also, 
Class implements j.l.i.FieldTypeDescriptor. Also, String, Integer, etc 
implement ConstantDesc.

Also as a reference [2] is the last webrev.



On 04/27/2018 01:31 PM, Vicente Romero wrote:
> Hi all,
> Please review the current proposal of the constants API, which are 
> nominal descriptor types defined in pkg java.lang.invoke.constant. The 
> code can be found at [1]. This API is being developed in the context 
> of JEP 303: Intrinsics for the LDC and INVOKEDYNAMIC Instructions [2]
> Thanks in advance for your comments,
> Vicente
> [1] http://cr.openjdk.java.net/~vromero/constant.api/webrev.00
> [2] http://openjdk.java.net/jeps/303

More information about the amber-spec-experts mailing list