fix: EXPOSED-280 Comparison operators show incorrect compiler warning with datetime columns #1984
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I came across this warning while scanning the datetime modules for PR #1983 .
A strange compiler warning is flagged for the following code in
exposed-jodatime
andexposed-java-time
modules:The same warning doesn't appear in the
exposed-kotlin-datetime
module.But a user has already reported that they are seeing the warning with regular (non-entity id) UUID columns, suggesting a pattern only involving objects that aren't part of the Kotlin standard library.
This occurs because this convenience overload (introduced by PR #1961 ) is being incorrectly chosen:
These overloads incorrectly make the
ExpressionWithColumnType
argument's type parameter contravariant, when this annotation should instead be set on the callingExpression
object's type parameter.Note: No tests have been added but there are multiple examples of the highlighted warning in
JodaTimeTests/testlocalDateComparison
andtestLocalDateTimeComparison
. Switching between branches confirms the warning is resolved by this fix.