-
Notifications
You must be signed in to change notification settings - Fork 0
Refactoring dao method inspections #274
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
…for improved clarity and maintainability
…idation in DAO methods
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
Refactors DAO method inspection logic by introducing a shared TypeUtil for type checks, streamlining return/parameter processors, updating related tests, and adjusting message bundle placeholders.
- Centralize type handling in
TypeUtiland update inspection processors to use genericcheckParamTypeResult - Revise message bundles for select-return-type strategy placeholders
- Extend test data and inspection tests for new
HogeBiFunctioncases
Reviewed Changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/test/testData/.../SqlProcessorReturnTypeTestDao.java | Extend SQL-processor return-type tests with HogeBiFunction cases |
| src/test/testData/.../SelectReturnTypeTestDao.java | Adjust select-return tests to match new bundle placeholder logic |
| src/test/testData/.../SqlProcessorParamTestDao.java | Add HogeBiFunction param-type test case |
| src/test/kotlin/.../AnnotationReturnTypeCheckInspectionTest.kt | Enable inspection tests for HogeBiFunction |
| src/test/kotlin/.../AnnotationParamTypeCheckInspectionTest.kt | Enable param-type tests for HogeBiFunction |
| src/main/resources/messages/DomaToolsBundle_ja.properties | Update Japanese message for select-return placeholder |
| src/main/resources/messages/DomaToolsBundle.properties | Update English message for select-return placeholder |
| src/main/kotlin/.../common/util/TypeUtil.kt | Add new utility for unwrapping and classifying types |
| src/main/kotlin/.../processor/returntype/ReturnTypeCheckerProcessor.kt | Remove duplicate logic, add generic checkParamTypeResult stub |
| src/main/kotlin/.../processor/returntype/SqlProcessorReturnTypeCheckProcessor.kt | Refactor SQL-processor return-type check to use generic solution |
| src/main/kotlin/.../processor/returntype/SelectReturnTypeCheckProcessor.kt | Refactor select-return-type check to use TypeUtil |
| src/main/kotlin/.../processor/returntype/UpdateReturnTypeCheckProcessor.kt | Replace inline entity checks with TypeUtil call |
| src/main/kotlin/.../processor/returntype/MultiInsertReturnTypeCheckProcessor.kt | Switch to TypeUtil.isImmutableEntity |
| src/main/kotlin/.../processor/returntype/FunctionReturnTypeCheckProcessor.kt | Refactor function-return-type check to use TypeUtil |
| src/main/kotlin/.../processor/returntype/BatchReturnTypeCheckProcessor.kt | Replace inline entity logic with TypeUtil |
| src/main/kotlin/.../processor/paramtype/UpdateParamTypeCheckProcessor.kt | Simplify entity-param check via TypeUtil |
| src/main/kotlin/.../processor/paramtype/SqlProcessorParamTypeCheckProcessor.kt | Use getMethodParamTargetType helper |
| src/main/kotlin/.../processor/paramtype/SelectParamTypeCheckProcessor.kt | Replace manual super-type traversal with getSuperClassType |
| src/main/kotlin/.../processor/paramtype/ProcedureParamTypeCheckProcessor.kt | Add KDoc for procedure-param validation |
| src/main/kotlin/.../processor/paramtype/BatchParamTypeCheckProcessor.kt | Replace isEntity inline with TypeUtil |
| src/main/kotlin/.../processor/TypeCheckerProcessor.kt | Add class-level KDoc and support for checkParamTypeResult |
| src/main/kotlin/.../processor/StrategyParam.kt | Add KDoc for strategy-parameter helper |
| src/main/kotlin/.../processor/FactoryAnnotationType.kt | Add KDoc for factory-annotation enum |
| src/main/kotlin/.../common/validation/result/ValidationMethodSelectStrategyReturnTypeResult.kt | Update parameter order for strategy-return error message |
| src/main/kotlin/.../common/validation/result/ValidationMethodParamsIterableEntityResult.kt | Fix nullable identifier in iterable-entity validation result |
Comments suppressed due to low confidence (2)
src/main/resources/messages/DomaToolsBundle.properties:20
- [nitpick] The wording and placeholder order may be confusing; consider rephrasing to something like: "The return type must match type parameter "{1}" of "{0}"", so the meanings of {0}/{1} are clear.
inspection.invalid.dao.select.returnType.strategy=The return type must match the "{0}" type parameter "{1}"
src/main/kotlin/org/domaframework/doma/intellij/common/util/TypeUtil.kt:1
- [nitpick] Consider adding dedicated unit tests for the new
TypeUtilmethods (unwrapOptional,isBaseOrOptionalWrapper,isValidMapType, etc.) to ensure they behave correctly and maintain coverage.
/*
…essage Co-authored-by: Copilot <[email protected]>
Refactor the return type and parameter checking process for DAO methods.
Consolidate similar logic into a utility class and add KDocs.
Also check subtypes of specific types and handle them as
Function,Collector, orBiFunction.