org.jf.dexlib2.iface.Method.getParameters()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(150)

本文整理了Java中org.jf.dexlib2.iface.Method.getParameters()方法的一些代码示例,展示了Method.getParameters()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Method.getParameters()方法的具体详情如下:
包路径:org.jf.dexlib2.iface.Method
类名称:Method
方法名:getParameters

Method.getParameters介绍

[英]Gets a list of the parameters of this method. As per the MethodReference interface, the MethodParameter objects contained in the returned list also act as a simple reference to the type of the parameter. However, the MethodParameter object can also contain additional information about the parameter. Note: In some implementations, the returned list is likely to not provide efficient random access.
[中]获取此方法的参数列表。根据MethodReference接口,返回列表中包含的MethodParameter对象还充当参数类型的简单引用。但是,MethodParameter对象还可以包含有关该参数的其他信息。注意:在某些实现中,返回的列表可能提供有效的随机访问。

代码示例

代码示例来源:origin: JesusFreke/smali

@Nonnull @Override public List<? extends MethodParameter> getParameters() {
  return method.getParameters();
}

代码示例来源:origin: Sable/soot

protected List<Type> getParameterTypes(final Method method) {
 // retrieve all parameter types
 List<Type> parameterTypes = new ArrayList<Type>();
 if (method.getParameters() != null) {
  List<? extends CharSequence> parameters = method.getParameterTypes();
  for (CharSequence t : parameters) {
   Type type = DexType.toSoot(t.toString());
   parameterTypes.add(type);
  }
 }
 return parameterTypes;
}

代码示例来源:origin: Sable/soot

tries = code.getTryBlocks();
List<? extends MethodParameter> parameters = method.getParameters();
if (parameters != null) {
 parameterNames = new ArrayList<String>();
 parameterTypes = new ArrayList<Type>();
 for (MethodParameter param : method.getParameters()) {
  parameterNames.add(param.getName());
  parameterTypes.add(DexType.toSoot(param.getType()));

代码示例来源:origin: Tencent/tinker

method.getDefiningClass(),
method.getName(),
method.getParameters(),
method.getReturnType(),
method.getAccessFlags(),

代码示例来源:origin: JesusFreke/smali

private void propagateParameterTypes(int parameterStartRegister) {
  int i=0;
  for (MethodParameter parameter: method.getParameters()) {
    if (TypeUtils.isWideType(parameter)) {
      setPostRegisterTypeAndPropagateChanges(startOfMethod, parameterStartRegister + i++,
          RegisterType.getWideRegisterType(parameter, true));
      setPostRegisterTypeAndPropagateChanges(startOfMethod, parameterStartRegister + i++,
          RegisterType.getWideRegisterType(parameter, false));
    } else {
      setPostRegisterTypeAndPropagateChanges(startOfMethod, parameterStartRegister + i++,
          RegisterType.getRegisterType(classPath, parameter));
    }
  }
}

代码示例来源:origin: JesusFreke/smali

methodParameters = ImmutableList.copyOf(method.getParameters());

代码示例来源:origin: Sable/soot

for (MethodParameter p : method.getParameters()) {
 String name = p.getName();
 if (name != null) {
  parameterNames = new String[method.getParameters().size()];
  parameterNames[i] = name;
List<? extends MethodParameter> parameters = method.getParameters();
for (MethodParameter p : parameters) {
 if (p.getAnnotations().size() > 0) {

代码示例来源:origin: JesusFreke/smali

private void internDebug(@Nonnull Method method) {
  for (MethodParameter param: method.getParameters()) {
    String paramName = param.getName();
    if (paramName != null) {
      dexPool.stringSection.intern(paramName);
    }
  }
  MethodImplementation methodImpl = method.getImplementation();
  if (methodImpl != null) {
    for (DebugItem debugItem: methodImpl.getDebugItems()) {
      switch (debugItem.getDebugItemType()) {
        case DebugItemType.START_LOCAL:
          StartLocal startLocal = (StartLocal)debugItem;
          dexPool.stringSection.internNullable(startLocal.getName());
          dexPool.typeSection.internNullable(startLocal.getType());
          dexPool.stringSection.internNullable(startLocal.getSignature());
          break;
        case DebugItemType.SET_SOURCE_FILE:
          dexPool.stringSection.internNullable(((SetSourceFile) debugItem).getSourceFile());
          break;
      }
    }
  }
}

代码示例来源:origin: JesusFreke/smali

public static void writeEmptyMethodTo(IndentingWriter writer, Method method,
                   BaksmaliOptions options) throws IOException {
  writer.write(".method ");
  writeAccessFlags(writer, method.getAccessFlags());
  writer.write(method.getName());
  writer.write("(");
  ImmutableList<MethodParameter> methodParameters = ImmutableList.copyOf(method.getParameters());
  for (MethodParameter parameter: methodParameters) {
    writer.write(parameter.getType());
  }
  writer.write(")");
  writer.write(method.getReturnType());
  writer.write('\n');
  writer.indent(4);
  writeParameters(writer, method, methodParameters, options);
  String containingClass = null;
  if (options.implicitReferences) {
    containingClass = method.getDefiningClass();
  }
  AnnotationFormatter.writeTo(writer, method.getAnnotations(), containingClass);
  writer.deindent(4);
  writer.write(".end method\n");
}

代码示例来源:origin: KB5201314/ZjDroid

@Override @Nonnull public List<? extends MethodParameter> getParameters() {
  return method.getParameters();
}

代码示例来源:origin: testwhat/SmaliEx

@Override @Nonnull public List<? extends MethodParameter> getParameters() {
  return method.getParameters();
}

代码示例来源:origin: KB5201314/ZjDroid

private boolean methodSignaturesMatch(@Nonnull Method a, @Nonnull Method b) {
  return (a.getName().equals(b.getName()) &&
      a.getReturnType().equals(b.getReturnType()) &&
      a.getParameters().equals(b.getParameters()));
}

代码示例来源:origin: org.smali/dexlib2

@Override @Nonnull public List<? extends MethodParameter> getParameters() {
  // We can't use the MethodReferenceRewriter to rewrite the parameters, because we would lose
  // parameter names and annotations. If a method rewrite involves changing parameters, it needs
  // to be handled here as well as in the MethodReferenceRewriter
  return RewriterUtils.rewriteList(rewriters.getMethodParameterRewriter(), method.getParameters());
}

代码示例来源:origin: testwhat/SmaliEx

@Override @Nonnull public List<? extends MethodParameter> getParameters() {
  // We can't use the MethodReferenceRewriter to rewrite the parameters, because we would lose
  // parameter names and annotations. If a method rewrite involves changing parameters, it needs
  // to be handled here as well as in the MethodReferenceRewriter
  return RewriterUtils.rewriteList(rewriters.getMethodParameterRewriter(), method.getParameters());
}

代码示例来源:origin: KB5201314/ZjDroid

@Override @Nonnull public List<? extends MethodParameter> getParameters() {
  // We can't use the MethodReferenceRewriter to rewrite the parameters, because we would lose
  // parameter names and annotations. If a method rewrite involves changing parameters, it needs
  // to be handled here as well as in the MethodReferenceRewriter
  return RewriterUtils.rewriteList(rewriters.getMethodParameterRewriter(), method.getParameters());
}

代码示例来源:origin: wala/WALA

Map<Integer,List<Annotation>> getParameterAnnotations(Method m) {
  Map<Integer,List<Annotation>> result = HashMapFactory.make();
  int i = 0;
  for(MethodParameter as : m.getParameters()) {
    for(org.jf.dexlib2.iface.Annotation a : as.getAnnotations()) {
      if (! result.containsKey(i)) {
        result.put(i, new ArrayList<Annotation>());
      }    
      result.get(i).add(DexUtil.getAnnotation(a, getClassLoader().getReference()));
    }
    i++;
  }
  return result;
}

代码示例来源:origin: com.ibm.wala/com.ibm.wala.dalvik

Map<Integer,List<Annotation>> getParameterAnnotations(Method m) {
  Map<Integer,List<Annotation>> result = HashMapFactory.make();
  int i = 0;
  for(MethodParameter as : m.getParameters()) {
    for(org.jf.dexlib2.iface.Annotation a : as.getAnnotations()) {
      if (! result.containsKey(i)) {
        result.put(i, new ArrayList<Annotation>());
      }    
      result.get(i).add(DexUtil.getAnnotation(a, getClassLoader().getReference()));
    }
    i++;
  }
  return result;
}

代码示例来源:origin: testwhat/SmaliEx

public static ImmutableMethod of(Method method) {
  if (method instanceof ImmutableMethod) {
    return (ImmutableMethod)method;
  }
  return new ImmutableMethod(
      method.getDefiningClass(),
      method.getName(),
      method.getParameters(),
      method.getReturnType(),
      method.getAccessFlags(),
      method.getAnnotations(),
      method.getImplementation());
}

代码示例来源:origin: KB5201314/ZjDroid

public static ImmutableMethod of(Method method) {
  if (method instanceof ImmutableMethod) {
    return (ImmutableMethod)method;
  }
  return new ImmutableMethod(
      method.getDefiningClass(),
      method.getName(),
      method.getParameters(),
      method.getReturnType(),
      method.getAccessFlags(),
      method.getAnnotations(),
      method.getImplementation());
}

代码示例来源:origin: org.smali/dexlib2

public static ImmutableMethod of(Method method) {
  if (method instanceof ImmutableMethod) {
    return (ImmutableMethod)method;
  }
  return new ImmutableMethod(
      method.getDefiningClass(),
      method.getName(),
      method.getParameters(),
      method.getReturnType(),
      method.getAccessFlags(),
      method.getAnnotations(),
      method.getImplementation());
}

相关文章