mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 05:21:29 +07:00
new inference: don't push resolved vars in case of failed substitution
This commit is contained in:
@@ -296,7 +296,7 @@ public class InferenceSession {
|
||||
@NotNull PsiExpression[] args,
|
||||
@NotNull MethodCandidateInfo.CurrentCandidateProperties properties,
|
||||
@NotNull PsiSubstitutor psiSubstitutor) {
|
||||
return doInfer(parameters, args, myContext, properties, psiSubstitutor);
|
||||
return performGuardedInference(parameters, args, myContext, properties, psiSubstitutor);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -311,72 +311,20 @@ public class InferenceSession {
|
||||
@Nullable PsiExpression[] args,
|
||||
@Nullable PsiElement parent,
|
||||
@Nullable MethodCandidateInfo.CurrentCandidateProperties properties) {
|
||||
return doInfer(parameters, args, parent, properties, null);
|
||||
return performGuardedInference(parameters, args, parent, properties, PsiSubstitutor.EMPTY);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private PsiSubstitutor doInfer(@Nullable PsiParameter[] parameters,
|
||||
@Nullable PsiExpression[] args,
|
||||
@Nullable PsiElement parent,
|
||||
@Nullable MethodCandidateInfo.CurrentCandidateProperties properties,
|
||||
PsiSubstitutor initialSubstitutor) {
|
||||
private PsiSubstitutor performGuardedInference(@Nullable PsiParameter[] parameters,
|
||||
@Nullable PsiExpression[] args,
|
||||
@Nullable PsiElement parent,
|
||||
@Nullable MethodCandidateInfo.CurrentCandidateProperties properties,
|
||||
@NotNull PsiSubstitutor initialSubstitutor) {
|
||||
try {
|
||||
if (initialSubstitutor == null && !repeatInferencePhases(true)) {
|
||||
//inferred result would be checked as candidate won't be applicable
|
||||
return resolveSubset(myInferenceVariables, mySiteSubstitutor);
|
||||
}
|
||||
|
||||
if (properties != null && !properties.isApplicabilityCheck()) {
|
||||
if (initialSubstitutor == null) {
|
||||
initReturnTypeConstraint(properties.getMethod(), (PsiCall)parent);
|
||||
if (!repeatInferencePhases(true)) {
|
||||
return prepareSubstitution();
|
||||
}
|
||||
}
|
||||
|
||||
if (parameters != null && args != null) {
|
||||
final Set<ConstraintFormula> additionalConstraints = new LinkedHashSet<ConstraintFormula>();
|
||||
if (parameters.length > 0) {
|
||||
collectAdditionalConstraints(parameters, args, properties.getMethod(), mySiteSubstitutor, additionalConstraints, properties.isVarargs());
|
||||
}
|
||||
|
||||
if (!additionalConstraints.isEmpty() && !proceedWithAdditionalConstraints(additionalConstraints)) {
|
||||
return prepareSubstitution();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (initialSubstitutor == null) {
|
||||
initialSubstitutor = PsiSubstitutor.EMPTY;
|
||||
}
|
||||
|
||||
final PsiSubstitutor substitutor = resolveBounds(myInferenceVariables, initialSubstitutor);
|
||||
if (substitutor != null) {
|
||||
if (myContext != null) {
|
||||
myContext.putUserData(ERASED, myErased);
|
||||
}
|
||||
final Map<PsiTypeParameter, PsiType> map = substitutor.getSubstitutionMap();
|
||||
for (PsiTypeParameter parameter : map.keySet()) {
|
||||
final PsiType mapping = map.get(parameter);
|
||||
PsiTypeParameter param;
|
||||
if (parameter instanceof InferenceVariable) {
|
||||
((InferenceVariable)parameter).setInstantiation(mapping);
|
||||
if (((InferenceVariable)parameter).getCallContext() != myContext) {
|
||||
//don't include in result substitutor foreign inference variables
|
||||
continue;
|
||||
}
|
||||
param = ((InferenceVariable)parameter).getParameter();
|
||||
}
|
||||
else {
|
||||
param = parameter;
|
||||
}
|
||||
mySiteSubstitutor = mySiteSubstitutor.put(param, mapping);
|
||||
}
|
||||
}
|
||||
doInfer(parameters, args, parent, properties, initialSubstitutor);
|
||||
return prepareSubstitution();
|
||||
}
|
||||
finally {
|
||||
|
||||
for (ConstraintFormula formula : myConstraintsCopy) {
|
||||
if (formula instanceof InputOutputConstraintFormula) {
|
||||
LambdaUtil.getFunctionalTypeMap().remove(((InputOutputConstraintFormula)formula).getExpression());
|
||||
@@ -389,6 +337,58 @@ public class InferenceSession {
|
||||
}
|
||||
}
|
||||
|
||||
private void doInfer(@Nullable PsiParameter[] parameters,
|
||||
@Nullable PsiExpression[] args,
|
||||
@Nullable PsiElement parent,
|
||||
@Nullable MethodCandidateInfo.CurrentCandidateProperties properties,
|
||||
@NotNull PsiSubstitutor initialSubstitutor) {
|
||||
if (!repeatInferencePhases(true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (properties != null && !properties.isApplicabilityCheck()) {
|
||||
initReturnTypeConstraint(properties.getMethod(), (PsiCall)parent);
|
||||
if (!repeatInferencePhases(true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (parameters != null && args != null) {
|
||||
final Set<ConstraintFormula> additionalConstraints = new LinkedHashSet<ConstraintFormula>();
|
||||
if (parameters.length > 0) {
|
||||
collectAdditionalConstraints(parameters, args, properties.getMethod(), mySiteSubstitutor, additionalConstraints, properties.isVarargs());
|
||||
}
|
||||
|
||||
if (!additionalConstraints.isEmpty() && !proceedWithAdditionalConstraints(additionalConstraints)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final PsiSubstitutor substitutor = resolveBounds(myInferenceVariables, initialSubstitutor);
|
||||
if (substitutor != null) {
|
||||
if (myContext != null) {
|
||||
myContext.putUserData(ERASED, myErased);
|
||||
}
|
||||
final Map<PsiTypeParameter, PsiType> map = substitutor.getSubstitutionMap();
|
||||
for (PsiTypeParameter parameter : map.keySet()) {
|
||||
final PsiType mapping = map.get(parameter);
|
||||
PsiTypeParameter param;
|
||||
if (parameter instanceof InferenceVariable) {
|
||||
((InferenceVariable)parameter).setInstantiation(mapping);
|
||||
if (((InferenceVariable)parameter).getCallContext() != myContext) {
|
||||
//don't include in result substitutor foreign inference variables
|
||||
continue;
|
||||
}
|
||||
param = ((InferenceVariable)parameter).getParameter();
|
||||
}
|
||||
else {
|
||||
param = parameter;
|
||||
}
|
||||
mySiteSubstitutor = mySiteSubstitutor.put(param, mapping);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void collectAdditionalConstraints(PsiParameter[] parameters,
|
||||
PsiExpression[] args,
|
||||
PsiMethod parentMethod,
|
||||
|
||||
@@ -4,6 +4,6 @@ class A<T>{
|
||||
}
|
||||
|
||||
class C<T extends Throwable> extends A<T> {
|
||||
void foo(C<?>.B b){ bar<error descr="'bar(A<java.lang.Throwable>.B)' in 'C' cannot be applied to '(A<capture<?>>.B)'">(b)</error>; }
|
||||
void foo(C<?>.B b){ bar<error descr="'bar(A<T>.B)' in 'C' cannot be applied to '(A<capture<?>>.B)'">(b)</error>; }
|
||||
<T extends Throwable> void bar(A<T>.B b){}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
class A<K>{
|
||||
void foo(A<A<?>> b){ <error descr="Inferred type 'A<?>' for type parameter 'T' is not within its bound; should extend 'A<java.lang.Object>'">bar(b)</error>; }
|
||||
void foo(A<A<?>> b){ bar<error descr="'bar(A<T>)' in 'A' cannot be applied to '(A<A<?>>)'">(b)</error>; }
|
||||
<S, T extends A<S>> void bar(A<T> a){}
|
||||
}
|
||||
@@ -2,6 +2,6 @@ class A<K> {
|
||||
<S, T extends A<S>> void foo(A<? extends T> x){}
|
||||
|
||||
void bar(A<A<?>> x){
|
||||
<error descr="Inferred type 'A<?>' for type parameter 'T' is not within its bound; should extend 'A<java.lang.Object>'">foo(x)</error>;
|
||||
foo<error descr="'foo(A<? extends T>)' in 'A' cannot be applied to '(A<A<?>>)'">(x)</error>;
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,8 @@ class B<L> {
|
||||
void bar(B<?> b, A<?, ?> foo1) {
|
||||
baz(b.foo());
|
||||
A<?, ?> foo = b.foo();
|
||||
baz<error descr="'baz(A<java.lang.Object,java.lang.Object>)' in 'B' cannot be applied to '(A<capture<?>,capture<?>>)'">(foo)</error>;
|
||||
baz<error descr="'baz(A<java.lang.Object,java.lang.Object>)' in 'B' cannot be applied to '(A<capture<?>,capture<?>>)'">(foo1)</error>;
|
||||
baz<error descr="'baz(A<K,K>)' in 'B' cannot be applied to '(A<capture<?>,capture<?>>)'">(foo)</error>;
|
||||
baz<error descr="'baz(A<K,K>)' in 'B' cannot be applied to '(A<capture<?>,capture<?>>)'">(foo1)</error>;
|
||||
}
|
||||
|
||||
<K> void baz(A<K, K> a) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
class B<T>{}
|
||||
class A<T extends B<? extends Runnable>> {
|
||||
void bar(A<? extends B<? extends Cloneable>> a){
|
||||
<error descr="Inferred type 'B<? extends java.lang.Cloneable>' for type parameter 'T' is not within its bound; should extend 'B<java.lang.Object>'">foo(a)</error>;
|
||||
foo<error descr="'foo(A<? extends T>)' in 'A' cannot be applied to '(A<capture<? extends B<? extends java.lang.Cloneable>>>)'">(a)</error>;
|
||||
}
|
||||
|
||||
<S, T extends B<S>> void foo(A<? extends T> a){}
|
||||
|
||||
@@ -17,15 +17,15 @@ class B<T> extends A<A<T>> {
|
||||
foo2(sb);
|
||||
foo2(s);
|
||||
|
||||
foo3<error descr="'foo3(A<A<?>>)' in 'B' cannot be applied to '(B<capture<?>>)'">(b)</error>;
|
||||
foo3<error descr="'foo3(A<A<?>>)' in 'B' cannot be applied to '(B<capture<? extends java.lang.String>>)'">(eb)</error>;
|
||||
foo3<error descr="'foo3(A<A<?>>)' in 'B' cannot be applied to '(B<capture<? super java.lang.String>>)'">(sb)</error>;
|
||||
foo3<error descr="'foo3(A<A<?>>)' in 'B' cannot be applied to '(B<java.lang.String>)'">(s)</error>;
|
||||
foo3<error descr="'foo3(A<A<? extends T>>)' in 'B' cannot be applied to '(B<capture<?>>)'">(b)</error>;
|
||||
foo3<error descr="'foo3(A<A<? extends T>>)' in 'B' cannot be applied to '(B<capture<? extends java.lang.String>>)'">(eb)</error>;
|
||||
foo3<error descr="'foo3(A<A<? extends T>>)' in 'B' cannot be applied to '(B<capture<? super java.lang.String>>)'">(sb)</error>;
|
||||
foo3<error descr="'foo3(A<A<? extends T>>)' in 'B' cannot be applied to '(B<java.lang.String>)'">(s)</error>;
|
||||
|
||||
foo4<error descr="'foo4(A<A<? super java.lang.Object>>)' in 'B' cannot be applied to '(B<capture<?>>)'">(b)</error>;
|
||||
foo4<error descr="'foo4(A<A<? super java.lang.Object>>)' in 'B' cannot be applied to '(B<capture<? extends java.lang.String>>)'">(eb)</error>;
|
||||
foo4<error descr="'foo4(A<A<? super java.lang.Object>>)' in 'B' cannot be applied to '(B<capture<? super java.lang.String>>)'">(sb)</error>;
|
||||
foo4<error descr="'foo4(A<A<? super java.lang.Object>>)' in 'B' cannot be applied to '(B<java.lang.String>)'">(s)</error>;
|
||||
foo4<error descr="'foo4(A<A<? super T>>)' in 'B' cannot be applied to '(B<capture<?>>)'">(b)</error>;
|
||||
foo4<error descr="'foo4(A<A<? super T>>)' in 'B' cannot be applied to '(B<capture<? extends java.lang.String>>)'">(eb)</error>;
|
||||
foo4<error descr="'foo4(A<A<? super T>>)' in 'B' cannot be applied to '(B<capture<? super java.lang.String>>)'">(sb)</error>;
|
||||
foo4<error descr="'foo4(A<A<? super T>>)' in 'B' cannot be applied to '(B<java.lang.String>)'">(s)</error>;
|
||||
|
||||
foo5(b);
|
||||
foo5(eb);
|
||||
|
||||
@@ -11,6 +11,6 @@ abstract class A1{
|
||||
abstract <T> T baz(List<? super T> a);
|
||||
|
||||
void bar(List<?> x){
|
||||
String o = baz<error descr="'baz(java.util.List<? super java.lang.Object>)' in 'A1' cannot be applied to '(java.util.List<capture<?>>)'">(x)</error>;
|
||||
String o = baz<error descr="'baz(java.util.List<? super T>)' in 'A1' cannot be applied to '(java.util.List<capture<?>>)'">(x)</error>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ abstract class A {
|
||||
abstract <T> T baz(List<? super List<? super T>> a);
|
||||
|
||||
void bar(C<?> x){
|
||||
baz<error descr="'baz(java.util.List<? super java.util.List<? super java.lang.Object>>)' in 'A' cannot be applied to '(C<capture<?>>)'">(x)</error>;
|
||||
baz<error descr="'baz(java.util.List<? super java.util.List<? super T>>)' in 'A' cannot be applied to '(C<capture<?>>)'">(x)</error>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ abstract class B {
|
||||
|
||||
void bar(List<List<?>> x, List<List<List<?>>> y){
|
||||
foo(x) [0] = "";
|
||||
foo1<error descr="'foo1(java.util.List<? extends java.util.List<java.lang.Object>>)' in 'B' cannot be applied to '(java.util.List<java.util.List<?>>)'">(x)</error> [0] = "";
|
||||
foo2<error descr="'foo2(java.util.List<java.util.List<? super java.util.List<java.lang.Object>>>)' in 'B' cannot be applied to '(java.util.List<java.util.List<java.util.List<?>>>)'">(y)</error> [0] = "";
|
||||
foo1<error descr="'foo1(java.util.List<? extends java.util.List<T>>)' in 'B' cannot be applied to '(java.util.List<java.util.List<?>>)'">(x)</error> [0] = "";
|
||||
foo2<error descr="'foo2(java.util.List<java.util.List<? super java.util.List<T>>>)' in 'B' cannot be applied to '(java.util.List<java.util.List<java.util.List<?>>>)'">(y)</error> [0] = "";
|
||||
|
||||
String s = foo0(x);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ abstract class B {
|
||||
abstract <T> void foo(List<T>[] x);
|
||||
|
||||
void bar(List<?>[] x){
|
||||
foo<error descr="'foo(java.util.List<java.lang.Object>[])' in 'B' cannot be applied to '(java.util.List<?>[])'">(x)</error>;
|
||||
foo<error descr="'foo(java.util.List<T>[])' in 'B' cannot be applied to '(java.util.List<?>[])'">(x)</error>;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,6 @@ class Bug1<A, B> {
|
||||
<X, Y extends X> void f1(Bug1<X, Y> b) {}
|
||||
|
||||
void f2(Bug1<?, ?> b) {
|
||||
<error descr="Inferred type 'capture<?>' for type parameter 'Y' is not within its bound; should extend 'capture<?>'">f1(b)</error>;
|
||||
f1<error descr="'f1(Bug1<X,Y>)' in 'Bug1' cannot be applied to '(Bug1<capture<?>,capture<?>>)'">(b)</error>;
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ class GenericsTest98 {
|
||||
List<Movable<? extends Serializable>> list = new ArrayList<Movable<? extends Serializable>> ();
|
||||
Factory factory = Factory.newInstance();
|
||||
// Doesn't compile, but Idea doesn't complain
|
||||
Mover<? extends Serializable> mover = factory.getNew<error descr="'getNew(java.util.List<? extends Movable<java.io.Serializable>>)' in 'Factory' cannot be applied to '(java.util.List<Movable<? extends java.io.Serializable>>)'">(list)</error>;
|
||||
Mover<? extends Serializable> mover = factory.getNew<error descr="'getNew(java.util.List<? extends Movable<T>>)' in 'Factory' cannot be applied to '(java.util.List<Movable<? extends java.io.Serializable>>)'">(list)</error>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class D<T> {
|
||||
void foo(D<?> x){
|
||||
bar<error descr="'bar(D<?>, D<? super java.lang.Object>)' in 'D' cannot be applied to '(D<capture<?>>, D<capture<?>>)'">(x,x)</error>;
|
||||
bar<error descr="'bar(D<? extends T>, D<? super T>)' in 'D' cannot be applied to '(D<capture<?>>, D<capture<?>>)'">(x,x)</error>;
|
||||
}
|
||||
<T> void bar(D<? extends T> x, D<? super T> y){}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@ abstract class A<T> {
|
||||
<K> void baz35(B<K, ? extends K> a) {}
|
||||
abstract B<T,? super T> foo35();
|
||||
void bar35(A<? super T> a){
|
||||
baz35<error descr="'baz35(B<java.lang.Object,?>)' in 'A' cannot be applied to '(B<capture<? super T>,capture<? super T>>)'">(a.foo35())</error>;
|
||||
baz35<error descr="'baz35(B<K,? extends K>)' in 'A' cannot be applied to '(B<capture<? super T>,capture<? super T>>)'">(a.foo35())</error>;
|
||||
}
|
||||
|
||||
|
||||
<K> void baz44(B<K, ? extends K> a) {}
|
||||
abstract B<? super T,? super T> foo44();
|
||||
void bar44(A<? super T> a){
|
||||
baz44<error descr="'baz44(B<java.lang.Object,?>)' in 'A' cannot be applied to '(B<capture<? super T>,capture<? super T>>)'">(a.foo44())</error>;
|
||||
baz44<error descr="'baz44(B<K,? extends K>)' in 'A' cannot be applied to '(B<capture<? super T>,capture<? super T>>)'">(a.foo44())</error>;
|
||||
}
|
||||
}
|
||||
@@ -4,40 +4,40 @@ abstract class A<T> {
|
||||
<K> void baz253(B<? super K, ?> a) {}
|
||||
abstract B<? super T, ? super T> foo253();
|
||||
void bar253(A<?> a) {
|
||||
baz253<error descr="'baz253(B<? super java.lang.Object,?>)' in 'A' cannot be applied to '(B<capture<? super capture<?>>,capture<? super capture<?>>>)'">(a.foo253())</error>;
|
||||
baz253<error descr="'baz253(B<? super K,?>)' in 'A' cannot be applied to '(B<capture<? super capture<?>>,capture<? super capture<?>>>)'">(a.foo253())</error>;
|
||||
}
|
||||
|
||||
|
||||
<K> void baz255(B<? super K, ?> a) {}
|
||||
abstract B<? super T, ? super T> foo255();
|
||||
void bar255(A<? extends T> a) {
|
||||
baz255<error descr="'baz255(B<? super java.lang.Object,?>)' in 'A' cannot be applied to '(B<capture<? super capture<? extends T>>,capture<? super capture<? extends T>>>)'">(a.foo255())</error>;
|
||||
baz255<error descr="'baz255(B<? super K,?>)' in 'A' cannot be applied to '(B<capture<? super capture<? extends T>>,capture<? super capture<? extends T>>>)'">(a.foo255())</error>;
|
||||
}
|
||||
|
||||
|
||||
<K> void baz256(B<? super K, ?> a) {}
|
||||
abstract B<? super T, ? extends T> foo256();
|
||||
void bar256(A<?> a) {
|
||||
baz256<error descr="'baz256(B<? super java.lang.Object,?>)' in 'A' cannot be applied to '(B<capture<? super capture<?>>,capture<? extends capture<?>>>)'">(a.foo256())</error>;
|
||||
baz256<error descr="'baz256(B<? super K,?>)' in 'A' cannot be applied to '(B<capture<? super capture<?>>,capture<? extends capture<?>>>)'">(a.foo256())</error>;
|
||||
}
|
||||
|
||||
|
||||
<K> void baz258(B<? super K, ?> a) {}
|
||||
abstract B<? super T, ? extends T> foo258();
|
||||
void bar258(A<? extends T> a) {
|
||||
baz258<error descr="'baz258(B<? super java.lang.Object,?>)' in 'A' cannot be applied to '(B<capture<? super capture<? extends T>>,capture<? extends T>>)'">(a.foo258())</error>;
|
||||
baz258<error descr="'baz258(B<? super K,?>)' in 'A' cannot be applied to '(B<capture<? super capture<? extends T>>,capture<? extends T>>)'">(a.foo258())</error>;
|
||||
}
|
||||
|
||||
|
||||
<K> void baz259(B<? super K, ?> a) {}
|
||||
abstract B<? super T, ?> foo259();
|
||||
void bar259(A<?> a) {
|
||||
baz259<error descr="'baz259(B<? super java.lang.Object,?>)' in 'A' cannot be applied to '(B<capture<? super capture<?>>,capture<?>>)'">(a.foo259())</error>;
|
||||
baz259<error descr="'baz259(B<? super K,?>)' in 'A' cannot be applied to '(B<capture<? super capture<?>>,capture<?>>)'">(a.foo259())</error>;
|
||||
}
|
||||
|
||||
<K> void baz261(B<? super K, ?> a) {}
|
||||
abstract B<? super T, ?> foo261();
|
||||
void bar261(A<? extends T> a) {
|
||||
baz261<error descr="'baz261(B<? super java.lang.Object,?>)' in 'A' cannot be applied to '(B<capture<? super capture<? extends T>>,capture<?>>)'">(a.foo261())</error>;
|
||||
baz261<error descr="'baz261(B<? super K,?>)' in 'A' cannot be applied to '(B<capture<? super capture<? extends T>>,capture<?>>)'">(a.foo261())</error>;
|
||||
}
|
||||
}
|
||||
@@ -87,7 +87,7 @@ class CaptureTest {
|
||||
}
|
||||
|
||||
void foo (Class<? extends Emum<CaptureTest>> clazz) {
|
||||
<error descr="Inferred type 'java.lang.Object' for type parameter 'T' is not within its bound; should extend 'CaptureTest.Emum<java.lang.Object>'">Emum.valueOf(clazz, "CCC")</error>;
|
||||
Emum.valueOf<error descr="'valueOf(java.lang.Class<T>, java.lang.String)' in 'CaptureTest.Emum' cannot be applied to '(java.lang.Class<capture<? extends CaptureTest.Emum<CaptureTest>>>, java.lang.String)'">(clazz, "CCC")</error>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ class S2 {
|
||||
}
|
||||
|
||||
void bar(List<? extends S2> k) {
|
||||
f<error descr="'f(java.util.List<java.lang.Object>, java.util.List<java.lang.Object>)' in 'S2' cannot be applied to '(java.util.List<capture<? extends S2>>, java.util.List<capture<? extends S2>>)'">(k, k)</error>;
|
||||
f<error descr="'f(java.util.List<T>, java.util.List<T>)' in 'S2' cannot be applied to '(java.util.List<capture<? extends S2>>, java.util.List<capture<? extends S2>>)'">(k, k)</error>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ class S3 {
|
||||
}
|
||||
|
||||
void bar(Map<? extends S3, ? extends S3> k) {
|
||||
f<error descr="'f(java.util.Map<java.lang.Object,java.lang.Object>)' in 'S3' cannot be applied to '(java.util.Map<capture<? extends S3>,capture<? extends S3>>)'">(k)</error>;
|
||||
f<error descr="'f(java.util.Map<T,T>)' in 'S3' cannot be applied to '(java.util.Map<capture<? extends S3>,capture<? extends S3>>)'">(k)</error>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ class TypeBug {
|
||||
|
||||
multiList.add(intHolder);
|
||||
multiList.add(doubleHolder);
|
||||
swapFirstTwoValues<error descr="'swapFirstTwoValues(java.util.List<TypeBug.ValueHolder<java.lang.Object>>)' in 'TypeBug' cannot be applied to '(java.util.List<TypeBug.ValueHolder<?>>)'">(multiList)</error>; //need to be highlighted
|
||||
swapFirstTwoValues<error descr="'swapFirstTwoValues(java.util.List<TypeBug.ValueHolder<T>>)' in 'TypeBug' cannot be applied to '(java.util.List<TypeBug.ValueHolder<?>>)'">(multiList)</error>; //need to be highlighted
|
||||
|
||||
// this line causes a ClassCastException when checked.
|
||||
Integer value = intHolder.value;
|
||||
|
||||
@@ -10,6 +10,6 @@ class Node<NodeTypeT extends NodeType> {
|
||||
|
||||
class Main {
|
||||
public static void main(NodeProperty<NumberExpression, Integer> nval, Node<? extends NodeType> expr) {
|
||||
int val = expr.get<error descr="'get(NodeProperty<? super capture<? extends NodeType>,java.lang.Object>)' in 'Node' cannot be applied to '(NodeProperty<NumberExpression,java.lang.Integer>)'">(nval)</error>;
|
||||
int val = expr.get<error descr="'get(NodeProperty<? super capture<? extends NodeType>,ValueT>)' in 'Node' cannot be applied to '(NodeProperty<NumberExpression,java.lang.Integer>)'">(nval)</error>;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -29,7 +29,7 @@ public class ConcurrentCollectors {
|
||||
static <T, K, D, M1 extends Map<K, D>> C<T, M1> groupingBy(F<M1> f,
|
||||
C<T, D> c,
|
||||
BiConsumer<M1, T> consumer) {
|
||||
return new CImpl<><error descr="'CImpl(ConcurrentCollectors.F<M1>, ConcurrentCollectors.BiConsumer<M1,T>, ConcurrentCollectors.BiOp<M1>)' in 'ConcurrentCollectors.CImpl' cannot be applied to '(ConcurrentCollectors.F<M1>, ConcurrentCollectors.BiConsumer<M1,T>, ConcurrentCollectors.BiOp<ConcurrentCollectors.ConcurrentMap<java.lang.Object,D>>)'">(f, consumer, arg(c.getOp()))</error>;
|
||||
return new CImpl<><error descr="'CImpl(ConcurrentCollectors.F<R>, ConcurrentCollectors.BiConsumer<R,T>, ConcurrentCollectors.BiOp<R>)' in 'ConcurrentCollectors.CImpl' cannot be applied to '(ConcurrentCollectors.F<M1>, ConcurrentCollectors.BiConsumer<M1,T>, ConcurrentCollectors.BiOp<ConcurrentCollectors.ConcurrentMap<java.lang.Object,D>>)'">(f, consumer, arg(c.getOp()))</error>;
|
||||
}
|
||||
|
||||
static <K, V, M2 extends ConcurrentMap<K, V>> BiOp<M2> arg(BiOp<V> op) {
|
||||
|
||||
@@ -16,7 +16,7 @@ class NoInferenceResult {
|
||||
|
||||
void test() {
|
||||
m((String s1) -> <error descr="Target type of a lambda conversion must be an interface">(String s2) -> s1 + s2</error>);
|
||||
m((String s1) -> {return <error descr="Target type of a lambda conversion must be an interface">(String s2) -> s1 + s2</error>;});
|
||||
m(<error descr="B is not a functional interface">(String s1) -> {return (String s2) -> s1 + s2;}</error>);
|
||||
|
||||
m((String s1) -> s1.length());
|
||||
m((String s1) -> s1);
|
||||
|
||||
@@ -9,6 +9,6 @@ class Calls {
|
||||
void foo(Function<String, Optional> computable) {}
|
||||
|
||||
{
|
||||
((x) -> a(b(c<error descr="'c(java.lang.Object)' in 'Calls' cannot be applied to '(<lambda parameter>)'">(x)</error>)));
|
||||
((x) -> a(b(c<error descr="'c(C)' in 'Calls' cannot be applied to '(<lambda parameter>)'">(x)</error>)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ class Foo<R> {
|
||||
|
||||
public void foo() {
|
||||
reduce(Moo::new);
|
||||
<error descr="Inferred type 'Foo<R>.AMoo' for type parameter 'S' is not within its bound; should implement 'Foo.ASink<java.lang.Object,Foo<R>.AMoo>'">reduce(AMoo::new)</error>;
|
||||
reduce<error descr="'reduce(Foo.Factory<S>)' in 'Foo' cannot be applied to '(<method reference>)'">(AMoo::new)</error>;
|
||||
reduce(AAMoo::new);
|
||||
reduce(AAAMoo::new);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class MyTestDefaultConstructor {
|
||||
private static void <warning descr="Private method 'foo(MyTestDefaultConstructor.I3)' is never used">foo</warning>(I3 i) {System.out.println(i);}
|
||||
|
||||
static {
|
||||
foo<error descr="Ambiguous method call: both 'MyTestDefaultConstructor.foo(I1)' and 'MyTestDefaultConstructor.foo(I2)' match">(Foo::new)</error>;
|
||||
foo<error descr="Cannot resolve method 'foo(<method reference>)'">(Foo::new)</error>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class MyTestConstructor {
|
||||
private static void <warning descr="Private method 'foo(MyTestConstructor.I3)' is never used">foo</warning>(I3 i) {System.out.println(i);}
|
||||
|
||||
static {
|
||||
foo<error descr="Ambiguous method call: both 'MyTestConstructor.foo(I1)' and 'MyTestConstructor.foo(I2)' match">(Foo::new)</error>;
|
||||
foo<error descr="Cannot resolve method 'foo(<method reference>)'">(Foo::new)</error>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class Test1111 {
|
||||
}
|
||||
|
||||
public void test(I<?> i) {
|
||||
bar<error descr="'bar(Test1111.I<? super java.lang.Object>)' in 'Test1111' cannot be applied to '(Test1111.I<capture<?>>)'">(i)</error>;
|
||||
bar<error descr="'bar(Test1111.I<? super A>)' in 'Test1111' cannot be applied to '(Test1111.I<capture<?>>)'">(i)</error>;
|
||||
}
|
||||
|
||||
public static <A> void bar(I<? super A> i) {}
|
||||
|
||||
Reference in New Issue
Block a user