Skip to content

Commit fcfa9f4

Browse files
committed
Refactor DaoAnnotationOptionParameterCheckProcessor to use allFields for property checks
1 parent ff2ad95 commit fcfa9f4

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/processor/option/DaoAnnotationOptionParameterCheckProcessor.kt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,11 @@ class DaoAnnotationOptionParameterCheckProcessor(
110110
val valueFields = fields.text.replace("\"", "").split(".")
111111
var searchParamType: PsiType = entityClass.psiClassType
112112
var searchParamClass: PsiClass? = project.getJavaClazz(searchParamType)
113-
var hasError = false
114113

115-
valueFields.forEachIndexed { index, field ->
114+
valueFields.forEachIndexed { _, field ->
116115
val currentField =
117116
searchParamClass
118-
?.fields
117+
?.allFields
119118
?.find { property -> isOptionTargetProperty(property, field, project) }
120119
// Given that the first `searchParamType` is assumed to contain the type of Entity class,
121120
// checking the index for a primitive type is unnecessary.
@@ -128,7 +127,6 @@ class DaoAnnotationOptionParameterCheckProcessor(
128127
field,
129128
optionName,
130129
).highlightElement(holder)
131-
hasError = true
132130
return@map
133131
} else {
134132
if (currentField != null) {
@@ -143,7 +141,6 @@ class DaoAnnotationOptionParameterCheckProcessor(
143141
searchParamClass?.name ?: "Unknown",
144142
getTargetOptionProperties(searchParamClass),
145143
).highlightElement(holder)
146-
hasError = true
147144
return@map
148145
}
149146
}
@@ -172,12 +169,12 @@ class DaoAnnotationOptionParameterCheckProcessor(
172169
}
173170

174171
private fun getTargetOptionProperties(paramClass: PsiClass?) =
175-
paramClass?.fields?.filter { isOptionTargetProperty(it, it.name, project) }?.joinToString(", ") { it.name.substringAfter(":") }
172+
paramClass?.allFields?.filter { isOptionTargetProperty(it, it.name, project) }?.joinToString(", ") { it.name.substringAfter(":") }
176173
?: "No fields found"
177174

178175
private fun getEmbeddableProperties(embeddableClass: PsiClass?) =
179176
embeddableClass
180-
?.fields
177+
?.allFields
181178
?.filter { !TypeUtil.isEntity(it.type, project) && !TypeUtil.isEmbeddable(it.type, project) }
182179
?.joinToString(", ") { it.name }
183180
?: "No properties found"

0 commit comments

Comments
 (0)