Skip to content

Conversation

@xterao
Copy link
Collaborator

@xterao xterao commented Jun 24, 2025

Exclude parameters defined in subtypes of unused types in the SQL template from error highlighting in DAO methods:

  • Function
  • Collector
  • BiFunction
  • SelectOptions

@xterao xterao self-assigned this Jun 24, 2025
@github-actions github-actions bot added the fix Bug fixes label Jun 24, 2025
@xterao xterao requested a review from Copilot June 24, 2025 05:14
@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

This comment was marked as outdated.

@xterao xterao force-pushed the fix/usage-check-to-dao-method-param-sub-type branch from a765a02 to c51b9bd Compare June 24, 2025 05:26
@xterao xterao requested a review from Copilot June 24, 2025 05:38
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 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.
        }

@xterao xterao force-pushed the fix/usage-check-to-dao-method-param-sub-type branch from 2fdfca0 to dc4b98a Compare June 24, 2025 06:36
…types of the specified type, to be fixed later.
@xterao xterao force-pushed the fix/usage-check-to-dao-method-param-sub-type branch from dc4b98a to 7686c12 Compare June 24, 2025 06:48
@xterao xterao merged commit 7bd4492 into main Jun 24, 2025
3 checks passed
@xterao xterao deleted the fix/usage-check-to-dao-method-param-sub-type branch June 24, 2025 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix parameter type checks for parameters with a specific parent type.

2 participants