Error message mentions relevant types transposed

XMLWordPrintable

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

      While compiling the following:

      // ---
      public class X {
          public static void main(String [] args) {
              if (args __matches String s) {
                  System.out.println("Broken");
              }
          }
      }
      // ---

      javac complains:

      /home/srikanth/tmp/X.java:3: error: incompatible types: String cannot be converted to String[]
              if (args __matches String s) {
                                 ^
      1 error

      The relevant types appear transposed: It should say String [] cannot be converted to String

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

              Created:
              Updated:
              Resolved: