Skip to content

Conversation

@xterao
Copy link
Collaborator

@xterao xterao commented Jun 24, 2025

Implement code inspection functionality to perform return type checks and parameter checks on Factory DAO methods, similar to the existing checks for other annotated methods.

@xterao xterao self-assigned this Jun 24, 2025
@xterao xterao requested a review from Copilot June 24, 2025 01:29
@xterao xterao added this to the 1.1.0 Release milestone Jun 24, 2025
@xterao xterao linked an issue Jun 24, 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

Implements return type and parameter validation for Factory DAO methods, mirroring existing checks for other annotated methods.

  • Added Factory return type and parameter check processors
  • Updated visitors to include Factory annotations in inspection
  • Extended tests and updated message bundle keys and processor naming

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/java/doma/example/dao/inspection/returntype/FactoryReturnTypeTestDao.java Add test cases for Factory return type validation
src/test/testData/src/main/java/doma/example/dao/inspection/paramtype/InsertUpdateDeleteParamTestDao.java Update error description wording
src/test/testData/src/main/java/doma/example/dao/inspection/paramtype/FactoryParamTestDao.java Add test cases for Factory parameter validation
src/test/kotlin/org/domaframework/doma/intellij/inspection/dao/AnnotationReturnTypeCheckInspectionTest.kt Register FactoryReturnTypeTestDao in return type tests
src/test/kotlin/org/domaframework/doma/intellij/inspection/dao/AnnotationParamTypeCheckInspectionTest.kt Register FactoryParamTestDao in parameter type tests
src/main/resources/messages/DomaToolsBundle_ja.properties Rename Japanese parameter validation key (inconsistent)
src/main/resources/messages/DomaToolsBundle.properties Rename English parameter validation key
src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/visitor/DaoMethodReturnTypeInspectionVisitor.kt Include Factory annotations in return type visitor
src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/visitor/DaoMethodParamTypeInspectionVisitor.kt Include Factory annotations in parameter type visitor
src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/processor/returntype/UpdateReturnTypeCheckProcessor.kt Rename processor class to UpdateReturnTypeCheckProcessor
src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/processor/returntype/SqlProcessorReturnTypeCheckProcessor.kt Rename processor class to SqlProcessorReturnTypeCheckProcessor
src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/processor/returntype/SelectReturnTypeCheckProcessor.kt Rename processor class to SelectReturnTypeCheckProcessor
src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/processor/returntype/ScriptReturnTypeCheckProcessor.kt Rename processor class to ScriptReturnTypeCheckProcessor
src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/processor/returntype/ProcedureReturnTypeCheckProcessor.kt Rename processor class to ProcedureReturnTypeCheckProcessor
src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/processor/returntype/MultiInsertReturnTypeCheckProcessor.kt Rename processor class to MultiInsertReturnTypeCheckProcessor
src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/processor/returntype/FunctionReturnTypeCheckProcessor.kt Rename processor class to FunctionReturnTypeCheckProcessor
src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/processor/returntype/FactoryReturnTypeCheckProcessor.kt New processor for Factory return type validation
src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/processor/returntype/BatchReturnTypeCheckProcessor.kt Rename processor class to BatchReturnTypeCheckProcessor
src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/processor/paramtype/UpdateParamTypeCheckProcessor.kt Switch to ValidationMethodParamTypeResult for entity parameter errors
src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/processor/paramtype/FactoryParamTypeCheckProcessor.kt New processor for Factory parameter validation
src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/processor/FactoryAnnotationType.kt Define metadata for Factory annotations
src/main/kotlin/org/domaframework/doma/intellij/extension/psi/DomaAnnotationType.kt Add Factory annotation types to the DomaAnnotationType enum
src/main/kotlin/org/domaframework/doma/intellij/common/validation/result/ValidationMethodParamTypeResult.kt Rename entity param result class and update its message key
Comments suppressed due to low confidence (4)

src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/processor/returntype/FactoryReturnTypeCheckProcessor.kt:24

  • [nitpick] Update the KDoc comment to reference Factory annotations instead of SqlProcessor, e.g., "Processor for checking the return type of Factory annotations."
 * Processor for checking the return type of SqlProcessor annotation.

src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/visitor/DaoMethodParamTypeInspectionVisitor.kt:51

  • Missing import for SelectParamTypeCheckProcessor; add import org.domaframework.doma.intellij.inspection.dao.processor.paramtype.SelectParamTypeCheckProcessor to avoid compile errors.
            DomaAnnotationType.Select -> {

src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/visitor/DaoMethodParamTypeInspectionVisitor.kt:58

  • Missing import for UpdateParamTypeCheckProcessor; add import org.domaframework.doma.intellij.inspection.dao.processor.paramtype.UpdateParamTypeCheckProcessor to avoid compile errors.
            DomaAnnotationType.Insert, DomaAnnotationType.Update, DomaAnnotationType.Delete -> {

src/main/resources/messages/DomaToolsBundle_ja.properties:27

  • The translation key should match the English bundle (inspection.invalid.dao.params.type); rename this key to inspection.invalid.dao.params.type for consistency.
inspection.invalid.dao.params=\u5F15\u6570\u306E\u578B\u306F{0}\u3067\u306A\u3051\u308C\u3070\u306A\u308A\u307E\u305B\u3093

@xterao xterao merged commit b7b4f98 into main Jun 24, 2025
5 checks passed
@xterao xterao deleted the feature/factory-dao-method-check branch June 24, 2025 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Return Type and Parameter Checks for Factory DAO Methods

2 participants