public class NullConstant extends Expression
A null constant value. The expression can have an optional object type, because null can represent any object type, and if this expression type is needed to derive the type of some parent expression, the type may need to be explicitly specified.
  • Field Details

    • type

      public final ObjectType type
      The type of the null, which may be needed to determine expression types
  • Constructor Details

    • NullConstant

      public NullConstant()
      Create a null constant with a type of java.lang.Object
    • NullConstant

      public NullConstant(ObjectType type)
      Create a null constant with a specific type
      Parameters:
      type - The type of this expression
    • NullConstant

      public NullConstant(String filename, int lineNumber)
      Create a null constant with a type of java.lang.Object
      Parameters:
      filename - The source filename this expression is associated with
      lineNumber - The source line number this expression is associated with
    • NullConstant

      public NullConstant(ObjectType type, String filename, int lineNumber)
      Create a null constant with a specific type
      Parameters:
      type - The type of this expression
      filename - The source filename this expression is associated with
      lineNumber - The source line number this expression is associated with
  • Method Details

    • findCaptured

      public void findCaptured(Environment env)
      Description copied from class: Expression
      Search for local variables that would be captured by a lambda. Each expression has its own implementation of this, because each subexpression must be searched.
      Specified by:
      findCaptured in class Expression
      Parameters:
      env - The environment chain to search
    • getType

      public Type getType()
      Description copied from class: Expression
      Get the type returned by this expression
      Specified by:
      getType in class Expression
      Returns:
      The type of this expression
    • convertToFullTailCalls

      public Expression convertToFullTailCalls(boolean inTailPosition)
      Description copied from class: Expression
      Converts this expression to one that is compatible with full tail call optimization
      Specified by:
      convertToFullTailCalls in class Expression
      Parameters:
      inTailPosition - True if this expression is called from the tail position
      Returns:
      A version of this expression whose types are compatible with full tail call optimization
    • generate

      public void generate(ClassGenerator gen, Environment env, boolean inTailPosition)
      Description copied from class: Expression
      Generate the bytecode for this expression
      Specified by:
      generate in class Expression
      Parameters:
      gen - The generator for generating instructions and additional declarations
      env - The environment containing the local variables currently visible to this expression
      inTailPosition - True if this expression is being generated from the tail position of the method