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

Single comma in array initializer should parse

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 8
    • 8
    • tools
    • None
    • b98
    • Verified

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: