本文整理汇总了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);
}
}
}
}
示例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;
}
}
示例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);
}
示例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;
}
示例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;
}
}
示例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);
}
示例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);
}
示例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);
}