inference: check glb with captured wildcard: if not assignable check if it is an interface

This commit is contained in:
Anna Kozlova
2016-02-17 17:24:41 +01:00
parent e3a4f7386c
commit 0ac147ad95
3 changed files with 45 additions and 14 deletions
@@ -0,0 +1,26 @@
interface Condition<T> {
boolean value(T t);
}
abstract class Test {
protected static <Impl extends AbstractCache, T extends OCSymbol> T findNearestTopLevelSymbol(Class<Impl> clazz,
Condition<? super T> condition) {
return null;
}
interface OCSymbol {}
interface SwiftSymbol extends OCSymbol {}
class AbstractCache<T extends OCSymbol> {}
class SwiftCache extends AbstractCache<SwiftSymbol> {}
private static void foo(final Condition<? super SwiftSymbol> condition) {
SwiftSymbol s = findNearestTopLevelSymbol(SwiftCache.class, condition);
}
private static void foo1(final Condition<? extends SwiftSymbol> condition) {
SwiftSymbol s = findNearestTopLevelSymbol(SwiftCache.class, condition);
}
}