Search in sources :

Example 1 with ReferenceType

use of com.github.javaparser.ast.type.ReferenceType in project checker-framework by typetools.

the class StubParser method annotateAsArray.

/**
 * Add the annotations from {@code type} to {@code atype}. Type annotations that parsed as
 * declaration annotations (ie those in {@code declAnnos} are applied to the innermost component
 * type.
 *
 * @param atype annotated type to which to add annotations
 * @param type parsed type
 * @param declAnnos annotations stored on the declaration of the variable with this type or null
 */
private void annotateAsArray(AnnotatedArrayType atype, ReferenceType type, NodeList<AnnotationExpr> declAnnos) {
    annotateInnermostComponentType(atype, declAnnos);
    Type typeDef = type;
    AnnotatedTypeMirror currentAtype = atype;
    while (typeDef.isArrayType() && currentAtype.getKind() == TypeKind.ARRAY) {
        // handle generic type
        clearAnnotations(currentAtype, typeDef);
        List<AnnotationExpr> annotations = typeDef.getAnnotations();
        if (annotations != null) {
            annotate(currentAtype, annotations);
        }
        typeDef = ((com.github.javaparser.ast.type.ArrayType) typeDef).getComponentType();
        currentAtype = ((AnnotatedArrayType) currentAtype).getComponentType();
        if (typeDef.isArrayType() ^ currentAtype.getKind() == TypeKind.ARRAY) {
            stubWarn("Mismatched array lengths; atype: " + atype + "%n  type: " + type);
        }
    }
}
Also used : ClassOrInterfaceType(com.github.javaparser.ast.type.ClassOrInterfaceType) AnnotatedArrayType(org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedArrayType) Type(com.github.javaparser.ast.type.Type) ArrayType(javax.lang.model.type.ArrayType) AnnotatedExecutableType(org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedExecutableType) ReferenceType(com.github.javaparser.ast.type.ReferenceType) AnnotatedWildcardType(org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedWildcardType) AnnotatedDeclaredType(org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedDeclaredType) WildcardType(com.github.javaparser.ast.type.WildcardType) AnnotationExpr(com.github.javaparser.ast.expr.AnnotationExpr) MarkerAnnotationExpr(com.github.javaparser.ast.expr.MarkerAnnotationExpr) SingleMemberAnnotationExpr(com.github.javaparser.ast.expr.SingleMemberAnnotationExpr) NormalAnnotationExpr(com.github.javaparser.ast.expr.NormalAnnotationExpr) AnnotatedTypeMirror(org.checkerframework.framework.type.AnnotatedTypeMirror)

Example 2 with ReferenceType

use of com.github.javaparser.ast.type.ReferenceType in project checker-framework by typetools.

the class AnnotationFileParser method annotateAsArray.

/**
 * Add the annotations from {@code type} to {@code atype}. Type annotations that parsed as
 * declaration annotations (i.e., type annotations in {@code declAnnos}) are applied to the
 * innermost component type.
 *
 * @param atype annotated type to which to add annotations
 * @param type parsed type
 * @param declAnnos annotations stored on the declaration of the variable with this type or null
 * @param astNode where to report errors
 */
private void annotateAsArray(AnnotatedArrayType atype, ReferenceType type, @Nullable NodeList<AnnotationExpr> declAnnos, NodeWithRange<?> astNode) {
    annotateInnermostComponentType(atype, declAnnos, astNode);
    Type typeDef = type;
    AnnotatedTypeMirror currentAtype = atype;
    while (typeDef.isArrayType()) {
        if (currentAtype.getKind() != TypeKind.ARRAY) {
            warn(astNode, "Mismatched array lengths; atype: " + atype + "%n  type: " + type);
            return;
        }
        // handle generic type
        clearAnnotations(currentAtype, typeDef);
        List<AnnotationExpr> annotations = typeDef.getAnnotations();
        if (annotations != null) {
            annotate(currentAtype, annotations, astNode);
        }
        typeDef = ((com.github.javaparser.ast.type.ArrayType) typeDef).getComponentType();
        currentAtype = ((AnnotatedArrayType) currentAtype).getComponentType();
    }
    if (currentAtype.getKind() == TypeKind.ARRAY) {
        warn(astNode, "Mismatched array lengths; atype: " + atype + "%n  type: " + type);
    }
}
Also used : AnnotatedArrayType(org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedArrayType) Type(com.github.javaparser.ast.type.Type) ArrayType(javax.lang.model.type.ArrayType) AnnotatedExecutableType(org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedExecutableType) AnnotatedWildcardType(org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedWildcardType) AnnotationFileType(org.checkerframework.framework.stub.AnnotationFileUtil.AnnotationFileType) DeclaredType(javax.lang.model.type.DeclaredType) WildcardType(com.github.javaparser.ast.type.WildcardType) ClassOrInterfaceType(com.github.javaparser.ast.type.ClassOrInterfaceType) ReferenceType(com.github.javaparser.ast.type.ReferenceType) AnnotatedDeclaredType(org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedDeclaredType) PrimitiveType(com.github.javaparser.ast.type.PrimitiveType) AnnotationExpr(com.github.javaparser.ast.expr.AnnotationExpr) MarkerAnnotationExpr(com.github.javaparser.ast.expr.MarkerAnnotationExpr) SingleMemberAnnotationExpr(com.github.javaparser.ast.expr.SingleMemberAnnotationExpr) NormalAnnotationExpr(com.github.javaparser.ast.expr.NormalAnnotationExpr) AnnotatedTypeMirror(org.checkerframework.framework.type.AnnotatedTypeMirror)

Example 3 with ReferenceType

use of com.github.javaparser.ast.type.ReferenceType in project javaparser by javaparser.

the class CallableDeclaration method appendThrowsIfRequested.

protected String appendThrowsIfRequested(boolean includingThrows) {
    StringBuilder sb = new StringBuilder();
    if (includingThrows) {
        boolean firstThrow = true;
        for (ReferenceType thr : getThrownExceptions()) {
            if (firstThrow) {
                firstThrow = false;
                sb.append(" throws ");
            } else {
                sb.append(", ");
            }
            sb.append(thr.toString(prettyPrinterNoCommentsConfiguration));
        }
    }
    return sb.toString();
}
Also used : ReferenceType(com.github.javaparser.ast.type.ReferenceType)

Example 4 with ReferenceType

use of com.github.javaparser.ast.type.ReferenceType in project checker-framework by typetools.

the class AnnotationFileParser method annotate.

/**
 * Add to formal parameter {@code atype}:
 *
 * <ol>
 *   <li>the annotations from {@code typeDef}, and
 *   <li>any type annotations that parsed as declaration annotations (i.e., type annotations in
 *       {@code declAnnos}).
 * </ol>
 *
 * @param atype annotated type to which to add annotations
 * @param typeDef parsed type
 * @param declAnnos annotations stored on the declaration of the variable with this type, or null
 * @param astNode where to report errors
 */
private void annotate(AnnotatedTypeMirror atype, Type typeDef, @Nullable NodeList<AnnotationExpr> declAnnos, NodeWithRange<?> astNode) {
    if (atype.getKind() == TypeKind.ARRAY) {
        if (typeDef instanceof ReferenceType) {
            annotateAsArray((AnnotatedArrayType) atype, (ReferenceType) typeDef, declAnnos, astNode);
        } else {
            warn(astNode, "expected ReferenceType but found: " + typeDef);
        }
        return;
    }
    clearAnnotations(atype, typeDef);
    // Primary annotations for the type of a variable declaration are not stored in typeDef, but
    // rather as declaration annotations (passed as declAnnos to this method).  But, if typeDef
    // is not the type of a variable, then the primary annotations are stored in typeDef.
    NodeList<AnnotationExpr> primaryAnnotations;
    if (typeDef.getAnnotations().isEmpty() && declAnnos != null) {
        primaryAnnotations = declAnnos;
    } else {
        primaryAnnotations = typeDef.getAnnotations();
    }
    if (atype.getKind() != TypeKind.WILDCARD) {
        // The primary annotation on a wildcard applies to the super or extends bound and
        // are added below.
        annotate(atype, primaryAnnotations, astNode);
    }
    switch(atype.getKind()) {
        case DECLARED:
            ClassOrInterfaceType declType = unwrapDeclaredType(typeDef);
            if (declType == null) {
                break;
            }
            AnnotatedDeclaredType adeclType = (AnnotatedDeclaredType) atype;
            // Process type arguments.
            if (declType.getTypeArguments().isPresent() && !declType.getTypeArguments().get().isEmpty() && !adeclType.getTypeArguments().isEmpty()) {
                if (declType.getTypeArguments().get().size() != adeclType.getTypeArguments().size()) {
                    warn(astNode, String.format("Mismatch in type argument size between %s (%d) and %s (%d)", declType, declType.getTypeArguments().get().size(), adeclType, adeclType.getTypeArguments().size()));
                    break;
                }
                for (int i = 0; i < declType.getTypeArguments().get().size(); ++i) {
                    annotate(adeclType.getTypeArguments().get(i), declType.getTypeArguments().get().get(i), null, astNode);
                }
            }
            break;
        case WILDCARD:
            AnnotatedWildcardType wildcardType = (AnnotatedWildcardType) atype;
            // Ensure that the file also has a wildcard type, report an error otherwise
            if (!typeDef.isWildcardType()) {
                // We throw an error here, as otherwise we are just getting a generic cast error
                // on the very next line.
                warn(astNode, "Wildcard type <" + atype + "> does not match type in stubs file" + filename + ": <" + typeDef + ">" + " while parsing " + typeBeingParsed);
                return;
            }
            WildcardType wildcardDef = (WildcardType) typeDef;
            if (wildcardDef.getExtendedType().isPresent()) {
                annotate(wildcardType.getExtendsBound(), wildcardDef.getExtendedType().get(), null, astNode);
                annotate(wildcardType.getSuperBound(), primaryAnnotations, astNode);
            } else if (wildcardDef.getSuperType().isPresent()) {
                annotate(wildcardType.getSuperBound(), wildcardDef.getSuperType().get(), null, astNode);
                annotate(wildcardType.getExtendsBound(), primaryAnnotations, astNode);
            } else {
                annotate(atype, primaryAnnotations, astNode);
            }
            break;
        case TYPEVAR:
            // Add annotations from the declaration of the TypeVariable
            AnnotatedTypeVariable typeVarUse = (AnnotatedTypeVariable) atype;
            Types typeUtils = processingEnv.getTypeUtils();
            for (AnnotatedTypeVariable typePar : typeParameters) {
                if (typeUtils.isSameType(typePar.getUnderlyingType(), atype.getUnderlyingType())) {
                    atypeFactory.replaceAnnotations(typePar.getUpperBound(), typeVarUse.getUpperBound());
                    atypeFactory.replaceAnnotations(typePar.getLowerBound(), typeVarUse.getLowerBound());
                }
            }
            break;
        default:
    }
}
Also used : Types(javax.lang.model.util.Types) AnnotatedWildcardType(org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedWildcardType) WildcardType(com.github.javaparser.ast.type.WildcardType) AnnotationExpr(com.github.javaparser.ast.expr.AnnotationExpr) MarkerAnnotationExpr(com.github.javaparser.ast.expr.MarkerAnnotationExpr) SingleMemberAnnotationExpr(com.github.javaparser.ast.expr.SingleMemberAnnotationExpr) NormalAnnotationExpr(com.github.javaparser.ast.expr.NormalAnnotationExpr) AnnotatedDeclaredType(org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedDeclaredType) AnnotatedWildcardType(org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedWildcardType) ClassOrInterfaceType(com.github.javaparser.ast.type.ClassOrInterfaceType) AnnotatedTypeVariable(org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedTypeVariable) ReferenceType(com.github.javaparser.ast.type.ReferenceType)

Example 5 with ReferenceType

use of com.github.javaparser.ast.type.ReferenceType in project drools by kiegroup.

the class ExpressionTyper method toTypedExpressionFromMethodCallOrField.

private TypedExpressionResult toTypedExpressionFromMethodCallOrField(Expression drlxExpr) {
    if (drlxExpr instanceof FieldAccessExpr) {
        // try to see if it's a constant
        final Optional<TypedExpression> typedExpression = tryParseAsConstantField(ruleContext.getTypeResolver(), ((FieldAccessExpr) drlxExpr).getScope(), ((FieldAccessExpr) drlxExpr).getNameAsString());
        if (typedExpression.isPresent()) {
            return new TypedExpressionResult(typedExpression, context);
        }
    }
    if (patternType == null && drlxExpr instanceof NullSafeFieldAccessExpr) {
        // try to see if it's a constant
        final Optional<TypedExpression> typedExpression = tryParseAsConstantField(ruleContext.getTypeResolver(), ((NullSafeFieldAccessExpr) drlxExpr).getScope(), ((NullSafeFieldAccessExpr) drlxExpr).getNameAsString());
        if (typedExpression.isPresent()) {
            return new TypedExpressionResult(typedExpression, context);
        }
    }
    final List<Node> childrenNodes = flattenScope(ruleContext.getTypeResolver(), drlxExpr);
    final Node firstChild = childrenNodes.get(0);
    boolean isInLineCast = firstChild instanceof InlineCastExpr;
    java.lang.reflect.Type originalTypeCursor;
    final Node firstNode;
    if (isInLineCast) {
        InlineCastExpr inlineCast = (InlineCastExpr) firstChild;
        originalTypeCursor = originalTypeCursorFromInlineCast(inlineCast);
        firstNode = inlineCast.getExpression();
        if (inlineCast.getExpression().isThisExpr()) {
            context.setInlineCastExpression(Optional.of(new InstanceOfExpr(new NameExpr(THIS_PLACEHOLDER), (ReferenceType) inlineCast.getType())));
        } else {
            context.setInlineCastExpression(toTypedExpression(inlineCast.getExpression()).getTypedExpression().map(TypedExpression::getExpression).map(expr -> new InstanceOfExpr(expr, (ReferenceType) inlineCast.getType())));
        }
    } else {
        originalTypeCursor = patternType;
        firstNode = firstChild;
    }
    if (originalTypeCursor != null && originalTypeCursor.equals(Object.class)) {
        // try infer type  from the declarations
        final Optional<DeclarationSpec> declarationById = ruleContext.getDeclarationById(printNode(firstChild));
        originalTypeCursor = declarationById.map(d -> (java.lang.reflect.Type) d.getDeclarationClass()).orElse(originalTypeCursor);
    }
    final Optional<TypedExpressionCursor> teCursor = processFirstNode(drlxExpr, childrenNodes, firstNode, isInLineCast, originalTypeCursor);
    if (firstNode instanceof MethodCallExpr) {
        MethodCallExpr me = (MethodCallExpr) firstNode;
        addReactOnProperty(me.getNameAsString(), me.getArguments());
    }
    if (firstNode instanceof NullSafeMethodCallExpr) {
        NullSafeMethodCallExpr me = (NullSafeMethodCallExpr) firstNode;
        addReactOnProperty(me.getNameAsString(), me.getArguments());
    }
    if (!teCursor.isPresent()) {
        return new TypedExpressionResult(empty(), context);
    }
    Expression previous = teCursor.get().expressionCursor;
    java.lang.reflect.Type typeCursor = teCursor.get().typeCursor;
    List<Node> childrenWithoutFirst = childrenNodes.subList(1, childrenNodes.size());
    for (Node part : childrenWithoutFirst) {
        if (part instanceof SimpleName) {
            String field = part.toString();
            TypedExpression expression = nameExprToMethodCallExpr(field, typeCursor, previous, ruleContext);
            if (expression == null) {
                ruleContext.addCompilationError(new InvalidExpressionErrorResult("Unknown field " + field + " on " + typeCursor));
                break;
            }
            typeCursor = expression.getType();
            previous = expression.getExpression();
        } else if (part instanceof MethodCallExpr) {
            TypedExpressionCursor typedExpr = methodCallExpr((MethodCallExpr) part, typeCursor, previous);
            typeCursor = typedExpr.typeCursor;
            previous = typedExpr.expressionCursor;
        } else if (part instanceof NullSafeMethodCallExpr) {
            TypedExpressionCursor typedExpr = nullSafeMethodCallExpr((NullSafeMethodCallExpr) part, typeCursor, previous);
            typeCursor = typedExpr.typeCursor;
            previous = typedExpr.expressionCursor;
        } else if (part instanceof InlineCastExpr && ((InlineCastExpr) part).getExpression() instanceof FieldAccessExpr) {
            InlineCastExpr inlineCastExprPart = (InlineCastExpr) part;
            final FieldAccessExpr fieldAccessExpr = (FieldAccessExpr) inlineCastExprPart.getExpression();
            final TypedExpression toMethodCallExpr = nameExprToMethodCallExpr(fieldAccessExpr.getNameAsString(), typeCursor, previous, ruleContext);
            if (toMethodCallExpr == null) {
                ruleContext.addCompilationError(new InvalidExpressionErrorResult("Unknown field " + fieldAccessExpr.getNameAsString() + " on " + typeCursor));
                break;
            }
            final Class<?> castClass = getClassFromType(ruleContext.getTypeResolver(), inlineCastExprPart.getType());
            previous = addCastToExpression(castClass, toMethodCallExpr.getExpression(), false);
            typeCursor = castClass;
        } else if (part instanceof ArrayAccessExpr) {
            final ArrayAccessExpr inlineCastExprPart = (ArrayAccessExpr) part;
            TypedExpressionCursor typedExpr = arrayAccessExpr(inlineCastExprPart, typeCursor, previous).orElseThrow(() -> new NoSuchElementException("ArrayAccessExpr doesn't contain TypedExpressionCursor!"));
            typeCursor = typedExpr.typeCursor;
            previous = typedExpr.expressionCursor;
        } else {
            throw new UnsupportedOperationException();
        }
    }
    return new TypedExpressionResult(of(new TypedExpression(previous, typeCursor, accessorToFieldName(drlxExpr))), context);
}
Also used : ArrayAccessExpr(com.github.javaparser.ast.expr.ArrayAccessExpr) Arrays(java.util.Arrays) ClassExpr(com.github.javaparser.ast.expr.ClassExpr) HalfPointFreeExpr(org.drools.mvel.parser.ast.expr.HalfPointFreeExpr) DrlxParseUtil.findRootNodeViaParent(org.drools.modelcompiler.builder.generator.DrlxParseUtil.findRootNodeViaParent) DeclarationSpec(org.drools.modelcompiler.builder.generator.DeclarationSpec) DrlxParseUtil(org.drools.modelcompiler.builder.generator.DrlxParseUtil) NodeList.nodeList(com.github.javaparser.ast.NodeList.nodeList) Optional.of(java.util.Optional.of) InstanceOfExpr(com.github.javaparser.ast.expr.InstanceOfExpr) NullLiteralExpr(com.github.javaparser.ast.expr.NullLiteralExpr) ParseExpressionErrorResult(org.drools.modelcompiler.builder.errors.ParseExpressionErrorResult) FlattenScope.flattenScope(org.drools.modelcompiler.builder.generator.expressiontyper.FlattenScope.flattenScope) LiteralExpr(com.github.javaparser.ast.expr.LiteralExpr) CharLiteralExpr(com.github.javaparser.ast.expr.CharLiteralExpr) Type(com.github.javaparser.ast.type.Type) ObjectCreationExpr(com.github.javaparser.ast.expr.ObjectCreationExpr) Map(java.util.Map) Expression(com.github.javaparser.ast.expr.Expression) FlattenScope.transformFullyQualifiedInlineCastExpr(org.drools.modelcompiler.builder.generator.expressiontyper.FlattenScope.transformFullyQualifiedInlineCastExpr) ClassUtil.toRawClass(org.drools.modelcompiler.util.ClassUtil.toRawClass) DrlxParseUtil.getClassFromContext(org.drools.modelcompiler.builder.generator.DrlxParseUtil.getClassFromContext) OperatorSpec(org.drools.modelcompiler.builder.generator.operatorspec.OperatorSpec) OOPathExpr(org.drools.mvel.parser.ast.expr.OOPathExpr) PackageModel(org.drools.modelcompiler.builder.PackageModel) SimpleName(com.github.javaparser.ast.expr.SimpleName) ArrayCreationExpr(com.github.javaparser.ast.expr.ArrayCreationExpr) DrlxParseUtil.getExpressionType(org.drools.modelcompiler.builder.generator.DrlxParseUtil.getExpressionType) MethodCallExpr(com.github.javaparser.ast.expr.MethodCallExpr) MapCreationLiteralExpressionKeyValuePair(org.drools.mvel.parser.ast.expr.MapCreationLiteralExpressionKeyValuePair) MethodUtils(org.drools.core.util.MethodUtils) UnaryExpr(com.github.javaparser.ast.expr.UnaryExpr) BlockStmt(com.github.javaparser.ast.stmt.BlockStmt) ArrayInitializerExpr(com.github.javaparser.ast.expr.ArrayInitializerExpr) Optional.empty(java.util.Optional.empty) DrlxParseUtil.replaceAllHalfBinaryChildren(org.drools.modelcompiler.builder.generator.DrlxParseUtil.replaceAllHalfBinaryChildren) PrintUtil.printNode(org.drools.mvel.parser.printer.PrintUtil.printNode) CastExpr(com.github.javaparser.ast.expr.CastExpr) ArrayList(java.util.ArrayList) NullSafeMethodCallExpr(org.drools.mvel.parser.ast.expr.NullSafeMethodCallExpr) DrlxParseUtil.transformDrlNameExprToNameExpr(org.drools.modelcompiler.builder.generator.DrlxParseUtil.transformDrlNameExprToNameExpr) ListCreationLiteralExpressionElement(org.drools.mvel.parser.ast.expr.ListCreationLiteralExpressionElement) UnificationTypedExpression(org.drools.modelcompiler.builder.generator.UnificationTypedExpression) TypeVariable(java.lang.reflect.TypeVariable) NativeOperatorSpec(org.drools.modelcompiler.builder.generator.operatorspec.NativeOperatorSpec) DrlxParseUtil.toClassOrInterfaceType(org.drools.modelcompiler.builder.generator.DrlxParseUtil.toClassOrInterfaceType) DrlNameExpr(org.drools.mvel.parser.ast.expr.DrlNameExpr) InlineCastExpr(org.drools.mvel.parser.ast.expr.InlineCastExpr) NameExpr(com.github.javaparser.ast.expr.NameExpr) Field(java.lang.reflect.Field) InitializerDeclaration(com.github.javaparser.ast.body.InitializerDeclaration) ParameterizedType(java.lang.reflect.ParameterizedType) ModelGenerator(org.drools.modelcompiler.builder.generator.ModelGenerator) MapCreationLiteralExpression(org.drools.mvel.parser.ast.expr.MapCreationLiteralExpression) ClassOrInterfaceType(com.github.javaparser.ast.type.ClassOrInterfaceType) DrlxParseUtil.prepend(org.drools.modelcompiler.builder.generator.DrlxParseUtil.prepend) DrlxParseUtil.getClassFromType(org.drools.modelcompiler.builder.generator.DrlxParseUtil.getClassFromType) TypeResolver(org.drools.core.addon.TypeResolver) TemporalOperatorSpec(org.drools.modelcompiler.builder.generator.operatorspec.TemporalOperatorSpec) LoggerFactory(org.slf4j.LoggerFactory) ThisExpr(com.github.javaparser.ast.expr.ThisExpr) InvalidExpressionErrorResult(org.drools.modelcompiler.builder.errors.InvalidExpressionErrorResult) ClassUtils.getter2property(org.drools.core.util.ClassUtils.getter2property) DrlxParseUtil.isThisExpression(org.drools.modelcompiler.builder.generator.DrlxParseUtil.isThisExpression) CustomOperatorSpec(org.drools.modelcompiler.builder.generator.operatorspec.CustomOperatorSpec) BinaryExpr(com.github.javaparser.ast.expr.BinaryExpr) Method(java.lang.reflect.Method) Node(com.github.javaparser.ast.Node) NodeList(com.github.javaparser.ast.NodeList) ReferenceType(com.github.javaparser.ast.type.ReferenceType) HalfBinaryExpr(org.drools.mvel.parser.ast.expr.HalfBinaryExpr) ListCreationLiteralExpression(org.drools.mvel.parser.ast.expr.ListCreationLiteralExpression) OOPathChunk(org.drools.mvel.parser.ast.expr.OOPathChunk) FullyQualifiedInlineCastExpr(org.drools.mvel.parser.ast.expr.FullyQualifiedInlineCastExpr) DrlxParseUtil.safeResolveType(org.drools.modelcompiler.builder.generator.DrlxParseUtil.safeResolveType) THIS_PLACEHOLDER(org.drools.modelcompiler.builder.generator.DrlxParseUtil.THIS_PLACEHOLDER) StringLiteralExpr(com.github.javaparser.ast.expr.StringLiteralExpr) EnclosedExpr(com.github.javaparser.ast.expr.EnclosedExpr) List(java.util.List) TypedExpression(org.drools.modelcompiler.builder.generator.TypedExpression) DrlxParseUtil.nameExprToMethodCallExpr(org.drools.modelcompiler.builder.generator.DrlxParseUtil.nameExprToMethodCallExpr) Modifier(java.lang.reflect.Modifier) Optional(java.util.Optional) MvelParser.parseType(org.drools.mvel.parser.MvelParser.parseType) FieldAccessExpr(com.github.javaparser.ast.expr.FieldAccessExpr) DrlxParseUtil.toStringLiteral(org.drools.modelcompiler.builder.generator.DrlxParseUtil.toStringLiteral) NodeWithArguments(com.github.javaparser.ast.nodeTypes.NodeWithArguments) HashMap(java.util.HashMap) ClassUtils.extractGenericType(org.drools.core.util.ClassUtils.extractGenericType) PointFreeExpr(org.drools.mvel.parser.ast.expr.PointFreeExpr) DoubleLiteralExpr(com.github.javaparser.ast.expr.DoubleLiteralExpr) DrlxParseUtil.getLiteralExpressionType(org.drools.modelcompiler.builder.generator.DrlxParseUtil.getLiteralExpressionType) ClassUtil.getTypeArgument(org.drools.modelcompiler.util.ClassUtil.getTypeArgument) RuleUnitUtil.isDataSource(org.kie.internal.ruleunit.RuleUnitUtil.isDataSource) NoSuchElementException(java.util.NoSuchElementException) Logger(org.slf4j.Logger) AssignExpr(com.github.javaparser.ast.expr.AssignExpr) NullSafeFieldAccessExpr(org.drools.mvel.parser.ast.expr.NullSafeFieldAccessExpr) PrintUtil(org.drools.mvel.parser.printer.PrintUtil) RuleContext(org.drools.modelcompiler.builder.generator.RuleContext) DrlxParseUtil.trasformHalfBinaryToBinary(org.drools.modelcompiler.builder.generator.DrlxParseUtil.trasformHalfBinaryToBinary) BigDecimalArgumentCoercion(org.drools.mvelcompiler.util.BigDecimalArgumentCoercion) PrintUtil.printNode(org.drools.mvel.parser.printer.PrintUtil.printNode) Node(com.github.javaparser.ast.Node) SimpleName(com.github.javaparser.ast.expr.SimpleName) DrlxParseUtil.transformDrlNameExprToNameExpr(org.drools.modelcompiler.builder.generator.DrlxParseUtil.transformDrlNameExprToNameExpr) DrlNameExpr(org.drools.mvel.parser.ast.expr.DrlNameExpr) NameExpr(com.github.javaparser.ast.expr.NameExpr) InvalidExpressionErrorResult(org.drools.modelcompiler.builder.errors.InvalidExpressionErrorResult) FieldAccessExpr(com.github.javaparser.ast.expr.FieldAccessExpr) NullSafeFieldAccessExpr(org.drools.mvel.parser.ast.expr.NullSafeFieldAccessExpr) UnificationTypedExpression(org.drools.modelcompiler.builder.generator.UnificationTypedExpression) TypedExpression(org.drools.modelcompiler.builder.generator.TypedExpression) ArrayAccessExpr(com.github.javaparser.ast.expr.ArrayAccessExpr) FlattenScope.transformFullyQualifiedInlineCastExpr(org.drools.modelcompiler.builder.generator.expressiontyper.FlattenScope.transformFullyQualifiedInlineCastExpr) InlineCastExpr(org.drools.mvel.parser.ast.expr.InlineCastExpr) FullyQualifiedInlineCastExpr(org.drools.mvel.parser.ast.expr.FullyQualifiedInlineCastExpr) InstanceOfExpr(com.github.javaparser.ast.expr.InstanceOfExpr) NullSafeFieldAccessExpr(org.drools.mvel.parser.ast.expr.NullSafeFieldAccessExpr) DeclarationSpec(org.drools.modelcompiler.builder.generator.DeclarationSpec) Expression(com.github.javaparser.ast.expr.Expression) UnificationTypedExpression(org.drools.modelcompiler.builder.generator.UnificationTypedExpression) MapCreationLiteralExpression(org.drools.mvel.parser.ast.expr.MapCreationLiteralExpression) DrlxParseUtil.isThisExpression(org.drools.modelcompiler.builder.generator.DrlxParseUtil.isThisExpression) ListCreationLiteralExpression(org.drools.mvel.parser.ast.expr.ListCreationLiteralExpression) TypedExpression(org.drools.modelcompiler.builder.generator.TypedExpression) ClassUtil.toRawClass(org.drools.modelcompiler.util.ClassUtil.toRawClass) NullSafeMethodCallExpr(org.drools.mvel.parser.ast.expr.NullSafeMethodCallExpr) NoSuchElementException(java.util.NoSuchElementException) MethodCallExpr(com.github.javaparser.ast.expr.MethodCallExpr) NullSafeMethodCallExpr(org.drools.mvel.parser.ast.expr.NullSafeMethodCallExpr) DrlxParseUtil.nameExprToMethodCallExpr(org.drools.modelcompiler.builder.generator.DrlxParseUtil.nameExprToMethodCallExpr)

Aggregations

ReferenceType (com.github.javaparser.ast.type.ReferenceType)5 ClassOrInterfaceType (com.github.javaparser.ast.type.ClassOrInterfaceType)4 AnnotationExpr (com.github.javaparser.ast.expr.AnnotationExpr)3 MarkerAnnotationExpr (com.github.javaparser.ast.expr.MarkerAnnotationExpr)3 NormalAnnotationExpr (com.github.javaparser.ast.expr.NormalAnnotationExpr)3 SingleMemberAnnotationExpr (com.github.javaparser.ast.expr.SingleMemberAnnotationExpr)3 Type (com.github.javaparser.ast.type.Type)3 WildcardType (com.github.javaparser.ast.type.WildcardType)3 ArrayType (javax.lang.model.type.ArrayType)2 AnnotatedTypeMirror (org.checkerframework.framework.type.AnnotatedTypeMirror)2 AnnotatedArrayType (org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedArrayType)2 AnnotatedDeclaredType (org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedDeclaredType)2 AnnotatedExecutableType (org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedExecutableType)2 AnnotatedWildcardType (org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedWildcardType)2 Node (com.github.javaparser.ast.Node)1 NodeList (com.github.javaparser.ast.NodeList)1 NodeList.nodeList (com.github.javaparser.ast.NodeList.nodeList)1 InitializerDeclaration (com.github.javaparser.ast.body.InitializerDeclaration)1 ArrayAccessExpr (com.github.javaparser.ast.expr.ArrayAccessExpr)1 ArrayCreationExpr (com.github.javaparser.ast.expr.ArrayCreationExpr)1