inference errors: make applicability error thread safe so multiple threads can perform overload resolution of parent method calls independently, save presentable error when substitutor cached only

This commit is contained in:
Anna Kozlova
2017-05-08 12:12:13 +03:00
parent fa07225451
commit 77f4894aae
36 changed files with 145 additions and 136 deletions
@@ -1,5 +1,6 @@
class Foo<T extends Enum> {
public T bar(Class<? extends T> type, String str) {
return Enum.valueOf(<error descr="'valueOf(java.lang.Class<T>, java.lang.String)' in 'java.lang.Enum' cannot be applied to '(java.lang.Class<capture<? extends T>>, java.lang.String)'">type</error>, str);
return <error descr="Incompatible types. Required T but 'valueOf' was inferred to T:
Incompatible types: Enum is not convertible to T">Enum.valueOf(type, str);</error>
}
}
@@ -10,7 +10,8 @@ class Test {
public void test(Set<MyConsumer> set) {
@SuppressWarnings("unchecked")
Map<Parent, MyConsumer<Parent>> map = create<error descr="'create(java.util.Set<T>)' in 'Test' cannot be applied to '(java.util.Set<Test.MyConsumer>)'">(set)</error>;
Map<Parent, MyConsumer<Parent>> map = <error descr="Incompatible types. Required Map<Parent, MyConsumer<Parent>> but 'create' was inferred to Map<S, T>:
Incompatible equality constraint: MyConsumer<Test.Parent> and MyConsumer">create(set);</error>
}
@@ -4,7 +4,8 @@ abstract class Group {
}
public <T extends Category> T get(Key<T> key) {
return getCategory<error descr="'getCategory(Key<R>)' in 'Group' cannot be applied to '(Key<T>)'">(key)</error>;
return <error descr="Incompatible types. Required T but 'getCategory' was inferred to R:
Incompatible types: Category is not convertible to T">getCategory(key);</error>
}
public abstract <R extends Category<R>> R getCategory(Key<R> key);
@@ -10,7 +10,8 @@ class NachCollections<K,V> {
Collection<? super Map.Entry<K,V>> c2,
Consumer<Map.Entry<K, V>> a) {
c1.forEach(consumer(a));
c2.forEach(consumer<error descr="'consumer(java.util.function.Consumer<java.util.Map.Entry<K1,V1>>)' in 'NachCollections' cannot be applied to '(java.util.function.Consumer<java.util.Map.Entry<K,V>>)'">(a)</error>);
c2.forEach(<error descr="Incompatible types. Required Consumer<? super capture of ? super Entry<K, V>> but 'consumer' was inferred to Consumer<Entry<K1, V1>>:
no instance(s) of type variable(s) K1, V1 exist so that capture of ? super Entry<K, V> conforms to Entry<K1, V1>">consumer(a)</error>);
}
}