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

Several tree classes return a ParenthesizedTree rather than the expression itself.

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      WhileLoopTree.getCondition(), DoWhileLoop.getCondition() and SynchronizedTree.getExpression() always returns a ParenthesedTree, not the expression itself. For example, "while(true);" defines a WhileLoopTree whose condition is a ParenthesizedTree, and that tree's expression is the LiteralTree. Previously (I don't know what release this changed) WhileLoopTree.getCondition() returned the LiteralTree. I think the ParenthesizedTree is a mistake because the outer parentheses in while, do/while, and synchronized statements are part of their syntax. ForLoopTree does not return a ParenthesizedTree for its methods (unless the original code had parens, of course).

      This is an issue for source code rewriters which want to preserve the original parentheses when changing the expression within.

        Attachments

          Activity

            People

            • Assignee:
              jjg Jonathan Gibbons
              Reporter:
              tballsunw Tom Ball (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: