Incorrect error message when type test pattern involves primitive types.

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • repo-amber
    • Affects Version/s: None
    • Component/s: tools
    • generic
    • generic

      While compiling:

      public class X {
          public static void main(String [] args) {
              Object o = args;
              if (o __matches int s) {
                  System.out.println("Broken");
              } else {
                  System.out.println("!Broken");
              }
          }
      }


      I get:

      /home/srikanth/tmp/X.java:4: error: bad operand types for binary operator '=='
              if (o __matches int s) {
                    ^
        first type: int
        second type: Object
      1 error

      This is surprising.

            Assignee:
            Gavin Bierman
            Reporter:
            Srikanth Adayapalam (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: