本文整理汇总了Java中org.apache.bcel.classfile.Method.getArgumentTypes方法的典型用法代码示例。如果您正苦于以下问题:Java Method.getArgumentTypes方法的具体用法?Java Method.getArgumentTypes怎么用?Java Method.getArgumentTypes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.bcel.classfile.Method
的用法示例。
在下文中一共展示了Method.getArgumentTypes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.apache.bcel.classfile.Method; //导入方法依赖的package包/类
public void visit(Method obj) {
check = publicClass && (obj.getAccessFlags() & (ACC_PUBLIC)) != 0;
if (!check) return;
dangerousToStoreIntoField = false;
staticMethod = (obj.getAccessFlags() & (ACC_STATIC)) != 0;
//variableNames = obj.getLocalVariableTable();
parameterCount = obj.getArgumentTypes().length;
/*
System.out.println(betterMethodName);
for(int i = 0; i < parameterCount; i++)
System.out.println("parameter " + i + ": " + obj.getArgumentTypes()[i]);
*/
if (!staticMethod) parameterCount++;
for (int i = 0; i < parameterCount; i++)
timesRead[i] = 0;
thisOnTOS = false;
fieldOnTOS = false;
super.visit(obj);
thisOnTOS = false;
fieldOnTOS = false;
}
示例2: visitObject
import org.apache.bcel.classfile.Method; //导入方法依赖的package包/类
/** @see com.puppycrawl.tools.checkstyle.bcel.IObjectSetVisitor */
public void visitObject(Object aJavaClass)
{
final JavaClass javaClass = (JavaClass) aJavaClass;
final String className = javaClass.getClassName();
final JavaClass[] superClasses = javaClass.getSuperClasses();
final Method[] methods = javaClass.getMethods();
// Check all methods
for (int i = 0; i < methods.length; i++) {
final Method method = methods[i];
// Check that the method is a possible match
if (!method.isPrivate() && method.isStatic()) {
// Go through all their superclasses
for (int j = 0; j < superClasses.length; j++) {
final JavaClass superClass = superClasses[j];
final String superClassName = superClass.getClassName();
final Method[] superClassMethods = superClass.getMethods();
// Go through the methods of the superclasses
for (int k = 0; k < superClassMethods.length; k++) {
final Method superClassMethod = superClassMethods[k];
if (superClassMethod.getName().equals(method.getName()) &&
!ignore(className, method)) {
Type[] methodTypes = method.getArgumentTypes();
Type[] superTypes = superClassMethod.
getArgumentTypes();
if (methodTypes.length == superTypes.length) {
boolean match = true;
for (int arg = 0; arg < methodTypes.length; arg++) {
if (!methodTypes[arg].equals(superTypes[arg])) {
match = false;
}
}
// Same method parameters
if (match) {
log(
javaClass,
0,
"hidden.static.method",
new Object[] {method, superClassName});
}
}
}
}
}
}
}
}