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

Skip comparing variableResolver if underlying type is Class #32511

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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 @@ -999,7 +999,7 @@ public boolean equals(@Nullable Object other) {
!ObjectUtils.nullSafeEquals(this.typeProvider.getType(), otherType.typeProvider.getType()))) {
return false;
}
if (this.variableResolver != otherType.variableResolver &&
if (!(this.type instanceof Class<?>) && this.variableResolver != otherType.variableResolver &&
(this.variableResolver == null || otherType.variableResolver == null ||
!ObjectUtils.nullSafeEquals(this.variableResolver.getSource(), otherType.variableResolver.getSource()))) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1403,6 +1403,13 @@ void gh32327() throws Exception {
assertThat(repository3.isAssignableFromResolvedPart(repository1)).isFalse();
}

@Test
void skipComparingVariableResolverIfUnderlyingTypeIsClass() {
ResolvableType type1 = ResolvableType.forClassWithGenerics(IProvider.class, String.class);
ResolvableType type2 = ResolvableType.forClassWithGenerics(IProvider.class,
ResolvableType.forClass(StringProvider.class).as(IProvider.class).getGenerics());
assertThat(type1).isEqualTo(type2);
}

private ResolvableType testSerialization(ResolvableType type) throws Exception {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
Expand Down Expand Up @@ -1719,6 +1726,9 @@ class TypedInnerTyped extends InnerTyped<Long> {
public interface IProvider<P> {
}

public interface StringProvider extends IProvider<String> {
}

public interface IBase<BT extends IBase<BT>> {
}

Expand Down