mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-24 09:20:53 +07:00
type equality constraint: accept unbounded/extends wildcards pair; reject unbounded/super
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
public class SampleExtendsWildcard {
|
||||
public void highlightsTheBug(Stream<String> stream) {
|
||||
stream.flatMap((Block<?> sink, String element) -> {});
|
||||
}
|
||||
|
||||
public interface Block<B> {
|
||||
void apply(B t);
|
||||
}
|
||||
|
||||
public interface Stream<S> {
|
||||
<R> Stream<R> flatMap(FlatMapper<? super S, R> mapper);
|
||||
|
||||
}
|
||||
|
||||
public interface FlatMapper<F, R> {
|
||||
void flatMapInto(Block<? extends R> sink, F element);
|
||||
}
|
||||
}
|
||||
|
||||
class SampleSuperWildcard {
|
||||
public void highlightsTheBug(Stream<String> stream) {
|
||||
stream.flatMap((<error descr="Incompatible parameter types in lambda expression">Block<?> sink</error>, String element) -> {});
|
||||
}
|
||||
|
||||
public interface Block<B> {
|
||||
void apply(B t);
|
||||
}
|
||||
|
||||
public interface Stream<S> {
|
||||
<R> Stream<R> flatMap(FlatMapper<? super S, R> mapper);
|
||||
|
||||
}
|
||||
|
||||
public interface FlatMapper<F, R> {
|
||||
void flatMapInto(Block<? super R> sink, F element);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user