mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
java: redundant cast: preserve exact types for functional expressions
otherwise we may loose serialization or miss compilation errors in lambda body GitOrigin-RevId: 180e0ee713a19c42abecf1228616bbd6754ea3b8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a9c09d9c09
commit
2bc23faf05
+15
@@ -0,0 +1,15 @@
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
abstract class NestedLambda {
|
||||
abstract <T, V> V[] map2Array(Collection<? extends T> collection, Class<V> aClass, Function<? super T, ? extends V> mapper);
|
||||
|
||||
void m(Collection<String> methods) {
|
||||
Object[] r = map2Array(methods, Consumer.class, method -> (Consumer<Integer>) resolveResult -> {
|
||||
int i = resolveResult.intValue();
|
||||
});
|
||||
Object[] r1 = map2Array(methods, Consumer.class, method -> (<warning descr="Casting 'resolveResult -> {...}' to 'Consumer' is redundant">Consumer</warning>) resolveResult -> { });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user