Skip to content

Conversation

@xterao
Copy link
Collaborator

@xterao xterao commented May 8, 2025

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 test cases for Optional DAO parameter conversion.
  • Support Optional, OptionalInt, OptionalLong, and OptionalDouble.
  • Modifications to utility classes to properly convert Optional types.

@xterao xterao added this to the 0.7.0 Release milestone May 8, 2025
@xterao xterao requested a review from Copilot May 8, 2025 09:23
@xterao xterao self-assigned this May 8, 2025
@xterao xterao added bug Something isn't working fix Bug fixes labels May 8, 2025
@xterao xterao linked an issue May 8, 2025 that may be closed by this pull request
Copy link
Contributor

Copilot AI left a 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.

@xterao xterao requested a review from Copilot May 9, 2025 01:44
Copy link
Contributor

Copilot AI left a 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;

@xterao xterao changed the title Fix/optional dao param type conversion Fix: optional dao param type conversion May 9, 2025
@xterao xterao merged commit 3d9af93 into main May 9, 2025
3 checks passed
@xterao xterao deleted the fix/optional-dao-param-type-conversion branch May 9, 2025 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working fix Bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for Optional type Dao method parameters

2 participants