RFR: 8304283: Modernize the switch statements in jdk.internal.foreign
Jorn Vernee
jvernee at openjdk.org
Wed Mar 15 19:57:20 UTC 2023
On Wed, 15 Mar 2023 18:33:34 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> This PR proposes changing old-type switch statements to newer forms of switch.
>
> src/java.base/share/classes/jdk/internal/foreign/abi/CallingSequenceBuilder.java line 208:
>
>> 206: static boolean isUnbox(Binding binding) {
>> 207: return switch (binding) {
>> 208: case Binding.VMStore unused -> true;
>
> I wonder... here it might be better to capture the box/unbox nature of a binding in a virtual method in the binding class? E.g. isBox(), isUnbox() ?
I prefer this approach, to be honest, since the logic for all the different binding operators is in one place. It gives an overview of which operators are expected in an unboxing recipe. Making them virtual methods would put quite a bit of visual distance between the different `true`/`false` values.
I've been through the Binding file quite a bit, and the amount of scrolling/searching needed to find a particular implementation is kind of annoying.
-------------
PR: https://git.openjdk.org/jdk/pull/13047
More information about the core-libs-dev
mailing list