mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
make "'Throwable' printed to 'System.out'" inspection warn in more cases
This commit is contained in:
+2
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -69,11 +69,7 @@ public class ThrowablePrintedToSystemOutInspection extends BaseInspection {
|
||||
return;
|
||||
}
|
||||
final PsiExpression argument = arguments[0];
|
||||
if (!(argument instanceof PsiReferenceExpression)) {
|
||||
return;
|
||||
}
|
||||
final PsiReferenceExpression referenceExpression = (PsiReferenceExpression)argument;
|
||||
if (!TypeUtils.expressionHasTypeOrSubtype(referenceExpression, CommonClassNames.JAVA_LANG_THROWABLE)) {
|
||||
if (!TypeUtils.expressionHasTypeOrSubtype(argument, CommonClassNames.JAVA_LANG_THROWABLE)) {
|
||||
return;
|
||||
}
|
||||
final PsiMethod method = expression.resolveMethod();
|
||||
|
||||
+4
@@ -30,6 +30,10 @@ public class ThrowablePrintedToSystemOutInspectionTest extends LightInspectionTe
|
||||
"}\n");
|
||||
}
|
||||
|
||||
public void testEvenSimpler() {
|
||||
doStatementTest("System.out.println(/*Throwable argument 'new RuntimeException()' to 'System.out.println()' call*/new RuntimeException()/**/);");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InspectionProfileEntry getInspection() {
|
||||
return new ThrowablePrintedToSystemOutInspection();
|
||||
|
||||
Reference in New Issue
Block a user