IReferenceType rt = sf.location().declaringType();
String superClass = null;
if (!"java.lang.Object".equals(rt.name())) {
superClass = rt.getSuperClassName();
}
ClassFile cf = factory.createClass(rt.name(), superClass);
ConstantPool cp = cf.getPool();
FieldFactory fieldFactory = new FieldFactory();
for (IField field : rt.visibleFields()) {
AccessFlags flags = new AccessFlags(field.modifiers());
Field fieldToAdd = fieldFactory.createField(cf, flags, cp.optionalAddUtf8(field.name()), cp.optionalAddUtf8(field.signature()));