-
Bug
-
Resolution: Won't Fix
-
P5
-
7
-
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
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