Search in sources :

Example 16 with TypeDeclarationError

use of org.drools.compiler.compiler.TypeDeclarationError in project drools by kiegroup.

the class TypeDeclarationNameResolver method ensureQualifiedSuperType.

private void ensureQualifiedSuperType(AbstractClassTypeDeclarationDescr typeDescr, PackageDescr packageDescr, TypeResolver typeResolver, List<TypeDefinition> unresolvedTypes) {
    for (QualifiedName qname : typeDescr.getSuperTypes()) {
        String declaredSuperType = qname.getFullName();
        String resolved = resolveName(declaredSuperType, typeDescr, packageDescr, typeResolver, unresolvedTypes, true);
        if (resolved != null) {
            qname.setName(resolved);
        } else {
            kbuilder.addBuilderResult(new TypeDeclarationError(typeDescr, "Cannot resolve supertype '" + declaredSuperType + " for declared type " + typeDescr.getTypeName()));
        }
    }
}
Also used : TypeDeclarationError(org.drools.compiler.compiler.TypeDeclarationError) QualifiedName(org.drools.compiler.lang.descr.QualifiedName)

Aggregations

TypeDeclarationError (org.drools.compiler.compiler.TypeDeclarationError)16 AbstractClassTypeDeclarationDescr (org.drools.compiler.lang.descr.AbstractClassTypeDeclarationDescr)6 TypeFieldDescr (org.drools.compiler.lang.descr.TypeFieldDescr)5 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 ClassDefinition (org.drools.core.factmodel.ClassDefinition)4 TypeDeclaration (org.drools.core.rule.TypeDeclaration)4 HashMap (java.util.HashMap)3 LinkedHashMap (java.util.LinkedHashMap)3 QualifiedName (org.drools.compiler.lang.descr.QualifiedName)3 TypeDeclarationDescr (org.drools.compiler.lang.descr.TypeDeclarationDescr)3 InternalKnowledgePackage (org.drools.core.definitions.InternalKnowledgePackage)3 FieldDefinition (org.drools.core.factmodel.FieldDefinition)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 PackageRegistry (org.drools.compiler.compiler.PackageRegistry)2 AnnotationDescr (org.drools.compiler.lang.descr.AnnotationDescr)2 BaseDescr (org.drools.compiler.lang.descr.BaseDescr)2 MVELAnalysisResult (org.drools.compiler.rule.builder.dialect.mvel.MVELAnalysisResult)2 AnnotationDefinition (org.drools.core.factmodel.AnnotationDefinition)2 Traitable (org.drools.core.factmodel.traits.Traitable)2