jif.visit

## Class ConstChecker

- java.lang.Object
- - polyglot.visit.NodeVisitor
  - - jif.visit.ConstChecker

- 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.)

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface polyglot.util.Copy

      `polyglot.util.Copy.Util`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConstChecker(polyglot.types.ClassType currentClass)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `isConst()`
    `polyglot.ast.Node` | `leave(polyglot.ast.Node old, polyglot.ast.Node n, polyglot.visit.NodeVisitor v)`
    `polyglot.ast.Node` | `override(polyglot.ast.Node n)`

    - ### Methods inherited from class polyglot.visit.NodeVisitor

      `begin, copy, enter, enter, finish, finish, lang, leave, override, toString, visitEdge, visitEdgeNoOverride`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ConstChecker

          public ConstChecker(polyglot.types.ClassType currentClass)

  - ### Method Detail

    - #### isConst

          public boolean isConst()

    - #### override

          public polyglot.ast.Node override(polyglot.ast.Node n)

      Overrides:
        `override` in class `polyglot.visit.NodeVisitor`

    - #### leave

          public polyglot.ast.Node leave(polyglot.ast.Node old,
                                         polyglot.ast.Node n,
                                         polyglot.visit.NodeVisitor v)

      Overrides:
        `leave` in class `polyglot.visit.NodeVisitor`