mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-115573 (Bogus "Throwable result of a method ignored" in ternary expression.)
This commit is contained in:
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2015 Bas Leijdekkers
|
||||
* Copyright 2008-2016 Bas Leijdekkers
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -60,7 +60,8 @@ public class ThrowableResultOfMethodCallIgnoredInspection extends BaseInspection
|
||||
public void visitMethodCallExpression(PsiMethodCallExpression expression) {
|
||||
super.visitMethodCallExpression(expression);
|
||||
PsiElement parent = expression.getParent();
|
||||
while (parent instanceof PsiParenthesizedExpression || parent instanceof PsiTypeCastExpression) {
|
||||
while (parent instanceof PsiParenthesizedExpression || parent instanceof PsiTypeCastExpression ||
|
||||
parent instanceof PsiConditionalExpression) {
|
||||
parent = parent.getParent();
|
||||
}
|
||||
if (!TypeUtils.expressionHasTypeOrSubtype(expression, CommonClassNames.JAVA_LANG_THROWABLE)) {
|
||||
|
||||
+4
@@ -19,6 +19,10 @@ public class ThrowableResultOfMethodCallIgnored {
|
||||
throw (RuntimeException) b();
|
||||
}
|
||||
|
||||
void n(int i) throws Exception {
|
||||
throw i == 0 ? null : b();
|
||||
}
|
||||
|
||||
public Exception b() {
|
||||
return new RuntimeException();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user