public ImRecordType resolveStruct(GimpleRecordType recordType) {
ImRecordType type = map.get(recordType.getId());
if(type != null) {
return type;
} else {
GimpleRecordTypeDef def = defs.get(recordType.getId());
if(def == null) {
throw new RuntimeException("Can't find record type definition for " + recordType);
}
if(providedTypes.containsKey(def.getName())) {
ImRecordType providedType = providedTypes.get(def.getName());
map.put(recordType.getId(), providedType);
return providedType;
} else {
// create a new JVM type to back this array
JimpleClassBuilder recordClass = context.getJimpleOutput().newClass();
recordClass.setPackageName(context.getMainClass().getPackageName());
recordClass.setClassName(context.getMainClass().getClassName() + "$" + def.getName());
SimpleRecordType struct = new SimpleRecordType(new SyntheticJimpleType(recordClass.getFqcn()));
map.put(recordType.getId(), struct);
buildFields(struct, recordClass, def);