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

Conversation

quaff
Copy link
Contributor

@quaff quaff commented Mar 22, 2024

Before this commit, given:

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);

will cause:

Expected :org.springframework.core.ResolvableTypeTests$IProvider<java.lang.String>
Actual   :org.springframework.core.ResolvableTypeTests$IProvider<java.lang.String>

Before this commit, given:
```java
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);
```
will cause:
```
Expected :org.springframework.core.ResolvableTypeTests$IProvider<java.lang.String>
Actual   :org.springframework.core.ResolvableTypeTests$IProvider<java.lang.String>
```
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Mar 22, 2024
@sbrannen sbrannen requested a review from jhoeller March 22, 2024 14:02
@sbrannen sbrannen added the in: core Issues in core modules (aop, beans, core, context, expression) label Mar 22, 2024
@snicoll
Copy link
Member

snicoll commented Apr 23, 2024

Thanks for the PR but you should be using equalsType for that type of comparison. The regular equals implementation is rather strict since it is primarily used for cache lookups, not for type comparisons.

@snicoll snicoll closed this Apr 23, 2024
@snicoll snicoll added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants