Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8187420

Error message mentions relevant types transposed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • repo-amber
    • None
    • 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

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

              Created:
              Updated:
              Resolved: