import com.litecoding.smali2java.entity.smali.SmaliMethod;
import com.litecoding.smali2java.renderer.SmaliRenderer.SmaliBlock;
public class JavaRenderer {
public static List<Renderable> generateJavaEntities(SmaliMethod smaliMethod) {
SmaliBlock block = null;
Comment errorComment = null;
try {
block = SmaliRenderer.generateBlocks(smaliMethod);
System.out.println("===[BEGIN OF BLOCK CHAIN]===");
SmaliRenderer.printBlockChain(block);
System.out.println("===[END OF BLOCK CHAIN]===");
System.out.println();
} catch(Exception e) {
System.out.println("Exception while generating block");
e.printStackTrace();
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
errorComment = new Comment(sw.toString());
}
List<Renderable> entities = new ArrayList<Renderable>();
if(errorComment != null) {
entities.add(errorComment);
return entities;
}
if(!block.isPlain()) {
//for this time we don't support block chains
entities.add(new Comment("Can't render chain of blocks"));
return entities;
}