Package: org.codehaus.groovy.classgen

## [Java] Class Verifier

- org.codehaus.groovy.classgen.Verifier

- All Implemented Interfaces and Traits:
    GroovyClassVisitor, org.objectweb.asm.Opcodes

      public class Verifier
      extends Object

  Verifies the AST node and adds any default AST code before bytecode generation occurs.

  Checks include:

  - Methods with duplicate signatures
  - Duplicate interfaces
  - Reassigned final variables/parameters
  - Uninitialized variables
  - Bad code in object initializers or constructors
  - Mismatches in modifiers or return types between implementations and interfaces/abstract classes
  Added code includes:
  - Methods needed to implement GroovyObject
  - Property accessor methods
  - Covariant methods
  - Additional methods/constructors as needed for default parameters

- - ### Nested Class Summary

    Nested classes
    Modifiers | Name | Description
    --- | --- | ---
    `interface` | `Verifier.DefaultArgsAction` |

  - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static String` | `DEFAULT_PARAMETER_GENERATED` |
    `static String` | `INITIAL_EXPRESSION` |
    `static String` | `STATIC_METACLASS_BOOL` |
    `static String` | `SWAP_INIT` |
    `static String` | `__TIMESTAMP` |
    `static String` | `__TIMESTAMP__` |

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `protected void` | `addClosureCode(InnerClassNode node)`
    `` | `protected void` | `addConstructor(Parameter[] newParams, ConstructorNode ctor, Statement code, ClassNode type)`
    `` | `protected void` | `addCovariantMethods(ClassNode classNode)`
    `` | `protected void` | `addDefaultConstructor(ClassNode node)`
    `` | `protected void` | `addDefaultParameterConstructors(ClassNode type)` Creates a new constructor for each combination of default parameter expressions.
    `` | `protected void` | `addDefaultParameterMethods(ClassNode type)` Creates a new method for each combination of default parameter expressions.
    `` | `protected void` | `addDefaultParameters(List<? extends MethodNode> methods, Verifier.DefaultArgsAction action)` Creates a new helper method for each combination of default parameter expressions.
    `` | `protected void` | `addDefaultParameters(Verifier.DefaultArgsAction action, MethodNode method)`
    `` | `protected void` | `addFieldInitialization(List list, List staticList, FieldNode fieldNode, boolean isEnumClassNode, List initStmtsAfterEnumValuesInit, Set explicitStaticPropsInEnum)`
    `` | `protected void` | `addGroovyObjectInterfaceAndMethods(ClassNode node, String classInternalName)`
    `` | `protected void` | `addInitialization(ClassNode node)`
    `` | `protected void` | `addInitialization(ClassNode node, ConstructorNode constructorNode)`
    `` | `protected MethodNode` | `addMethod(ClassNode node, boolean shouldBeSynthetic, String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code)` Helper method to add a new method to a ClassNode.
    `` | `protected void` | `addMethod$$bridge(ClassNode node, boolean shouldBeSynthetic, String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code)`
    `` | `protected void` | `addPropertyMethod(MethodNode method)`
    `` | `protected void` | `addReturnIfNeeded(MethodNode node)`
    `` | `protected void` | `addTimeStamp(ClassNode node)`
    `` | `static String` | `capitalize(String name)` Capitalizes the start of the given bean property name.
    `` | `protected Statement` | `createGetterBlock(PropertyNode propertyNode, FieldNode field)`
    `` | `protected Statement` | `createSetterBlock(PropertyNode propertyNode, FieldNode field)`
    `` | `ClassNode` | `getClassNode()`
    `` | `protected VariableNotFinalCallback` | `getFinalVariablesCallback()`
    `` | `MethodNode` | `getMethodNode()`
    `` | `static long` | `getTimestamp(Class<?> clazz)`
    `` | `static Long` | `getTimestampFromFieldName(String fieldName)`
    `` | `protected void` | `setClassNode(ClassNode classNode)`
    `` | `static ConstantExpression` | `transformToPrimitiveConstantIfPossible(ConstantExpression constantExpression)` When constant expressions are created, the value is always wrapped to a non primitive type.
    `` | `void` | `variableNotAlwaysInitialized(VariableExpression var)`
    `` | `void` | `variableNotFinal(Variable var, Expression bexp)`
    `` | `void` | `visit(org.objectweb.asm.MethodVisitor mv)`
    `` | `void` | `visit(org.objectweb.asm.MethodVisitor mv)`
    `` | `void` | `visit(org.objectweb.asm.MethodVisitor mv)`
    `` | `void` | `visit(org.objectweb.asm.MethodVisitor mv)`
    `` | `void` | `visit(org.objectweb.asm.MethodVisitor mv)`
    `` | `void` | `visit(org.objectweb.asm.MethodVisitor mv)`
    `` | `void` | `visit(org.objectweb.asm.MethodVisitor mv)`
    `` | `void` | `visit(org.objectweb.asm.MethodVisitor mv)`
    `` | `void` | `visitClass(ClassNode node)`
    `` | `void` | `visitClosureExpression(ClosureExpression expression)`
    `` | `void` | `visitClosureExpression(ClosureExpression ce)`
    `` | `void` | `visitClosureExpression(ClosureExpression e)`
    `` | `void` | `visitConstructor(ConstructorNode node)`
    `` | `void` | `visitConstructorCallExpression(ConstructorCallExpression cce)`
    `` | `void` | `visitConstructorCallExpression(ConstructorCallExpression call)`
    `` | `void` | `visitConstructorCallExpression(ConstructorCallExpression call)`
    `` | `void` | `visitField(FieldNode node)`
    `` | `void` | `visitGenericType(GenericsType genericsType)`
    `` | `void` | `visitMethod(MethodNode node)`
    `` | `void` | `visitMethodCallExpression(MethodCallExpression mce)`
    `` | `void` | `visitProperty(PropertyNode node)`
    `` | `void` | `visitReturnStatement(ReturnStatement statement)`
    `` | `void` | `visitVariableExpression(VariableExpression ve)`
    `` | `void` | `visitVariableExpression(VariableExpression e)`
    `` | `void` | `visitVariableExpression(VariableExpression e)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Field Detail

    - #### public static final String DEFAULT_PARAMETER_GENERATED

    - #### public static final String INITIAL_EXPRESSION

    - #### public static final String STATIC_METACLASS_BOOL

    - #### public static final String SWAP_INIT

    - #### public static final String __TIMESTAMP

    - #### public static final String __TIMESTAMP__

  - ### Method Detail

    - #### protected void addClosureCode(InnerClassNode node)

    - #### protected void addConstructor(Parameter[] newParams, ConstructorNode ctor, Statement code, ClassNode type)

    - #### protected void addCovariantMethods(ClassNode classNode)

    - #### protected void addDefaultConstructor(ClassNode node)

    - #### protected void addDefaultParameterConstructors(ClassNode type)

      Creates a new constructor for each combination of default parameter expressions.

    - #### protected void addDefaultParameterMethods(ClassNode type)

      Creates a new method for each combination of default parameter expressions.

    - #### protected void addDefaultParameters(List<? extends MethodNode> methods, Verifier.DefaultArgsAction action)

      Creates a new helper method for each combination of default parameter expressions.

    - #### protected void addDefaultParameters(Verifier.DefaultArgsAction action, MethodNode method)

    - #### protected void addFieldInitialization(List list, List staticList, FieldNode fieldNode, boolean isEnumClassNode, List initStmtsAfterEnumValuesInit, Set explicitStaticPropsInEnum)

    - #### protected void addGroovyObjectInterfaceAndMethods(ClassNode node, String classInternalName)

    - #### protected void addInitialization(ClassNode node)

    - #### protected void addInitialization(ClassNode node, ConstructorNode constructorNode)

    - #### protected MethodNode addMethod(ClassNode node, boolean shouldBeSynthetic, String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code)

      Helper method to add a new method to a ClassNode. Depending on the shouldBeSynthetic flag the call will either be made to ClassNode.addSyntheticMethod() or ClassNode.addMethod(). If a non-synthetic method is to be added the ACC_SYNTHETIC modifier is removed if it has been accidentally supplied.

    - #### protected void addMethod$$bridge(ClassNode node, boolean shouldBeSynthetic, String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code)

    - #### protected void addPropertyMethod(MethodNode method)

    - #### protected void addReturnIfNeeded(MethodNode node)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprDeprecated protected void addTimeStamp(ClassNode node)

    - #### public static String capitalize(String name)

      Capitalizes the start of the given bean property name.

    - #### protected Statement createGetterBlock(PropertyNode propertyNode, FieldNode field)

    - #### protected Statement createSetterBlock(PropertyNode propertyNode, FieldNode field)

    - #### public ClassNode getClassNode()

    - #### protected VariableNotFinalCallback getFinalVariablesCallback()

    - #### public MethodNode getMethodNode()

    - #### public static long getTimestamp(Class<?> clazz)

    - #### public static Long getTimestampFromFieldName(String fieldName)

    - #### protected void setClassNode(ClassNode classNode)

    - #### public static ConstantExpression transformToPrimitiveConstantIfPossible(ConstantExpression constantExpression)

      When constant expressions are created, the value is always wrapped to a non primitive type. Some constant expressions are optimized to return primitive types, but not all primitives are handled. This method guarantees to return a similar constant expression but with a primitive type instead of a boxed type.

      Additionally, single char strings are converted to 'char' types.
      Parameters:
        `constantExpression` - a constant expression
      Returns:
        the same instance of constant expression if the type is already primitive, or a primitive constant if possible.

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void variableNotAlwaysInitialized(VariableExpression var)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void variableNotFinal(Variable var, Expression bexp)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visit(org.objectweb.asm.MethodVisitor mv)

    - #### public void visit(org.objectweb.asm.MethodVisitor mv)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visit(org.objectweb.asm.MethodVisitor mv)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitClass(ClassNode node)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitClosureExpression(ClosureExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitClosureExpression(ClosureExpression ce)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitClosureExpression(ClosureExpression e)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitConstructor(ConstructorNode node)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitConstructorCallExpression(ConstructorCallExpression cce)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitConstructorCallExpression(ConstructorCallExpression call)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitField(FieldNode node)

    - #### public void visitGenericType(GenericsType genericsType)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitMethod(MethodNode node)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitMethodCallExpression(MethodCallExpression mce)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitProperty(PropertyNode node)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitReturnStatement(ReturnStatement statement)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitVariableExpression(VariableExpression ve)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitVariableExpression(VariableExpression e)