fix(ksp): keep well-known QueryDSL Path type for @Convert/@Type/@JdbcTypeCode properties#1848
Open
goekhantopcu wants to merge 2 commits into
Open
fix(ksp): keep well-known QueryDSL Path type for @Convert/@Type/@JdbcTypeCode properties#1848goekhantopcu wants to merge 2 commits into
goekhantopcu wants to merge 2 commits into
Conversation
…ll-known types Same fix as fix/ksp-convert-well-known-types-simplepath, applied directly on top of the 7.4.0 release tag (not master) so every other artifact stays byte-for-byte identical to the published 7.4.0 release - only querydsl-ksp-codegen differs, by this one guard clause. This is a local-only patch for mavenLocal() installation under the unmodified '7.4.0' GAV coordinates, to use as a drop-in replacement while https://github.com/OpenFeign/querydsl PR for fix/ksp-convert-well-known-types-simplepath is pending review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
In
querydsl-ksp-codegen'sTypeExtractor, properties annotated with@Convert,@Type, or@JdbcTypeCodeare treated as "unknown" types and fall back to a genericSimplePath, even when the underlying Kotlin type (e.g.Instant,Boolean,LocalDate, ...) already has a well-known QueryDSL Path mapping.@Convert(and friends) only change how JPA persists the attribute to the database column - the JPQL/Path-level type is still whatever the Kotlin property declares. Falling back toSimplePathneedlessly throws away query capabilities such asDateTimePath.after()/before(),BooleanPath,NumberPath, etc. - capabilities thatquerydsl-apt(the Java APT generator) keeps for the very same case.This is the same root cause as the existing enum check (#1410), just generalized to all of
SimpleType.Mapperinstead of only enums.Fix
Skip the "unknown type" fallback in
TypeExtractorwhen the type already has a well-known mapping inSimpleType.Mapper, so the generated Q-class keeps the specific Path type instead of degrading toSimplePath.Testing
Added an integration test covering a
@Convert-annotatedInstantproperty, verifying the generated Q-class usesDateTimePath<Instant>instead ofSimplePath<Instant>.