/** * Removes the given field from this class. */ public void removeField(SootField f) { checkLevel(SIGNATURES); if (!f.isDeclared() || f.getDeclaringClass() != this) { throw new RuntimeException("did not declare: " + f.getName()); } if (fields != null) { fields.remove(f); } f.setDeclared(false); f.setDeclaringClass(null); }
/** * Adds the given field to this class. */ public void addField(SootField f) { checkLevel(SIGNATURES); if (f.isDeclared()) { throw new RuntimeException("already declared: " + f.getName()); } if (declaresField(f.getName(), f.getType())) { throw new RuntimeException("Field already exists : " + f.getName() + " of type " + f.getType()); } if (fields == null) { fields = new HashChain<>(); } fields.add(f); f.setDeclared(true); f.setDeclaringClass(this); }
public synchronized SootField getOrAddField(SootField f) { checkLevel(SIGNATURES); if (f.isDeclared()) { throw new RuntimeException("already declared: " + f.getName()); } SootField old = getFieldUnsafe(f.getName(), f.getType()); if (old != null) { return old; } if (fields == null) { fields = new HashChain<>(); } fields.add(f); f.setDeclared(true); f.setDeclaringClass(this); return f; }
/** Removes the given field from this class. */ public void removeField(SootField f) { checkLevel(SIGNATURES); if(!f.isDeclared() || f.getDeclaringClass() != this) throw new RuntimeException("did not declare: "+f.getName()); fields.remove(f); f.isDeclared = false; }
/** Removes the given field from this class. */ public void removeField(SootField f) { checkLevel(SIGNATURES); if(!f.isDeclared() || f.getDeclaringClass() != this) throw new RuntimeException("did not declare: "+f.getName()); fields.remove(f); f.isDeclared = false; }
/** Adds the given field to this class. */ public void addField(SootField f) { checkLevel(SIGNATURES); if(f.isDeclared()) throw new RuntimeException("already declared: "+f.getName()); if(declaresField(f.getName())) throw new RuntimeException("Field already exists : "+f.getName()); fields.add(f); f.isDeclared = true; f.declaringClass = this; }
/** Adds the given field to this class. */ public void addField(SootField f) { checkLevel(SIGNATURES); if(f.isDeclared()) throw new RuntimeException("already declared: "+f.getName()); if(declaresField(f.getName())) throw new RuntimeException("Field already exists : "+f.getName()); fields.add(f); f.isDeclared = true; f.declaringClass = this; }
@Override public void reset() { super.reset(); // Get rid of the generated component methods for (SootMethod sm : getAdditionalMethods()) { if (sm.isDeclared()) sm.getDeclaringClass().removeMethod(sm); } for (SootField sf : getAdditionalFields()) { if (sf.isDeclared()) sf.getDeclaringClass().removeField(sf); } // Get rid of the generated fields for (SootField fld : callbackClassToField.values()) { if (fld.isDeclared()) fld.getDeclaringClass().removeField(fld); } componentToInfo.clear(); callbackClassToField.clear(); }