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

Single comma in array initializer should parse

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • 8
    • 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.

            emc Eric Mccorkle
            abuckley Alex Buckley
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: