Skip to content

Conversation

@xterao
Copy link
Collaborator

@xterao xterao commented Jun 17, 2025

Implement a validation feature for DAO method parameters.
This validation targets method parameters excluding those annotated with @factory.

Inspection Scope:

  • Verify the number of parameters
  • Check that all required parameter types are present
  • Ensure that parameter types are supported

Additionally, this PR includes refactoring such as renaming classes related to return-type validation.
Ongoing refactoring of the code-inspection framework is planned (e.g., splitting the ValidationResult class into separate packages and adding new error codes).

@xterao xterao requested a review from Copilot June 17, 2025 11:08
@xterao xterao self-assigned this Jun 17, 2025
@xterao xterao added the enhancement New feature or request label Jun 17, 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

This PR implements parameter validation for DAO methods by refining type checks and error reporting. Key changes include:

  • Updates to PsiClass extensions (renaming getEntityAnnotation to getClassAnnotation, adding isDomain and getSuperType).
  • Addition of a new "Function" annotation type in DomaAnnotationType along with several new validation result classes.
  • Updates to ProjectExtensions, PsiClassTypeUtil, and PsiTypeChecker to utilize centralized DomaClassName constants for improved consistency.

Reviewed Changes

Copilot reviewed 71 out of 71 changed files in this pull request and generated no comments.

Show a summary per file
File Description
PsiClassExtension.kt Renamed annotation methods and added isDomain/getSuperType to support wider annotation checks.
DomaAnnotationType.kt New enum constant "Function" added for extended annotation support.
ProjectExtensions.kt Refactored class lookup to extract a top-level class name from generic type names.
ValidationReturnTypeUpdateReturningResult.kt Renamed class to better reflect updated behavior.
Validation*Result.kt Introduced several new validation result classes with explicit error messages.
LiteralDirectiveHandler.kt Removed type filtering in parameter lookup for directive handling.
PsiClassTypeUtil.kt & PsiTypeChecker.kt Updated to use DomaClassName constants and refined type checking logic.
DomaClassName.kt Added a helper enum with centralized class name references for uniformity.
Comments suppressed due to low confidence (3)

src/main/kotlin/org/domaframework/doma/intellij/common/psi/PsiTypeChecker.kt:89

  • [nitpick] The TODO comment suggests additional type checks might be needed here. It would be helpful to either implement those checks or update the documentation to clarify why non-matching types return false.
return false

src/main/kotlin/org/domaframework/doma/intellij/common/validation/result/ValidationMethodParamsProcedureInTypeResult.kt:27

  • The parameter name 'validaType' appears to be a typo; consider renaming it to 'validType' for improved clarity.
private val validaType: String,

src/main/kotlin/org/domaframework/doma/intellij/common/sql/directive/LiteralDirectiveHandler.kt:41

  • Removal of the type check filter may cause non-target type parameters to be included in the lookup results. Confirm if this change is intentional; if not, consider reintroducing a filtering mechanism.
?.map { param -> VariableLookupItem(param) }

@xterao xterao merged commit bdb8f2c into main Jun 19, 2025
5 checks passed
@xterao xterao deleted the feature/check-dao-method-params branch June 19, 2025 04:44
@xterao xterao added this to the 1.1.0 Release milestone Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Treat record types as immutable Entities DAO Method Argument Parameter Check

2 participants