Package jadx.core.dex.info

Examples of jadx.core.dex.info.MethodInfo


      insn.simplifyCondition();
    }
  }

  private static InsnNode convertInvoke(MethodNode mth, InsnNode insn) {
    MethodInfo callMth = ((InvokeNode) insn).getCallMth();
    if (callMth.getDeclClass().getFullName().equals(Consts.CLASS_STRING_BUILDER)
        && callMth.getShortId().equals(Consts.MTH_TOSTRING_SIGNATURE)
        && insn.getArg(0).isInsnWrap()) {
      try {
        List<InsnNode> chain = flattenInsnChain(insn);
        if (chain.size() > 1 && chain.get(0).getType() == InsnType.CONSTRUCTOR) {
          ConstructorInsn constr = (ConstructorInsn) chain.get(0);
View Full Code Here


      // check argument types for overloaded methods
      case INVOKE: {
        boolean change = false;
        InvokeNode inv = (InvokeNode) insn;
        MethodInfo callMth = inv.getCallMth();
        MethodNode node = mth.dex().resolveMethod(callMth);
        if (node != null && node.isArgsOverload()) {
          List<ArgType> args = callMth.getArgumentsTypes();
          int j = inv.getArgsCount() - 1;
          for (int i = args.size() - 1; i >= 0; i--) {
            ArgType argType = args.get(i);
            InsnArg insnArg = inv.getArg(j--);
            if (insnArg.isRegister() && !argType.equals(insnArg.getType())) {
View Full Code Here

    String valuesMethod = "values()" + TypeGen.signature(ArgType.array(clsType));

    // remove synthetic methods
    for (Iterator<MethodNode> it = cls.getMethods().iterator(); it.hasNext(); ) {
      MethodNode mth = it.next();
      MethodInfo mi = mth.getMethodInfo();
      if (mi.isClassInit()) {
        staticMethod = mth;
      } else {
        String shortId = mi.getShortId();
        boolean isSynthetic = mth.getAccessFlags().isSynthetic();
        if (mi.isConstructor() && !isSynthetic) {
          if (shortId.equals(enumConstructor)) {
            it.remove();
          }
        } else if (isSynthetic
            || shortId.equals(valuesMethod)
View Full Code Here

      }
    }
  }

  private static boolean isMethodUniq(ClassNode cls, MethodNode mth) {
    MethodInfo mi = mth.getMethodInfo();
    for (MethodNode otherMth : cls.getMethods()) {
      if (otherMth != mth) {
        MethodInfo omi = otherMth.getMethodInfo();
        if (omi.getName().equals(mi.getName())
            && omi.getArgumentsTypes().size() == mi.getArgumentsTypes().size()) {
          // TODO: check objects types
          return false;
        }
      }
    }
View Full Code Here

   * Check if instruction is a interface invoke with corresponding parameters.
   */
  private static boolean checkInvoke(InsnNode insn, String declClsFullName, String mthId, int argsCount) {
    if (insn.getType() == InsnType.INVOKE) {
      InvokeNode inv = (InvokeNode) insn;
      MethodInfo callMth = inv.getCallMth();
      if (callMth.getArgsCount() == argsCount
          && callMth.getShortId().equals(mthId)
          && inv.getInvokeType() == InvokeType.INTERFACE) {
        return declClsFullName == null || callMth.getDeclClass().getFullName().equals(declClsFullName);
      }
    }
    return false;
  }
View Full Code Here

    }
    generateMethodArguments(code, insn, 0, mth.dex().resolveMethod(insn.getCallMth()));
  }

  private void makeInvoke(InvokeNode insn, CodeWriter code) throws CodegenException {
    MethodInfo callMth = insn.getCallMth();

    // inline method
    MethodNode callMthNode = mth.dex().resolveMethod(callMth);
    if (callMthNode != null && inlineMethod(callMthNode, insn, code)) {
      return;
    }

    int k = 0;
    InvokeType type = insn.getInvokeType();
    switch (type) {
      case DIRECT:
      case VIRTUAL:
      case INTERFACE:
        InsnArg arg = insn.getArg(0);
        // FIXME: add 'this' for equals methods in scope
        if (!arg.isThis()) {
          addArgDot(code, arg);
        }
        k++;
        break;

      case SUPER:
        // use 'super' instead 'this' in 0 arg
        code.add("super").add('.');
        k++;
        break;

      case STATIC:
        ClassInfo insnCls = mth.getParentClass().getClassInfo();
        ClassInfo declClass = callMth.getDeclClass();
        if (!insnCls.equals(declClass)) {
          useClass(code, declClass);
          code.add('.');
        }
        break;
    }
    if (callMthNode != null) {
      code.attachAnnotation(callMthNode);
    }
    code.add(callMth.getName());
    generateMethodArguments(code, insn, k, callMthNode);
  }
View Full Code Here

  private static void processInvoke(MethodNode mth, BlockNode block, int insnNumber, InstructionRemover remover) {
    ClassNode parentClass = mth.getParentClass();
    InsnNode insn = block.getInstructions().get(insnNumber);
    InvokeNode inv = (InvokeNode) insn;
    MethodInfo callMth = inv.getCallMth();
    if (callMth.isConstructor()) {
      InsnNode instArgAssignInsn = ((RegisterArg) inv.getArg(0)).getAssignInsn();
      ConstructorInsn co = new ConstructorInsn(mth, inv);
      boolean remove = false;
      if (co.isSuper() && (co.getArgsCount() == 0 || parentClass.isEnum())) {
        remove = true;
      } else if (co.isThis() && co.getArgsCount() == 0) {
        MethodNode defCo = parentClass.searchMethodByName(callMth.getShortId());
        if (defCo == null || defCo.isNoCode()) {
          // default constructor not implemented
          remove = true;
        }
      }
View Full Code Here

    return inode;
  }

  private InsnNode invoke(DecodedInstruction insn, int offset, InvokeType type, boolean isRange) {
    int resReg = getMoveResultRegister(insnArr, offset);
    MethodInfo mth = MethodInfo.fromDex(dex, insn.getIndex());
    return new InvokeNode(mth, insn, type, isRange, resReg);
  }
View Full Code Here

TOP

Related Classes of jadx.core.dex.info.MethodInfo

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.