Skip to content

Irrelevant wildcard causes compile error #3482

@TheTribalK

Description

@TheTribalK

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    javacecj not compatible with javac

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions