-
Notifications
You must be signed in to change notification settings - Fork 0
Enhance the usage checks of DAO method parameters for subtypes. #273
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
a765a02 to
c51b9bd
Compare
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 refines the DAO method parameter usage check by excluding parameters defined in subtypes of Function, Collector, BiFunction, and SelectOptions from error highlighting. Key changes include:
- Adding new SQL test files and Java/Kotlin classes (e.g., HogeSelectOptions, HogeBiFunction) to exercise the updated behavior.
- Refactoring the inspection logic by replacing multiple specific checks (isFunctionClazz, isCollector, isSelectOption) with a unified isIgnoreUsageCheck method.
- Cleaning up unused methods and updating related utility classes and tests to support the new exclusion rules.
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| selectHogeFunction.sql, selectHogeCollector.sql, functionDoesNotCauseError.sql | Added SQL test files for new parameter usage scenarios |
| HogeSelectOptions.java, HogeBiFunction.java | Introduced subtype classes for testing purposes |
| SelectReturnTypeTestDao.java | Updated return type error message test expectations |
| DaoMethodVariableInspectionTestDao.java | Modified test methods to use new subtypes and error markers |
| DomaUseVariableTest.kt | Updated test fixture setup to include new test files and Java files |
| UsedDaoMethodParamInspectionVisitor.kt | Refactored parameter filtering logic to use isIgnoreUsageCheck() method |
| PsiParameterExtension.kt | Added helper function isIgnoreUsageCheck() and updated type matching logic |
| DomaAnnotationType.kt, DomaClassName.kt, PsiDaoMethod.kt | Removed unused methods and integrated new subtype handling |
Comments suppressed due to low confidence (2)
src/main/kotlin/org/domaframework/doma/intellij/extension/psi/PsiParameterExtension.kt:30
- [nitpick] Consider adding a comment explaining why these specific types are ignored in the usage check to improve maintainability for future developers.
fun PsiParameter.isIgnoreUsageCheck(): Boolean =
src/main/kotlin/org/domaframework/doma/intellij/common/psi/PsiDaoMethod.kt:102
- Verify that the removal of isSelectTypeCollect() does not inadvertently impact functionality, ensuring that the new isIgnoreUsageCheck logic fully covers all required cases.
}
...rg/domaframework/doma/intellij/inspection/dao/visitor/UsedDaoMethodParamInspectionVisitor.kt
Show resolved
Hide resolved
2fdfca0 to
dc4b98a
Compare
…types of the specified type, to be fixed later.
dc4b98a to
7686c12
Compare
Exclude parameters defined in subtypes of unused types in the SQL template from error highlighting in DAO methods: