Package: org.codehaus.groovy.control

## [Java] Class GenericsVisitor

- org.codehaus.groovy.control.GenericsVisitor

-     public class GenericsVisitor
      extends ClassCodeVisitorSupport

  Verify correct usage of generics. This includes:

  - class header (class and superclass declaration)
  - arity of type parameters for fields, parameters, local variables
  - invalid diamond `<>` usage

- - ### Constructor Summary

    Constructors
    Constructor and description
    `GenericsVisitor(SourceUnit source)` Creates a visitor that validates generic type usage for one source unit.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `protected SourceUnit` | `getSourceUnit()` Returns the source unit currently being verified.
    `` | `public void` | `visitArrayExpression(ArrayExpression expression)` Validates generic usage for array element types.
    `` | `public void` | `visitCastExpression(CastExpression expression)` Validates generic usage for cast target types.
    `` | `public void` | `visitClass(ClassNode node)` Validates generic usage in a class header and its contents.
    `` | `public void` | `visitConstructorCallExpression(ConstructorCallExpression expression)` Validates generic usage on constructor call types.
    `` | `protected void` | `visitConstructorOrMethod(MethodNode node, boolean isConstructor)` Validates generic usage for a constructor or method signature.
    `` | `public void` | `visitDeclarationExpression(DeclarationExpression expression)` Validates generic usage in declared variable types.
    `` | `public void` | `visitField(FieldNode node)` Validates generic usage for a field declaration.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `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, visitStatementAnnotations, 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`

- - ### Constructor Detail

    - #### public GenericsVisitor(SourceUnit source)

      Creates a visitor that validates generic type usage for one source unit.

      Parameters:
        `source` - the source unit being verified

  - ### Method Detail

    - #### protected SourceUnit getSourceUnit()

      Returns the source unit currently being verified.

      Returns:
        the active source unit

    - #### public void visitArrayExpression(ArrayExpression expression)

      Validates generic usage for array element types.

      Parameters:
        `expression` - the array expression to inspect

    - #### public void visitCastExpression(CastExpression expression)

      Validates generic usage for cast target types.

      Parameters:
        `expression` - the cast expression to inspect

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

      Validates generic usage in a class header and its contents.

      Parameters:
        `node` - the class to inspect

    - #### public void visitConstructorCallExpression(ConstructorCallExpression expression)

      Validates generic usage on constructor call types.

      Parameters:
        `expression` - the constructor call to inspect

    - #### protected void visitConstructorOrMethod(MethodNode node, boolean isConstructor)

      Validates generic usage for a constructor or method signature.

      Parameters:
        `node` - the executable member to inspect
        `isConstructor` - whether `node` is a constructor

    - #### public void visitDeclarationExpression(DeclarationExpression expression)

      Validates generic usage in declared variable types.

      Parameters:
        `expression` - the declaration expression to inspect

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

      Validates generic usage for a field declaration.

      Parameters:
        `node` - the field to inspect