"Replace Exceptions in Throws Clause with Single More General Exception" intention should NOT be available on throws list which contains just a single exception

This commit is contained in:
Bas Leijdekkers
2012-09-19 10:38:24 +02:00
parent 82961c728e
commit bcf62495e7
@@ -1,5 +1,5 @@
/*
* Copyright 2011 Bas Leijdekkers
* Copyright 2011-2012 Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,16 +22,20 @@ import com.siyeh.ipp.base.PsiElementPredicate;
class ObscureThrownExceptionsPredicate implements PsiElementPredicate {
@Override
public boolean satisfiedBy(PsiElement element) {
if (!(element instanceof PsiReferenceList)) {
return false;
}
final PsiReferenceList throwsList = (PsiReferenceList)element;
if (throwsList.getReferenceElements().length < 2) {
return false;
}
final PsiElement parent = element.getParent();
if (!(parent instanceof PsiMethod)) {
return false;
}
final PsiMethod method = (PsiMethod)parent;
final PsiReferenceList throwsList = method.getThrowsList();
return throwsList.equals(element);
return method.getThrowsList().equals(element);
}
}