- All Implemented Interfaces:
- java.lang.Cloneable, polyglot.util.Copy<polyglot.visit.NodeVisitor>
public class ConstChecker
extends polyglot.visit.NodeVisitor
Visitor which traverses an expression AST, and determines if the expression
is a constant expression. This visitor should only be used for checking the
initialization expressions of static fields; it is not checking for
compile-time constants.
In general, we prevent static initializers from containing any references,
as such a reference may cause a class to be loaded, and thus leak
information about when a class is first mentioned. However, we allow
literals (e.g. String literals) and array initializers (although if an
element of the array initalizer is not constant, it will be ruled out.)