if (superTypeDeclaration != null) {
ClassDefinition classDef = superTypeDeclaration.getTypeClassDef();
// inherit fields
for (FactField fld : classDef.getFields()) {
TypeFieldDescr inheritedFlDescr = TypeFieldDescr.buildInheritedFromDefinition( fld );
fieldMap.put( inheritedFlDescr.getFieldName(),
inheritedFlDescr );
}
// new classes are already distinguished from tagged external classes
isSuperClassTagged = !superTypeDeclaration.isNovel();
} else {
isSuperClassDeclared = false;
}
} else {
isSuperClassDeclared = false;
}
// look for the class externally
if (!isSuperClassDeclared || isSuperClassTagged) {
try {
Class superKlass = registry.getTypeResolver().resolveType( fullSuper );
ClassFieldInspector inspector = new ClassFieldInspector( superKlass );
for (String name : inspector.getGetterMethods().keySet()) {
// classFieldAccessor requires both getter and setter
if (inspector.getSetterMethods().containsKey( name )) {
if (!inspector.isNonGetter( name ) && !"class".equals( name )) {
TypeFieldDescr inheritedFlDescr = new TypeFieldDescr(
name,
new PatternDescr(
inspector.getFieldTypes().get( name ).getName() ) );
inheritedFlDescr.setInherited( !Modifier.isAbstract( inspector.getGetterMethods().get( name ).getModifiers() ) );
inheritedFlDescr.setIndex( inspector.getFieldNames().size() + inspector.getFieldNames().get( name ) );
if (!fieldMap.containsKey( inheritedFlDescr.getFieldName() ))
fieldMap.put( inheritedFlDescr.getFieldName(),
inheritedFlDescr );
}
}
}