RFR: 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview) [v19]

Aggelos Biboudis abimpoudis at openjdk.org
Mon Oct 16 17:25:29 UTC 2023


On Fri, 13 Oct 2023 09:33:28 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

>> 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.

Good recommendation. Names updated!

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

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


More information about the core-libs-dev mailing list