Single comma in array initializer should parse

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 8
    • Affects Version/s: 8
    • Component/s: tools
    • None
    • b98
    • Verified

      Given the annotation type:

      @interface Foo { int[] value(); }

      javac fails to, but should, parse an annotation @Foo({,}) - that is, a single comma as the value of the array which is assigned to Foo's "value" element.

      Accepting not merely a trailing comma but a single comma was the clear intent of JLS 9.7.1 "Normal annotations". It aligns with array initializers for variable declarations, where "int[] x = {,}" is accepted.

            Assignee:
            Eric Mccorkle
            Reporter:
            Alex Buckley
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: