-
Notifications
You must be signed in to change notification settings - Fork 0
Implement Return Type Checking for Select and Function Annotations #266
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
Implement Return Type Checking for Select and Function Annotations #266
Conversation
…d Select annotations
643da87 to
a28f638
Compare
5883cf8 to
712849b
Compare
1ae816d to
3649cfb
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
Implements return type validation for DAO methods annotated with @select and @function, and refactors related processors and tests.
- Introduce
SelectAnnotationReturnTypeCheckProcessorandFunctionAnnotationReturnTypeCheckProcessorto enforce correct return types. - Update
DaoMethodReturnTypeInspectionVisitorto register new processors and adjust base class logic (ReturnTypeCheckerProcessor→TypeCheckerProcessor). - Refactor
SelectParamTypeCheckProcessor, addStrategyParam, and extend test fixtures (addOtherJavaFile) and message bundles.
Reviewed Changes
Copilot reviewed 20 out of 29 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/paramtype/SelectParamTestDao.java | Added new stream/collector return‐type and parameter‐type test cases |
| src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/visitor/DaoMethodReturnTypeInspectionVisitor.kt | Registered processors for @select and @function annotations |
| src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/processor/returntype/SelectAnnotationReturnTypeCheckProcessor.kt | New processor to check @select return types based on strategy |
| src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/processor/returntype/FunctionAnnotationReturnTypeCheckProcessor.kt | New processor to check @function return types |
| src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/processor/TypeCheckerProcessor.kt | Refactored base class; centralized parameter and annotation option lookup |
| src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/processor/paramtype/SelectParamTypeCheckProcessor.kt | Updated stream/collector parameter validation; removed duplication |
| src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/processor/StrategyParam.kt | Introduced helper for reading annotation strategy parameters |
| src/main/resources/messages/DomaToolsBundle*.properties | Added new i18n keys for invalid return type and strategy mismatch |
| src/test/kotlin/org/domaframework/doma/intellij/inspection/dao/AnnotationReturnTypeCheckInspectionTest.kt | Adjusted test DAO names and paths for new return‐type tests |
| src/test/kotlin/org/domaframework/doma/intellij/DomaSqlTest.kt | Added addOtherJavaFile helper for including additional test files |
Comments suppressed due to low confidence (5)
src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/processor/cheker/ProcedureFunctionResultSetParamAnnotationTypeChecker.kt:1
- The directory name 'cheker' is misspelled; consider renaming it to 'checker' to maintain consistency and avoid confusion.
/*
src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/processor/cheker/ProcedureFunctionInOutParamAnnotationTypeChecker.kt:1
- The directory name 'cheker' is misspelled; consider renaming it to 'checker' to maintain consistency.
/*
src/test/testData/src/main/java/doma/example/dao/inspection/paramtype/SelectParamTestDao.java:36
- [nitpick] The parameter name 'stream' is misleading for a BigDecimal; consider renaming it to reflect its purpose or type (e.g., 'value' or 'amount').
BigDecimal selectFunctionInvalidParam(Function<Stream<Map<String, Pckt>>,BigDecimal> <error descr="\"java.util.Map<java.lang.String,doma.example.entity.Pckt>\" is illegal as the type argument of \"java.util.stream.Stream\"">function</error>, BigDecimal stream);
src/test/kotlin/org/domaframework/doma/intellij/inspection/dao/AnnotationParamTypeCheckInspectionTest.kt:43
- Consider adding tests to cover parameter type inspection for @function methods, similar to existing @select parameter type tests, to ensure FunctionAnnotationReturnTypeCheckProcessor rules are validated.
addOtherJavaFile("function", "HogeFunction.java")
src/test/kotlin/org/domaframework/doma/intellij/DomaSqlTest.kt:178
- [nitpick] The path used in addOtherJavaFile may be missing the 'java' segment compared to addDaoJavaFile; consider aligning path conventions to ensure test files are correctly recognized.
"main/$sourceRoot/$packagePath/$packageName/$fileName",
Implemented return type checking for DAO methods annotated with @select and @function.