当前位置: 首页>>代码示例>>Java>>正文


Java Type.getArgumentTypes方法代码示例

本文整理汇总了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);
	}
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:26,代码来源:BadResultSetAccess.java

示例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));
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:26,代码来源:InefficientMemberAccess.java

示例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;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:26,代码来源:ObligationFactory.java

示例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);
}
 
开发者ID:kjlubick,项目名称:fb-contrib-eclipse-quick-fixes,代码行数:19,代码来源:CharsetIssuesResolution.java

示例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;
    }
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:32,代码来源:UselessSubclassMethod.java

示例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;
    }
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:32,代码来源:UselessSubclassMethod.java

示例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());
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:7,代码来源:OpcodeStack.java

示例8: getArgumentTypes

import org.apache.bcel.generic.Type; //导入方法依赖的package包/类
/**
 * @return array of method argument types
 */
public Type[] getArgumentTypes() {
  return Type.getArgumentTypes(getSignature());
}
 
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:7,代码来源:Method.java

示例9: getParamTypesNoThis

import org.apache.bcel.generic.Type; //导入方法依赖的package包/类
private Type[] getParamTypesNoThis(Method m) {
return Type.getArgumentTypes(m.getSignature());
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:4,代码来源:MethodTable.java

示例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;
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:76,代码来源:UselessSubclassMethod.java

示例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());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:9,代码来源:ClazzMethod.java


注:本文中的org.apache.bcel.generic.Type.getArgumentTypes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。