On Fri, 26 Jan 2024 18:02:58 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/latest/ > > Aggelos Biboudis has updated the pull request incrementally with one > additional commit since the last revision: > > Remove redundant null check and introduce a const boolean for > unconditionally exact pairs javac changes look sensible to me - some minor comments inline. src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 5040: > 5038: * @param target Target primitive or reference type > 5039: */ > 5040: public boolean checkUnconditionallyExact(Type source, Type target) { Maybe something like `isUnconditionallyExact`? src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 5060: > 5058: * @param targetType Target type > 5059: */ > 5060: public boolean checkUnconditionallyExactPrimitives(Type > selectorType, Type targetType) { Maybe something like `isUnconditionallyExactPrimitives`? src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 1799: > 1797: log.error(label.pos(), > Errors.UnconditionalPatternAndDefault); > 1798: } else if (booleanSwitch && > constants.containsAll(Set.of(0, 1))) { > 1799: log.error(label.pos(), > Errors.UnconditionalPatternAndDefault); // TODO improve error Maybe file a follow-up to improve the error? src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java line 3079: > 3077: > 3078: // Resolve the exactness method > 3079: Symbol ecsym = rs.resolveQualifiedMethod(null, Minor: better use `rs.resolveInternalMethod` or `this.lookupMethod`, so that the compilation fails more obviously if the method cannot be found. test/langtools/tools/javac/diags/examples/NotApplicableTypes.java line 21: > 19: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA > 20: * or visit www.oracle.com if you need additional information or have any > 21: * questions. The key does not exist any, per my understanding. I would suggest to simply delete the file. test/langtools/tools/javac/diags/examples/SelectorTypeNotAllowed.java line 24: > 22: */ > 23: > 24: // key: compiler.err.preview.feature.disabled.plural The key does not exist any, per my understanding. I would suggest to simply delete the file. ------------- Marked as reviewed by jlahoda (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/15638#pullrequestreview-1848712425 PR Review Comment: https://git.openjdk.org/jdk/pull/15638#discussion_r1469805646 PR Review Comment: https://git.openjdk.org/jdk/pull/15638#discussion_r1469806136 PR Review Comment: https://git.openjdk.org/jdk/pull/15638#discussion_r1469614384 PR Review Comment: https://git.openjdk.org/jdk/pull/15638#discussion_r1469811642 PR Review Comment: https://git.openjdk.org/jdk/pull/15638#discussion_r1469838360 PR Review Comment: https://git.openjdk.org/jdk/pull/15638#discussion_r1469838529