RFR: 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview) [v21]
Aggelos Biboudis
abimpoudis at openjdk.org
Tue Oct 17 14:44:48 UTC 2023
On Tue, 17 Oct 2023 12:06:53 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:
>> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Adjust javadoc on ExactConversionsSupport
>
> src/java.base/share/classes/java/lang/runtime/ExactConversionsSupport.java line 54:
>
>> 52: * Exactness method from int to byte
>> 53: * @param n value
>> 54: * @return true if the passed value can be converted exactly to the target type
>
> Suggestion:
>
> * @return true if and only if the passed value can be converted exactly to the target type
>
> Without the "only if", the method could simply always return `true` while meeting the `@return` "contract" ;-)
>
> Alternatively
> Suggestion:
>
> * @return whether or not the passed value can be converted exactly to the target type
>
>
> Similarly for all other methods.
Good point! Thx
> src/java.base/share/classes/java/lang/runtime/ExactConversionsSupport.java line 80:
>
>> 78: * specification of the {@linkplain Double} class.
>> 79: */
>> 80: public static boolean isIntToFloatExact(int n) { return n == (int)(float)n && n != Integer.MAX_VALUE; }
>
> Suggestion:
>
> public static boolean isIntToFloatExact(int n) {
> return n == (int)(float)n && n != Integer.MAX_VALUE;
> }
>
> Nit: what about formatting this on 3 lines?
Looks better indeed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15638#discussion_r1362247167
PR Review Comment: https://git.openjdk.org/jdk/pull/15638#discussion_r1362247460
More information about the core-libs-dev
mailing list