mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
SuspiciousToArrayCallInspection: support parentheses
This commit is contained in:
+2
-1
@@ -91,7 +91,8 @@ public class SuspiciousToArrayCallInspection extends BaseInspection {
|
||||
if (arguments.length != 1) {
|
||||
return;
|
||||
}
|
||||
final PsiExpression argument = arguments[0];
|
||||
final PsiExpression argument = PsiUtil.skipParenthesizedExprDown(arguments[0]);
|
||||
if (argument == null) return;
|
||||
|
||||
final PsiClassType classType = (PsiClassType)type;
|
||||
final PsiClass aClass = classType.resolve();
|
||||
|
||||
+11
-2
@@ -77,16 +77,25 @@ public class SuspiciousToArrayCallInspectionTest extends LightInspectionTestCase
|
||||
public void testStreams() {
|
||||
doTest("import java.util.stream.Stream;\n" +
|
||||
"class Test {\n" +
|
||||
" {\n" +
|
||||
" static {\n" +
|
||||
" Stream.of(1.0, 2.0, 3.0).toArray(/*Array of type 'java.lang.Double[]' expected, 'java.lang.Integer[]' found*/Integer[]::new/**/);\n" +
|
||||
" }\n" +
|
||||
"}");
|
||||
}
|
||||
|
||||
public void testStreamsParens() {
|
||||
doTest("import java.util.stream.Stream;\n" +
|
||||
"class Test {\n" +
|
||||
" static {\n" +
|
||||
" Stream.of(1.0, 2.0, 3.0).toArray(((/*Array of type 'java.lang.Double[]' expected, 'java.lang.Integer[]' found*/Integer[]::new/**/)));\n" +
|
||||
" }\n" +
|
||||
"}");
|
||||
}
|
||||
|
||||
public void testStreamsIntersection() {
|
||||
doTest("import java.util.stream.Stream;\n" +
|
||||
"class Test {\n" +
|
||||
" {\n" +
|
||||
" static {\n" +
|
||||
" Stream.of(1, 2.0, 3.0).toArray(/*Array of type 'java.lang.Number[]' expected, 'java.lang.Integer[]' found*/Integer[]::new/**/);\n" +
|
||||
" }\n" +
|
||||
"}");
|
||||
|
||||
Reference in New Issue
Block a user