/** * Makes sure that there is a RefType pointing to this SootClass. Client code that provides its own SootClass * implementation can override and modify this behavior. * * @param name * The name of the new class */ protected void initializeRefType(String name) { refType = RefType.v(name); refType.setSootClass(this); }
private void updateType(Type type) { if (type instanceof RefType) { RefType rt = (RefType) type; if (!rt.getSootClass().isLibraryClass() && oldToNewClassNames.containsKey(rt.getClassName())) { rt.setSootClass(newNameToClass.get(oldToNewClassNames.get(rt.getClassName()))); rt.setClassName(oldToNewClassNames.get(rt.getClassName())); } } else if (type instanceof ArrayType) { ArrayType at = (ArrayType) type; if (at.baseType instanceof RefType) { RefType rt = (RefType) at.baseType; if (!rt.getSootClass().isLibraryClass() && oldToNewClassNames.containsKey(rt.getClassName())) { rt.setSootClass(newNameToClass.get(oldToNewClassNames.get(rt.getClassName()))); } } } }
/** * Adds the given class to the Scene. This method does not handle any dependencies such as invalidating the hierarchy. The * class is neither marked as application class, nor library class. * * @param c * The class to add */ protected void addClassSilent(SootClass c) { if (c.isInScene()) { throw new RuntimeException("already managed: " + c.getName()); } if (containsClass(c.getName())) { throw new RuntimeException("duplicate class: " + c.getName()); } classes.add(c); nameToClass.put(c.getName(), c.getType()); c.getType().setSootClass(c); c.setInScene(true); // Phantom classes are not really part of the hierarchy anyway, so // we can keep the old one if (!c.isPhantom) { modifyHierarchy(); } }
public void removeClass(SootClass c) { if (!c.isInScene()) { throw new RuntimeException(); } classes.remove(c); if (c.isLibraryClass()) { libraryClasses.remove(c); } else if (c.isPhantomClass()) { phantomClasses.remove(c); } else if (c.isApplicationClass()) { applicationClasses.remove(c); } c.getType().setSootClass(null); c.setInScene(false); modifyHierarchy(); }
crt.setSootClass(applicationClass); applicationClass.setRefType(crt); applicationClass.setResolvingLevel(SootClass.BODIES);
/** Constructs an empty SootClass with the given name and modifiers. */ public SootClass(String name, int modifiers) { if( name.charAt(0) == '[' ) throw new RuntimeException( "Attempt to make a class whose name starts with [" ); setName( name); this.modifiers = modifiers; refType = RefType.v(name); refType.setSootClass(this); if(Options.v().debug_resolver()) G.v().out.println("created "+name+" with modifiers "+modifiers); setResolvingLevel(BODIES); Scene.v().getClassNumberer().add(this); }
/** Constructs an empty SootClass with the given name and modifiers. */ public SootClass(String name, int modifiers) { if( name.charAt(0) == '[' ) throw new RuntimeException( "Attempt to make a class whose name starts with [" ); setName( name); this.modifiers = modifiers; refType = RefType.v(name); refType.setSootClass(this); if(Options.v().debug_resolver()) G.v().out.println("created "+name+" with modifiers "+modifiers); setResolvingLevel(BODIES); Scene.v().getClassNumberer().add(this); }
public void addClass(SootClass c) { if(c.isInScene()) throw new RuntimeException("already managed: "+c.getName()); if(containsClass(c.getName())) throw new RuntimeException("duplicate class: "+c.getName()); classes.add(c); c.setLibraryClass(); nameToClass.put(c.getName(), c.getType()); c.getType().setSootClass(c); c.setInScene(true); modifyHierarchy(); }
public void addClass(SootClass c) { if(c.isInScene()) throw new RuntimeException("already managed: "+c.getName()); if(containsClass(c.getName())) throw new RuntimeException("duplicate class: "+c.getName()); classes.add(c); c.setLibraryClass(); nameToClass.put(c.getName(), c.getType()); c.getType().setSootClass(c); c.setInScene(true); modifyHierarchy(); }
public void removeClass(SootClass c) { if(!c.isInScene()) throw new RuntimeException(); classes.remove(c); if(c.isLibraryClass()) { libraryClasses.remove(c); } else if(c.isPhantomClass()) { phantomClasses.remove(c); } else if(c.isApplicationClass()) { applicationClasses.remove(c); } c.getType().setSootClass(null); c.setInScene(false); modifyHierarchy(); }
public void removeClass(SootClass c) { if(!c.isInScene()) throw new RuntimeException(); classes.remove(c); if(c.isLibraryClass()) { libraryClasses.remove(c); } else if(c.isPhantomClass()) { phantomClasses.remove(c); } else if(c.isApplicationClass()) { applicationClasses.remove(c); } c.getType().setSootClass(null); c.setInScene(false); modifyHierarchy(); }