[lworld] RFR: JDK-8271556: [lworld] java.lang.BootstrapMethodError in .equals() for primitive record

Jesper Steen Møller jespersm at openjdk.java.net
Sun Aug 15 11:32:53 UTC 2021


On Thu, 12 Aug 2021 18:05:18 GMT, Mandy Chung <mchung at openjdk.org> wrote:

> We want the default choice is to use the primary L-type mirror and only
> when there is a contextual need to make a distinction, the Q-type mirror will be an option.
> 
> The proposal is to always pass the primary mirror to the `recordClass` argument
> and adjust the bootstrap code to drive method handle creation off of the primitive
> value type of the record class instead of `recordClass`, using `recordClass` only
> for getting the class name for `toString`.

The patch also works here. Just a minor stylistic suggestion where a pattern could save a few casts.

src/java.base/share/classes/java/lang/runtime/ObjectMethods.java line 340:

> 338:         Class<?> receiverType = recordClass.isPrimitiveClass() ? recordClass.asValueType() : recordClass;
> 339: 
> 340:         if (type instanceof MethodType) {

Nitpicking: Perhaps

if (type instanceof MethodType mType) {
    methodType = mType;
    if (mType.parameterType(0) != receiverType) {

?

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

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


More information about the valhalla-dev mailing list