Skip to content

Commit fe6b7af

Browse files
committed
Add fallback for parent class name retrieval in validation property result
1 parent dd18e42 commit fe6b7af

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/main/kotlin/org/domaframework/doma/intellij/common/sql/validator/result/ValidationPropertyResult.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ class ValidationPropertyResult(
3737
parent: PsiParentClass?,
3838
) {
3939
val project = identify.project
40+
val parentClassType = parentClass?.type
4041
val parentName =
4142
parentClass?.clazz?.name
42-
?: (parentClass?.type as? PsiClassType)?.name
43+
?: (parentClassType as? PsiClassType)?.name
44+
?: parentClassType?.canonicalText
4345
?: ""
4446
holder.registerProblem(
4547
identify,

src/test/testData/src/main/resources/META-INF/doma/example/dao/EmployeeSummaryDao/bindVariableForEntityAndNonEntityParentClass.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ INSERT INTO employee_project (employee_name, department, project)
1111
AND e1.user_dept = /*# "development" */'dev'
1212
-- Access to parent private field
1313
WHERE u1.user_name = /* employee.userName.toLowerCase() */'name'
14+
OR u1.name = /* employee.userName.isBlank().<error descr="The field or method [x] does not exist in the class [boolean]">x</error> */'boolean'
1415
-- Access to non-existent parent field
1516
OR u1.user_name = /* employee.<error descr="The field or method [userFirstName] does not exist in the class [Employee]">userFirstName</error>.toLowerCase() */'name'
1617
-- Public parent method

0 commit comments

Comments
 (0)