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

C style array declaration not accepted in pattern binding declaration

    XMLWordPrintable

    Details

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

      Description

      (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


        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated: