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

Parameter.isDynamicProjectionParameter does not properly resolve generics of containing class #3020

Closed
mp911de opened this issue Jan 11, 2024 · 0 comments
Labels
type: regression A regression from a previous release

Comments

@mp911de
Copy link
Member

mp911de commented Jan 11, 2024

Consider the following arrangement:

interface GenericRepository<T, ID> extends Repository<T, ID> {
	<P extends Projection<T>> Optional<P> dynamicBind(Class<P> type);
}

interface ParametrizedRepository extends GenericRepository<User, Long> {}

interface Projection<T> {
}

When comparing the method parameter Class<P> type against the return type definition, then we consider the containing class ParametrizedRepository at the parameter level (#2996) but we do not consider the containing class when introspecing the method return type.

This yields ? as parameter for Optional while the method parameter resolves correctly to Projection<User>. In a second step, we compare inner generics of the return type and therefore, the equality check fails.

While we previously always fell back to ?, fixing #2996 uncovered this bug.

@mp911de mp911de added the type: regression A regression from a previous release label Jan 11, 2024
mp911de added a commit that referenced this issue Jan 11, 2024
We now consider the enclosing class to determine correct generic typing.

Closes #3020
@mp911de mp911de added this to the 3.2.2 (2023.1.2) milestone Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

1 participant