The JVM constants API
This JEP introduces an API to standardize the description and loading of class constants.
Every Java class has a constant pool. It either stores simple values such as strings and integers or values to represent classes or methods. Class constant pool values are used as operand values for the ldc (load constant) bytecode instruction. These constants can also be used by the invokedynamic bytecode instruction—in the static argument list of a bootstrap method.
When either an ldc or invokedynamic instruction executes, it represents the constant value as a Java data type value, a class, an integer, or a string. Until now, the responsibility of modeling bytecode instructions and loading constants was on the class that wanted ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access