Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,16 @@ void resolveTypeFromGenericDefaultMethod() {
assertThat(resolvedType).isEqualTo(InheritsDefaultMethod.ConcreteType.class);
}

@Test
void resolveTypeVariableCollisionAcrossInterfaces() throws Exception {
Type createBody = Create.class.getMethod("create", Object.class)
.getGenericParameterTypes()[0];

Type resolved = resolveType(createBody, Controller.class);

assertThat(resolved).isEqualTo(Long.class);
}

private static Method method(Class<?> target, String methodName, Class<?>... parameterTypes) {
Method method = findMethod(target, methodName, parameterTypes);
assertThat(method).describedAs(target.getName() + "#" + methodName).isNotNull();
Expand Down Expand Up @@ -477,4 +487,17 @@ static class ConcreteType implements InterfaceWithDefaultMethod.AbstractType {
}
}

interface Search<I, O> {
}

interface Create<I, O> {

default O create(I body) {
return null;
}
}

static class Controller implements Search<String, Long>, Create<Long, Long> {
}

}