mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-28 04:37:32 +07:00
SuspiciousArrayMethodCallInspection: erased types are compared (fixes IDEA-172742). As the corresponding argument accepts Object or Object[], exact generic signature cannot be always inferred.
This commit is contained in:
+17
-1
@@ -1,4 +1,4 @@
|
||||
import java.util.Arrays;
|
||||
import java.util.*;
|
||||
|
||||
public class SuspiciousArrayMethodCall {
|
||||
void test() {
|
||||
@@ -27,4 +27,20 @@ public class SuspiciousArrayMethodCall {
|
||||
return Arrays.<warning descr="Array types are incompatible: arrays are always different">equals</warning>(arr, arr2) ||
|
||||
Arrays.<warning descr="Array types are incompatible: arrays are always different">equals</warning>(arr2, arr);
|
||||
}
|
||||
|
||||
static class TestOptional {
|
||||
private Optional<Boolean>[] optionals =
|
||||
(Optional<Boolean>[])new Optional[2];
|
||||
|
||||
|
||||
public TestOptional() {
|
||||
Arrays.fill(optionals, Optional.empty()); //IDEA-172742
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
TestOptional t = new TestOptional();
|
||||
System.out.println(t.optionals[0].isPresent());
|
||||
System.out.println(t.optionals[1].isPresent());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user