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

C style array declaration not accepted in pattern binding declaration

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • repo-amber
    • None
    • tools
    • None
    • generic
    • generic

      (This should perhaps be closed as won't fix ?)

      Note that asymmetry in javac's treatment between argv array and the pattern binding variable array.

      public class X {

          public static void main(String args[]) {
              Object o = null;
              if (o __matches String x []) {
              }
          }
      }

      This program fails to compiler and elicits the following:

      /home/srikanth/tmp/X.java:5: error: ')' expected
              if (o __matches String x []) {
                                      ^
      /home/srikanth/tmp/X.java:5: error: illegal start of expression
              if (o __matches String x []) {
                                       ^
      2 errors


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

              Created:
              Updated:
              Resolved: