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

Confusing error message when match binding variable omitted in matches predicate

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: None
    • Fix Version/s: repo-amber
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      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.

        Attachments

          Activity

            People

            Assignee:
            jlahoda Jan Lahoda
            Reporter:
            sadayapalam Srikanth Adayapalam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: