RFR: 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview) [v19]
Raffaello Giulietti
rgiulietti at openjdk.org
Fri Oct 13 09:36:21 UTC 2023
On Wed, 11 Oct 2023 15:43:19 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:
>> This is the first draft of a patch for Primitive types in patterns, instanceof, and switch (Preview).
>>
>> Draft spec here: https://cr.openjdk.org/~abimpoudis/instanceof/jep443-20231010/specs/instanceof-jls.html
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix duplicate method name and add a new test in PrimitivePatternsSwitchErrors
src/java.base/share/classes/java/lang/runtime/ExactConversionsSupport.java line 51:
> 49: *
> 50: * */
> 51: public static boolean intToByteExact(int n) {return n == (int)(byte)n;}
These ones seem more _conversions_ than _tests_.
To me, `intToByteExact(int)` looks more like a request to convert an `int` to a `byte`, rather than a check to see whether the argument lies in the `byte` range.
Pure methods returning `boolean` are often named like `isIntToByteExact(int)` or the like (`is*()`, `has*()`, etc.)
I know: choosing good, speaking, and evocative names is one of the hardest problem in computer science.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15638#discussion_r1358027977
More information about the compiler-dev
mailing list