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

Clean up use of Symbols in JCTree constructors

XMLWordPrintable

    • generic
    • generic

      A number of JCTree classes have a field of type Symbol (or some subtype of Symbol). Many of them also have a corresponding constructor parameter; a few, inconsistently, do not. In typical usage (see class TreeMaker), this symbol parameter is unknown at construction time, and so "null" must be passed to the constructor. (Occasionally, TreeMaker has a clone-like feature that duplicates another tree node, and in that exceptional case, the symbol is known and provided to the constructor. Subsequently, other fields that don't have constructor parameters -- like type -- are set manually.)

      For consistentency, Symbol fields should either always be constructor parameters, or never be constructor parameters.

      Here are the AST class types in question:

      JCCompilationUnit
      JCClassDecl
      JCMethodDecl*
      JCVariableDecl*
      JCNewClass#
      JCAssignOp
      JCUnary#
      JCBinary
      JCFieldAccess*
      JCIdent*

      * TreeMaker has a clone-like method providing a non-null argument
      # No symbol constructor parameter

            dlsmith Dan Smith
            dlsmith Dan Smith
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: