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

Confusing error message when match binding variable omitted in matches predicate

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • 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) {
                  System.out.println("Broken");
              }
          }
      }

      // ---
      javac complains:

      /home/srikanth/tmp/X.java:3: error: cannot find symbol
              if (args __matches String) {
                                 ^
        symbol: variable String
        location: class X
      1 error

      This could be confusing to a user.

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

              Created:
              Updated:
              Resolved: