Search in sources :

Example 6 with GenericsTypeName

use of org.codehaus.groovy.ast.GenericsType.GenericsTypeName in project groovy by apache.

the class StaticTypeCheckingSupport method applyGenericsContext.

private static GenericsType applyGenericsContext(final Map<GenericsTypeName, GenericsType> spec, final GenericsType gt) {
    if (gt.isPlaceholder()) {
        GenericsTypeName name = new GenericsTypeName(gt.getName());
        GenericsType specType = spec.get(name);
        if (specType != null)
            return specType;
        if (hasNonTrivialBounds(gt)) {
            GenericsType newGT = new GenericsType(gt.getType(), applyGenericsContext(spec, gt.getUpperBounds()), applyGenericsContext(spec, gt.getLowerBound()));
            newGT.setPlaceholder(true);
            return newGT;
        }
        return gt;
    } else if (gt.isWildcard()) {
        GenericsType newGT = new GenericsType(gt.getType(), applyGenericsContext(spec, gt.getUpperBounds()), applyGenericsContext(spec, gt.getLowerBound()));
        newGT.setWildcard(true);
        return newGT;
    }
    ClassNode type = gt.getType();
    ClassNode newType;
    if (type.isArray()) {
        newType = applyGenericsContext(spec, type.getComponentType()).makeArray();
    } else {
        if (type.getGenericsTypes() == null) {
            return gt;
        }
        newType = type.getPlainNodeReference();
        newType.setGenericsPlaceHolder(type.isGenericsPlaceHolder());
        newType.setGenericsTypes(applyGenericsContext(spec, type.getGenericsTypes()));
    }
    return new GenericsType(newType);
}
Also used : ClassNode(org.codehaus.groovy.ast.ClassNode) InnerClassNode(org.codehaus.groovy.ast.InnerClassNode) GenericsType(org.codehaus.groovy.ast.GenericsType) GenericsTypeName(org.codehaus.groovy.ast.GenericsType.GenericsTypeName)

Example 7 with GenericsTypeName

use of org.codehaus.groovy.ast.GenericsType.GenericsTypeName in project groovy by apache.

the class StaticTypeCheckingSupport method parameterizeArguments.

/**
 * Given a receiver and a method node, parameterize the method arguments using
 * available generic type information.
 *
 * @param receiver the class
 * @param m        the method
 * @return the parameterized arguments
 */
public static Parameter[] parameterizeArguments(final ClassNode receiver, final MethodNode m) {
    Map<GenericsTypeName, GenericsType> genericFromReceiver = GenericsUtils.extractPlaceholders(receiver);
    Map<GenericsTypeName, GenericsType> contextPlaceholders = extractGenericsParameterMapOfThis(m);
    Parameter[] methodParameters = m.getParameters();
    Parameter[] params = new Parameter[methodParameters.length];
    for (int i = 0, n = methodParameters.length; i < n; i += 1) {
        Parameter methodParameter = methodParameters[i];
        ClassNode paramType = methodParameter.getType();
        params[i] = buildParameter(genericFromReceiver, contextPlaceholders, methodParameter, paramType);
    }
    return params;
}
Also used : ClassNode(org.codehaus.groovy.ast.ClassNode) InnerClassNode(org.codehaus.groovy.ast.InnerClassNode) GenericsType(org.codehaus.groovy.ast.GenericsType) GenericsTypeName(org.codehaus.groovy.ast.GenericsType.GenericsTypeName) Parameter(org.codehaus.groovy.ast.Parameter)

Example 8 with GenericsTypeName

use of org.codehaus.groovy.ast.GenericsType.GenericsTypeName in project groovy by apache.

the class StaticTypeCheckingVisitor method visitBinaryExpression.

@Override
public void visitBinaryExpression(final BinaryExpression expression) {
    BinaryExpression enclosingBinaryExpression = typeCheckingContext.getEnclosingBinaryExpression();
    typeCheckingContext.pushEnclosingBinaryExpression(expression);
    try {
        int op = expression.getOperation().getType();
        Expression leftExpression = expression.getLeftExpression();
        Expression rightExpression = expression.getRightExpression();
        leftExpression.visit(this);
        SetterInfo setterInfo = removeSetterInfo(leftExpression);
        ClassNode lType = null;
        if (setterInfo != null) {
            if (ensureValidSetter(expression, leftExpression, rightExpression, setterInfo)) {
                return;
            }
            lType = getType(leftExpression);
        } else {
            if (op != EQUAL && op != ELVIS_EQUAL) {
                lType = getType(leftExpression);
            } else {
                lType = getOriginalDeclarationType(leftExpression);
                if (isFunctionalInterface(lType)) {
                    processFunctionalInterfaceAssignment(lType, rightExpression);
                } else if (isClosureWithType(lType) && rightExpression instanceof ClosureExpression) {
                    storeInferredReturnType(rightExpression, getCombinedBoundType(lType.getGenericsTypes()[0]));
                }
            }
            rightExpression.visit(this);
        }
        ClassNode rType = isNullConstant(rightExpression) && !isPrimitiveType(lType) ? // null to primitive type is handled elsewhere
        UNKNOWN_PARAMETER_TYPE : getInferredTypeFromTempInfo(rightExpression, getType(rightExpression));
        ClassNode resultType;
        if (op == KEYWORD_IN || op == COMPARE_NOT_IN) {
            // for the "in" or "!in" operator, the receiver and the arguments are reversed
            BinaryExpression reverseExpression = binX(rightExpression, expression.getOperation(), leftExpression);
            resultType = getResultType(rType, op, lType, reverseExpression);
            // GROOVY-10239
            if (resultType == null)
                resultType = boolean_TYPE;
            storeTargetMethod(expression, reverseExpression.getNodeMetaData(DIRECT_METHOD_CALL_TARGET));
        } else {
            resultType = getResultType(lType, op, rType, expression);
            if (op == ELVIS_EQUAL) {
                // TODO: Should this transform and visit be done before left and right are visited above?
                Expression fullExpression = new ElvisOperatorExpression(leftExpression, rightExpression);
                fullExpression.setSourcePosition(expression);
                fullExpression.visit(this);
                resultType = getType(fullExpression);
            }
        }
        if (resultType == null) {
            resultType = lType;
        }
        if (isArrayOp(op)) {
            if (leftExpression instanceof VariableExpression) {
                // GROOVY-6782
                if (leftExpression.getNodeMetaData(INFERRED_TYPE) == null) {
                    leftExpression.removeNodeMetaData(INFERRED_RETURN_TYPE);
                    storeType(leftExpression, lType);
                }
            }
            if (!lType.isArray() && enclosingBinaryExpression != null && enclosingBinaryExpression.getLeftExpression() == expression && isAssignment(enclosingBinaryExpression.getOperation().getType())) {
                // left hand side of a subscript assignment: map['foo'] = ...
                Expression enclosingExpressionRHS = enclosingBinaryExpression.getRightExpression();
                if (!(enclosingExpressionRHS instanceof ClosureExpression)) {
                    enclosingExpressionRHS.visit(this);
                }
                ClassNode[] arguments = { rType, getType(enclosingExpressionRHS) };
                List<MethodNode> nodes = findMethod(lType.redirect(), "putAt", arguments);
                if (nodes.size() == 1) {
                    typeCheckMethodsWithGenericsOrFail(lType, arguments, nodes.get(0), enclosingExpressionRHS);
                } else if (nodes.isEmpty()) {
                    addNoMatchingMethodError(lType, "putAt", arguments, enclosingBinaryExpression);
                }
            }
        }
        boolean isEmptyDeclaration = (expression instanceof DeclarationExpression && (rightExpression instanceof EmptyExpression || rType == UNKNOWN_PARAMETER_TYPE));
        if (!isEmptyDeclaration && isAssignment(op)) {
            if (rightExpression instanceof ConstructorCallExpression)
                inferDiamondType((ConstructorCallExpression) rightExpression, lType);
            if (lType.isUsingGenerics() && missesGenericsTypes(resultType)) {
                // "completed" with generics type information available from the LHS
                if (lType.equals(resultType)) {
                    if (!lType.isGenericsPlaceHolder())
                        resultType = lType;
                } else if (!resultType.isGenericsPlaceHolder()) {
                    // GROOVY-10324
                    Map<GenericsTypeName, GenericsType> gt = new HashMap<>();
                    extractGenericsConnections(gt, resultType, resultType.redirect());
                    extractGenericsConnections(gt, lType, getNextSuperClass(resultType, lType));
                    // GROOVY-10235, et al.
                    resultType = applyGenericsContext(gt, resultType.redirect());
                }
            }
            ClassNode originType = getOriginalDeclarationType(leftExpression);
            typeCheckAssignment(expression, leftExpression, originType, rightExpression, resultType);
            // check for implicit conversion like "String a = 123", "int[] b = [1,2,3]", "List c = [].stream()", etc.
            if (!implementsInterfaceOrIsSubclassOf(wrapTypeIfNecessary(resultType), wrapTypeIfNecessary(originType))) {
                resultType = originType;
            } else if (isPrimitiveType(originType) && resultType.equals(getWrapper(originType))) {
                // retain primitive semantics
                resultType = originType;
            } else {
                // GROOVY-7549: RHS type may not be accessible to enclosing class
                int modifiers = resultType.getModifiers();
                ClassNode enclosingType = typeCheckingContext.getEnclosingClassNode();
                if (!Modifier.isPublic(modifiers) && !enclosingType.equals(resultType) && !getOutermost(enclosingType).equals(getOutermost(resultType)) && (Modifier.isPrivate(modifiers) || !Objects.equals(enclosingType.getPackageName(), resultType.getPackageName()))) {
                    // TODO: Find accesible type in hierarchy of resultType?
                    resultType = originType;
                } else if (GenericsUtils.hasUnresolvedGenerics(resultType)) {
                    // GROOVY-9033, GROOVY-10089, et al.
                    Map<GenericsTypeName, GenericsType> enclosing = extractGenericsParameterMapOfThis(typeCheckingContext);
                    resultType = fullyResolveType(resultType, Optional.ofNullable(enclosing).orElseGet(Collections::emptyMap));
                }
            }
            // track conditional assignment
            if (leftExpression instanceof VariableExpression && typeCheckingContext.ifElseForWhileAssignmentTracker != null) {
                Variable accessedVariable = ((VariableExpression) leftExpression).getAccessedVariable();
                if (accessedVariable instanceof Parameter) {
                    accessedVariable = new ParameterVariableExpression((Parameter) accessedVariable);
                }
                if (accessedVariable instanceof VariableExpression) {
                    recordAssignment((VariableExpression) accessedVariable, resultType);
                }
            }
            storeType(leftExpression, resultType);
            // propagate closure parameter type information
            if (leftExpression instanceof VariableExpression) {
                if (rightExpression instanceof ClosureExpression) {
                    leftExpression.putNodeMetaData(CLOSURE_ARGUMENTS, ((ClosureExpression) rightExpression).getParameters());
                } else if (rightExpression instanceof VariableExpression && ((VariableExpression) rightExpression).getAccessedVariable() instanceof Expression && ((Expression) ((VariableExpression) rightExpression).getAccessedVariable()).getNodeMetaData(CLOSURE_ARGUMENTS) != null) {
                    Variable targetVariable = findTargetVariable((VariableExpression) leftExpression);
                    if (targetVariable instanceof ASTNode) {
                        ((ASTNode) targetVariable).putNodeMetaData(CLOSURE_ARGUMENTS, ((Expression) ((VariableExpression) rightExpression).getAccessedVariable()).getNodeMetaData(CLOSURE_ARGUMENTS));
                    }
                }
            }
        } else if (op == KEYWORD_INSTANCEOF) /*|| op == COMPARE_NOT_INSTANCEOF*/
        {
            pushInstanceOfTypeInfo(leftExpression, rightExpression);
        }
        if (!isEmptyDeclaration) {
            storeType(expression, resultType);
        }
        validateResourceInARM(expression, resultType);
        // GROOVY-5874: if left expression is a closure shared variable, a second pass should be done
        if (leftExpression instanceof VariableExpression && ((VariableExpression) leftExpression).isClosureSharedVariable()) {
            typeCheckingContext.secondPassExpressions.add(new SecondPassExpression<>(expression));
        }
    } finally {
        typeCheckingContext.popEnclosingBinaryExpression();
    }
}
Also used : DynamicVariable(org.codehaus.groovy.ast.DynamicVariable) Variable(org.codehaus.groovy.ast.Variable) StaticTypeCheckingSupport.findTargetVariable(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.findTargetVariable) BinaryExpression(org.codehaus.groovy.ast.expr.BinaryExpression) MethodNode(org.codehaus.groovy.ast.MethodNode) ElvisOperatorExpression(org.codehaus.groovy.ast.expr.ElvisOperatorExpression) GenericsType(org.codehaus.groovy.ast.GenericsType) StaticTypeCheckingSupport.getCombinedGenericsType(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.getCombinedGenericsType) ASTNode(org.codehaus.groovy.ast.ASTNode) ClosureExpression(org.codehaus.groovy.ast.expr.ClosureExpression) Collections(java.util.Collections) StaticTypeCheckingSupport.findDGMMethodsForClassNode(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.findDGMMethodsForClassNode) ClassNode(org.codehaus.groovy.ast.ClassNode) InnerClassNode(org.codehaus.groovy.ast.InnerClassNode) ConstructorCallExpression(org.codehaus.groovy.ast.expr.ConstructorCallExpression) DeclarationExpression(org.codehaus.groovy.ast.expr.DeclarationExpression) VariableExpression(org.codehaus.groovy.ast.expr.VariableExpression) ClosureSignatureHint(groovy.transform.stc.ClosureSignatureHint) EmptyExpression(org.codehaus.groovy.ast.expr.EmptyExpression) UnaryMinusExpression(org.codehaus.groovy.ast.expr.UnaryMinusExpression) ClosureListExpression(org.codehaus.groovy.ast.expr.ClosureListExpression) ArgumentListExpression(org.codehaus.groovy.ast.expr.ArgumentListExpression) MethodReferenceExpression(org.codehaus.groovy.ast.expr.MethodReferenceExpression) TernaryExpression(org.codehaus.groovy.ast.expr.TernaryExpression) PropertyExpression(org.codehaus.groovy.ast.expr.PropertyExpression) PrefixExpression(org.codehaus.groovy.ast.expr.PrefixExpression) PostfixExpression(org.codehaus.groovy.ast.expr.PostfixExpression) Expression(org.codehaus.groovy.ast.expr.Expression) UnaryPlusExpression(org.codehaus.groovy.ast.expr.UnaryPlusExpression) AnnotationConstantExpression(org.codehaus.groovy.ast.expr.AnnotationConstantExpression) BitwiseNegationExpression(org.codehaus.groovy.ast.expr.BitwiseNegationExpression) MapExpression(org.codehaus.groovy.ast.expr.MapExpression) ConstantExpression(org.codehaus.groovy.ast.expr.ConstantExpression) StaticTypeCheckingSupport.evaluateExpression(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.evaluateExpression) NotExpression(org.codehaus.groovy.ast.expr.NotExpression) FieldExpression(org.codehaus.groovy.ast.expr.FieldExpression) EmptyExpression(org.codehaus.groovy.ast.expr.EmptyExpression) ConstructorCallExpression(org.codehaus.groovy.ast.expr.ConstructorCallExpression) ClassExpression(org.codehaus.groovy.ast.expr.ClassExpression) TupleExpression(org.codehaus.groovy.ast.expr.TupleExpression) MethodPointerExpression(org.codehaus.groovy.ast.expr.MethodPointerExpression) MapEntryExpression(org.codehaus.groovy.ast.expr.MapEntryExpression) VariableExpression(org.codehaus.groovy.ast.expr.VariableExpression) CastExpression(org.codehaus.groovy.ast.expr.CastExpression) StaticMethodCallExpression(org.codehaus.groovy.ast.expr.StaticMethodCallExpression) LambdaExpression(org.codehaus.groovy.ast.expr.LambdaExpression) ListExpression(org.codehaus.groovy.ast.expr.ListExpression) RangeExpression(org.codehaus.groovy.ast.expr.RangeExpression) SpreadExpression(org.codehaus.groovy.ast.expr.SpreadExpression) ArrayExpression(org.codehaus.groovy.ast.expr.ArrayExpression) BinaryExpression(org.codehaus.groovy.ast.expr.BinaryExpression) ElvisOperatorExpression(org.codehaus.groovy.ast.expr.ElvisOperatorExpression) MethodCallExpression(org.codehaus.groovy.ast.expr.MethodCallExpression) DeclarationExpression(org.codehaus.groovy.ast.expr.DeclarationExpression) ClosureExpression(org.codehaus.groovy.ast.expr.ClosureExpression) AttributeExpression(org.codehaus.groovy.ast.expr.AttributeExpression) GenericsTypeName(org.codehaus.groovy.ast.GenericsType.GenericsTypeName) ClosureUtils.hasImplicitParameter(org.codehaus.groovy.ast.tools.ClosureUtils.hasImplicitParameter) Parameter(org.codehaus.groovy.ast.Parameter) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap) Collectors.toMap(java.util.stream.Collectors.toMap) EnumMap(java.util.EnumMap) HashMap(java.util.HashMap)

Example 9 with GenericsTypeName

use of org.codehaus.groovy.ast.GenericsType.GenericsTypeName in project groovy by apache.

the class StaticTypeCheckingVisitor method convertClosureTypeToSAMType.

/**
 * Converts a Closure type to the appropriate SAM type, which can be used to
 * infer return type generics.
 *
 * @param expression  the argument expression
 * @param closureType the inferred type of {@code expression}
 * @param samType     the target type for the argument expression
 * @return SAM type augmented using information from the argument expression
 */
private static ClassNode convertClosureTypeToSAMType(final Expression expression, final ClassNode closureType, final MethodNode sam, final ClassNode samType) {
    Map<GenericsTypeName, GenericsType> samTypeConnections = GenericsUtils.extractPlaceholders(samType);
    samTypeConnections.replaceAll((// GROOVY-9762, GROOVY-9803: reduce "? super T" to "T"
    xx, // GROOVY-9762, GROOVY-9803: reduce "? super T" to "T"
    gt) -> Optional.ofNullable(gt.getLowerBound()).map(GenericsType::new).orElse(gt));
    ClassNode closureReturnType = closureType.getGenericsTypes()[0].getType();
    Parameter[] parameters = sam.getParameters();
    if (parameters.length > 0 && expression instanceof MethodPointerExpression && GenericsUtils.hasUnresolvedGenerics(closureReturnType)) {
        // try to resolve referenced method type parameters in return type
        MethodPointerExpression mp = (MethodPointerExpression) expression;
        List<MethodNode> candidates = mp.getNodeMetaData(MethodNode.class);
        if (candidates != null && !candidates.isEmpty()) {
            ClassNode[] paramTypes = applyGenericsContext(samTypeConnections, extractTypesFromParameters(parameters));
            ClassNode[] matchTypes = candidates.stream().map(candidate -> collateMethodReferenceParameterTypes(mp, candidate)).filter(candidate -> checkSignatureSuitability(candidate, paramTypes)).findFirst().orElse(// TODO: order signatures by param distance
            null);
            if (matchTypes != null) {
                Map<GenericsTypeName, GenericsType> connections = new HashMap<>();
                for (int i = 0, n = parameters.length; i < n; i += 1) {
                    // SAM parameters should align with the referenced method's parameters
                    extractGenericsConnections(connections, paramTypes[i], matchTypes[i]);
                }
                // convert the method reference's generics into the SAM's generics domain
                closureReturnType = applyGenericsContext(connections, closureReturnType);
                // apply known generics connections to the SAM's placeholders in the return type
                closureReturnType = applyGenericsContext(samTypeConnections, closureReturnType);
            }
        }
    }
    // the SAM's return type exactly corresponds to the inferred closure return type
    extractGenericsConnections(samTypeConnections, closureReturnType, sam.getReturnType());
    // repeat the same for each parameter given in the ClosureExpression
    if (parameters.length > 0 && expression instanceof ClosureExpression) {
        // TODO
        return closureType;
    }
    return applyGenericsContext(samTypeConnections, samType.redirect());
}
Also used : BigInteger_TYPE(org.codehaus.groovy.ast.ClassHelper.BigInteger_TYPE) Enumeration(java.util.Enumeration) StaticTypeCheckingSupport.applyGenericsContext(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.applyGenericsContext) StaticTypeCheckingSupport.filterMethodsByVisibility(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.filterMethodsByVisibility) Character_TYPE(org.codehaus.groovy.ast.ClassHelper.Character_TYPE) LinkedHashSet_TYPE(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.LinkedHashSet_TYPE) InvocationWriter(org.codehaus.groovy.classgen.asm.InvocationWriter) StaticTypeCheckingSupport.chooseBestMethod(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.chooseBestMethod) StaticTypeCheckingSupport.fullyResolve(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.fullyResolve) Map(java.util.Map) GeneralUtils.propX(org.codehaus.groovy.ast.tools.GeneralUtils.propX) StaticTypeCheckingSupport.prettyPrintTypeName(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.prettyPrintTypeName) VOID_TYPE(org.codehaus.groovy.ast.ClassHelper.VOID_TYPE) PropertyNode(org.codehaus.groovy.ast.PropertyNode) COMPARE_TO(org.codehaus.groovy.syntax.Types.COMPARE_TO) UnaryMinusExpression(org.codehaus.groovy.ast.expr.UnaryMinusExpression) ClosureListExpression(org.codehaus.groovy.ast.expr.ClosureListExpression) PV_FIELDS_MUTATION(org.codehaus.groovy.transform.stc.StaticTypesMarker.PV_FIELDS_MUTATION) ClassHelper.isPrimitiveLong(org.codehaus.groovy.ast.ClassHelper.isPrimitiveLong) ArgumentListExpression(org.codehaus.groovy.ast.expr.ArgumentListExpression) StaticTypeCheckingSupport.findDGMMethodsForClassNode(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.findDGMMethodsForClassNode) MethodReferenceExpression(org.codehaus.groovy.ast.expr.MethodReferenceExpression) TernaryExpression(org.codehaus.groovy.ast.expr.TernaryExpression) OBJECT_TYPE(org.codehaus.groovy.ast.ClassHelper.OBJECT_TYPE) ClassHelper.byte_TYPE(org.codehaus.groovy.ast.ClassHelper.byte_TYPE) GeneralUtils.elvisX(org.codehaus.groovy.ast.tools.GeneralUtils.elvisX) STRING_TYPE(org.codehaus.groovy.ast.ClassHelper.STRING_TYPE) BeanUtils.decapitalize(org.apache.groovy.util.BeanUtils.decapitalize) ClassHelper.getWrapper(org.codehaus.groovy.ast.ClassHelper.getWrapper) COMPARE_NOT_IN(org.codehaus.groovy.syntax.Types.COMPARE_NOT_IN) StaticTypeCheckingSupport.isOperationInGroup(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isOperationInGroup) COMPARE_EQUAL(org.codehaus.groovy.syntax.Types.COMPARE_EQUAL) GeneralUtils.isOrImplements(org.codehaus.groovy.ast.tools.GeneralUtils.isOrImplements) ClassHelper.isPrimitiveDouble(org.codehaus.groovy.ast.ClassHelper.isPrimitiveDouble) PropertyExpression(org.codehaus.groovy.ast.expr.PropertyExpression) ClassHelper.isWrapperInteger(org.codehaus.groovy.ast.ClassHelper.isWrapperInteger) DIVIDE_EQUAL(org.codehaus.groovy.syntax.Types.DIVIDE_EQUAL) StaticTypeCheckingSupport.getOperationName(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.getOperationName) IMPLICIT_RECEIVER(org.codehaus.groovy.transform.stc.StaticTypesMarker.IMPLICIT_RECEIVER) StaticTypeCheckingSupport.resolveClassNodeGenerics(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.resolveClassNodeGenerics) ClassHelper.isPrimitiveShort(org.codehaus.groovy.ast.ClassHelper.isPrimitiveShort) ClosureUtils.getParametersSafe(org.codehaus.groovy.ast.tools.ClosureUtils.getParametersSafe) ClassHelper.isWrapperDouble(org.codehaus.groovy.ast.ClassHelper.isWrapperDouble) Matcher_TYPE(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.Matcher_TYPE) LinkedHashMap(java.util.LinkedHashMap) PrefixExpression(org.codehaus.groovy.ast.expr.PrefixExpression) SystemUtil(org.apache.groovy.util.SystemUtil) ExpressionStatement(org.codehaus.groovy.ast.stmt.ExpressionStatement) PostfixExpression(org.codehaus.groovy.ast.expr.PostfixExpression) Expression(org.codehaus.groovy.ast.expr.Expression) ClassHelper.short_TYPE(org.codehaus.groovy.ast.ClassHelper.short_TYPE) StaticTypeCheckingSupport.isPowerOperator(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isPowerOperator) Opcodes(org.objectweb.asm.Opcodes) UnaryPlusExpression(org.codehaus.groovy.ast.expr.UnaryPlusExpression) SourceUnit(org.codehaus.groovy.control.SourceUnit) ClassNode(org.codehaus.groovy.ast.ClassNode) ClassHelper.isStringType(org.codehaus.groovy.ast.ClassHelper.isStringType) ClassHelper.float_TYPE(org.codehaus.groovy.ast.ClassHelper.float_TYPE) ClassHelper.isPrimitiveInt(org.codehaus.groovy.ast.ClassHelper.isPrimitiveInt) GenericsType(org.codehaus.groovy.ast.GenericsType) ClassHelper.isPrimitiveBoolean(org.codehaus.groovy.ast.ClassHelper.isPrimitiveBoolean) GeneralUtils.castX(org.codehaus.groovy.ast.tools.GeneralUtils.castX) ReturnStatement(org.codehaus.groovy.ast.stmt.ReturnStatement) AnnotationConstantExpression(org.codehaus.groovy.ast.expr.AnnotationConstantExpression) UNKNOWN_PARAMETER_TYPE(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.UNKNOWN_PARAMETER_TYPE) AtomicLong(java.util.concurrent.atomic.AtomicLong) DYNAMIC_RESOLUTION(org.codehaus.groovy.transform.stc.StaticTypesMarker.DYNAMIC_RESOLUTION) BitwiseNegationExpression(org.codehaus.groovy.ast.expr.BitwiseNegationExpression) ClassHelper.isFunctionalInterface(org.codehaus.groovy.ast.ClassHelper.isFunctionalInterface) Float_TYPE(org.codehaus.groovy.ast.ClassHelper.Float_TYPE) CONSTRUCTED_LAMBDA_EXPRESSION(org.codehaus.groovy.transform.stc.StaticTypesMarker.CONSTRUCTED_LAMBDA_EXPRESSION) MapExpression(org.codehaus.groovy.ast.expr.MapExpression) ClassHelper.isGStringType(org.codehaus.groovy.ast.ClassHelper.isGStringType) GenericsTypeName(org.codehaus.groovy.ast.GenericsType.GenericsTypeName) AnnotatedNode(org.codehaus.groovy.ast.AnnotatedNode) ConstantExpression(org.codehaus.groovy.ast.expr.ConstantExpression) Long_TYPE(org.codehaus.groovy.ast.ClassHelper.Long_TYPE) StaticTypeCheckingSupport.extractGenericsParameterMapOfThis(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.extractGenericsParameterMapOfThis) StaticTypesTransformation(org.codehaus.groovy.transform.StaticTypesTransformation) GeneralUtils.getGetterName(org.codehaus.groovy.ast.tools.GeneralUtils.getGetterName) StaticTypeCheckingSupport.getCombinedBoundType(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.getCombinedBoundType) Number_TYPE(org.codehaus.groovy.ast.ClassHelper.Number_TYPE) MethodCall(org.codehaus.groovy.ast.expr.MethodCall) ClassHelper.isBigDecimalType(org.codehaus.groovy.ast.ClassHelper.isBigDecimalType) Collectors.toMap(java.util.stream.Collectors.toMap) StaticTypeCheckingSupport.evaluateExpression(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.evaluateExpression) INFERRED_TYPE(org.codehaus.groovy.transform.stc.StaticTypesMarker.INFERRED_TYPE) ForStatement(org.codehaus.groovy.ast.stmt.ForStatement) PV_FIELDS_ACCESS(org.codehaus.groovy.transform.stc.StaticTypesMarker.PV_FIELDS_ACCESS) StaticTypeCheckingSupport.findSetters(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.findSetters) Collection(java.util.Collection) DefaultGroovyMethods(org.codehaus.groovy.runtime.DefaultGroovyMethods) Collectors(java.util.stream.Collectors) NotExpression(org.codehaus.groovy.ast.expr.NotExpression) InnerClassNode(org.codehaus.groovy.ast.InnerClassNode) Short_TYPE(org.codehaus.groovy.ast.ClassHelper.Short_TYPE) Objects(java.util.Objects) StaticTypeCheckingSupport.findDGMMethodsByNameAndArguments(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.findDGMMethodsByNameAndArguments) IfStatement(org.codehaus.groovy.ast.stmt.IfStatement) FieldExpression(org.codehaus.groovy.ast.expr.FieldExpression) StaticTypeCheckingSupport.isBitOperator(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isBitOperator) ClosureUtils.hasImplicitParameter(org.codehaus.groovy.ast.tools.ClosureUtils.hasImplicitParameter) StaticTypeCheckingSupport.isWildcardLeftHandSide(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isWildcardLeftHandSide) BigDecimal_TYPE(org.codehaus.groovy.ast.ClassHelper.BigDecimal_TYPE) ClassHelper.isPrimitiveByte(org.codehaus.groovy.ast.ClassHelper.isPrimitiveByte) StaticTypeCheckingSupport.getCombinedGenericsType(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.getCombinedGenericsType) WideningCategories.isIntCategory(org.codehaus.groovy.ast.tools.WideningCategories.isIntCategory) DynamicVariable(org.codehaus.groovy.ast.DynamicVariable) Double_TYPE(org.codehaus.groovy.ast.ClassHelper.Double_TYPE) IntStream(java.util.stream.IntStream) StaticTypeCheckingSupport.isAssignableTo(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isAssignableTo) ClosureSignatureHint(groovy.transform.stc.ClosureSignatureHint) AnnotationNode(org.codehaus.groovy.ast.AnnotationNode) StaticTypeCheckingSupport.isBeingCompiled(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isBeingCompiled) StaticTypeCheckingSupport.typeCheckMethodsWithGenerics(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.typeCheckMethodsWithGenerics) DIVIDE(org.codehaus.groovy.syntax.Types.DIVIDE) Function(java.util.function.Function) ASSIGN(org.codehaus.groovy.syntax.Types.ASSIGN) HashSet(java.util.HashSet) ClassHelper.isNumberType(org.codehaus.groovy.ast.ClassHelper.isNumberType) BiPredicate(java.util.function.BiPredicate) ELVIS_EQUAL(org.codehaus.groovy.syntax.Types.ELVIS_EQUAL) NUMBER_OPS(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.NUMBER_OPS) Tuple2(groovy.lang.Tuple2) ClassHelper.boolean_TYPE(org.codehaus.groovy.ast.ClassHelper.boolean_TYPE) PV_METHODS_ACCESS(org.codehaus.groovy.transform.stc.StaticTypesMarker.PV_METHODS_ACCESS) ClassCodeVisitorSupport(org.codehaus.groovy.ast.ClassCodeVisitorSupport) StaticTypeCheckingSupport.checkPossibleLossOfPrecision(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.checkPossibleLossOfPrecision) GeneralUtils.varX(org.codehaus.groovy.ast.tools.GeneralUtils.varX) EmptyExpression(org.codehaus.groovy.ast.expr.EmptyExpression) LinkedList(java.util.LinkedList) StaticTypeCheckingSupport.typeCheckMethodArgumentWithGenerics(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.typeCheckMethodArgumentWithGenerics) ConstructorCallExpression(org.codehaus.groovy.ast.expr.ConstructorCallExpression) COMPARE_NOT_INSTANCEOF(org.codehaus.groovy.syntax.Types.COMPARE_NOT_INSTANCEOF) ClassHelper(org.codehaus.groovy.ast.ClassHelper) DECLARATION_INFERRED_TYPE(org.codehaus.groovy.transform.stc.StaticTypesMarker.DECLARATION_INFERRED_TYPE) SET_TYPE(org.codehaus.groovy.ast.ClassHelper.SET_TYPE) StaticTypeCheckingSupport.isArrayOp(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isArrayOp) ClassExpression(org.codehaus.groovy.ast.expr.ClassExpression) ASTNode(org.codehaus.groovy.ast.ASTNode) TupleExpression(org.codehaus.groovy.ast.expr.TupleExpression) GeneralUtils.binX(org.codehaus.groovy.ast.tools.GeneralUtils.binX) TryCatchStatement(org.codehaus.groovy.ast.stmt.TryCatchStatement) GenericsUtils(org.codehaus.groovy.ast.tools.GenericsUtils) StringJoiner(java.util.StringJoiner) MethodPointerExpression(org.codehaus.groovy.ast.expr.MethodPointerExpression) StaticTypeCheckingSupport.allParametersAndArgumentsMatchWithDefaultParams(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.allParametersAndArgumentsMatchWithDefaultParams) ClassHelper.isWrapperCharacter(org.codehaus.groovy.ast.ClassHelper.isWrapperCharacter) ConstructorNode(org.codehaus.groovy.ast.ConstructorNode) MapEntryExpression(org.codehaus.groovy.ast.expr.MapEntryExpression) ClassHelper.isObjectType(org.codehaus.groovy.ast.ClassHelper.isObjectType) Arrays(java.util.Arrays) INFERRED_RETURN_TYPE(org.codehaus.groovy.transform.stc.StaticTypesMarker.INFERRED_RETURN_TYPE) StaticTypeCheckingSupport.checkCompatibleAssignmentTypes(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.checkCompatibleAssignmentTypes) Closure(groovy.lang.Closure) StaticTypeCheckingSupport.getGenericsWithoutArray(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.getGenericsWithoutArray) WideningCategories.isFloatingCategory(org.codehaus.groovy.ast.tools.WideningCategories.isFloatingCategory) StaticTypeCheckingSupport.isTraitSelf(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isTraitSelf) RANGE_TYPE(org.codehaus.groovy.ast.ClassHelper.RANGE_TYPE) ClosureParams(groovy.transform.stc.ClosureParams) CLOSURE_ARGUMENTS(org.codehaus.groovy.transform.stc.StaticTypesMarker.CLOSURE_ARGUMENTS) INTDIV_EQUAL(org.codehaus.groovy.syntax.Types.INTDIV_EQUAL) StaticTypeCheckingSupport.extractGenericsConnections(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.extractGenericsConnections) CaseStatement(org.codehaus.groovy.ast.stmt.CaseStatement) ClassHelper.isBigIntegerType(org.codehaus.groovy.ast.ClassHelper.isBigIntegerType) Traits(org.codehaus.groovy.transform.trait.Traits) ClassHelper.char_TYPE(org.codehaus.groovy.ast.ClassHelper.char_TYPE) MINUS_MINUS(org.codehaus.groovy.syntax.Types.MINUS_MINUS) VariableExpression(org.codehaus.groovy.ast.expr.VariableExpression) EnumMap(java.util.EnumMap) LIST_TYPE(org.codehaus.groovy.ast.ClassHelper.LIST_TYPE) TypeCheckingMode(groovy.transform.TypeCheckingMode) BeanUtils.capitalize(org.apache.groovy.util.BeanUtils.capitalize) PATTERN_TYPE(org.codehaus.groovy.ast.ClassHelper.PATTERN_TYPE) NamedParams(groovy.transform.NamedParams) Set(java.util.Set) Token(org.codehaus.groovy.syntax.Token) ClassHelper.isPrimitiveVoid(org.codehaus.groovy.ast.ClassHelper.isPrimitiveVoid) ClassHelper.getUnwrapper(org.codehaus.groovy.ast.ClassHelper.getUnwrapper) GeneralUtils.callX(org.codehaus.groovy.ast.tools.GeneralUtils.callX) InvocationTargetException(java.lang.reflect.InvocationTargetException) WideningCategories.isFloat(org.codehaus.groovy.ast.tools.WideningCategories.isFloat) STREAM_TYPE(org.codehaus.groovy.ast.ClassHelper.STREAM_TYPE) CLASS_Type(org.codehaus.groovy.ast.ClassHelper.CLASS_Type) StaticTypeCheckingSupport.toMethodParametersString(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.toMethodParametersString) ClassHelper.isWrapperByte(org.codehaus.groovy.ast.ClassHelper.isWrapperByte) COMPARE_NOT_EQUAL(org.codehaus.groovy.syntax.Types.COMPARE_NOT_EQUAL) StaticTypeCheckingSupport.implementsInterfaceOrIsSubclassOf(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.implementsInterfaceOrIsSubclassOf) ClassHelper.getNextSuperClass(org.codehaus.groovy.ast.ClassHelper.getNextSuperClass) ClassHelper.isWrapperFloat(org.codehaus.groovy.ast.ClassHelper.isWrapperFloat) ClassHelper.dynamicType(org.codehaus.groovy.ast.ClassHelper.dynamicType) ClassHelper.long_TYPE(org.codehaus.groovy.ast.ClassHelper.long_TYPE) LinkedHashMap_TYPE(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.LinkedHashMap_TYPE) StaticTypeCheckingSupport.isBoolIntrinsicOp(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isBoolIntrinsicOp) CastExpression(org.codehaus.groovy.ast.expr.CastExpression) StaticTypeCheckingSupport.boundUnboundedWildcards(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.boundUnboundedWildcards) ReturnAdder(org.codehaus.groovy.classgen.ReturnAdder) INTDIV(org.codehaus.groovy.syntax.Types.INTDIV) StaticMethodCallExpression(org.codehaus.groovy.ast.expr.StaticMethodCallExpression) LambdaExpression(org.codehaus.groovy.ast.expr.LambdaExpression) TYPE(org.codehaus.groovy.transform.stc.StaticTypesMarker.TYPE) GeneralUtils.thisPropX(org.codehaus.groovy.ast.tools.GeneralUtils.thisPropX) StaticTypeCheckingSupport.missesGenericsTypes(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.missesGenericsTypes) MOD_EQUAL(org.codehaus.groovy.syntax.Types.MOD_EQUAL) WhileStatement(org.codehaus.groovy.ast.stmt.WhileStatement) ArrayList(java.util.ArrayList) ClosureUtils.getResolveStrategyName(org.codehaus.groovy.ast.tools.ClosureUtils.getResolveStrategyName) MethodNode(org.codehaus.groovy.ast.MethodNode) WideningCategories.isBigDecCategory(org.codehaus.groovy.ast.tools.WideningCategories.isBigDecCategory) ClassHelper.isPrimitiveFloat(org.codehaus.groovy.ast.ClassHelper.isPrimitiveFloat) KEYWORD_IN(org.codehaus.groovy.syntax.Types.KEYWORD_IN) LinkedHashSet(java.util.LinkedHashSet) Parameter(org.codehaus.groovy.ast.Parameter) MAP_TYPE(org.codehaus.groovy.ast.ClassHelper.MAP_TYPE) WideningCategories.isDoubleCategory(org.codehaus.groovy.ast.tools.WideningCategories.isDoubleCategory) EmptyStatement(org.codehaus.groovy.ast.stmt.EmptyStatement) ClassHelper.isClassType(org.codehaus.groovy.ast.ClassHelper.isClassType) ClassHelper.isPrimitiveType(org.codehaus.groovy.ast.ClassHelper.isPrimitiveType) ClassHelper.double_TYPE(org.codehaus.groovy.ast.ClassHelper.double_TYPE) ClassHelper.isPrimitiveChar(org.codehaus.groovy.ast.ClassHelper.isPrimitiveChar) WideningCategories.isLongCategory(org.codehaus.groovy.ast.tools.WideningCategories.isLongCategory) DIRECT_METHOD_CALL_TARGET(org.codehaus.groovy.transform.stc.StaticTypesMarker.DIRECT_METHOD_CALL_TARGET) WideningCategories.isNumberCategory(org.codehaus.groovy.ast.tools.WideningCategories.isNumberCategory) PLUS_PLUS(org.codehaus.groovy.syntax.Types.PLUS_PLUS) ListExpression(org.codehaus.groovy.ast.expr.ListExpression) KEYWORD_INSTANCEOF(org.codehaus.groovy.syntax.Types.KEYWORD_INSTANCEOF) StaticTypeCheckingSupport.isAssignment(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isAssignment) GeneralUtils.getSetterName(org.codehaus.groovy.ast.tools.GeneralUtils.getSetterName) DELEGATION_METADATA(org.codehaus.groovy.transform.stc.StaticTypesMarker.DELEGATION_METADATA) StaticTypeCheckingSupport.lastArgMatchesVarg(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.lastArgMatchesVarg) StaticTypeCheckingSupport.isGStringOrGStringStringLUB(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isGStringOrGStringStringLUB) ClassHelper.findSAM(org.codehaus.groovy.ast.ClassHelper.findSAM) RangeExpression(org.codehaus.groovy.ast.expr.RangeExpression) ResolveVisitor(org.codehaus.groovy.control.ResolveVisitor) Variable(org.codehaus.groovy.ast.Variable) ClassHelper.isSAMType(org.codehaus.groovy.ast.ClassHelper.isSAMType) FIND_REGEX(org.codehaus.groovy.syntax.Types.FIND_REGEX) StaticTypeCheckingSupport.prettyPrintType(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.prettyPrintType) GeneralUtils(org.codehaus.groovy.ast.tools.GeneralUtils) WideningCategories.isDouble(org.codehaus.groovy.ast.tools.WideningCategories.isDouble) Integer_TYPE(org.codehaus.groovy.ast.ClassHelper.Integer_TYPE) DelegatesTo(groovy.lang.DelegatesTo) SpreadExpression(org.codehaus.groovy.ast.expr.SpreadExpression) SUPER_MOP_METHOD_REQUIRED(org.codehaus.groovy.transform.stc.StaticTypesMarker.SUPER_MOP_METHOD_REQUIRED) ClassHelper.isWrapperLong(org.codehaus.groovy.ast.ClassHelper.isWrapperLong) ArrayExpression(org.codehaus.groovy.ast.expr.ArrayExpression) GROOVY_OBJECT_TYPE(org.codehaus.groovy.ast.ClassHelper.GROOVY_OBJECT_TYPE) GeneralUtils.args(org.codehaus.groovy.ast.tools.GeneralUtils.args) CatchStatement(org.codehaus.groovy.ast.stmt.CatchStatement) GroovyBugError(org.codehaus.groovy.GroovyBugError) READONLY_PROPERTY(org.codehaus.groovy.transform.stc.StaticTypesMarker.READONLY_PROPERTY) List(java.util.List) TypeChecked(groovy.transform.TypeChecked) BinaryExpression(org.codehaus.groovy.ast.expr.BinaryExpression) BlockStatement(org.codehaus.groovy.ast.stmt.BlockStatement) Modifier(java.lang.reflect.Modifier) Optional(java.util.Optional) Statement(org.codehaus.groovy.ast.stmt.Statement) ClassHelper.isWrapperShort(org.codehaus.groovy.ast.ClassHelper.isWrapperShort) GeneralUtils.constX(org.codehaus.groovy.ast.tools.GeneralUtils.constX) ClassHelper.int_TYPE(org.codehaus.groovy.ast.ClassHelper.int_TYPE) CodeVisitorSupport(org.codehaus.groovy.ast.CodeVisitorSupport) ElvisOperatorExpression(org.codehaus.groovy.ast.expr.ElvisOperatorExpression) Collection_TYPE(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.Collection_TYPE) StaticTypeCheckingSupport.findTargetVariable(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.findTargetVariable) WideningCategories.lowestUpperBound(org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound) HashMap(java.util.HashMap) ClassHelper.isDynamicTyped(org.codehaus.groovy.ast.ClassHelper.isDynamicTyped) TokenUtil(org.codehaus.groovy.syntax.TokenUtil) AtomicReference(java.util.concurrent.atomic.AtomicReference) StaticTypeCheckingSupport.isVargs(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isVargs) CompilationUnit(org.codehaus.groovy.control.CompilationUnit) CLOSURE_TYPE(org.codehaus.groovy.ast.ClassHelper.CLOSURE_TYPE) WideningCategories.isBigIntCategory(org.codehaus.groovy.ast.tools.WideningCategories.isBigIntCategory) MethodCallExpression(org.codehaus.groovy.ast.expr.MethodCallExpression) StaticTypeCheckingSupport.isCompareToBoolean(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isCompareToBoolean) StaticTypeCheckingSupport.isParameterizedWithString(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isParameterizedWithString) Byte_TYPE(org.codehaus.groovy.ast.ClassHelper.Byte_TYPE) ErrorCollector(org.codehaus.groovy.control.ErrorCollector) Iterator(java.util.Iterator) IntRange(groovy.lang.IntRange) ClosureSignatureConflictResolver(groovy.transform.stc.ClosureSignatureConflictResolver) GenericsUtils.makeClassSafe0(org.codehaus.groovy.ast.tools.GenericsUtils.makeClassSafe0) StaticTypeCheckingSupport.isUsingGenericsOrIsArrayUsingGenerics(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isUsingGenericsOrIsArrayUsingGenerics) DeclarationExpression(org.codehaus.groovy.ast.expr.DeclarationExpression) StaticTypeCheckingSupport.isClassClassNodeWrappingConcreteType(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isClassClassNodeWrappingConcreteType) StaticTypeCheckingSupport.isParameterizedWithGStringOrGStringString(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isParameterizedWithGStringOrGStringString) NamedParam(groovy.transform.NamedParam) ClosureExpression(org.codehaus.groovy.ast.expr.ClosureExpression) StaticTypeCheckingSupport.applyGenericsConnections(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.applyGenericsConnections) StaticTypeCheckingSupport.fullyResolveType(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.fullyResolveType) SwitchStatement(org.codehaus.groovy.ast.stmt.SwitchStatement) StaticTypeCheckingSupport.isShiftOperation(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isShiftOperation) FieldNode(org.codehaus.groovy.ast.FieldNode) AttributeExpression(org.codehaus.groovy.ast.expr.AttributeExpression) WideningCategories(org.codehaus.groovy.ast.tools.WideningCategories) AUTOCLOSEABLE_TYPE(org.codehaus.groovy.ast.ClassHelper.AUTOCLOSEABLE_TYPE) EQUAL(org.codehaus.groovy.syntax.Types.EQUAL) MOD(org.codehaus.groovy.syntax.Types.MOD) Collections(java.util.Collections) Iterator_TYPE(org.codehaus.groovy.ast.ClassHelper.Iterator_TYPE) ArrayList_TYPE(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.ArrayList_TYPE) StaticTypeCheckingSupport.findDGMMethodsForClassNode(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.findDGMMethodsForClassNode) ClassNode(org.codehaus.groovy.ast.ClassNode) InnerClassNode(org.codehaus.groovy.ast.InnerClassNode) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) MethodPointerExpression(org.codehaus.groovy.ast.expr.MethodPointerExpression) ClosureSignatureHint(groovy.transform.stc.ClosureSignatureHint) MethodNode(org.codehaus.groovy.ast.MethodNode) GenericsType(org.codehaus.groovy.ast.GenericsType) StaticTypeCheckingSupport.getCombinedGenericsType(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.getCombinedGenericsType) GenericsTypeName(org.codehaus.groovy.ast.GenericsType.GenericsTypeName) ClosureUtils.hasImplicitParameter(org.codehaus.groovy.ast.tools.ClosureUtils.hasImplicitParameter) Parameter(org.codehaus.groovy.ast.Parameter) ClosureExpression(org.codehaus.groovy.ast.expr.ClosureExpression)

Example 10 with GenericsTypeName

use of org.codehaus.groovy.ast.GenericsType.GenericsTypeName in project groovy by apache.

the class StaticTypeCheckingVisitor method resolvePlaceholdersFromImplicitTypeHints.

/**
 * Given method call like "m(Collections.emptyList())", the type of the call
 * argument is {@code List<T>} without explicit type arguments. Knowning the
 * method target of "m", {@code T} could be resolved.
 */
private void resolvePlaceholdersFromImplicitTypeHints(final ClassNode[] actuals, final ArgumentListExpression argumentList, final Parameter[] parameterArray) {
    int np = parameterArray.length;
    for (int i = 0, n = actuals.length; np > 0 && i < n; i += 1) {
        Expression a = argumentList.getExpression(i);
        Parameter p = parameterArray[Math.min(i, np - 1)];
        ClassNode at = actuals[i], pt = p.getOriginType();
        if (!isUsingGenericsOrIsArrayUsingGenerics(pt))
            continue;
        if (i >= (np - 1) && pt.isArray() && !at.isArray())
            pt = pt.getComponentType();
        if (a instanceof ListExpression) {
            actuals[i] = getLiteralResultType(pt, at, ArrayList_TYPE);
        } else if (a instanceof MapExpression) {
            actuals[i] = getLiteralResultType(pt, at, LinkedHashMap_TYPE);
        } else if (a instanceof ConstructorCallExpression) {
            // GROOVY-10086
            inferDiamondType((ConstructorCallExpression) a, pt);
        } else if (a instanceof TernaryExpression && at.getGenericsTypes() != null && at.getGenericsTypes().length == 0) {
            // GROOVY-9983: double diamond scenario -- "m(flag ? new Type<>(...) : new Type<>(...))"
            typeCheckingContext.pushEnclosingBinaryExpression(assignX(varX(p), a, a));
            // re-visit with target type witness
            a.visit(this);
            typeCheckingContext.popEnclosingBinaryExpression();
            actuals[i] = getType(a);
        }
        // check for method call with known target
        if (!(a instanceof MethodCallExpression))
            continue;
        if (((MethodCallExpression) a).isUsingGenerics())
            continue;
        MethodNode aNode = a.getNodeMetaData(DIRECT_METHOD_CALL_TARGET);
        if (aNode == null || aNode.getGenericsTypes() == null)
            continue;
        // and unknown generics
        if (!GenericsUtils.hasUnresolvedGenerics(at))
            continue;
        while (!at.equals(pt) && !isObjectType(at) && !isGenericsPlaceHolderOrArrayOf(at)) {
            at = applyGenericsContext(GenericsUtils.extractPlaceholders(at), getNextSuperClass(at, pt));
        }
        // try to resolve placeholder(s) in argument type using parameter type
        Map<GenericsTypeName, GenericsType> linked = new HashMap<>();
        Map<GenericsTypeName, GenericsType> source = GenericsUtils.extractPlaceholders(at);
        Map<GenericsTypeName, GenericsType> target = GenericsUtils.extractPlaceholders(pt);
        // connect E:T from source to E:Type from target
        for (GenericsType placeholder : aNode.getGenericsTypes()) {
            for (Map.Entry<GenericsTypeName, GenericsType> e : source.entrySet()) {
                if (e.getValue().getNodeMetaData(GenericsType.class) == placeholder) {
                    Optional.ofNullable(target.get(e.getKey())).filter(gt -> isAssignableTo(gt.getType(), placeholder.getType())).ifPresent(gt -> linked.put(new GenericsTypeName(e.getValue().getName()), gt));
                    break;
                }
            }
        }
        actuals[i] = applyGenericsContext(linked, at);
    }
}
Also used : MapExpression(org.codehaus.groovy.ast.expr.MapExpression) BigInteger_TYPE(org.codehaus.groovy.ast.ClassHelper.BigInteger_TYPE) Enumeration(java.util.Enumeration) StaticTypeCheckingSupport.applyGenericsContext(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.applyGenericsContext) StaticTypeCheckingSupport.filterMethodsByVisibility(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.filterMethodsByVisibility) Character_TYPE(org.codehaus.groovy.ast.ClassHelper.Character_TYPE) LinkedHashSet_TYPE(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.LinkedHashSet_TYPE) InvocationWriter(org.codehaus.groovy.classgen.asm.InvocationWriter) StaticTypeCheckingSupport.chooseBestMethod(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.chooseBestMethod) StaticTypeCheckingSupport.fullyResolve(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.fullyResolve) Map(java.util.Map) GeneralUtils.propX(org.codehaus.groovy.ast.tools.GeneralUtils.propX) StaticTypeCheckingSupport.prettyPrintTypeName(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.prettyPrintTypeName) VOID_TYPE(org.codehaus.groovy.ast.ClassHelper.VOID_TYPE) PropertyNode(org.codehaus.groovy.ast.PropertyNode) COMPARE_TO(org.codehaus.groovy.syntax.Types.COMPARE_TO) UnaryMinusExpression(org.codehaus.groovy.ast.expr.UnaryMinusExpression) ClosureListExpression(org.codehaus.groovy.ast.expr.ClosureListExpression) PV_FIELDS_MUTATION(org.codehaus.groovy.transform.stc.StaticTypesMarker.PV_FIELDS_MUTATION) ClassHelper.isPrimitiveLong(org.codehaus.groovy.ast.ClassHelper.isPrimitiveLong) ArgumentListExpression(org.codehaus.groovy.ast.expr.ArgumentListExpression) StaticTypeCheckingSupport.findDGMMethodsForClassNode(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.findDGMMethodsForClassNode) MethodReferenceExpression(org.codehaus.groovy.ast.expr.MethodReferenceExpression) TernaryExpression(org.codehaus.groovy.ast.expr.TernaryExpression) OBJECT_TYPE(org.codehaus.groovy.ast.ClassHelper.OBJECT_TYPE) ClassHelper.byte_TYPE(org.codehaus.groovy.ast.ClassHelper.byte_TYPE) GeneralUtils.elvisX(org.codehaus.groovy.ast.tools.GeneralUtils.elvisX) STRING_TYPE(org.codehaus.groovy.ast.ClassHelper.STRING_TYPE) BeanUtils.decapitalize(org.apache.groovy.util.BeanUtils.decapitalize) ClassHelper.getWrapper(org.codehaus.groovy.ast.ClassHelper.getWrapper) COMPARE_NOT_IN(org.codehaus.groovy.syntax.Types.COMPARE_NOT_IN) StaticTypeCheckingSupport.isOperationInGroup(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isOperationInGroup) COMPARE_EQUAL(org.codehaus.groovy.syntax.Types.COMPARE_EQUAL) GeneralUtils.isOrImplements(org.codehaus.groovy.ast.tools.GeneralUtils.isOrImplements) ClassHelper.isPrimitiveDouble(org.codehaus.groovy.ast.ClassHelper.isPrimitiveDouble) PropertyExpression(org.codehaus.groovy.ast.expr.PropertyExpression) ClassHelper.isWrapperInteger(org.codehaus.groovy.ast.ClassHelper.isWrapperInteger) DIVIDE_EQUAL(org.codehaus.groovy.syntax.Types.DIVIDE_EQUAL) StaticTypeCheckingSupport.getOperationName(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.getOperationName) IMPLICIT_RECEIVER(org.codehaus.groovy.transform.stc.StaticTypesMarker.IMPLICIT_RECEIVER) StaticTypeCheckingSupport.resolveClassNodeGenerics(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.resolveClassNodeGenerics) ClassHelper.isPrimitiveShort(org.codehaus.groovy.ast.ClassHelper.isPrimitiveShort) ClosureUtils.getParametersSafe(org.codehaus.groovy.ast.tools.ClosureUtils.getParametersSafe) ClassHelper.isWrapperDouble(org.codehaus.groovy.ast.ClassHelper.isWrapperDouble) Matcher_TYPE(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.Matcher_TYPE) LinkedHashMap(java.util.LinkedHashMap) PrefixExpression(org.codehaus.groovy.ast.expr.PrefixExpression) SystemUtil(org.apache.groovy.util.SystemUtil) ExpressionStatement(org.codehaus.groovy.ast.stmt.ExpressionStatement) PostfixExpression(org.codehaus.groovy.ast.expr.PostfixExpression) Expression(org.codehaus.groovy.ast.expr.Expression) ClassHelper.short_TYPE(org.codehaus.groovy.ast.ClassHelper.short_TYPE) StaticTypeCheckingSupport.isPowerOperator(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isPowerOperator) Opcodes(org.objectweb.asm.Opcodes) UnaryPlusExpression(org.codehaus.groovy.ast.expr.UnaryPlusExpression) SourceUnit(org.codehaus.groovy.control.SourceUnit) ClassNode(org.codehaus.groovy.ast.ClassNode) ClassHelper.isStringType(org.codehaus.groovy.ast.ClassHelper.isStringType) ClassHelper.float_TYPE(org.codehaus.groovy.ast.ClassHelper.float_TYPE) ClassHelper.isPrimitiveInt(org.codehaus.groovy.ast.ClassHelper.isPrimitiveInt) GenericsType(org.codehaus.groovy.ast.GenericsType) ClassHelper.isPrimitiveBoolean(org.codehaus.groovy.ast.ClassHelper.isPrimitiveBoolean) GeneralUtils.castX(org.codehaus.groovy.ast.tools.GeneralUtils.castX) ReturnStatement(org.codehaus.groovy.ast.stmt.ReturnStatement) AnnotationConstantExpression(org.codehaus.groovy.ast.expr.AnnotationConstantExpression) UNKNOWN_PARAMETER_TYPE(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.UNKNOWN_PARAMETER_TYPE) AtomicLong(java.util.concurrent.atomic.AtomicLong) DYNAMIC_RESOLUTION(org.codehaus.groovy.transform.stc.StaticTypesMarker.DYNAMIC_RESOLUTION) BitwiseNegationExpression(org.codehaus.groovy.ast.expr.BitwiseNegationExpression) ClassHelper.isFunctionalInterface(org.codehaus.groovy.ast.ClassHelper.isFunctionalInterface) Float_TYPE(org.codehaus.groovy.ast.ClassHelper.Float_TYPE) CONSTRUCTED_LAMBDA_EXPRESSION(org.codehaus.groovy.transform.stc.StaticTypesMarker.CONSTRUCTED_LAMBDA_EXPRESSION) MapExpression(org.codehaus.groovy.ast.expr.MapExpression) ClassHelper.isGStringType(org.codehaus.groovy.ast.ClassHelper.isGStringType) GenericsTypeName(org.codehaus.groovy.ast.GenericsType.GenericsTypeName) AnnotatedNode(org.codehaus.groovy.ast.AnnotatedNode) ConstantExpression(org.codehaus.groovy.ast.expr.ConstantExpression) Long_TYPE(org.codehaus.groovy.ast.ClassHelper.Long_TYPE) StaticTypeCheckingSupport.extractGenericsParameterMapOfThis(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.extractGenericsParameterMapOfThis) StaticTypesTransformation(org.codehaus.groovy.transform.StaticTypesTransformation) GeneralUtils.getGetterName(org.codehaus.groovy.ast.tools.GeneralUtils.getGetterName) StaticTypeCheckingSupport.getCombinedBoundType(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.getCombinedBoundType) Number_TYPE(org.codehaus.groovy.ast.ClassHelper.Number_TYPE) MethodCall(org.codehaus.groovy.ast.expr.MethodCall) ClassHelper.isBigDecimalType(org.codehaus.groovy.ast.ClassHelper.isBigDecimalType) Collectors.toMap(java.util.stream.Collectors.toMap) StaticTypeCheckingSupport.evaluateExpression(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.evaluateExpression) INFERRED_TYPE(org.codehaus.groovy.transform.stc.StaticTypesMarker.INFERRED_TYPE) ForStatement(org.codehaus.groovy.ast.stmt.ForStatement) PV_FIELDS_ACCESS(org.codehaus.groovy.transform.stc.StaticTypesMarker.PV_FIELDS_ACCESS) StaticTypeCheckingSupport.findSetters(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.findSetters) Collection(java.util.Collection) DefaultGroovyMethods(org.codehaus.groovy.runtime.DefaultGroovyMethods) Collectors(java.util.stream.Collectors) NotExpression(org.codehaus.groovy.ast.expr.NotExpression) InnerClassNode(org.codehaus.groovy.ast.InnerClassNode) Short_TYPE(org.codehaus.groovy.ast.ClassHelper.Short_TYPE) Objects(java.util.Objects) StaticTypeCheckingSupport.findDGMMethodsByNameAndArguments(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.findDGMMethodsByNameAndArguments) IfStatement(org.codehaus.groovy.ast.stmt.IfStatement) FieldExpression(org.codehaus.groovy.ast.expr.FieldExpression) StaticTypeCheckingSupport.isBitOperator(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isBitOperator) ClosureUtils.hasImplicitParameter(org.codehaus.groovy.ast.tools.ClosureUtils.hasImplicitParameter) StaticTypeCheckingSupport.isWildcardLeftHandSide(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isWildcardLeftHandSide) BigDecimal_TYPE(org.codehaus.groovy.ast.ClassHelper.BigDecimal_TYPE) ClassHelper.isPrimitiveByte(org.codehaus.groovy.ast.ClassHelper.isPrimitiveByte) StaticTypeCheckingSupport.getCombinedGenericsType(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.getCombinedGenericsType) WideningCategories.isIntCategory(org.codehaus.groovy.ast.tools.WideningCategories.isIntCategory) DynamicVariable(org.codehaus.groovy.ast.DynamicVariable) Double_TYPE(org.codehaus.groovy.ast.ClassHelper.Double_TYPE) IntStream(java.util.stream.IntStream) StaticTypeCheckingSupport.isAssignableTo(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isAssignableTo) ClosureSignatureHint(groovy.transform.stc.ClosureSignatureHint) AnnotationNode(org.codehaus.groovy.ast.AnnotationNode) StaticTypeCheckingSupport.isBeingCompiled(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isBeingCompiled) StaticTypeCheckingSupport.typeCheckMethodsWithGenerics(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.typeCheckMethodsWithGenerics) DIVIDE(org.codehaus.groovy.syntax.Types.DIVIDE) Function(java.util.function.Function) ASSIGN(org.codehaus.groovy.syntax.Types.ASSIGN) HashSet(java.util.HashSet) ClassHelper.isNumberType(org.codehaus.groovy.ast.ClassHelper.isNumberType) BiPredicate(java.util.function.BiPredicate) ELVIS_EQUAL(org.codehaus.groovy.syntax.Types.ELVIS_EQUAL) NUMBER_OPS(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.NUMBER_OPS) Tuple2(groovy.lang.Tuple2) ClassHelper.boolean_TYPE(org.codehaus.groovy.ast.ClassHelper.boolean_TYPE) PV_METHODS_ACCESS(org.codehaus.groovy.transform.stc.StaticTypesMarker.PV_METHODS_ACCESS) ClassCodeVisitorSupport(org.codehaus.groovy.ast.ClassCodeVisitorSupport) StaticTypeCheckingSupport.checkPossibleLossOfPrecision(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.checkPossibleLossOfPrecision) GeneralUtils.varX(org.codehaus.groovy.ast.tools.GeneralUtils.varX) EmptyExpression(org.codehaus.groovy.ast.expr.EmptyExpression) LinkedList(java.util.LinkedList) StaticTypeCheckingSupport.typeCheckMethodArgumentWithGenerics(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.typeCheckMethodArgumentWithGenerics) ConstructorCallExpression(org.codehaus.groovy.ast.expr.ConstructorCallExpression) COMPARE_NOT_INSTANCEOF(org.codehaus.groovy.syntax.Types.COMPARE_NOT_INSTANCEOF) ClassHelper(org.codehaus.groovy.ast.ClassHelper) DECLARATION_INFERRED_TYPE(org.codehaus.groovy.transform.stc.StaticTypesMarker.DECLARATION_INFERRED_TYPE) SET_TYPE(org.codehaus.groovy.ast.ClassHelper.SET_TYPE) StaticTypeCheckingSupport.isArrayOp(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isArrayOp) ClassExpression(org.codehaus.groovy.ast.expr.ClassExpression) ASTNode(org.codehaus.groovy.ast.ASTNode) TupleExpression(org.codehaus.groovy.ast.expr.TupleExpression) GeneralUtils.binX(org.codehaus.groovy.ast.tools.GeneralUtils.binX) TryCatchStatement(org.codehaus.groovy.ast.stmt.TryCatchStatement) GenericsUtils(org.codehaus.groovy.ast.tools.GenericsUtils) StringJoiner(java.util.StringJoiner) MethodPointerExpression(org.codehaus.groovy.ast.expr.MethodPointerExpression) StaticTypeCheckingSupport.allParametersAndArgumentsMatchWithDefaultParams(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.allParametersAndArgumentsMatchWithDefaultParams) ClassHelper.isWrapperCharacter(org.codehaus.groovy.ast.ClassHelper.isWrapperCharacter) ConstructorNode(org.codehaus.groovy.ast.ConstructorNode) MapEntryExpression(org.codehaus.groovy.ast.expr.MapEntryExpression) ClassHelper.isObjectType(org.codehaus.groovy.ast.ClassHelper.isObjectType) Arrays(java.util.Arrays) INFERRED_RETURN_TYPE(org.codehaus.groovy.transform.stc.StaticTypesMarker.INFERRED_RETURN_TYPE) StaticTypeCheckingSupport.checkCompatibleAssignmentTypes(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.checkCompatibleAssignmentTypes) Closure(groovy.lang.Closure) StaticTypeCheckingSupport.getGenericsWithoutArray(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.getGenericsWithoutArray) WideningCategories.isFloatingCategory(org.codehaus.groovy.ast.tools.WideningCategories.isFloatingCategory) StaticTypeCheckingSupport.isTraitSelf(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isTraitSelf) RANGE_TYPE(org.codehaus.groovy.ast.ClassHelper.RANGE_TYPE) ClosureParams(groovy.transform.stc.ClosureParams) CLOSURE_ARGUMENTS(org.codehaus.groovy.transform.stc.StaticTypesMarker.CLOSURE_ARGUMENTS) INTDIV_EQUAL(org.codehaus.groovy.syntax.Types.INTDIV_EQUAL) StaticTypeCheckingSupport.extractGenericsConnections(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.extractGenericsConnections) CaseStatement(org.codehaus.groovy.ast.stmt.CaseStatement) ClassHelper.isBigIntegerType(org.codehaus.groovy.ast.ClassHelper.isBigIntegerType) Traits(org.codehaus.groovy.transform.trait.Traits) ClassHelper.char_TYPE(org.codehaus.groovy.ast.ClassHelper.char_TYPE) MINUS_MINUS(org.codehaus.groovy.syntax.Types.MINUS_MINUS) VariableExpression(org.codehaus.groovy.ast.expr.VariableExpression) EnumMap(java.util.EnumMap) LIST_TYPE(org.codehaus.groovy.ast.ClassHelper.LIST_TYPE) TypeCheckingMode(groovy.transform.TypeCheckingMode) BeanUtils.capitalize(org.apache.groovy.util.BeanUtils.capitalize) PATTERN_TYPE(org.codehaus.groovy.ast.ClassHelper.PATTERN_TYPE) NamedParams(groovy.transform.NamedParams) Set(java.util.Set) Token(org.codehaus.groovy.syntax.Token) ClassHelper.isPrimitiveVoid(org.codehaus.groovy.ast.ClassHelper.isPrimitiveVoid) ClassHelper.getUnwrapper(org.codehaus.groovy.ast.ClassHelper.getUnwrapper) GeneralUtils.callX(org.codehaus.groovy.ast.tools.GeneralUtils.callX) InvocationTargetException(java.lang.reflect.InvocationTargetException) WideningCategories.isFloat(org.codehaus.groovy.ast.tools.WideningCategories.isFloat) STREAM_TYPE(org.codehaus.groovy.ast.ClassHelper.STREAM_TYPE) CLASS_Type(org.codehaus.groovy.ast.ClassHelper.CLASS_Type) StaticTypeCheckingSupport.toMethodParametersString(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.toMethodParametersString) ClassHelper.isWrapperByte(org.codehaus.groovy.ast.ClassHelper.isWrapperByte) COMPARE_NOT_EQUAL(org.codehaus.groovy.syntax.Types.COMPARE_NOT_EQUAL) StaticTypeCheckingSupport.implementsInterfaceOrIsSubclassOf(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.implementsInterfaceOrIsSubclassOf) ClassHelper.getNextSuperClass(org.codehaus.groovy.ast.ClassHelper.getNextSuperClass) ClassHelper.isWrapperFloat(org.codehaus.groovy.ast.ClassHelper.isWrapperFloat) ClassHelper.dynamicType(org.codehaus.groovy.ast.ClassHelper.dynamicType) ClassHelper.long_TYPE(org.codehaus.groovy.ast.ClassHelper.long_TYPE) LinkedHashMap_TYPE(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.LinkedHashMap_TYPE) StaticTypeCheckingSupport.isBoolIntrinsicOp(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isBoolIntrinsicOp) CastExpression(org.codehaus.groovy.ast.expr.CastExpression) StaticTypeCheckingSupport.boundUnboundedWildcards(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.boundUnboundedWildcards) ReturnAdder(org.codehaus.groovy.classgen.ReturnAdder) INTDIV(org.codehaus.groovy.syntax.Types.INTDIV) StaticMethodCallExpression(org.codehaus.groovy.ast.expr.StaticMethodCallExpression) LambdaExpression(org.codehaus.groovy.ast.expr.LambdaExpression) TYPE(org.codehaus.groovy.transform.stc.StaticTypesMarker.TYPE) GeneralUtils.thisPropX(org.codehaus.groovy.ast.tools.GeneralUtils.thisPropX) StaticTypeCheckingSupport.missesGenericsTypes(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.missesGenericsTypes) MOD_EQUAL(org.codehaus.groovy.syntax.Types.MOD_EQUAL) WhileStatement(org.codehaus.groovy.ast.stmt.WhileStatement) ArrayList(java.util.ArrayList) ClosureUtils.getResolveStrategyName(org.codehaus.groovy.ast.tools.ClosureUtils.getResolveStrategyName) MethodNode(org.codehaus.groovy.ast.MethodNode) WideningCategories.isBigDecCategory(org.codehaus.groovy.ast.tools.WideningCategories.isBigDecCategory) ClassHelper.isPrimitiveFloat(org.codehaus.groovy.ast.ClassHelper.isPrimitiveFloat) KEYWORD_IN(org.codehaus.groovy.syntax.Types.KEYWORD_IN) LinkedHashSet(java.util.LinkedHashSet) Parameter(org.codehaus.groovy.ast.Parameter) MAP_TYPE(org.codehaus.groovy.ast.ClassHelper.MAP_TYPE) WideningCategories.isDoubleCategory(org.codehaus.groovy.ast.tools.WideningCategories.isDoubleCategory) EmptyStatement(org.codehaus.groovy.ast.stmt.EmptyStatement) ClassHelper.isClassType(org.codehaus.groovy.ast.ClassHelper.isClassType) ClassHelper.isPrimitiveType(org.codehaus.groovy.ast.ClassHelper.isPrimitiveType) ClassHelper.double_TYPE(org.codehaus.groovy.ast.ClassHelper.double_TYPE) ClassHelper.isPrimitiveChar(org.codehaus.groovy.ast.ClassHelper.isPrimitiveChar) WideningCategories.isLongCategory(org.codehaus.groovy.ast.tools.WideningCategories.isLongCategory) DIRECT_METHOD_CALL_TARGET(org.codehaus.groovy.transform.stc.StaticTypesMarker.DIRECT_METHOD_CALL_TARGET) WideningCategories.isNumberCategory(org.codehaus.groovy.ast.tools.WideningCategories.isNumberCategory) PLUS_PLUS(org.codehaus.groovy.syntax.Types.PLUS_PLUS) ListExpression(org.codehaus.groovy.ast.expr.ListExpression) KEYWORD_INSTANCEOF(org.codehaus.groovy.syntax.Types.KEYWORD_INSTANCEOF) StaticTypeCheckingSupport.isAssignment(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isAssignment) GeneralUtils.getSetterName(org.codehaus.groovy.ast.tools.GeneralUtils.getSetterName) DELEGATION_METADATA(org.codehaus.groovy.transform.stc.StaticTypesMarker.DELEGATION_METADATA) StaticTypeCheckingSupport.lastArgMatchesVarg(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.lastArgMatchesVarg) StaticTypeCheckingSupport.isGStringOrGStringStringLUB(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isGStringOrGStringStringLUB) ClassHelper.findSAM(org.codehaus.groovy.ast.ClassHelper.findSAM) RangeExpression(org.codehaus.groovy.ast.expr.RangeExpression) ResolveVisitor(org.codehaus.groovy.control.ResolveVisitor) Variable(org.codehaus.groovy.ast.Variable) ClassHelper.isSAMType(org.codehaus.groovy.ast.ClassHelper.isSAMType) FIND_REGEX(org.codehaus.groovy.syntax.Types.FIND_REGEX) StaticTypeCheckingSupport.prettyPrintType(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.prettyPrintType) GeneralUtils(org.codehaus.groovy.ast.tools.GeneralUtils) WideningCategories.isDouble(org.codehaus.groovy.ast.tools.WideningCategories.isDouble) Integer_TYPE(org.codehaus.groovy.ast.ClassHelper.Integer_TYPE) DelegatesTo(groovy.lang.DelegatesTo) SpreadExpression(org.codehaus.groovy.ast.expr.SpreadExpression) SUPER_MOP_METHOD_REQUIRED(org.codehaus.groovy.transform.stc.StaticTypesMarker.SUPER_MOP_METHOD_REQUIRED) ClassHelper.isWrapperLong(org.codehaus.groovy.ast.ClassHelper.isWrapperLong) ArrayExpression(org.codehaus.groovy.ast.expr.ArrayExpression) GROOVY_OBJECT_TYPE(org.codehaus.groovy.ast.ClassHelper.GROOVY_OBJECT_TYPE) GeneralUtils.args(org.codehaus.groovy.ast.tools.GeneralUtils.args) CatchStatement(org.codehaus.groovy.ast.stmt.CatchStatement) GroovyBugError(org.codehaus.groovy.GroovyBugError) READONLY_PROPERTY(org.codehaus.groovy.transform.stc.StaticTypesMarker.READONLY_PROPERTY) List(java.util.List) TypeChecked(groovy.transform.TypeChecked) BinaryExpression(org.codehaus.groovy.ast.expr.BinaryExpression) BlockStatement(org.codehaus.groovy.ast.stmt.BlockStatement) Modifier(java.lang.reflect.Modifier) Optional(java.util.Optional) Statement(org.codehaus.groovy.ast.stmt.Statement) ClassHelper.isWrapperShort(org.codehaus.groovy.ast.ClassHelper.isWrapperShort) GeneralUtils.constX(org.codehaus.groovy.ast.tools.GeneralUtils.constX) ClassHelper.int_TYPE(org.codehaus.groovy.ast.ClassHelper.int_TYPE) CodeVisitorSupport(org.codehaus.groovy.ast.CodeVisitorSupport) ElvisOperatorExpression(org.codehaus.groovy.ast.expr.ElvisOperatorExpression) Collection_TYPE(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.Collection_TYPE) StaticTypeCheckingSupport.findTargetVariable(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.findTargetVariable) WideningCategories.lowestUpperBound(org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound) HashMap(java.util.HashMap) ClassHelper.isDynamicTyped(org.codehaus.groovy.ast.ClassHelper.isDynamicTyped) TokenUtil(org.codehaus.groovy.syntax.TokenUtil) AtomicReference(java.util.concurrent.atomic.AtomicReference) StaticTypeCheckingSupport.isVargs(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isVargs) CompilationUnit(org.codehaus.groovy.control.CompilationUnit) CLOSURE_TYPE(org.codehaus.groovy.ast.ClassHelper.CLOSURE_TYPE) WideningCategories.isBigIntCategory(org.codehaus.groovy.ast.tools.WideningCategories.isBigIntCategory) MethodCallExpression(org.codehaus.groovy.ast.expr.MethodCallExpression) StaticTypeCheckingSupport.isCompareToBoolean(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isCompareToBoolean) StaticTypeCheckingSupport.isParameterizedWithString(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isParameterizedWithString) Byte_TYPE(org.codehaus.groovy.ast.ClassHelper.Byte_TYPE) ErrorCollector(org.codehaus.groovy.control.ErrorCollector) Iterator(java.util.Iterator) IntRange(groovy.lang.IntRange) ClosureSignatureConflictResolver(groovy.transform.stc.ClosureSignatureConflictResolver) GenericsUtils.makeClassSafe0(org.codehaus.groovy.ast.tools.GenericsUtils.makeClassSafe0) StaticTypeCheckingSupport.isUsingGenericsOrIsArrayUsingGenerics(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isUsingGenericsOrIsArrayUsingGenerics) DeclarationExpression(org.codehaus.groovy.ast.expr.DeclarationExpression) StaticTypeCheckingSupport.isClassClassNodeWrappingConcreteType(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isClassClassNodeWrappingConcreteType) StaticTypeCheckingSupport.isParameterizedWithGStringOrGStringString(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isParameterizedWithGStringOrGStringString) NamedParam(groovy.transform.NamedParam) ClosureExpression(org.codehaus.groovy.ast.expr.ClosureExpression) StaticTypeCheckingSupport.applyGenericsConnections(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.applyGenericsConnections) StaticTypeCheckingSupport.fullyResolveType(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.fullyResolveType) SwitchStatement(org.codehaus.groovy.ast.stmt.SwitchStatement) StaticTypeCheckingSupport.isShiftOperation(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isShiftOperation) FieldNode(org.codehaus.groovy.ast.FieldNode) AttributeExpression(org.codehaus.groovy.ast.expr.AttributeExpression) WideningCategories(org.codehaus.groovy.ast.tools.WideningCategories) AUTOCLOSEABLE_TYPE(org.codehaus.groovy.ast.ClassHelper.AUTOCLOSEABLE_TYPE) EQUAL(org.codehaus.groovy.syntax.Types.EQUAL) MOD(org.codehaus.groovy.syntax.Types.MOD) Collections(java.util.Collections) Iterator_TYPE(org.codehaus.groovy.ast.ClassHelper.Iterator_TYPE) ArrayList_TYPE(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.ArrayList_TYPE) StaticTypeCheckingSupport.findDGMMethodsForClassNode(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.findDGMMethodsForClassNode) ClassNode(org.codehaus.groovy.ast.ClassNode) InnerClassNode(org.codehaus.groovy.ast.InnerClassNode) TernaryExpression(org.codehaus.groovy.ast.expr.TernaryExpression) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) ConstructorCallExpression(org.codehaus.groovy.ast.expr.ConstructorCallExpression) ClosureListExpression(org.codehaus.groovy.ast.expr.ClosureListExpression) ArgumentListExpression(org.codehaus.groovy.ast.expr.ArgumentListExpression) ListExpression(org.codehaus.groovy.ast.expr.ListExpression) ClosureSignatureHint(groovy.transform.stc.ClosureSignatureHint) StaticMethodCallExpression(org.codehaus.groovy.ast.expr.StaticMethodCallExpression) MethodCallExpression(org.codehaus.groovy.ast.expr.MethodCallExpression) MethodNode(org.codehaus.groovy.ast.MethodNode) UnaryMinusExpression(org.codehaus.groovy.ast.expr.UnaryMinusExpression) ClosureListExpression(org.codehaus.groovy.ast.expr.ClosureListExpression) ArgumentListExpression(org.codehaus.groovy.ast.expr.ArgumentListExpression) MethodReferenceExpression(org.codehaus.groovy.ast.expr.MethodReferenceExpression) TernaryExpression(org.codehaus.groovy.ast.expr.TernaryExpression) PropertyExpression(org.codehaus.groovy.ast.expr.PropertyExpression) PrefixExpression(org.codehaus.groovy.ast.expr.PrefixExpression) PostfixExpression(org.codehaus.groovy.ast.expr.PostfixExpression) Expression(org.codehaus.groovy.ast.expr.Expression) UnaryPlusExpression(org.codehaus.groovy.ast.expr.UnaryPlusExpression) AnnotationConstantExpression(org.codehaus.groovy.ast.expr.AnnotationConstantExpression) BitwiseNegationExpression(org.codehaus.groovy.ast.expr.BitwiseNegationExpression) MapExpression(org.codehaus.groovy.ast.expr.MapExpression) ConstantExpression(org.codehaus.groovy.ast.expr.ConstantExpression) StaticTypeCheckingSupport.evaluateExpression(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.evaluateExpression) NotExpression(org.codehaus.groovy.ast.expr.NotExpression) FieldExpression(org.codehaus.groovy.ast.expr.FieldExpression) EmptyExpression(org.codehaus.groovy.ast.expr.EmptyExpression) ConstructorCallExpression(org.codehaus.groovy.ast.expr.ConstructorCallExpression) ClassExpression(org.codehaus.groovy.ast.expr.ClassExpression) TupleExpression(org.codehaus.groovy.ast.expr.TupleExpression) MethodPointerExpression(org.codehaus.groovy.ast.expr.MethodPointerExpression) MapEntryExpression(org.codehaus.groovy.ast.expr.MapEntryExpression) VariableExpression(org.codehaus.groovy.ast.expr.VariableExpression) CastExpression(org.codehaus.groovy.ast.expr.CastExpression) StaticMethodCallExpression(org.codehaus.groovy.ast.expr.StaticMethodCallExpression) LambdaExpression(org.codehaus.groovy.ast.expr.LambdaExpression) ListExpression(org.codehaus.groovy.ast.expr.ListExpression) RangeExpression(org.codehaus.groovy.ast.expr.RangeExpression) SpreadExpression(org.codehaus.groovy.ast.expr.SpreadExpression) ArrayExpression(org.codehaus.groovy.ast.expr.ArrayExpression) BinaryExpression(org.codehaus.groovy.ast.expr.BinaryExpression) ElvisOperatorExpression(org.codehaus.groovy.ast.expr.ElvisOperatorExpression) MethodCallExpression(org.codehaus.groovy.ast.expr.MethodCallExpression) DeclarationExpression(org.codehaus.groovy.ast.expr.DeclarationExpression) ClosureExpression(org.codehaus.groovy.ast.expr.ClosureExpression) AttributeExpression(org.codehaus.groovy.ast.expr.AttributeExpression) GenericsType(org.codehaus.groovy.ast.GenericsType) StaticTypeCheckingSupport.getCombinedGenericsType(org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.getCombinedGenericsType) ClosureUtils.hasImplicitParameter(org.codehaus.groovy.ast.tools.ClosureUtils.hasImplicitParameter) Parameter(org.codehaus.groovy.ast.Parameter) GenericsTypeName(org.codehaus.groovy.ast.GenericsType.GenericsTypeName) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap) Collectors.toMap(java.util.stream.Collectors.toMap) EnumMap(java.util.EnumMap) HashMap(java.util.HashMap)

Aggregations

GenericsType (org.codehaus.groovy.ast.GenericsType)27 GenericsTypeName (org.codehaus.groovy.ast.GenericsType.GenericsTypeName)27 ClassNode (org.codehaus.groovy.ast.ClassNode)25 InnerClassNode (org.codehaus.groovy.ast.InnerClassNode)25 HashMap (java.util.HashMap)16 LinkedHashMap (java.util.LinkedHashMap)15 Parameter (org.codehaus.groovy.ast.Parameter)14 Map (java.util.Map)12 MethodNode (org.codehaus.groovy.ast.MethodNode)12 StaticTypeCheckingSupport.findDGMMethodsForClassNode (org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.findDGMMethodsForClassNode)12 StaticTypeCheckingSupport.getCombinedGenericsType (org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.getCombinedGenericsType)12 ClosureSignatureHint (groovy.transform.stc.ClosureSignatureHint)10 ArgumentListExpression (org.codehaus.groovy.ast.expr.ArgumentListExpression)10 ArrayExpression (org.codehaus.groovy.ast.expr.ArrayExpression)10 BinaryExpression (org.codehaus.groovy.ast.expr.BinaryExpression)10 CastExpression (org.codehaus.groovy.ast.expr.CastExpression)10 ClosureExpression (org.codehaus.groovy.ast.expr.ClosureExpression)10 ConstantExpression (org.codehaus.groovy.ast.expr.ConstantExpression)10 Expression (org.codehaus.groovy.ast.expr.Expression)10 ListExpression (org.codehaus.groovy.ast.expr.ListExpression)10