StaticCompilationVisitor (Groovy 5.1.0)

Package: org.codehaus.groovy.transform.sc

## [Java] Class StaticCompilationVisitor

- org.codehaus.groovy.transform.sc.StaticCompilationVisitor

-     public class StaticCompilationVisitor
      extends StaticTypeCheckingVisitor

  This visitor is responsible for amending the AST with static compilation metadata or transform the AST so that a class or a method can be statically compiled. It may also throw errors specific to static compilation which are not considered as an error at the type check pass. For example, usage of spread operator is not allowed in statically compiled portions of code, while it may be statically checked. Static compilation relies on static type checking, which explains why this visitor extends the type checker visitor.

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static MethodNode` | `ARRAYLIST_ADD_METHOD` |
    `static ClassNode` | `ARRAYLIST_CLASSNODE` |
    `static MethodNode` | `ARRAYLIST_CONSTRUCTOR` |
    `static ClassNode` | `COMPILESTATIC_CLASSNODE` |
    `static ClassNode` | `TYPECHECKED_CLASSNODE` |

  - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class StaticTypeCheckingVisitor` | `CLOSUREPARAMS_CLASSNODE, CLOSURE_CALL_NO_ARG, CLOSURE_CALL_ONE_ARG, CLOSURE_CALL_VARGS, CURRENT_SIGNATURE_PROTOCOL, CURRENT_SIGNATURE_PROTOCOL_VERSION, DELEGATES_TO, DELEGATES_TO_TARGET, DGM_CLASSNODE, EMPTY_METHODNODE_LIST, ENUMERATION_TYPE, ERROR_COLLECTOR, GENERATED_EMPTY_STATEMENT, GET_DELEGATE, GET_OWNER, GET_THISOBJECT, ITERABLE_TYPE, LINKEDHASHMAP_CLASSNODE, MAP_ENTRY_TYPE, NAMED_PARAMS_CLASSNODE, NAMED_PARAM_CLASSNODE, TYPECHECKED_CLASSNODE, TYPECHECKING_ANNOTATIONS, TYPECHECKING_INFO_NODE, currentField, currentProperty, extension, returnAdder, returnListener, typeCheckingContext`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `StaticCompilationVisitor(SourceUnit unit, ClassNode node)`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `protected boolean` | `existsProperty(PropertyExpression pexp, boolean checkForReadOnly, ClassCodeVisitorSupport visitor)`
    `` | `protected MethodNode` | `findMethodOrFail(Expression expr, ClassNode receiver, String name, ClassNode args)`
    `` | `protected SourceUnit` | `getSourceUnit()`
    `` | `protected ClassNode[]` | `getTypeCheckingAnnotations()`
    `` | `public static boolean` | `isStaticallyCompiled(AnnotatedNode node)`
    `` | `public void` | `visitClass(ClassNode node)`
    `` | `public void` | `visitConstructor(ConstructorNode node)`
    `` | `public void` | `visitConstructorCallExpression(ConstructorCallExpression call)`
    `` | `public void` | `visitField(FieldNode node)`
    `` | `public void` | `visitForLoop(ForStatement statement)`
    `` | `public void` | `visitLambdaExpression(LambdaExpression expression)`
    `` | `public void` | `visitMethod(MethodNode node)`
    `` | `public void` | `visitMethod(MethodNode node)`
    `` | `public void` | `visitMethodCallExpression(MethodCallExpression call)`
    `` | `public void` | `visitProperty(PropertyNode node)`
    `` | `public void` | `visitPropertyExpression(PropertyExpression expression)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class StaticTypeCheckingVisitor` | `addAmbiguousErrorMessage, addAssignmentError, addCategoryMethodCallError, addClosureReturnType, addError, addNoMatchingMethodError, addNoMatchingMethodError, addReceivers, addStaticTypeError, addTypeCheckingExtension, addTypeCheckingInfoAnnotation, addUnsupportedPreOrPostfixExpressionError, afterSwitchCaseStatementsVisited, afterSwitchConditionExpressionVisited, areCategoryMethodCalls, checkCast, checkClosureParameters, checkForbiddenSpreadArgument, checkGroovyConstructorMap, checkGroovyStyleConstructor, checkReturnType, existsProperty, existsProperty, extractPropertyNameFromMethodName, extractTemporaryTypeInfoKey, extractTypesFromParameters, findCurrentInstanceOfClass, findMethod, findMethodOrFail, findMethodsWithGenerated, formatArgumentList, getArgumentTypes, getDelegationMetadata, getGroupOperationResultType, getInferredReturnType, getInferredReturnTypeFromWithClosureArgument, getOriginalDeclarationType, getResultType, getSourceUnit, getTemporaryTypesForExpression, getType, getTypeCheckingAnnotations, getTypeCheckingContext, hasRHSIncompleteGenericTypeInfo, inferClosureParameterTypes, inferComponentType, inferDiamondType, inferListExpressionType, inferLoopElementType, inferMapExpressionType, inferReturnTypeGenerics, inferReturnTypeGenerics, initialize, isClassInnerClassOrEqualTo, isNullConstant, isSecondPassNeededForControlStructure, isSkipMode, isSkippedInnerClass, isSuperExpression, isThisExpression, makeOwnerList, performSecondPass, popAssignmentTracking, prettyPrintMethodList, pushAssignmentTracking, pushInstanceOfTypeInfo, restoreVariableExpressionMetadata, saveVariableExpressionMetadata, setCompilationUnit, setMethodsToBeVisited, shouldSkipClassNode, shouldSkipMethodNode, silentlyVisitMethodNode, startMethodInference, storeInferredReturnType, storeTargetMethod, storeType, transform, typeCheckAssignment, typeCheckClosureCall, typeCheckMapConstructor, typeCheckMethodsWithGenericsOrFail, visitArrayExpression, visitAttributeExpression, visitBinaryExpression, visitBitwiseNegationExpression, visitCaseStatement, visitCastExpression, visitClass, visitClassExpression, visitClosureExpression, visitClosureExpression, visitConstructor, visitConstructorCallExpression, visitConstructorOrMethod, visitExpressionStatement, visitField, visitForLoop, visitIfElse, visitMethod, visitMethodCallArguments, visitMethodCallExpression, visitMethodCallExpression, visitMethodPointerExpression, visitNotExpression, visitObjectInitializerStatements, visitPostfixExpression, visitPrefixExpression, visitProperty, visitPropertyExpression, visitRangeExpression, visitReturnStatement, visitReturnStatement, visitStaticMethodCallExpression, visitSwitch, visitTernaryExpression, visitTryCatchFinally, visitUnaryMinusExpression, visitUnaryPlusExpression, visitVariableExpression, visitWhileLoop, wrapTypeIfNecessary`
    `class ClassCodeVisitorSupport` | `addError, getSourceUnit, visitAnnotation, visitAnnotations, visitAnnotations, visitAssertStatement, visitBlockStatement, visitBreakStatement, visitCaseStatement, visitCatchStatement, visitClass, visitClassCodeContainer, visitClosureExpression, visitConstructor, visitConstructorOrMethod, visitContinueStatement, visitDeclarationExpression, visitDoWhileLoop, visitExpressionStatement, visitField, visitForLoop, visitIfElse, visitImports, visitMethod, visitObjectInitializerStatements, visitPackage, visitProperty, visitReturnStatement, visitStatement, visitSwitch, visitSynchronizedStatement, visitThrowStatement, visitTryCatchFinally, visitWhileLoop`
    `class CodeVisitorSupport` | `afterSwitchCaseStatementsVisited, afterSwitchConditionExpressionVisited, visitArgumentlistExpression, visitArrayExpression, visitAssertStatement, visitAttributeExpression, visitBinaryExpression, visitBitwiseNegationExpression, visitBlockStatement, visitBooleanExpression, visitBreakStatement, visitBytecodeExpression, visitCaseStatement, visitCastExpression, visitCatchStatement, visitClassExpression, visitClosureExpression, visitClosureListExpression, visitConstantExpression, visitConstructorCallExpression, visitContinueStatement, visitDeclarationExpression, visitDoWhileLoop, visitEmptyStatement, visitExpressionStatement, visitFieldExpression, visitForLoop, visitGStringExpression, visitIfElse, visitLambdaExpression, visitListExpression, visitMapEntryExpression, visitMapExpression, visitMethodCallExpression, visitMethodPointerExpression, visitMethodReferenceExpression, visitNotExpression, visitPostfixExpression, visitPrefixExpression, visitPropertyExpression, visitRangeExpression, visitReturnStatement, visitShortTernaryExpression, visitSpreadExpression, visitSpreadMapExpression, visitStaticMethodCallExpression, visitSwitch, visitSynchronizedStatement, visitTernaryExpression, visitThrowStatement, visitTryCatchFinally, visitTupleExpression, visitUnaryMinusExpression, visitUnaryPlusExpression, visitVariableExpression, visitWhileLoop`

- - ### Field Detail

    - #### public static final MethodNode ARRAYLIST_ADD_METHOD

    - #### public static final ClassNode ARRAYLIST_CLASSNODE

    - #### public static final MethodNode ARRAYLIST_CONSTRUCTOR

    - #### public static final ClassNode COMPILESTATIC_CLASSNODE

    - #### public static final ClassNode TYPECHECKED_CLASSNODE

  - ### Constructor Detail

    - #### public StaticCompilationVisitor(SourceUnit unit, ClassNode node)

  - ### Method Detail

    - #### @Override
      protected boolean existsProperty(PropertyExpression pexp, boolean checkForReadOnly, ClassCodeVisitorSupport visitor)

    - #### @Override
      protected MethodNode findMethodOrFail(Expression expr, ClassNode receiver, String name, ClassNode args)

    - #### @Override
      protected SourceUnit getSourceUnit()

    - #### @Override
      protected ClassNode[] getTypeCheckingAnnotations()

    - #### public static boolean isStaticallyCompiled(AnnotatedNode node)

    - #### @Override
      public void visitClass(ClassNode node)

    - #### @Override
      public void visitConstructor(ConstructorNode node)

    - #### @Override
      public void visitConstructorCallExpression(ConstructorCallExpression call)

    - #### @Override
      public void visitField(FieldNode node)

    - #### @Override
      public void visitForLoop(ForStatement statement)

    - #### @Override
      public void visitLambdaExpression(LambdaExpression expression)

    - #### @Override
      public void visitMethod(MethodNode node)

    - #### @Override
      public void visitMethod(MethodNode node)

    - #### @Override
      public void visitMethodCallExpression(MethodCallExpression call)

    - #### @Override
      public void visitProperty(PropertyNode node)

    - #### @Override
      public void visitPropertyExpression(PropertyExpression expression)