當前位置: 首頁>>代碼示例>>Java>>正文


Java Type.getArgumentTypes方法代碼示例

本文整理匯總了Java中org.objectweb.asm.Type.getArgumentTypes方法的典型用法代碼示例。如果您正苦於以下問題:Java Type.getArgumentTypes方法的具體用法?Java Type.getArgumentTypes怎麽用?Java Type.getArgumentTypes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.objectweb.asm.Type的用法示例。


在下文中一共展示了Type.getArgumentTypes方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: visitInvokeDynamicInsn

import org.objectweb.asm.Type; //導入方法依賴的package包/類
@Override
public void visitInvokeDynamicInsn(String name, String desc, Handle bsm,
        Object... bsmArgs) {
    mv.visitInvokeDynamicInsn(name, desc, bsm, bsmArgs);
    if (constructor) {
        Type[] types = Type.getArgumentTypes(desc);
        for (int i = 0; i < types.length; i++) {
            popValue();
            if (types[i].getSize() == 2) {
                popValue();
            }
        }

        Type returnType = Type.getReturnType(desc);
        if (returnType != Type.VOID_TYPE) {
            pushValue(OTHER);
            if (returnType.getSize() == 2) {
                pushValue(OTHER);
            }
        }
    }
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:23,代碼來源:AdviceAdapter.java

示例2: CommonMethodVisitor

import org.objectweb.asm.Type; //導入方法依賴的package包/類
/**
 * 根據方法的描述符初始化參數Type數組
 *
 * @see AdviceAdapter#AdviceAdapter(int, MethodVisitor, int, String, String)
 */
private CommonMethodVisitor(int api, MethodVisitor mv, String className, int access, String name, String desc) {
    super(api, mv, access, name, desc);
    this.mv = mv;
    this.className = className;
    this.methodName = name;
    this.methodDesc = desc;

    this.index = ((access & Opcodes.ACC_STATIC) != 0 ? 0 : 1);
    this.argumentTypes = Type.getArgumentTypes(desc);
}
 
開發者ID:baidu,項目名稱:openrasp,代碼行數:16,代碼來源:CommonMethodVisitor.java

示例3: pop

import org.objectweb.asm.Type; //導入方法依賴的package包/類
private void pop(final String desc) {
    char c = desc.charAt(0);
    if (c == '(') {
        int n = 0;
        Type[] types = Type.getArgumentTypes(desc);
        for (int i = 0; i < types.length; ++i) {
            n += types[i].getSize();
        }
        pop(n);
    } else if (c == 'J' || c == 'D') {
        pop(2);
    } else {
        pop(1);
    }
}
 
開發者ID:ItzSomebody,項目名稱:Spigot-Attribute-Remover,代碼行數:16,代碼來源:AnalyzerAdapter.java

示例4: doVisitMethodInsn

import org.objectweb.asm.Type; //導入方法依賴的package包/類
private void doVisitMethodInsn(int opcode, final String owner,
        final String name, final String desc, final boolean itf) {
    mv.visitMethodInsn(opcode, owner, name, desc, itf);
    if (constructor) {
        Type[] types = Type.getArgumentTypes(desc);
        for (int i = 0; i < types.length; i++) {
            popValue();
            if (types[i].getSize() == 2) {
                popValue();
            }
        }
        switch (opcode) {
        // case INVOKESTATIC:
        // break;
        case INVOKEINTERFACE:
        case INVOKEVIRTUAL:
            popValue(); // objectref
            break;
        case INVOKESPECIAL:
            Object type = popValue(); // objectref
            if (type == THIS && !superInitialized) {
                onMethodEnter();
                superInitialized = true;
                // once super has been initialized it is no longer
                // necessary to keep track of stack state
                constructor = false;
            }
            break;
        }

        Type returnType = Type.getReturnType(desc);
        if (returnType != Type.VOID_TYPE) {
            pushValue(OTHER);
            if (returnType.getSize() == 2) {
                pushValue(OTHER);
            }
        }
    }
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:40,代碼來源:AdviceAdapter.java

示例5: updateStateForInvoke

import org.objectweb.asm.Type; //導入方法依賴的package包/類
private void updateStateForInvoke(String desc, boolean implicitReceiver) {
  // Pop arguments.
  Type[] parameterTypes = Type.getArgumentTypes(desc);
  state.popReverse(parameterTypes.length);
  // Pop implicit receiver if needed.
  if (implicitReceiver) {
    state.pop();
  }
  // Push return value if needed.
  Type returnType = Type.getReturnType(desc);
  if (returnType != Type.VOID_TYPE) {
    state.push(returnType);
  }
}
 
開發者ID:inferjay,項目名稱:r8,代碼行數:15,代碼來源:JarSourceCode.java

示例6: buildInvoke

import org.objectweb.asm.Type; //導入方法依賴的package包/類
private void buildInvoke(
    String methodDesc, Type methodOwner, boolean addImplicitReceiver,
    IRBuilder builder, BiConsumer<List<MoveType>, List<Integer>> creator) {

  // Build the argument list of the form [owner, param1, ..., paramN].
  // The arguments are in reverse order on the stack, so we pop off the parameters here.
  Type[] parameterTypes = Type.getArgumentTypes(methodDesc);
  Slot[] parameterRegisters = state.popReverse(parameterTypes.length);

  List<MoveType> types = new ArrayList<>(parameterTypes.length + 1);
  List<Integer> registers = new ArrayList<>(parameterTypes.length + 1);

  // Add receiver argument for non-static calls.
  if (addImplicitReceiver) {
    addArgument(types, registers, methodOwner, state.pop());
  }

  // The remaining arguments are the parameters of the method.
  for (int i = 0; i < parameterTypes.length; i++) {
    addArgument(types, registers, parameterTypes[i], parameterRegisters[i]);
  }

  // Create the invoke.
  creator.accept(types, registers);

  // Move the result to the "top of stack".
  Type returnType = Type.getReturnType(methodDesc);
  if (returnType != Type.VOID_TYPE) {
    builder.addMoveResult(moveType(returnType), state.push(returnType));
  }
}
 
開發者ID:inferjay,項目名稱:r8,代碼行數:32,代碼來源:JarSourceCode.java

示例7: getMethodDescriptorFQNMap

import org.objectweb.asm.Type; //導入方法依賴的package包/類
public static Map<String, String> getMethodDescriptorFQNMap(String descriptor) {
    Type type = Type.getMethodType(descriptor);

    Set<String> classes = new HashSet<String>();
    classes.add(type.getReturnType().getClassName());

    Type[] arguments = type.getArgumentTypes();
    if (arguments != null) {
        for (Type arg : arguments) {
            classes.add(arg.getClassName());
        }
    }

    return fqnToMap(classes);
}
 
開發者ID:willfleury,項目名稱:prometheus-metrics-agent,代碼行數:16,代碼來源:Configuration.java

示例8: containsParameter

import org.objectweb.asm.Type; //導入方法依賴的package包/類
public static boolean containsParameter(Parameter parameterRule, String desc) {
  Type[] parameters = Type.getArgumentTypes(desc);
  logger.trace("containsParameter: parameterRule={}, desc={}");
  if (parameters == null) {
    return false;
  }
  for (Type parameter : parameters) {
    logger.trace("parameter={}", parameter.getClassName());
    if(parameterRule.getType() == null || parameterRule.getType().equals(parameter.getClassName())) {
      return true;
    }
  }
  return false;
}
 
開發者ID:fergarrui,項目名稱:custom-bytecode-analyzer,代碼行數:15,代碼來源:RuleHelper.java

示例9: fix

import org.objectweb.asm.Type; //導入方法依賴的package包/類
public String fix(final String desc) {
    if (desc.startsWith("(")) {
        Type[] arguments = Type.getArgumentTypes(desc);
        Type result = Type.getReturnType(desc);
        for (int i = 0; i < arguments.length; ++i) {
            arguments[i] = fix(arguments[i]);
        }
        result = fix(result);
        return Type.getMethodDescriptor(result, arguments);
    } else {
        return fix(Type.getType(desc)).getDescriptor();
    }
}
 
開發者ID:acmerli,項目名稱:fastAOP,代碼行數:14,代碼來源:NameMapping.java

示例10: AnalyzerAdapter

import org.objectweb.asm.Type; //導入方法依賴的package包/類
/**
 * Creates a new {@link AnalyzerAdapter}.
 * 
 * @param api
 *            the ASM API version implemented by this visitor. Must be one
 *            of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
 * @param owner
 *            the owner's class name.
 * @param access
 *            the method's access flags (see {@link Opcodes}).
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link Type Type}).
 * @param mv
 *            the method visitor to which this adapter delegates calls. May
 *            be <tt>null</tt>.
 */
protected AnalyzerAdapter(final int api, final String owner,
        final int access, final String name, final String desc,
        final MethodVisitor mv) {
    super(api, mv);
    this.owner = owner;
    locals = new ArrayList<Object>();
    stack = new ArrayList<Object>();
    uninitializedTypes = new HashMap<Object, Object>();

    if ((access & Opcodes.ACC_STATIC) == 0) {
        if ("<init>".equals(name)) {
            locals.add(Opcodes.UNINITIALIZED_THIS);
        } else {
            locals.add(owner);
        }
    }
    Type[] types = Type.getArgumentTypes(desc);
    for (int i = 0; i < types.length; ++i) {
        Type type = types[i];
        switch (type.getSort()) {
        case Type.BOOLEAN:
        case Type.CHAR:
        case Type.BYTE:
        case Type.SHORT:
        case Type.INT:
            locals.add(Opcodes.INTEGER);
            break;
        case Type.FLOAT:
            locals.add(Opcodes.FLOAT);
            break;
        case Type.LONG:
            locals.add(Opcodes.LONG);
            locals.add(Opcodes.TOP);
            break;
        case Type.DOUBLE:
            locals.add(Opcodes.DOUBLE);
            locals.add(Opcodes.TOP);
            break;
        case Type.ARRAY:
            locals.add(types[i].getDescriptor());
            break;
        // case Type.OBJECT:
        default:
            locals.add(types[i].getInternalName());
        }
    }
    maxLocals = locals.size();
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:67,代碼來源:AnalyzerAdapter.java

示例11: LocalVariablesSorter

import org.objectweb.asm.Type; //導入方法依賴的package包/類
/**
 * Creates a new {@link LocalVariablesSorter}.
 * 
 * @param api
 *            the ASM API version implemented by this visitor. Must be one
 *            of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
 * @param access
 *            access flags of the adapted method.
 * @param desc
 *            the method's descriptor (see {@link Type Type}).
 * @param mv
 *            the method visitor to which this adapter delegates calls.
 */
protected LocalVariablesSorter(final int api, final int access,
        final String desc, final MethodVisitor mv) {
    super(api, mv);
    Type[] args = Type.getArgumentTypes(desc);
    nextLocal = (Opcodes.ACC_STATIC & access) == 0 ? 1 : 0;
    for (int i = 0; i < args.length; i++) {
        nextLocal += args[i].getSize();
    }
    firstLocal = nextLocal;
}
 
開發者ID:ItzSomebody,項目名稱:Spigot-Attribute-Remover,代碼行數:24,代碼來源:LocalVariablesSorter.java

示例12: GeneratorAdapter

import org.objectweb.asm.Type; //導入方法依賴的package包/類
/**
 * Creates a new {@link GeneratorAdapter}.
 * 
 * @param api
 *            the ASM API version implemented by this visitor. Must be one
 *            of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
 * @param mv
 *            the method visitor to which this adapter delegates calls.
 * @param access
 *            the method's access flags (see {@link Opcodes}).
 * @param name
 *            the method's name.
 * @param desc
 *            the method's descriptor (see {@link Type Type}).
 */
protected GeneratorAdapter(final int api, final MethodVisitor mv,
        final int access, final String name, final String desc) {
    super(api, access, desc, mv);
    this.access = access;
    this.returnType = Type.getReturnType(desc);
    this.argumentTypes = Type.getArgumentTypes(desc);
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:23,代碼來源:GeneratorAdapter.java

示例13: ReWriteMethod

import org.objectweb.asm.Type; //導入方法依賴的package包/類
/**
 * Creates a new {@link AdviceAdapter}.
 *
 * @param api    the ASM API version implemented by this visitor. Must be one
 *               of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
 * @param mv     the method visitor to which this adapter delegates calls.
 * @param access the method's access flags (see {@link Opcodes}).
 * @param name   the method's name.
 * @param desc   the method's descriptor (see {@link Type Type}).
 */
protected ReWriteMethod(int api, MethodVisitor mv, int access, String name, String desc) {
    super(api, mv, access, name, desc);
    this.argumentTypeArray = Type.getArgumentTypes(desc);
}
 
開發者ID:alibaba,項目名稱:jvm-sandbox,代碼行數:15,代碼來源:ReWriteMethod.java

示例14: getArgumentTypes

import org.objectweb.asm.Type; //導入方法依賴的package包/類
/**
 * Returns the argument types of the method described by this object.
 * 
 * @return the argument types of the method described by this object.
 */
public Type[] getArgumentTypes() {
    return Type.getArgumentTypes(desc);
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:9,代碼來源:Method.java


注:本文中的org.objectweb.asm.Type.getArgumentTypes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。