本文整理汇总了Java中org.apache.bcel.classfile.ExceptionTable.getExceptionNames方法的典型用法代码示例。如果您正苦于以下问题:Java ExceptionTable.getExceptionNames方法的具体用法?Java ExceptionTable.getExceptionNames怎么用?Java ExceptionTable.getExceptionNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.bcel.classfile.ExceptionTable
的用法示例。
在下文中一共展示了ExceptionTable.getExceptionNames方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.apache.bcel.classfile.ExceptionTable; //导入方法依赖的package包/类
public void visit(ExceptionTable obj) {
if (DEBUG) {
String names[] = obj.getExceptionNames();
for (int i = 0; i < names.length; i++)
if (names[i].equals("java.lang.Exception")
|| names[i].equals("java.lang.Throwable"))
System.out.println(names[i] + " thrown by " + getFullyQualifiedMethodName());
}
}
示例2: findDeclaredExceptions
import org.apache.bcel.classfile.ExceptionTable; //导入方法依赖的package包/类
/**
* Find the declared exceptions for the method called
* by given instruction.
*
* @param inv the InvokeInstruction
* @param cpg the ConstantPoolGen used by the class the InvokeInstruction belongs to
* @return array of ObjectTypes of thrown exceptions, or null
* if we can't find the list of declared exceptions
*/
public static ObjectType[] findDeclaredExceptions(InvokeInstruction inv, ConstantPoolGen cpg)
throws ClassNotFoundException {
Method m = findPrototypeMethod(inv, cpg);
if (m == null)
return null;
ExceptionTable exTable = m.getExceptionTable();
if (exTable == null)
return new ObjectType[0];
String[] exNameList = exTable.getExceptionNames();
ObjectType[] result = new ObjectType[exNameList.length];
for (int i = 0; i < exNameList.length; ++i) {
result[i] = new ObjectType(exNameList[i]);
}
return result;
}
示例3: visitMethod
import org.apache.bcel.classfile.ExceptionTable; //导入方法依赖的package包/类
/**
* @see org.apache.bcel.classfile.Visitor#visitMethod(org.apache.bcel.classfile.Method)
*/
public void visitMethod(Method m) {
log(" method=" + m.getName(), Project.MSG_VERBOSE);
String retType = Utility.methodSignatureReturnType(m.getSignature());
log(" method ret type=" + retType, Project.MSG_VERBOSE);
if (!"void".equals(retType))
design.checkClass(retType);
String[] types = Utility.methodSignatureArgumentTypes(m.getSignature());
for (int i = 0; i < types.length; i++) {
log(" method param[" + i + "]=" + types[i], Project.MSG_VERBOSE);
design.checkClass(types[i]);
}
ExceptionTable excs = m.getExceptionTable();
if (excs != null) {
types = excs.getExceptionNames();
for (int i = 0; i < types.length; i++) {
log(" exc=" + types[i], Project.MSG_VERBOSE);
design.checkClass(types[i]);
}
}
processInstructions(m);
}
示例4: visitExceptionTable
import org.apache.bcel.classfile.ExceptionTable; //导入方法依赖的package包/类
public void visitExceptionTable(ExceptionTable e) {
String[] names = e.getExceptionNames();
for(int i=0; i < names.length; i++)
out.println(".throws " + names[i].replace('.', '/'));
printEndMethod(e);
}
示例5: visit
import org.apache.bcel.classfile.ExceptionTable; //导入方法依赖的package包/类
@Override
public void visit(ExceptionTable obj) {
if (DEBUG) {
String names[] = obj.getExceptionNames();
for (String name : names)
if (name.equals("java.lang.Exception") || name.equals("java.lang.Throwable"))
System.out.println(name + " thrown by " + getFullyQualifiedMethodName());
}
}
示例6: thrownExceptions
import org.apache.bcel.classfile.ExceptionTable; //导入方法依赖的package包/类
HashSet<String> thrownExceptions(Method m) {
HashSet<String> result = new HashSet<String>();
ExceptionTable exceptionTable = m.getExceptionTable();
if (exceptionTable != null)
for (String e : exceptionTable.getExceptionNames())
result.add(e);
return result;
}
示例7: visitExceptionTable
import org.apache.bcel.classfile.ExceptionTable; //导入方法依赖的package包/类
public void visitExceptionTable(ExceptionTable e) {
String[] names = e.getExceptionNames();
for (int i = 0; i < names.length; i++)
out.println(" throws " + names[i].replace('.', '/'));
}