Skip to content
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

Irrelevant wildcard causes compile error #3482

Open
TheTribalK opened this issue Dec 20, 2024 · 2 comments
Open

Irrelevant wildcard causes compile error #3482

TheTribalK opened this issue Dec 20, 2024 · 2 comments
Labels
javac ecj not compatible with javac

Comments

@TheTribalK
Copy link

TheTribalK commented Dec 20, 2024

Hi.

Since I updated to ecj 3.40.0.v20241118-1641 I get several new compile errors which seem wrong.

For reproduction:

private interface A<T extends B<T>> {
}

private interface B<T> {
  T getT();
}

public static void test() {
  A<?> a = null;
  test(a);
}

public static <T extends A<U>, U extends B<U>> void test(T a) {
}

compiles fine.

private interface A<T extends B<T, ?>> {
}

private interface B<T, U> {
  T getT();
}

public static void test() {
  A<?> a = null;
  test(a);
}

public static <T extends A<U>, U extends B<U, ?>> void test(T a) {
}

The addition of the irrelevant generic type argument U to B causes a compile error.

The method test(T) in the type Test is not applicable for the arguments (Test.A<capture#4-of ?>)

In my opinion this is a bug?

Thanks in advance.

@TheTribalK TheTribalK changed the title Irrelevant Wildcard causes Compileerror Irrelevant wildcard causes compile error Dec 20, 2024
@TheTribalK
Copy link
Author

Same Problem in Version 3.39.0.v20240820-0604

@Madjosz
Copy link

Madjosz commented Dec 20, 2024

Can confirm that the problematic code compiles with javac in all versions (tested 7 - 24).

Looks like a regression. Code compiles in ecj-3.38.0-20240408.235704-30 but fails in ecj-3.38.100-20240620.121349-13.

@jukzi jukzi added the javac ecj not compatible with javac label Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javac ecj not compatible with javac
Projects
None yet
Development

No branches or pull requests

3 participants