On Mon, 16 Oct 2023 19:16:41 GMT, Aggelos Biboudis <abimpou...@openjdk.org> wrote:
>> This is the proposed 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: > > Adjust javadoc on ExactConversionsSupport src/java.base/share/classes/java/lang/runtime/ExactConversionsSupport.java line 40: > 38: * > 39: * @implNote Methods that describe a conversion check among > unconditionally exact types > 40: * (they would return true) are ommited. Similarly, methods that describe > a conversion check Suggestion: * (they would return true) are omitted. Similarly, methods that describe a conversion check 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. 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? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15638#discussion_r1362005727 PR Review Comment: https://git.openjdk.org/jdk/pull/15638#discussion_r1362008344 PR Review Comment: https://git.openjdk.org/jdk/pull/15638#discussion_r1362043660