本文整理汇总了Java中org.apache.bcel.generic.Type.getArgumentTypes方法的典型用法代码示例。如果您正苦于以下问题:Java Type.getArgumentTypes方法的具体用法?Java Type.getArgumentTypes怎么用?Java Type.getArgumentTypes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.bcel.generic.Type
的用法示例。
在下文中一共展示了Type.getArgumentTypes方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sawOpcode
import org.apache.bcel.generic.Type; //导入方法依赖的package包/类
public void sawOpcode(int seen) {
try {
if ((seen == INVOKEINTERFACE)
&& (getClassConstantOperand().equals("java/sql/ResultSet"))) {
String methodName = getNameConstantOperand();
if ((methodName.startsWith("get") && dbFieldTypesSet.contains(methodName.substring(3)))
|| (methodName.startsWith("update") && dbFieldTypesSet.contains(methodName.substring(6)))) {
String signature = getSigConstantOperand();
Type[] argTypes = Type.getArgumentTypes(signature);
int numParms = argTypes.length;
if (stack.getStackDepth() >= numParms) {
OpcodeStack.Item item = stack.getStackItem(numParms-1);
Object cons = item.getConstant();
if ((cons != null) && ("I".equals(item.getSignature())) && (((Integer) cons).intValue() == 0)) {
bugReporter.reportBug(new BugInstance(this, "BRSA_BAD_RESULTSET_ACCESS", NORMAL_PRIORITY)
.addClassAndMethod(this)
.addSourceLine(this));
}
}
}
}
} finally {
stack.sawOpcode(this, seen);
}
}
示例2: sawOpcode
import org.apache.bcel.generic.Type; //导入方法依赖的package包/类
@Override
public void sawOpcode(int seen) {
if (seen == INVOKESTATIC) {
String methodName = getNameConstantOperand();
if (!methodName.startsWith(ACCESS_PREFIX))
return;
String methodSig = getSigConstantOperand();
Type[] argTypes = Type.getArgumentTypes(methodSig);
if ((argTypes.length < 1) || (argTypes.length > 2))
return;
String parCls = argTypes[0].getSignature();
if (parCls.length() < 3)
return;
parCls = parCls.substring(1, parCls.length() - 1);
if (!parCls.equals(getClassConstantOperand()))
return;
if ((argTypes.length == 2) && !argTypes[1].getSignature().equals(Type.getReturnType(methodSig).getSignature()))
return;
bugReporter.reportBug(new BugInstance(this, "IMA_INEFFICIENT_MEMBER_ACCESS", LOW_PRIORITY).addClassAndMethod(this)
.addSourceLine(this));
}
}
示例3: getParameterObligationTypes
import org.apache.bcel.generic.Type; //导入方法依赖的package包/类
/**
* Get array of Obligation types corresponding to the parameters of the
* given method.
*
* @param xmethod
* a method
* @return array of Obligation types for each of the method's parameters; a
* null element means the corresponding parameter is not an
* Obligation type
*/
public Obligation[] getParameterObligationTypes(XMethod xmethod) {
Type[] paramTypes = Type.getArgumentTypes(xmethod.getSignature());
Obligation[] result = new Obligation[paramTypes.length];
for (int i = 0; i < paramTypes.length; i++) {
if (!(paramTypes[i] instanceof ObjectType)) {
continue;
}
try {
result[i] = getObligationByType((ObjectType) paramTypes[i]);
} catch (ClassNotFoundException e) {
Global.getAnalysisCache().getErrorLogger().reportMissingClass(e);
}
}
return result;
}
示例4: make
import org.apache.bcel.generic.Type; //导入方法依赖的package包/类
private QMethodAndArgs make(String fullSignatureWithArgs) {
int firstSplitIndex = fullSignatureWithArgs.indexOf('.');
int secondSplitIndex = fullSignatureWithArgs.indexOf('(');
String qualifiedTypeWithSlashes = fullSignatureWithArgs.substring(0, firstSplitIndex);
String qtype = qualifiedTypeWithSlashes.replace('/', '.');
String method = fullSignatureWithArgs.substring(firstSplitIndex + 1, secondSplitIndex);
List<String> argumentTypes = new ArrayList<>();
Type[] bcelTypes = Type.getArgumentTypes(fullSignatureWithArgs.substring(secondSplitIndex));
for (Type t : bcelTypes) {
argumentTypes.add(t.toString()); // toString returns them in human-readable dot notation
}
return new QMethodAndArgs(qtype, method, argumentTypes);
}
示例5: findSuperclassMethod
import org.apache.bcel.generic.Type; //导入方法依赖的package包/类
private Method findSuperclassMethod(String superclassName, Method subclassMethod) throws ClassNotFoundException {
String methodName = subclassMethod.getName();
Type[] subArgs = null;
JavaClass superClass = Repository.lookupClass(superclassName);
Method[] methods = superClass.getMethods();
outer: for (Method m : methods) {
if (m.getName().equals(methodName)) {
if (subArgs == null)
subArgs = Type.getArgumentTypes(subclassMethod.getSignature());
Type[] superArgs = Type.getArgumentTypes(m.getSignature());
if (subArgs.length == superArgs.length) {
for (int j = 0; j < subArgs.length; j++) {
if (!superArgs[j].equals(subArgs[j]))
continue outer;
}
return m;
}
}
}
if (!superclassName.equals("Object")) {
String superSuperClassName = superClass.getSuperclassName();
if (superSuperClassName.equals(superclassName)) {
throw new ClassNotFoundException("superclass of " + superclassName + " is itself");
}
return findSuperclassMethod(superClass.getSuperclassName(), subclassMethod);
}
return null;
}
示例6: findSuperclassMethod
import org.apache.bcel.generic.Type; //导入方法依赖的package包/类
private Method findSuperclassMethod(@DottedClassName String superclassName, Method subclassMethod) throws ClassNotFoundException {
String methodName = subclassMethod.getName();
Type[] subArgs = null;
JavaClass superClass = Repository.lookupClass(superclassName);
Method[] methods = superClass.getMethods();
outer: for (Method m : methods) {
if (m.getName().equals(methodName)) {
if (subArgs == null)
subArgs = Type.getArgumentTypes(subclassMethod.getSignature());
Type[] superArgs = Type.getArgumentTypes(m.getSignature());
if (subArgs.length == superArgs.length) {
for (int j = 0; j < subArgs.length; j++) {
if (!superArgs[j].equals(subArgs[j]))
continue outer;
}
return m;
}
}
}
if (!superclassName.equals("Object")) {
@DottedClassName String superSuperClassName = superClass.getSuperclassName();
if (superSuperClassName.equals(superclassName)) {
throw new ClassNotFoundException("superclass of " + superclassName + " is itself");
}
return findSuperclassMethod(superSuperClassName, subclassMethod);
}
return null;
}
示例7: pushByInvoke
import org.apache.bcel.generic.Type; //导入方法依赖的package包/类
private void pushByInvoke(DismantleBytecode dbc, boolean popThis) {
String signature = dbc.getSigConstantOperand();
Type[] argTypes = Type.getArgumentTypes(signature);
pop(argTypes.length+(popThis ? 1 : 0));
pushBySignature(Type.getReturnType(signature).getSignature());
}
示例8: getArgumentTypes
import org.apache.bcel.generic.Type; //导入方法依赖的package包/类
/**
* @return array of method argument types
*/
public Type[] getArgumentTypes() {
return Type.getArgumentTypes(getSignature());
}
示例9: getParamTypesNoThis
import org.apache.bcel.generic.Type; //导入方法依赖的package包/类
private Type[] getParamTypesNoThis(Method m) {
return Type.getArgumentTypes(m.getSignature());
}
示例10: sawOpcode
import org.apache.bcel.generic.Type; //导入方法依赖的package包/类
@Override
public void sawOpcode(int seen) {
switch (state) {
case SEEN_NOTHING:
if (seen == ALOAD_0) {
argTypes = Type.getArgumentTypes(this.getMethodSig());
curParm = 0;
curParmOffset = 1;
if (argTypes.length > 0)
state = State.SEEN_PARM;
else
state = State.SEEN_LAST_PARM;
} else
state = State.SEEN_INVALID;
break;
case SEEN_PARM:
if (curParm >= argTypes.length)
state = State.SEEN_INVALID;
else {
String signature = argTypes[curParm++].getSignature();
char typeChar0 = signature.charAt(0);
if ((typeChar0 == 'L') || (typeChar0 == '[')) {
checkParm(seen, ALOAD_0, ALOAD, 1);
} else if (typeChar0 == 'D') {
checkParm(seen, DLOAD_0, DLOAD, 2);
} else if (typeChar0 == 'F') {
checkParm(seen, FLOAD_0, FLOAD, 1);
} else if (typeChar0 == 'I' || typeChar0 == 'Z' || typeChar0 == 'S' || typeChar0 == 'C') {
checkParm(seen, ILOAD_0, ILOAD, 1);
} else if (typeChar0 == 'J') {
checkParm(seen, LLOAD_0, LLOAD, 2);
} else
state = State.SEEN_INVALID;
if ((state != State.SEEN_INVALID) && (curParm >= argTypes.length))
state = State.SEEN_LAST_PARM;
}
break;
case SEEN_LAST_PARM:
if ((seen == INVOKENONVIRTUAL) && getMethodName().equals(getNameConstantOperand())
&& getMethodSig().equals(getSigConstantOperand())) {
invokePC = getPC();
state = State.SEEN_INVOKE;
} else
state = State.SEEN_INVALID;
break;
case SEEN_INVOKE:
Type returnType = getMethod().getReturnType();
char retSigChar0 = returnType.getSignature().charAt(0);
if ((retSigChar0 == 'V') && (seen == RETURN))
state = State.SEEN_RETURN;
else if (((retSigChar0 == 'L') || (retSigChar0 == '[')) && (seen == ARETURN))
state = State.SEEN_RETURN;
else if ((retSigChar0 == 'D') && (seen == DRETURN))
state = State.SEEN_RETURN;
else if ((retSigChar0 == 'F') && (seen == FRETURN))
state = State.SEEN_RETURN;
else if ((retSigChar0 == 'I' || retSigChar0 == 'S' || retSigChar0 == 'C' || retSigChar0 == 'B' || retSigChar0 == 'Z')
&& (seen == IRETURN))
state = State.SEEN_RETURN;
else if ((retSigChar0 == 'J') && (seen == LRETURN))
state = State.SEEN_RETURN;
else
state = State.SEEN_INVALID;
break;
case SEEN_RETURN:
state = State.SEEN_INVALID;
break;
}
}
示例11: getArgumentTypes
import org.apache.bcel.generic.Type; //导入方法依赖的package包/类
/**
* Returns the argument types.
*
* @return an array of the argument types.
*/
private Type[] getArgumentTypes() {
return Type.getArgumentTypes(wrappedMethod.getSignature());
}