Package com.litecoding.smali2java.entity.smali

Examples of com.litecoding.smali2java.entity.smali.SmaliClass


  private static Collection<Renderable> generateConstructor(
      SmaliMethod smaliMethod, SmaliBlock rootBlock) {
    List<Renderable> entities = new ArrayList<Renderable>();
   
    SmaliClass smaliClass = smaliMethod.getSmaliClass();
    List<Instruction> instructions = rootBlock.instructions;
    Instruction instruction = instructions.get(0); //TODO: fix for super(CONST, ...)
    List<SmaliCodeEntity> args = instruction.getArguments();
   
    if("invoke-direct".equals(instruction.getOpcodeData().getName())) {
      //maybe this() or super() call
      MethodRef methodRef = (MethodRef) args.get(args.size() - 1);
     
      if(methodRef.isConstructor()) {
        //this is this() or super() call
        MethodCall methodCall = new MethodCall(MethodCall.CALL_DIRECT,
            methodRef.getClassName(),
            methodRef.getName());
        Renderable entity = methodCall;
       
        methodCall.setConstructorCall(true);
        if(smaliClass.getSuperClassName().equals(methodRef.getClassName()))
          methodCall.setSuperCall(true);
        else
          methodCall.setThisCall(true);
       
        RegisterGroup regGroup = (RegisterGroup) args.get(0);
        boolean skipElement = true;
        for(SmaliCodeEntity regEntity : regGroup.getArguments()) {
          if(skipElement) {
            skipElement = false;
            continue;
          }
          Variable var = new Variable();
          var.setName(((Register)regEntity).getName());
          methodCall.getParams().add(var);
        }
       
        if(smaliClass.getSuperClassName().equals("Ljava/lang/Object;"))
          entity = new Comment(methodCall.render());
       
        entities.add(entity);
      }
    }
View Full Code Here


      out.append("\n"); //fix for the bug than .end method ends by EOF but not CRLF
      in.close();
   
    Rule classrule = Parser.parse("smali", out.toString());
    SmaliClass smaliClass = (SmaliClass)classrule.accept(new SmaliClassBuilder());
    classes.put(smaliClass.getClassName(), smaliClass);
   
    System.out.println(ClassRenderer.renderObject(smaliClass));
  }
View Full Code Here

import com.litecoding.smali2java.parser.*;

public class SmaliClassBuilder extends BasicCommandsBuilder {
  @Override
  public Object visit(Rule_smali rule) {
    smaliClass = new SmaliClass();
    buildClassByRules(rule.rules);
    return smaliClass;
  }
View Full Code Here

TOP

Related Classes of com.litecoding.smali2java.entity.smali.SmaliClass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.