當前位置: 首頁>>代碼示例>>Java>>正文


Java IMethodBinding.getExceptionTypes方法代碼示例

本文整理匯總了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;
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:11,代碼來源:ExceptionAnalyzer.java

示例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;
	}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:43,代碼來源:Bindings.java


注:本文中的org.eclipse.jdt.core.dom.IMethodBinding.getExceptionTypes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。