Package org.codehaus.groovy.classgen

# Class FinalVariableAnalyzer

java.lang.Object
org.codehaus.groovy.ast.CodeVisitorSupport
org.codehaus.groovy.ast.ClassCodeVisitorSupport
org.codehaus.groovy.classgen.FinalVariableAnalyzer

All Implemented Interfaces:
  `GroovyClassVisitor`, `GroovyCodeVisitor`, `ErrorCollecting`

public class FinalVariableAnalyzer extends ClassCodeVisitorSupport

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static interface`
  `FinalVariableAnalyzer.VariableNotFinalCallback`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FinalVariableAnalyzer(SourceUnit sourceUnit)`
  `FinalVariableAnalyzer(SourceUnit sourceUnit, FinalVariableAnalyzer.VariableNotFinalCallback callback)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected SourceUnit`
  `getSourceUnit()`
  Provides access to the `SourceUnit` for error reporting during visitation.
  `boolean`
  `isEffectivelyFinal(Variable v)`
  `void`
  `visitArgumentlistExpression(ArgumentListExpression ale)`
  Visits an `ArgumentListExpression`, treating it as a tuple expression.
  `void`
  `visitBinaryExpression(BinaryExpression expression)`
  Visits a `BinaryExpression`, traversing left and right operand expressions.
  `void`
  `visitBlockStatement(BlockStatement block)`
  Visits a `BlockStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitClosureExpression(ClosureExpression expression)`
  Visits a `ClosureExpression` with annotation processing, traversing parameter annotations before delegating to parent traversal.
  `void`
  `visitIfElse(IfStatement ifElse)`
  Visits an `IfStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitPostfixExpression(PostfixExpression expression)`
  Visits a `PostfixExpression`, traversing the operand expression.
  `void`
  `visitPrefixExpression(PrefixExpression expression)`
  Visits a `PrefixExpression`, traversing the operand expression.
  `void`
  `visitSwitch(SwitchStatement switchS)`
  Visits a `SwitchStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitTryCatchFinally(TryCatchStatement statement)`
  Visits a `TryCatchStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitVariableExpression(VariableExpression expression)`
  Visits a `VariableExpression`.

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

  `addError, visitAnnotation, visitAnnotations, visitAnnotations, visitAssertStatement, visitBreakStatement, visitCaseStatement, visitCatchStatement, visitClass, visitClassCodeContainer, visitConstructor, visitConstructorOrMethod, visitContinueStatement, visitDeclarationExpression, visitDoWhileLoop, visitExpressionStatement, visitField, visitForLoop, visitImports, visitMethod, visitObjectInitializerStatements, visitPackage, visitProperty, visitReturnStatement, visitStatement, visitStatementAnnotations, visitSynchronizedStatement, visitThrowStatement, visitWhileLoop`

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

  `afterSwitchCaseStatementsVisited, afterSwitchConditionExpressionVisited, visitArrayExpression, visitAttributeExpression, visitBitwiseNegationExpression, visitBooleanExpression, visitBytecodeExpression, visitCastExpression, visitClassExpression, visitClosureListExpression, visitConstantExpression, visitConstructorCallExpression, visitEmptyStatement, visitFieldExpression, visitGStringExpression, visitLambdaExpression, visitListExpression, visitMapEntryExpression, visitMapExpression, visitMethodCallExpression, visitMethodPointerExpression, visitMethodReferenceExpression, visitNotExpression, visitPropertyExpression, visitRangeExpression, visitShortTernaryExpression, visitSpreadExpression, visitSpreadMapExpression, visitStaticMethodCallExpression, visitTernaryExpression, visitTupleExpression, visitUnaryMinusExpression, visitUnaryPlusExpression`

  ### 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.GroovyCodeVisitor

  `visit, visit, visitEmptyExpression, visitListOfExpressions`

- ## Constructor Details

  - ### FinalVariableAnalyzer

    public FinalVariableAnalyzer(SourceUnit sourceUnit)

  - ### FinalVariableAnalyzer

    public FinalVariableAnalyzer(SourceUnit sourceUnit, FinalVariableAnalyzer.VariableNotFinalCallback callback)

- ## Method Details

  - ### getSourceUnit

    protected SourceUnit getSourceUnit()
    Description copied from class: `ClassCodeVisitorSupport`
    Provides access to the `SourceUnit` for error reporting during visitation. Implementations must override this method.
    Specified by:
      `getSourceUnit` in class `ClassCodeVisitorSupport`
    Returns:
      the source unit for this visitor

  - ### isEffectivelyFinal

    public boolean isEffectivelyFinal(Variable v)

  - ### visitBlockStatement

    public void visitBlockStatement(BlockStatement block)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits a `BlockStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitBlockStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitBlockStatement` in class `ClassCodeVisitorSupport`
    Parameters:
      `block` - the block statement to visit
    See Also:
      - `CodeVisitorSupport.visitForLoop(ForStatement)`
      - `CodeVisitorSupport.visitWhileLoop(WhileStatement)`

  - ### visitArgumentlistExpression

    public void visitArgumentlistExpression(ArgumentListExpression ale)
    Description copied from class: `CodeVisitorSupport`
    Visits an `ArgumentListExpression`, treating it as a tuple expression.
    Specified by:
      `visitArgumentlistExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitArgumentlistExpression` in class `CodeVisitorSupport`
    Parameters:
      `ale` - the argument list expression

  - ### visitBinaryExpression

    public void visitBinaryExpression(BinaryExpression expression)
    Description copied from class: `CodeVisitorSupport`
    Visits a `BinaryExpression`, traversing left and right operand expressions.
    Specified by:
      `visitBinaryExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitBinaryExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the binary expression

  - ### visitClosureExpression

    public void visitClosureExpression(ClosureExpression expression)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits a `ClosureExpression` with annotation processing, traversing parameter annotations before delegating to parent traversal.
    Specified by:
      `visitClosureExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitClosureExpression` in class `ClassCodeVisitorSupport`
    Parameters:
      `expression` - the closure expression to visit

  - ### visitPrefixExpression

    public void visitPrefixExpression(PrefixExpression expression)
    Description copied from class: `CodeVisitorSupport`
    Visits a `PrefixExpression`, traversing the operand expression.
    Specified by:
      `visitPrefixExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitPrefixExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the prefix expression

  - ### visitPostfixExpression

    public void visitPostfixExpression(PostfixExpression expression)
    Description copied from class: `CodeVisitorSupport`
    Visits a `PostfixExpression`, traversing the operand expression.
    Specified by:
      `visitPostfixExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitPostfixExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the postfix expression

  - ### visitVariableExpression

    public void visitVariableExpression(VariableExpression expression)
    Description copied from class: `CodeVisitorSupport`
    Visits a `VariableExpression`. No traversal is performed as variable expressions contain no child expressions.
    Specified by:
      `visitVariableExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitVariableExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the variable expression

  - ### visitIfElse

    public void visitIfElse(IfStatement ifElse)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits an `IfStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitIfElse` in interface `GroovyCodeVisitor`
    Overrides:
      `visitIfElse` in class `ClassCodeVisitorSupport`
    Parameters:
      `ifElse` - the if statement to visit

  - ### visitSwitch

    public void visitSwitch(SwitchStatement switchS)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits a `SwitchStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitSwitch` in interface `GroovyCodeVisitor`
    Overrides:
      `visitSwitch` in class `ClassCodeVisitorSupport`
    Parameters:
      `switchS` - the switch statement to visit

  - ### visitTryCatchFinally

    public void visitTryCatchFinally(TryCatchStatement statement)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits a `TryCatchStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitTryCatchFinally` in interface `GroovyCodeVisitor`
    Overrides:
      `visitTryCatchFinally` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the try-catch statement to visit