private void addSourceFileTag(soot.SootClass sc) { if (fileName == null && zipFileName == null) { return; } soot.tagkit.SourceFileTag tag = null; if (sc.hasTag("SourceFileTag")) { tag = (soot.tagkit.SourceFileTag) sc.getTag("SourceFileTag"); } else { tag = new soot.tagkit.SourceFileTag(); sc.addTag(tag); } // Sets sourceFile only when it hasn't been set before if (tag.getSourceFile() == null) { String name = zipFileName == null ? new File(fileName).getName() : new File(zipFileName).getName(); tag.setSourceFile(name); } }
/** * adds source file tag to each sootclass */ protected static void addSourceFileTag(SootClass sc, String fileName) { soot.tagkit.SourceFileTag tag = null; if (sc.hasTag("SourceFileTag")) { return; // do not add tag if original class already has debug // information } else { tag = new soot.tagkit.SourceFileTag(); sc.addTag(tag); } tag.setSourceFile(fileName); } }
/** * adds source file tag to each sootclass */ protected void addSourceFileTag(soot.SootClass sc) { soot.tagkit.SourceFileTag tag = null; if (sc.hasTag("SourceFileTag")) { tag = (soot.tagkit.SourceFileTag) sc.getTag("SourceFileTag"); } else { tag = new soot.tagkit.SourceFileTag(); sc.addTag(tag); } String name = Util.getSourceFileOfClass(sc); if (InitialResolver.v().classToSourceMap() != null) { if (InitialResolver.v().classToSourceMap().containsKey(name)) { name = InitialResolver.v().classToSourceMap().get(name); } } // the pkg is not included in the tag for some unknown reason // I think in this case windows uses the same slash - may cause // windows problems though int slashIndex = name.lastIndexOf("/"); if (slashIndex != -1) { name = name.substring(slashIndex + 1); } tag.setSourceFile(name); // sc.addTag(new soot.tagkit.SourceFileTag(name)); }
applicationClass.addTag(sourceFileTag); sourceFileTag.setSourceFile(newClassName);