Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-11492

Java compatibility: array initializers without "new Type[]"

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • parser-antlr4
    • None

    Description

      There are a few cases where bare array initializers are not yet supported:

      1. int[][] array = { {1,2}, {3,4} };
      2. @Target({ ElementType.FIELD, ElementType.METHOD })
      3. @interface A {
          String[] strings() default {}
        }
        

      These were implemented as part of [1] but the PR was closed. It may be worth looking back over what was done and re-implementing one or more of these cases. It was noted that Closure[] array = {}; is one of the edge cases that leads to ambiguity.

      [1] https://github.com/apache/groovy/pull/691

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              emilles Eric Milles
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: