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

LocalDate and LocalDateTime don't work with ComparableAttribute #1022

Open
njr-11 opened this issue Mar 19, 2025 · 4 comments
Open

LocalDate and LocalDateTime don't work with ComparableAttribute #1022

njr-11 opened this issue Mar 19, 2025 · 4 comments
Milestone

Comments

@njr-11
Copy link
Contributor

njr-11 commented Mar 19, 2025

Entity attribute types java.time.LocalDate and java.time.LocalDateTime are Comparable, but they implement Comparable<ChronoLocalDate> and Comparable<ChronoLocalDateTime> respectively rather than Comparable<LocalDate> and Comparable<LocalDateTime>.

I noticed this when attempting to use the static metamodel for LocalDate, where the following doesn't compile,

        ComparableAttribute<Author, LocalDate> birthday =
                ComparableAttribute.of(Author.class, BIRTHDAY, LocalDate.class);
@gavinking
Copy link
Contributor

Ooops.

I think it works if we change every occurrence of extends Comparable<T>> to extends Comparable<?>>.

@otaviojava
Copy link
Contributor

I remember that we removed the Comparable considering the LocalDate scenario

@gavinking
Copy link
Contributor

I remember that we removed the Comparable considering the LocalDate scenario

I don't think we need to completely remove Comparable. We can just use a wildcard in the upper bound, unless I'm missing something.

@njr-11
Copy link
Contributor Author

njr-11 commented Mar 20, 2025

To be clear, I wasn't suggesting to remove Comparable, only to have this issue as a reminder so that LocalDate it isn't overlooked because it does require an update to the API (using Comparable<?> instead) before we release it.

@njr-11 njr-11 added this to the 1.1 milestone Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants