Skip to content

Conversation

@xterao
Copy link
Collaborator

@xterao xterao commented Jun 24, 2025

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, or BiFunction.

@xterao xterao added this to the 1.1.0 Release milestone Jun 24, 2025
@xterao xterao requested a review from Copilot June 24, 2025 08:54
@xterao xterao self-assigned this Jun 24, 2025
@github-actions github-actions bot added the chore label Jun 24, 2025
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

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 TypeUtil and update inspection processors to use generic checkParamTypeResult
  • Revise message bundles for select-return-type strategy placeholders
  • Extend test data and inspection tests for new HogeBiFunction cases

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 TypeUtil methods (unwrapOptional, isBaseOrOptionalWrapper, isValidMapType, etc.) to ensure they behave correctly and maintain coverage.
/*

@xterao xterao linked an issue Jun 24, 2025 that may be closed by this pull request
@xterao xterao changed the title Chore/dao method inspections Refactoring dao method inspections Jun 24, 2025
@xterao xterao merged commit adb9df5 into main Jun 24, 2025
5 checks passed
@xterao xterao deleted the chore/dao-method-inspections branch June 24, 2025 09:24
@xterao xterao added bug Something isn't working and removed chore labels Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DAO method inspection

2 participants