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

(javac) Starting positions of ClassTree for enum constants

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P5
    • Resolution: Unresolved
    • Affects Version/s: 7
    • Fix Version/s: tbd_major
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      Consider the following code:
      enum Test {
          A {};
      }

      The "A {}" is modeled as a field whose initializer is a NewClassTree, containing a ClassTree as its ClassBody. Currently, the NewClassTree's starting position is:
          A {};
            ^
      but the embedded ClassTree's position is:
          A {};
          ^

      Which confuses the NetBeans code generator, as the inner tree is outside the bounds of the outer tree. I propose this position is changed to:
          A {};
            ^

      Similarly for enum constants with parameters, the NewClassTree's position would be kept as
          A (1) {};
            ^
      and the ClassTree's position would be:
          A (1) {};
                ^

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jlahoda Jan Lahoda
                Reporter:
                ksrini Kumar Srinivasan
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Imported:
                  Indexed: