File tree Expand file tree Collapse file tree 1 file changed +18
-9
lines changed
src/main/kotlin/org/domaframework/doma/intellij/common/util Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -76,21 +76,30 @@ object TypeUtil {
7676 type : PsiType ? ,
7777 project : Project ,
7878 ): Boolean {
79- val clazz = type?.let { project.getJavaClazz(type) }
80- return clazz?.isEntity() == true
79+ var clazz = type?.let { project.getJavaClazz(type) }
80+ while (clazz != null ) {
81+ if (clazz.isEntity()) {
82+ return true
83+ }
84+ clazz = clazz.superClass
85+ }
86+ return false
8187 }
8288
8389 fun isImmutableEntity (
8490 project : Project ,
8591 canonicalText : String ,
8692 ): Boolean {
87- val returnTypeClass = project.getJavaClazz(canonicalText)
88- val entity =
89- returnTypeClass?.getClassAnnotation(DomaClassName .ENTITY .className) ? : return false
90- return entity.let { entity ->
91- AnnotationUtil .getBooleanAttributeValue(entity, " immutable" ) == true
92- } == true ||
93- returnTypeClass.isRecord == true
93+ var returnTypeClass = project.getJavaClazz(canonicalText)
94+ while (returnTypeClass != null ) {
95+ val entity = returnTypeClass.getClassAnnotation(DomaClassName .ENTITY .className)
96+ if (entity != null ) {
97+ return AnnotationUtil .getBooleanAttributeValue(entity, " immutable" ) == true ||
98+ returnTypeClass.isRecord
99+ }
100+ returnTypeClass = returnTypeClass.superClass
101+ }
102+ return false
94103 }
95104
96105 /* *
You can’t perform that action at this time.
0 commit comments