@Nullable

This commit is contained in:
Roman Shevchenko
2011-04-27 16:07:06 +02:00
parent 005b543df7
commit 021a206b53
@@ -191,13 +191,13 @@ public class ExceptionUtil {
}
@NotNull
public static Collection<PsiClassType> collectUnhandledExceptions(@NotNull PsiElement element, PsiElement topElement) {
public static Collection<PsiClassType> collectUnhandledExceptions(@NotNull PsiElement element, @Nullable PsiElement topElement) {
final Set<PsiClassType> set = collectUnhandledExceptions(element, topElement, null);
return set == null ? Collections.<PsiClassType>emptyList() : set;
}
@Nullable
private static Set<PsiClassType> collectUnhandledExceptions(@NotNull PsiElement element, PsiElement topElement, Set<PsiClassType> foundExceptions) {
private static Set<PsiClassType> collectUnhandledExceptions(@NotNull PsiElement element, PsiElement topElement, @Nullable Set<PsiClassType> foundExceptions) {
Collection<PsiClassType> unhandledExceptions = null;
if (element instanceof PsiCallExpression) {
PsiCallExpression expression = (PsiCallExpression)element;
@@ -330,7 +330,7 @@ public class ExceptionUtil {
}
@NotNull
public static List<PsiClassType> getUnhandledExceptions(final PsiCallExpression methodCall, final PsiElement topElement) {
public static List<PsiClassType> getUnhandledExceptions(final PsiCallExpression methodCall, @Nullable final PsiElement topElement) {
final JavaResolveResult result = methodCall.resolveMethodGenerics();
final PsiMethod method = (PsiMethod)result.getElement();
final PsiSubstitutor substitutor = ApplicationManager.getApplication().runReadAction(new Computable<PsiSubstitutor>() {
@@ -342,7 +342,7 @@ public class ExceptionUtil {
}
@NotNull
public static List<PsiClassType> getUnhandledCloserExceptions(final PsiResourceVariable resource, final PsiElement topElement) {
public static List<PsiClassType> getUnhandledCloserExceptions(final PsiResourceVariable resource, @Nullable final PsiElement topElement) {
final PsiType resourceType = resource.getType();
if (resourceType instanceof PsiClassType) {
final PsiClass resourceClass = ((PsiClassType)resourceType).resolve();
@@ -359,7 +359,7 @@ public class ExceptionUtil {
}
@NotNull
public static List<PsiClassType> getUnhandledExceptions(final PsiThrowStatement throwStatement, final PsiElement topElement) {
public static List<PsiClassType> getUnhandledExceptions(final PsiThrowStatement throwStatement, @Nullable final PsiElement topElement) {
final PsiExpression exception = throwStatement.getException();
final List<PsiType> types = getPreciseThrowTypes(exception);
return ContainerUtil.mapNotNull(types, new NullableFunction<PsiType, PsiClassType>() {