本文整理匯總了Java中org.eclipse.jdt.core.dom.IMethodBinding.getExceptionTypes方法的典型用法代碼示例。如果您正苦於以下問題:Java IMethodBinding.getExceptionTypes方法的具體用法?Java IMethodBinding.getExceptionTypes怎麽用?Java IMethodBinding.getExceptionTypes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jdt.core.dom.IMethodBinding
的用法示例。
在下文中一共展示了IMethodBinding.getExceptionTypes方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleExceptions
import org.eclipse.jdt.core.dom.IMethodBinding; //導入方法依賴的package包/類
private boolean handleExceptions(IMethodBinding binding, ASTNode node) {
if (binding == null) {
return true;
}
ITypeBinding[] exceptions = binding.getExceptionTypes();
for (int i = 0; i < exceptions.length; i++) {
addException(exceptions[i], node.getAST());
}
return true;
}
示例2: areSubTypeCompatible
import org.eclipse.jdt.core.dom.IMethodBinding; //導入方法依賴的package包/類
private static boolean areSubTypeCompatible(IMethodBinding overridden, IMethodBinding overridable) {
if (overridden.getParameterTypes().length != overridable.getParameterTypes().length) {
return false;
}
ITypeBinding overriddenReturn= overridden.getReturnType();
ITypeBinding overridableReturn= overridable.getReturnType();
if (overriddenReturn == null || overridableReturn == null) {
return false;
}
if (!overriddenReturn.getErasure().isSubTypeCompatible(overridableReturn.getErasure())) {
return false;
}
ITypeBinding[] overriddenTypes= overridden.getParameterTypes();
ITypeBinding[] overridableTypes= overridable.getParameterTypes();
Assert.isTrue(overriddenTypes.length == overridableTypes.length);
for (int index= 0; index < overriddenTypes.length; index++) {
final ITypeBinding overridableErasure= overridableTypes[index].getErasure();
final ITypeBinding overriddenErasure= overriddenTypes[index].getErasure();
if (!overridableErasure.isSubTypeCompatible(overriddenErasure) || !overridableErasure.getKey().equals(overriddenErasure.getKey())) {
return false;
}
}
ITypeBinding[] overriddenExceptions= overridden.getExceptionTypes();
ITypeBinding[] overridableExceptions= overridable.getExceptionTypes();
boolean checked= false;
for (int index= 0; index < overriddenExceptions.length; index++) {
checked= false;
for (int offset= 0; offset < overridableExceptions.length; offset++) {
if (overriddenExceptions[index].isSubTypeCompatible(overridableExceptions[offset])) {
checked= true;
}
}
if (!checked) {
return false;
}
}
return true;
}