Map<String, TypeFieldDescr> fieldMap = new LinkedHashMap<String, TypeFieldDescr>();
boolean isNovel = TypeDeclarationUtils.isNovelClass( typeDescr, kbuilder.getPackageRegistry( typeDescr.getNamespace() ) );
PackageRegistry registry = kbuilder.getPackageRegistry( superTypePackageName );
InternalKnowledgePackage pack = null;
if ( registry != null ) {
pack = registry.getPackage();
} else {
// If there is no regisrty the type isn't a DRL-declared type, which is forbidden.
// Avoid NPE JIRA-3041 when trying to access the registry. Avoid subsequent problems.
// DROOLS-536 At this point, the declarations might exist, but the package might not have been processed yet
if ( isNovel ) {
unprocessableDescrs.put( typeDescr.getType().getFullName(), typeDescr );
return false;
}
}
if ( unprocessableDescrs.containsKey( fullSuper ) ) {
unprocessableDescrs.put( typeDescr.getType().getFullName(), typeDescr );
return false;
}
// if a class is declared in DRL, its package can't be null? The default package is replaced by "defaultpkg"
boolean isSuperClassTagged = false;
boolean isSuperClassDeclared = true; //in the same package, or in a previous one
if ( pack != null ) {
// look for the supertype declaration in available packages
TypeDeclaration superTypeDeclaration = pack.getTypeDeclaration( simpleSuperTypeName );
if (superTypeDeclaration != null && superTypeDeclaration.getTypeClassDef() != null ) {
ClassDefinition classDef = superTypeDeclaration.getTypeClassDef();
// inherit fields
for (org.kie.api.definition.type.FactField fld : classDef.getFields()) {