-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Method call with wildcard generic parameter fails to compile #3367
Comments
I was very curious where the first capture would come from, but indeed I see this error:
|
Inference fails when trying to instantiate inference variable
This clearly is unsolvable. Let's see if there is anything suspicious on the path towards creating these two bounds. |
Oops, I pasted the wrong error message; sorry! |
First let's give distinguishable names: class A<S> {}
class B<T> {}
public interface Test {
<U> B<U> b(U t);
<V> B<A<? super V>> bOfA(B<? super V> t);
<W> void errors(W t, B<? super W> m);
default void test(A<String> a) {
errors(a, bOfA(b(a)));
}
}
Outer inference for error(..) starts with
Reduction:
At this point we have
Incorporation:
Incorporation result:
Resolve:
So let me go over these steps if there is anything suspicous. So far nothing found. |
This variant demonstrates that a solution exists (with U = Object): class A<S> {}
class B<T> {}
public abstract class Test {
abstract <U> B<U> b(U t);
abstract <V> B<A<? super V>> bOfA(B<? super V> t);
abstract <W> void errors(W t, B<? super W> m);
void test(A<String> a) {
errors(a, bOfA(this.<Object>b(a)));
}
} Does inference have the rules to find this solution? |
Given a couple generic types:
And some generic methods with wildcards:
This compiles with javac, but ECJ fails to compile with:
This used to work fine. When we encountered #2817, we stuck to an older version until that was fixed, and then when updating after the fix we encountered this new issue. So it seems like the two issues might be related, the setup is similar too.
The text was updated successfully, but these errors were encountered: