本文整理汇总了Java中org.apache.bcel.generic.Type.THROWABLE属性的典型用法代码示例。如果您正苦于以下问题:Java Type.THROWABLE属性的具体用法?Java Type.THROWABLE怎么用?Java Type.THROWABLE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.bcel.generic.Type
的用法示例。
在下文中一共展示了Type.THROWABLE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCommonSupertype
/**
* Get the least (lowest in the lattice) common supertype
* of the exceptions in the set. Returns the special TOP
* type if the set is empty.
*/
public Type getCommonSupertype() throws ClassNotFoundException {
if (commonSupertype != null)
return commonSupertype;
if (isEmpty()) {
// This probably means that we're looking at an
// infeasible exception path.
return TypeFrame.getTopType();
}
// Compute first common superclass
ThrownExceptionIterator i = iterator();
ReferenceType result = i.next();
while (i.hasNext()) {
result = result.getFirstCommonSuperclass(i.next());
if (result == null) {
// This should only happen if the class hierarchy
// is incomplete. We'll just be conservative.
result = Type.THROWABLE;
break;
}
}
// Cache and return the result
commonSupertype = result;
return result;
}
示例2: getCommonSupertype
/**
* Get the least (lowest in the lattice) common supertype of the exceptions
* in the set. Returns the special TOP type if the set is empty.
*/
public Type getCommonSupertype() throws ClassNotFoundException {
if (commonSupertype != null)
return commonSupertype;
if (isEmpty()) {
// This probably means that we're looking at an
// infeasible exception path.
return TypeFrame.getTopType();
}
// Compute first common superclass
ThrownExceptionIterator i = iterator();
ReferenceType result = i.next();
while (i.hasNext()) {
if (Subtypes2.ENABLE_SUBTYPES2_FOR_COMMON_SUPERCLASS_QUERIES) {
result = AnalysisContext.currentAnalysisContext().getSubtypes2().getFirstCommonSuperclass(result, i.next());
} else {
result = result.getFirstCommonSuperclass(i.next());
}
if (result == null) {
// This should only happen if the class hierarchy
// is incomplete. We'll just be conservative.
result = Type.THROWABLE;
break;
}
}
// Cache and return the result
commonSupertype = result;
return result;
}
示例3: meetInto
public void meetInto(TypeFrame fact, Edge edge, TypeFrame result) throws DataflowAnalysisException {
BasicBlock basicBlock = edge.getTarget();
if (fact.isValid()) {
TypeFrame tmpFact = null;
// Handling an exception?
if (basicBlock.isExceptionHandler()) {
tmpFact = modifyFrame(fact, tmpFact);
// Special case: when merging predecessor facts for entry to
// an exception handler, we clear the stack and push a
// single entry for the exception object. That way, the locals
// can still be merged.
CodeExceptionGen exceptionGen = basicBlock.getExceptionGen();
tmpFact.clearStack();
// Determine the type of exception(s) caught.
Type catchType = null;
if (FORCE_ACCURATE_EXCEPTIONS
|| AnalysisContext.currentAnalysisContext().getBoolProperty(AnalysisFeatures.ACCURATE_EXCEPTIONS)) {
try {
// Ideally, the exceptions that can be propagated
// on this edge has already been computed.
CachedExceptionSet cachedExceptionSet = getCachedExceptionSet(edge.getSource());
ExceptionSet edgeExceptionSet = cachedExceptionSet.getEdgeExceptionSet(edge);
if (!edgeExceptionSet.isEmpty()) {
// System.out.println("Using computed edge exception set!");
catchType = ExceptionObjectType.fromExceptionSet(edgeExceptionSet);
}
} catch (ClassNotFoundException e) {
lookupFailureCallback.reportMissingClass(e);
}
}
if (catchType == null) {
// No information about propagated exceptions, so
// pick a type conservatively using the handler catch type.
catchType = exceptionGen.getCatchType();
if (catchType == null)
catchType = Type.THROWABLE; // handle catches anything
// throwable
}
tmpFact.pushValue(catchType);
}
// See if we can make some types more precise due to
// a successful instanceof check in the source block.
if (valueNumberDataflow != null) {
tmpFact = handleInstanceOfBranch(fact, tmpFact, edge);
}
if (tmpFact != null) {
fact = tmpFact;
}
}
mergeInto(fact, result);
}