Examples of MethodRef


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

    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);
View Full Code Here

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

  }

  @SuppressWarnings("unchecked")
  @Override
  public Object visit(Rule_smaliMethodRef rule) {
    MethodRef ref = EntityFactory.createCommonMethodRef();
    for(Rule innerRule : rule.rules) {
      if(innerRule instanceof Rule_className)
        ref.setClassName(innerRule.spelling);
      else if(innerRule instanceof Rule_qualifier)
        ref.setName(innerRule.spelling);
      else if(innerRule instanceof Rule_smaliConstructorName) {
        ref.setName(innerRule.spelling);
        ref.setConstructor(true);
      } else if(innerRule instanceof Rule_classMethodProto) {
        List<Param> protoParams = (List<Param>)innerRule.accept(this);
        ref.setReturnType(protoParams.remove(0).getType());
        smaliClass.addImport(ref.getReturnType());
        for(Param param : protoParams) {
          ref.addParam(param);
          smaliClass.addImport(param.getType());
        }
      }
    }
    return ref;
View Full Code Here

Examples of net.sf.laja.template.data.MethodRef

    return new NamespaceRef(namespaces);
  }

  @Override
  public IMethodRef createMethodRef() {
    return new MethodRef();
  }
View Full Code Here

Examples of org.allspice.bytecode.MethodRef

public class TestNew extends MyTestCase {
  public ClassDef defadd() {
    ClassDef cd = makeClassDef() ;
    {
      MethodRef mref = new MethodRef(
          new TypeName("TestClass"),TypeName.VOID,"<init>") ;
      MethodDef md = new MethodDef(new TypeName("TestClass"),"getFoo") ;
      md = md.setStatic(true) ;
      md = md.addInstructions(
          new New(new TypeName("TestClass")),
View Full Code Here

Examples of org.allspice.bytecode.MethodRef

      // constructor called <init>
      // must call superclass's <init>
      // Returns nothing
      MethodDef md = new MethodDef(TypeName.VOID,"<init>").addInstructions(
          new Load(new Var(0,new TypeName("TestClass"))),
          new InvokeSpecial(new MethodRef(cd.superClass,TypeName.VOID,"<init>")),
          new Return(TypeCode.VOID)
      ) ;
      // Watch it!  ClassDef is immutable
      cd = cd.addMethod(md) ;
    }
View Full Code Here

Examples of org.allspice.bytecode.MethodRef

    }
  }
  private static final class InvokeSpecialConverter implements
      InstConverter<InvokeSpecial> {
    public void convertInst(InvokeSpecial t, InstructionListContext ilc) {
      MethodRef mref = t.method;
      Type ret_type = TypeDefConverter.makeType(mref.returnType) ;
      Type[] args = makeArgList(mref.parameters);
      String ref = mref.clazz.toString();
      ilc.add(ilc.getInstructionFactory().createInvoke(ref, mref.name, ret_type, args, Constants.INVOKESPECIAL)) ;
    }
View Full Code Here

Examples of org.allspice.bytecode.MethodRef

    }
  }
  private static final class InvokeVirtualConverter implements
      InstConverter<InvokeVirtual> {
    public void convertInst(InvokeVirtual t, InstructionListContext ilc) {
      MethodRef mref = t.method;
      Type ret_type = TypeDefConverter.makeType(mref.returnType) ;
      Type[] args = makeArgList(mref.parameters);
      String ref = mref.clazz.toString();
      ilc.add(ilc.getInstructionFactory().createInvoke(ref, mref.name, ret_type, args, Constants.INVOKEVIRTUAL)) ;
    }
View Full Code Here

Examples of org.allspice.bytecode.MethodRef

    }
  }
  private static final class InvokeStaticConverter implements
      InstConverter<InvokeStatic> {
    public void convertInst(InvokeStatic t, InstructionListContext ilc) {
      MethodRef mref = t.method;
      Type ret_type = TypeDefConverter.makeType(mref.returnType) ;
      Type[] args = makeArgList(mref.parameters);
      String ref = mref.clazz.toString();
      ilc.add(ilc.getInstructionFactory().createInvoke(ref, mref.name, ret_type, args, Constants.INVOKESTATIC)) ;
    }
View Full Code Here

Examples of org.allspice.bytecode.MethodRef

    }
  }
  private static final class InvokeInterfaceConverter implements
      InstConverter<InvokeInterface> {
    public void convertInst(InvokeInterface t, InstructionListContext ilc) {
      MethodRef mref = t.method;
      Type ret_type = TypeDefConverter.makeType(mref.returnType) ;
      Type[] args = makeArgList(mref.parameters);
      String ref = mref.clazz.toString();
      ilc.add(ilc.getInstructionFactory().createInvoke(ref, mref.name, ret_type, args, Constants.INVOKEINTERFACE)) ;
    }
View Full Code Here

Examples of org.allspice.bytecode.MethodRef

        l.add(new Dup(TypeCode.VOID,v.getRefType())) ;
        l.add(new Load(v)) ;
        convert(context,type, TypeName.OBJECT, l) ;
        l.add(new New(TypeName.STRINGBUILDER)) ;
        l.add(new Dup(TypeCode.VOID,TypeCode.OBJECT)) ;
        l.add(new InvokeSpecial(new MethodRef(TypeName.STRINGBUILDER,TypeName.VOID,"<init>"))) ;
        l.add(new Swap()) ;
        l.add(new InvokeVirtual(new MethodRef(TypeName.STRINGBUILDER,TypeName.STRINGBUILDER,"append",TypeName.OBJECT))) ;
        StdJavaExpressions.createConvert(context, inc, TypeName.OBJECT,l) ;
        l.add(new InvokeVirtual(new MethodRef(TypeName.STRINGBUILDER,TypeName.STRINGBUILDER,"append",TypeName.OBJECT))) ;
        l.add(new InvokeVirtual(new MethodRef(TypeName.STRINGBUILDER,TypeName.STRING,"toString"))) ;
        l.add(new Store(v)) ;
      }
      else {
        ConstObj o = context.getConst(inc) ;
        if (o != null && o.o instanceof Number) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.