Package org.codehaus.groovy.transform.sc.transformers

# Class StaticCompilationTransformer

java.lang.Object
org.codehaus.groovy.ast.CodeVisitorSupport
org.codehaus.groovy.ast.ClassCodeVisitorSupport
org.codehaus.groovy.ast.ClassCodeExpressionTransformer
org.codehaus.groovy.transform.sc.transformers.StaticCompilationTransformer

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

    public class StaticCompilationTransformer
    extends ClassCodeExpressionTransformer

Some expressions use symbols as aliases to method calls (<<, +=, ...). In static compilation, if such a method call is found, we transform the original binary expression into a method call expression so that the call gets statically compiled.

- ## Field Summary

  Fields
  Modifier and Type | Field | Description
  --- | --- | ---
  `protected static ClassNode` | `BYTECODE_ADAPTER_CLASS` |
  `protected static java.util.Map<java.lang.Integer,​MethodNode>` | `BYTECODE_BINARY_ADAPTERS` |

- ## Constructor Summary

  Constructors
  Constructor | Description
  --- | ---
  `StaticCompilationTransformer​(SourceUnit unit, StaticTypeCheckingVisitor visitor)` |

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `ClassNode` | `getClassNode()` |
  `protected SourceUnit` | `getSourceUnit()` |
  `StaticTypesTypeChooser` | `getTypeChooser()` |
  `Expression` | `transform​(Expression expr)` | Transforms the given expression into another expression
  `void` | `visitClass​(ClassNode node)` | Visit a ClassNode.
  `void` | `visitClassCodeContainer​(Statement code)` |
  `protected void` | `visitConstructorOrMethod​(MethodNode node, boolean isConstructor)` |

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

  `setSourcePosition, visitAnnotation, visitAssertStatement, visitCaseStatement, visitDoWhileLoop, visitExpressionStatement, visitField, visitForLoop, visitIfElse, visitProperty, visitReturnStatement, visitSwitch, visitSynchronizedStatement, visitThrowStatement, visitWhileLoop`

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

  `addError, visitAnnotations, visitBlockStatement, visitBreakStatement, visitCatchStatement, visitConstructor, visitContinueStatement, visitDeclarationExpression, visitImports, visitMethod, visitObjectInitializerStatements, visitPackage, visitStatement, visitTryCatchFinally`

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

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

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

  `visitEmptyExpression, visitListOfExpressions`

- ## Field Details

  - ### BYTECODE_ADAPTER_CLASS

    protected static final ClassNode BYTECODE_ADAPTER_CLASS

  - ### BYTECODE_BINARY_ADAPTERS

    protected static final java.util.Map<java.lang.Integer,​MethodNode> BYTECODE_BINARY_ADAPTERS

- ## Constructor Details

  - ### StaticCompilationTransformer

    public StaticCompilationTransformer​(SourceUnit unit, StaticTypeCheckingVisitor visitor)

- ## Method Details

  - ### getSourceUnit

    protected SourceUnit getSourceUnit()
    Specified by:
      `getSourceUnit` in class `ClassCodeVisitorSupport`

  - ### getTypeChooser

    public StaticTypesTypeChooser getTypeChooser()

  - ### getClassNode

    public ClassNode getClassNode()

  - ### visitClassCodeContainer

    public void visitClassCodeContainer​(Statement code)
    Overrides:
      `visitClassCodeContainer` in class `ClassCodeVisitorSupport`

  - ### transform

    public Expression transform​(Expression expr)
    Description copied from interface: `ExpressionTransformer`
    Transforms the given expression into another expression
    Specified by:
      `transform` in interface `ExpressionTransformer`
    Overrides:
      `transform` in class `ClassCodeExpressionTransformer`

  - ### visitClass

    public void visitClass​(ClassNode node)
    Description copied from interface: `GroovyClassVisitor`
    Visit a ClassNode.
    Specified by:
      `visitClass` in interface `GroovyClassVisitor`
    Overrides:
      `visitClass` in class `ClassCodeVisitorSupport`

  - ### visitConstructorOrMethod

    protected void visitConstructorOrMethod​(MethodNode node, boolean isConstructor)
    Overrides:
      `visitConstructorOrMethod` in class `ClassCodeExpressionTransformer`