File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
utbot-framework/src/main/kotlin/org/utbot/framework/modifications Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -17,21 +17,22 @@ class DirectAccessorsAnalyzer {
17
17
*/
18
18
fun collectDirectAccesses (classIds : Set <ClassId >): Set <DirectFieldAccessId > =
19
19
classIds
20
- .flatMap { classId -> collectFieldsInPackage (classId) }
20
+ .flatMap { classId -> collectFields (classId) }
21
21
.map { fieldId -> DirectFieldAccessId (fieldId.declaringClass, directSetterName(fieldId), fieldId) }
22
22
.toSet()
23
23
24
24
/* *
25
- * Collect all fields with different non-private modifiers from class [classId].
25
+ * Collect all fields with different non-private modifiers
26
+ * from class [classId] or it's base classes.
26
27
*/
27
- private fun collectFieldsInPackage (classId : ClassId ): Set <FieldId > {
28
+ private fun collectFields (classId : ClassId ): Set <FieldId > {
28
29
var clazz = classId.jClass
29
30
30
31
val fieldIds = mutableSetOf<Field >()
31
32
fieldIds + = clazz.declaredFields.filterNot { Modifier .isPrivate(it.modifiers) }
32
33
while (clazz.superclass != null ) {
33
34
clazz = clazz.superclass
34
- fieldIds + = clazz.declaredFields.filter { Modifier .isPublic(it.modifiers) || Modifier .isProtected (it.modifiers) }
35
+ fieldIds + = clazz.declaredFields.filterNot { Modifier .isPrivate (it.modifiers) }
35
36
}
36
37
37
38
You can’t perform that action at this time.
0 commit comments