mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
"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:
+7
-3
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user