use of org.robovm.compiler.clazz.ClazzInfo in project robovm by robovm.
the class Linker method buildTypeInfo.
private TypeInfo buildTypeInfo(TypeInfo typeInfo, Map<ClazzInfo, TypeInfo> typeInfos) {
if (typeInfo.error || typeInfo.classTypes != null) {
return typeInfo;
}
ClazzInfo ci = typeInfo.clazz.getClazzInfo();
List<TypeInfo> clTypeInfos = new ArrayList<TypeInfo>();
Set<TypeInfo> ifTypeInfos = new TreeSet<TypeInfo>();
if (!ci.isInterface()) {
if (ci.hasSuperclass()) {
TypeInfo superTypeInfo = buildTypeInfo(typeInfos.get(ci.getSuperclass()), typeInfos);
if (superTypeInfo.error) {
typeInfo.error = true;
return typeInfo;
}
clTypeInfos.addAll(Arrays.asList(superTypeInfo.classTypes));
clTypeInfos.add(typeInfo);
ifTypeInfos.addAll(Arrays.asList(superTypeInfo.interfaceTypes));
superTypeInfo.children.add(typeInfo.clazz);
} else {
clTypeInfos.add(typeInfo);
}
}
for (ClazzInfo ifCi : ci.getInterfaces()) {
TypeInfo ifTypeInfo = buildTypeInfo(typeInfos.get(ifCi), typeInfos);
if (ifTypeInfo.error) {
typeInfo.error = true;
return typeInfo;
}
ifTypeInfos.addAll(Arrays.asList(ifTypeInfo.interfaceTypes));
}
if (ci.isInterface()) {
ifTypeInfos.add(typeInfo);
}
typeInfo.classTypes = EMPTY_TYPE_INFOS;
typeInfo.interfaceTypes = EMPTY_TYPE_INFOS;
if (!clTypeInfos.isEmpty()) {
typeInfo.classTypes = clTypeInfos.toArray(new TypeInfo[clTypeInfos.size()]);
}
if (!ifTypeInfos.isEmpty()) {
typeInfo.interfaceTypes = ifTypeInfos.toArray(new TypeInfo[ifTypeInfos.size()]);
}
return typeInfo;
}
Aggregations