RFR: 8271820: Implementation of JEP 416: Reimplement Core Reflection with Method Handle [v13]

Rémi Forax forax at openjdk.java.net
Thu Oct 14 06:05:52 UTC 2021


On Thu, 14 Oct 2021 00:54:57 GMT, Mandy Chung <mchung at openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/reflect/MethodHandleAccessorFactory.java line 151:
>> 
>>> 149:             var setter = isReadOnly ? null : JLIA.unreflectField(field, true);
>>> 150:             Class<?> type = field.getType();
>>> 151:             if (type == Boolean.TYPE) {
>> 
>> dumb question: any reason why `boolean.class` (which is compiled to a LDC) is not used?
>
> I only see `boolean.class` compiled to `getstatic Boolean.TYPE`.   Is there a javac flag to compile it to a LDC?

The LDC bytecode instruction for a class takes a class name not a descriptor as parameter, so there is no way to encode LDC Z. Valhalla may change that.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5027


More information about the core-libs-dev mailing list