mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
redundant casts: don't treat cast as redundant if functional expression get more specific type (IDEA-152093)
This commit is contained in:
+2
-2
@@ -20,7 +20,7 @@ class Test {
|
||||
public static void main(String[] args) {
|
||||
List<String> strings = Arrays.asList("a", "b", "c");
|
||||
strings.forEach((IoFunction<String>) arg -> {throw new IOException();});
|
||||
strings.forEach((<warning descr="Casting 'arg -> {}' to 'IFunction<String>' is redundant">IFunction<String></warning>) arg -> {});
|
||||
strings.forEach((<warning descr="Casting 'arg -> {}' to 'IIFunction<String>' is redundant">IIFunction<String></warning>) arg -> {});
|
||||
strings.forEach((IFunction<String>) arg -> {});
|
||||
strings.forEach((IIFunction<String>) arg -> {});
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -15,6 +15,6 @@ class Test {
|
||||
|
||||
{
|
||||
Predicate<String> mh2 = (SerPredicate<String>)Test::test;
|
||||
Predicate<String> mh02 = (<warning descr="Casting 'Test::test' to 'NonSerPredicate<String>' is redundant">NonSerPredicate<String></warning>)Test::test;
|
||||
Predicate<String> mh02 = (NonSerPredicate<String>)Test::test;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -6,7 +6,7 @@ class Test {
|
||||
public static void main(String[] args) {
|
||||
Runnable r = (Runnable & Serializable) (() -> {});
|
||||
r = (Runnable & Serializable)() -> {};
|
||||
r = (<warning descr="Casting '() -> {}' to 'Runnable & I' is redundant">Runnable & I</warning>)() -> {};
|
||||
r = (Runnable & I)() -> {};
|
||||
System.out.println(r);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user