Package org.codehaus.groovy.ast.stmt

# Class EmptyStatement

java.lang.Object
org.codehaus.groovy.ast.ASTNode
org.codehaus.groovy.ast.stmt.Statement
org.codehaus.groovy.ast.stmt.EmptyStatement

All Implemented Interfaces:
  `NodeMetaDataHandler`

public class EmptyStatement extends Statement
Represents an empty statement that performs no operation. An empty statement is a valid statement that can appear wherever a statement is expected but has no executable code. Empty statements are often used as default cases or as placeholders in control flow structures.

An immutable singleton `INSTANCE` is provided for use when source position or other occurrence-specific metadata is not needed. Using the singleton reduces memory overhead.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final EmptyStatement`
  `INSTANCE`
  Immutable singleton that is recommended for use when source range or any other occurrence-specific metadata is not needed.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `EmptyStatement()`
  Constructs a new empty statement instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `isEmpty()`
  Returns true if this statement is empty or produces no side effects.
  `void`
  `visit(GroovyCodeVisitor visitor)`
  Accepts a code visitor for AST traversal and transformation.

  ### Methods inherited from class org.codehaus.groovy.ast.stmt.Statement

  `addStatementAnnotation, addStatementLabel, copyStatementLabels, getStatementAnnotations, getStatementLabel, getStatementLabels, setStatementLabel`

  ### Methods inherited from class org.codehaus.groovy.ast.ASTNode

  `copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition`

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

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

  ### Methods inherited from interface org.codehaus.groovy.ast.NodeMetaDataHandler

  `copyNodeMetaData, getNodeMetaData, getNodeMetaData, getNodeMetaData, newMetaDataMap, putNodeMetaData, removeNodeMetaData, setNodeMetaData`

- ## Field Details

  - ### INSTANCE

    public static final EmptyStatement INSTANCE
    Immutable singleton that is recommended for use when source range or any other occurrence-specific metadata is not needed. Using this singleton conserves memory by avoiding unnecessary object allocations.
    See Also:
      - `EmptyStatement()`

- ## Constructor Details

  - ### EmptyStatement

    public EmptyStatement()
    Constructs a new empty statement instance. For most use cases, consider using `INSTANCE` instead to avoid unnecessary object allocation.
    See Also:
      - `INSTANCE`

- ## Method Details

  - ### isEmpty

    public boolean isEmpty()
    Description copied from class: `Statement`
    Returns true if this statement is empty or produces no side effects. Typically only `EmptyStatement` returns true.
    Overrides:
      `isEmpty` in class `Statement`
    Returns:
      true if this statement is empty

  - ### visit

    public void visit(GroovyCodeVisitor visitor)
    Description copied from class: `ASTNode`
    Accepts a code visitor for AST traversal and transformation. Subclasses must implement this method to support visitor pattern-based processing. The visitor pattern enables decoupling of AST structure from processing logic.
    Overrides:
      `visit` in class `ASTNode`
    Parameters:
      `visitor` - the `GroovyCodeVisitor` to process this node