Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ class DaoMethodVariableSqlVisitor(

// Recursively explore child elements in a file with PsiRecursiveElementVisitor.
override fun visitElement(element: PsiElement) {
val prevElementType = PsiTreeUtil.prevLeaf(element)?.elementType
if ((
element.elementType == SqlTypes.EL_IDENTIFIER ||
element is SqlElPrimaryExpr
) &&
PsiTreeUtil.prevLeaf(element)?.elementType != SqlTypes.DOT
prevElementType != SqlTypes.DOT &&
prevElementType != SqlTypes.AT_SIGN
) {
iterator = args.minus(elements.toSet()).iterator()
while (iterator.hasNext()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ interface DaoMethodVariableInspectionTestDao {
List<Employee> nonExistSQLFile(String name);

@Select
@Sql("select * from employee where name = /* employee.employeeName */'test'")
Employee noArgumentsUsedInSQLAnnotations(Employee employee,String <error descr="There are unused parameters in the SQL [employeeName]">employeeName</error>);
@Sql("select * from employee where name = /* employee.employeeName */'test' and status = /* @doma.example.entity.Project@status */'status'")
Employee noArgumentsUsedInSQLAnnotations(Employee employee,
String <error descr="There are unused parameters in the SQL [employeeName]">employeeName</error>,
String <error descr="There are unused parameters in the SQL [status]">status</error>,
String <error descr="There are unused parameters in the SQL [doma]">doma</error>);

@SqlProcessor
<R> R biFunctionDoesNotCauseError(Integer id, BiFunction<Config, PreparedSql, R> handler);
Expand All @@ -42,10 +45,12 @@ interface DaoMethodVariableInspectionTestDao {
Project selectOptionDoesNotCauseError(Employee <error descr="There are unused parameters in the SQL [employee]">employee</error>,String searchName,SelectOptions options);

@Select(strategy = SelectType.COLLECT)
Project collectDoesNotCauseError(Employee <error descr="There are unused parameters in the SQL [employee]">employee</error>,Integer id,Collector<Project, ?, Project> collector);
Project collectDoesNotCauseError(Employee <error descr="There are unused parameters in the SQL [employee]">employee</error>,Integer id,
Collector<Project, ?, Project> collector);

@Select
Project collectDoesCauseError(Employee <error descr="There are unused parameters in the SQL [employee]">employee</error>,String searchName,Collector<Project, ?, Project> <error descr="There are unused parameters in the SQL [collector]">collector</error>);
Project collectDoesCauseError(Employee <error descr="There are unused parameters in the SQL [employee]">employee</error>,String searchName,
Collector<Project, ?, Project> <error descr="There are unused parameters in the SQL [collector]">collector</error>);

@Select
Project noErrorWhenUsedInFunctionParameters(Employee employee, Integer count);
Expand Down
Loading