RFR: JDK-8301460: Clean up LambdaForm to reference BasicType enums directly

Sergey Tsypanov stsypanov at openjdk.org
Tue Feb 14 11:19:43 UTC 2023


On Mon, 13 Feb 2023 22:05:15 GMT, Mandy Chung <mchung at openjdk.org> wrote:

> `LambdaForm` declares int constants for `BasicType::ordinal` to workaround JDK-8161245.   Now these int constants are no longer needed.    This removes these int constants and reference `BasicType` enums directly.

src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java line 368:

> 366:             SpeciesData sd = extensions[typeNum];
> 367:             if (sd != null)  return sd;
> 368:             sd = SPECIALIZER.findSpecies(key() + basicType.basicTypeChar());

As soon as this is `java.base` I suggest to replace `key() + basicType.basicTypeChar()` with `key().concat(String.valueOf(basicType.basicTypeChar()))` to prevent `StringBuilder` allocation and `append()` chaining.

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

PR: https://git.openjdk.org/jdk/pull/12546


More information about the core-libs-dev mailing list