mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup after (IDEA-CR-984)
This commit is contained in:
+3
-3
@@ -156,10 +156,10 @@ public class SuspiciousNameCombinationInspectionBase extends BaseJavaBatchLocalI
|
||||
@Override
|
||||
public void visitReturnStatement(final PsiReturnStatement statement) {
|
||||
final PsiExpression returnValue = statement.getReturnValue();
|
||||
PsiElement containingMethod = PsiTreeUtil.getParentOfType(returnValue, PsiMethod.class, PsiLambdaExpression.class);
|
||||
if (returnValue instanceof PsiReferenceExpression && containingMethod instanceof PsiMethod) {
|
||||
PsiMethod containingMethod = PsiTreeUtil.getParentOfType(returnValue, PsiMethod.class, true, PsiLambdaExpression.class);
|
||||
if (returnValue instanceof PsiReferenceExpression && containingMethod != null) {
|
||||
final String refName = ((PsiReferenceExpression)returnValue).getReferenceName();
|
||||
checkCombination(returnValue, ((PsiMethod)containingMethod).getName(), refName, "suspicious.name.return");
|
||||
checkCombination(returnValue, containingMethod.getName(), refName, "suspicious.name.return");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -72,10 +72,10 @@ public class AddRuntimeExceptionToThrowsAction implements IntentionAction {
|
||||
PsiClassType exception = getRuntimeExceptionAtCaret(editor, file);
|
||||
if (exception == null) return false;
|
||||
|
||||
PsiElement element = PsiTreeUtil.getParentOfType(elementAtCaret(editor, file), PsiMethod.class, PsiLambdaExpression.class);
|
||||
if (element == null || element instanceof PsiLambdaExpression || !((PsiMethod)element).getThrowsList().isPhysical()) return false;
|
||||
PsiMethod method = PsiTreeUtil.getParentOfType(elementAtCaret(editor, file), PsiMethod.class, true, PsiLambdaExpression.class);
|
||||
if (method == null || !method.getThrowsList().isPhysical()) return false;
|
||||
|
||||
return !isMethodThrows((PsiMethod)element, exception);
|
||||
return !isMethodThrows(method, exception);
|
||||
}
|
||||
|
||||
private static PsiClassType getRuntimeExceptionAtCaret(Editor editor, PsiFile file) {
|
||||
|
||||
+3
-3
@@ -94,11 +94,11 @@ public class ReturnOfCollectionFieldInspection extends ReturnOfCollectionFieldIn
|
||||
}
|
||||
|
||||
private void fixContainingMethodReturnType(PsiReferenceExpression referenceExpression) {
|
||||
final PsiElement element = PsiTreeUtil.getParentOfType(referenceExpression, PsiMethod.class, PsiLambdaExpression.class);
|
||||
if (!(element instanceof PsiMethod)) {
|
||||
final PsiMethod method = PsiTreeUtil.getParentOfType(referenceExpression, PsiMethod.class, true, PsiLambdaExpression.class);
|
||||
if (method == null) {
|
||||
return;
|
||||
}
|
||||
final PsiTypeElement returnTypeElement = ((PsiMethod)element).getReturnTypeElement();
|
||||
final PsiTypeElement returnTypeElement = method.getReturnTypeElement();
|
||||
if (returnTypeElement == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user