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


Java ObjectType.getClassName方法代码示例

本文整理汇总了Java中org.apache.bcel.generic.ObjectType.getClassName方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectType.getClassName方法的具体用法?Java ObjectType.getClassName怎么用?Java ObjectType.getClassName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.bcel.generic.ObjectType的用法示例。


在下文中一共展示了ObjectType.getClassName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleCodeFragment

import org.apache.bcel.generic.ObjectType; //导入方法依赖的package包/类
/** Handles a single code fragment. */
private void handleCodeFragment(List<String> resultList,
		ConstantPoolGen cpg, Code code) {
	for (Instruction i : new InstructionList(code.getCode())
			.getInstructions()) {
		if (i instanceof NEW) {
			NEW newInstruction = (NEW) i;
			ObjectType ot = newInstruction.getLoadClassType(cpg);

			if (ot == null) { // ot is primitive type
				continue;
			}

			String newClassName = ot.getClassName();
			if (!resultList.contains(newClassName)
					&& !isBlacklisted(newClassName)) {
				resultList.add(newClassName);
			}
		}
	}
}
 
开发者ID:vimaier,项目名称:conqat,代码行数:22,代码来源:CreationListBuilder.java

示例2: createStream

import org.apache.bcel.generic.ObjectType; //导入方法依赖的package包/类
public Stream createStream(Location location, ObjectType type, ConstantPoolGen cpg,
                           RepositoryLookupFailureCallback lookupFailureCallback) {

	Instruction ins = location.getHandle().getInstruction();
	if (ins.getOpcode() != Constants.GETFIELD)
		return null;

	String fieldClass = type.getClassName();
	try {
		if (fieldClass.startsWith("["))
			return null;
		if (!Hierarchy.isSubtype(fieldClass, streamBaseClass))
			return null;

		Stream stream = new Stream(location, fieldClass, streamBaseClass);
		stream.setIsOpenOnCreation(true);
		stream.setOpenLocation(location);
		if (bugPatternType != null)
			stream.setInteresting(bugPatternType);

		//System.out.println("Instance field stream at " + location);
		return stream;
	} catch (ClassNotFoundException e) {
		lookupFailureCallback.reportMissingClass(e);
		return null;
	}
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:InstanceFieldLoadStreamFactory.java

示例3: fromExceptionSet

import org.apache.bcel.generic.ObjectType; //导入方法依赖的package包/类
/**
 * Initialize object from an exception set.
 *
 * @param exceptionSet the exception set
 * @return a Type that is a supertype of all of the exceptions in
 *         the exception set
 */
public static Type fromExceptionSet(ExceptionSet exceptionSet) throws ClassNotFoundException {
	Type commonSupertype = exceptionSet.getCommonSupertype();
	if (commonSupertype.getType() != T_OBJECT)
		return commonSupertype;

	ObjectType exceptionSupertype = (ObjectType) commonSupertype;
	return new ExceptionObjectType(exceptionSupertype.getClassName(), exceptionSet);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:16,代码来源:ExceptionObjectType.java

示例4: createStream

import org.apache.bcel.generic.ObjectType; //导入方法依赖的package包/类
public Stream createStream(Location location, ObjectType type, ConstantPoolGen cpg,
        RepositoryLookupFailureCallback lookupFailureCallback) {

    try {
        Instruction ins = location.getHandle().getInstruction();

        // For now, just support instance methods
        short opcode = ins.getOpcode();
        if (!invokeOpcodeSet.get(opcode))
            return null;

        // Is invoked class a subtype of the base class we want
        // FIXME: should test be different for INVOKESPECIAL and
        // INVOKESTATIC?
        InvokeInstruction inv = (InvokeInstruction) ins;
        ReferenceType classType = inv.getReferenceType(cpg);
        if (!Hierarchy.isSubtype(classType, baseClassType))
            return null;

        // See if method name and signature match
        String methodName = inv.getMethodName(cpg);
        String methodSig = inv.getSignature(cpg);
        if (!this.methodName.equals(methodName) || !this.methodSig.equals(methodSig))
            return null;

        String streamClass = type.getClassName();
        if (streamClass.equals("java.sql.CallableStatement"))
            streamClass = "java.sql.PreparedStatement";
        Stream result = new Stream(location, streamClass, streamClass).setIgnoreImplicitExceptions(true).setIsOpenOnCreation(
                true);
        if (!isUninteresting)
            result.setInteresting(bugType);
        return result;
    } catch (ClassNotFoundException e) {
        lookupFailureCallback.reportMissingClass(e);
    }

    return null;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:40,代码来源:MethodReturnValueStreamFactory.java

示例5: createStream

import org.apache.bcel.generic.ObjectType; //导入方法依赖的package包/类
public Stream createStream(Location location, ObjectType type, ConstantPoolGen cpg,
        RepositoryLookupFailureCallback lookupFailureCallback) {

    Instruction ins = location.getHandle().getInstruction();
    if (ins.getOpcode() != Constants.GETFIELD)
        return null;

    String fieldClass = type.getClassName();
    try {
        if (fieldClass.startsWith("["))
            return null;
        if (!Hierarchy.isSubtype(fieldClass, streamBaseClass))
            return null;

        Stream stream = new Stream(location, fieldClass, streamBaseClass);
        stream.setIsOpenOnCreation(true);
        stream.setOpenLocation(location);
        if (bugPatternType != null)
            stream.setInteresting(bugPatternType);

        // System.out.println("Instance field stream at " + location);
        return stream;
    } catch (ClassNotFoundException e) {
        lookupFailureCallback.reportMissingClass(e);
        return null;
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:28,代码来源:InstanceFieldLoadStreamFactory.java

示例6: merge

import org.apache.bcel.generic.ObjectType; //导入方法依赖的package包/类
public static ObjectType merge(GenericObjectType t1, ObjectType t2) {
    if (t2 instanceof GenericObjectType)
        return t2;
    List<? extends ReferenceType> parameters = t1.getParameters();
    if (parameters == null)
        return t2;
    return new GenericObjectType(t2.getClassName(), parameters);
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:9,代码来源:GenericUtilities.java

示例7: fromExceptionSet

import org.apache.bcel.generic.ObjectType; //导入方法依赖的package包/类
/**
 * Initialize object from an exception set.
 * 
 * @param exceptionSet
 *            the exception set
 * @return a Type that is a supertype of all of the exceptions in the
 *         exception set
 */
public static Type fromExceptionSet(ExceptionSet exceptionSet) throws ClassNotFoundException {
    Type commonSupertype = exceptionSet.getCommonSupertype();
    if (commonSupertype.getType() != T_OBJECT)
        return commonSupertype;

    ObjectType exceptionSupertype = (ObjectType) commonSupertype;

    String className = exceptionSupertype.getClassName();
    if (className.equals("java.lang.Throwable"))
        return exceptionSupertype;
    return new ExceptionObjectType(className, exceptionSet);
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:21,代码来源:ExceptionObjectType.java

示例8: merge

import org.apache.bcel.generic.ObjectType; //导入方法依赖的package包/类
public static ObjectType merge(@CheckForNull GenericObjectType t1, ObjectType t2) {
    if (t1 == null || t2 instanceof GenericObjectType)
        return t2;
    List<? extends ReferenceType> parameters = t1.getParameters();
    if (parameters == null)
        return t2;
    return new GenericObjectType(t2.getClassName(), parameters);
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:9,代码来源:GenericUtilities.java


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