mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-126352 (bug in "Throwable result of method call ignored" inspection)
This commit is contained in:
+4
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2011 Bas Leijdekkers
|
||||
* Copyright 2008-2014 Bas Leijdekkers
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,7 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.searches.ReferencesSearch;
|
||||
import com.intellij.psi.util.InheritanceUtil;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.util.Query;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
@@ -57,11 +58,10 @@ public class ThrowableResultOfMethodCallIgnoredInspection
|
||||
extends BaseInspectionVisitor {
|
||||
|
||||
@Override
|
||||
public void visitMethodCallExpression(
|
||||
PsiMethodCallExpression expression) {
|
||||
public void visitMethodCallExpression(PsiMethodCallExpression expression) {
|
||||
super.visitMethodCallExpression(expression);
|
||||
PsiElement parent = expression.getParent();
|
||||
while (parent instanceof PsiParenthesizedExpression) {
|
||||
while (parent instanceof PsiParenthesizedExpression || parent instanceof PsiTypeCastExpression) {
|
||||
parent = parent.getParent();
|
||||
}
|
||||
if (parent instanceof PsiReturnStatement ||
|
||||
|
||||
+8
@@ -15,4 +15,12 @@ public class A {
|
||||
public static <T> T firstNonNull(T first, T second) {
|
||||
return first != null ? first : second;
|
||||
}
|
||||
|
||||
void m() {
|
||||
throw (RuntimeException) b();
|
||||
}
|
||||
|
||||
public Exception b() {
|
||||
return new RuntimeException();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user