Support for Using @DataType-Annotated Records in DAO Method Return and Parameter Types
#350
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.
This update enables support for Java
recordtypes annotated with@DataTypewhen used as return types or parameter types in DAO methods.Issue
Previously, the code inspection mechanism would erroneously highlight
@DataTyperecords as errors when used as DAO method return types.Fix Overview
The inspection logic has been updated to recognize
@DataType-annotated records as valid in the following cases:For
@Select-annotated DAO methods:No error highlight for using
@DataTyperecords as either return type or parameter type.For
@Factory-annotated DAO methods:@DataTyperecords are accepted as both return type and parameter type.For
@Procedure-annotated DAO methods:@DataTyperecords are allowed as parameter types.For
@Update,@Insert, and@DeleteDAO methods:If the annotation has the option
sqlFile = trueor is used in combination with@Sql, then@DataTyperecords are allowed as parameter types.For Batch annotations (e.g.,
@BatchInsert,@BatchUpdate, etc.):If
sqlFile = trueis specified or@Sqlis present, then using a@DataTyperecord as the element type of the parameter is accepted and not highlighted as an error.This change improves support for domain-style value types and ensures compatibility with custom record-based models in Doma DAO method signatures.
Related Issue
N/A
Type of Change