-
Notifications
You must be signed in to change notification settings - Fork 0
DAO Method Parameter Validation #257
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
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
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) }
Implement a validation feature for DAO method parameters.
This validation targets method parameters excluding those annotated with @factory.
Inspection Scope:
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).