-
Notifications
You must be signed in to change notification settings - Fork 0
Fix: optional dao param type conversion #151
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses type conversion issues for optional DAO parameters by incorporating Optional conversion methods into multiple components and updating corresponding tests. Key changes include:
- Adding a convertOptionalType method in PsiClassTypeUtil for handling Optional and primitive variants.
- Updating SQL files and test cases to use optional DAO parameters.
- Adjusting documentation and PSI extension classes to work with these new type conversions.
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/testData/src/main/resources/META-INF/doma/example/dao/SqlCompleteTestDao/completeOptionalStaticProperty.sql | Added a test SQL file for optional static property queries. |
| src/test/testData/src/main/resources/META-INF/doma/example/dao/SqlCompleteTestDao/completeOptionalDaoParam.sql | Added a test SQL file for optional DAO parameter queries. |
| src/test/testData/src/main/resources/META-INF/doma/example/dao/SqlCompleteTestDao/completeOptionalByForItem.sql | Added a test SQL file demonstrating optional parameters within FOR directives. |
| src/test/testData/src/main/resources/META-INF/doma/example/dao/EmployeeSummaryDao/optionalDaoParameterFieldAccess.sql | Updated test SQL to simulate field accesses on Optional parameters. |
| src/test/testData/src/main/java/doma/example/entity/Project.java | Introduced new static Optional fields for test purposes. |
| src/main/kotlin/.../PsiClassTypeUtil.kt | Introduced and utilized Optional conversion logic. |
| Other files | Consistently updated to use the new Optional conversion features in completions, documentation, and inspections. |
src/main/kotlin/org/domaframework/doma/intellij/inspection/sql/visitor/SqlInspectionVisitor.kt
Show resolved
Hide resolved
src/main/kotlin/org/domaframework/doma/intellij/common/sql/PsiClassTypeUtil.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request fixes issues related to optional DAO parameter type conversion while updating relevant test files, DAO interfaces, and internal conversion utilities for Optional types. Key changes include:
- New SQL files and test cases for Optional DAO parameter conversion.
- Updates to DAO interfaces to support Optional, OptionalInt, OptionalLong, and OptionalDouble in method signatures.
- Modifications to utility classes (e.g., PsiClassTypeUtil, ForDirectiveUtil) to properly convert Optional types.
Reviewed Changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/testData/src/main/resources/META-INF/doma/example/dao/SqlCompleteTestDao/completeOptionalDaoParam.sql | Added SQL snippet for optional DAO parameter testing. |
| src/test/testData/src/main/resources/META-INF/doma/example/dao/SqlCompleteTestDao/completeOptionalByForItem.sql | Introduced for loop directive testing for Optional elements. |
| src/test/testData/src/main/resources/META-INF/doma/example/dao/SqlCompleteTestDao/completeOptionalBatchAnnotation.sql | Implemented batch annotation tests for Optional lists. |
| src/test/testData/src/main/resources/META-INF/doma/example/dao/EmployeeSummaryDao/optionalDaoParameterFieldAccess.sql | Added SQL with field accesses demonstrating errors for undefined methods. |
| src/test/testData/src/main/java/doma/example/entity/Project.java | Updated entity with new static Optional fields and introduced a potential type typo. |
| Other test and utility files | Adjusted tests and internal optional type conversion utilities accordingly. |
Comments suppressed due to low confidence (1)
src/test/testData/src/main/java/doma/example/entity/Project.java:23
- The type 'Integr' appears to be a typo; it should likely be 'Integer'.
public static Integr projectNumber;
This pull request fixes issues related to optional DAO parameter type conversion while updating relevant test files, DAO interfaces, and internal conversion utilities for Optional types. Key changes include: