Conflicting bindings accepted in some cases

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P2
    • 14
    • Affects Version/s: 14
    • Component/s: tools
    • None
    • b32

        Originally reported here:
        https://mail.openjdk.java.net/pipermail/amber-dev/2019-December/005413.html

        Cases like:
        ---
          static void test(Object o1, Object o2) {
              boolean b = o1 instanceof String s && (!(o2 instanceof String s)
        || consume(s));
          }
        ---

        or:
        ---
          static void test(Object o1, Object o2, Object o3) {
            boolean b1 = o1 instanceof String s ? o2 instanceof String s : o3
        instanceof String s;
          }
        ---

        Are not valid and should not compile, but javac currently accepts them without any compile-time error.

              Assignee:
              Jan Lahoda
              Reporter:
              Jan Lahoda
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: