[lworld] RFR: 8269956: [lworld] javac should generate `ldc LPoint; ` for class literal Point.class [v2]

Mandy Chung mchung at openjdk.java.net
Tue Jul 27 17:17:45 UTC 2021


On Tue, 27 Jul 2021 12:51:57 GMT, Srikanth Adayapalam <sadayapalam at openjdk.org> wrote:

>> Srikanth Adayapalam has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Address review comments (reinstate original code by backing out unneeded calls to asValueType() in addHelperClasses method invocation)
>
> test/jdk/valhalla/valuetypes/StaticFactoryMethodHandleTest.java line 69:
> 
>> 67:         MethodType mtype0 = MethodType.methodType(DefaultConstructor.class.asValueType());
>> 68:         MethodHandle mh0 = staticInitFactory(DefaultConstructor.val.class, mtype0);
>> 69:         DefaultConstructor o0 = (DefaultConstructor)mh0.invokeExact();
> 
> While the preferred change is go from Point.class to Point.class.asValueType(), here is one of the few places I had to resort to Point.val.class - This is because we don't have a spec for Class#asValueType() similar to Object#getClass() where the compiler munges the return type of the method. As a result, code won't compile unless I change it to Point.val.class format

What special treatment of `Object#getClass` in javac?

It's fine with this temporary workaround.  FYI.  The discussion about disallowing`Point.val.class` and `Point.ref.class` syntax to obtain the primitive value type mirror but use the `Class` API instead is relevant here.

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

PR: https://git.openjdk.java.net/valhalla/pull/501


More information about the valhalla-dev mailing list