c.s.t.javac.tree.Pretty.visitNewArray() prints duplicate dimension markers

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 8
    • Affects Version/s: 8
    • Component/s: tools
    • b103
    • Verified

      When pretty printing a new array that has an initializer, the "[]" markers are printed twice:

      if (tree.elemtype != null) {
      ...
          if (tree.elems != null) {
      ...
              print("[]");
          }
      ...
      }
      if (tree.elems != null) {
          if (tree.elemtype != null) print("[]");
      ...
      }

      Thus, a source file with "new Class[]{MethodType.class}" is printed as "new Class[][]{MethodType.class}".

      I tried this with the latest promoted 8:
      $ j8 -version
      java version "1.8.0-ea"
      Java(TM) SE Runtime Environment (build 1.8.0-ea-b90)
      Java HotSpot(TM) 64-Bit Server VM (build 25.0-b32, mixed mode)

            Assignee:
            Kumar Srinivasan
            Reporter:
            Andrew Gross
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: