RFR: 8303374: Implement JEP 455: Primitive Types in Patterns, instanceof, and switch (Preview) [v44]

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Jan 25 10:25:40 UTC 2024


On Wed, 24 Jan 2024 17:30:34 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java line 461:
>> 
>>> 459:                                     // Object o = ...
>>> 460:                                     // o instanceof Wrapped(float)
>>> 461:                                     cb.aload(0);
>> 
>> probably just a matter of style so up to you, but I don't like the mixing of low level code generation here with higher level logic. I would prefer to see the code generation be extracted if possible to helper methods and or a separate helper class.
>
> see my other comment above that I think supersedes this one

I see what you mean, that said, I think having some high-level checks driving low-level classfile generation is pretty standard for code generators (e.g. lambda metafactory, invoke bytecode generator, binding specializer). I agree on the fact that the lambda should probably moved onto a separate method.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15638#discussion_r1466153248


More information about the core-libs-dev mailing list