File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed
utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/util
utbot-sample/src/main/java/org/utbot/examples/annotations Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -37,10 +37,10 @@ infix fun ClassId.isAccessibleFrom(packageName: String): Boolean {
37
37
* Returns field of [this], such that [methodId] is a getter for it (or null if methodId doesn't represent a getter)
38
38
*/
39
39
internal fun ClassId.fieldThisIsGetterFor (methodId : MethodId ): FieldId ? =
40
- allDeclaredFieldIds.firstOrNull { it.getter == methodId }
40
+ allDeclaredFieldIds.firstOrNull { ! it.isStatic && it.getter == methodId }
41
41
42
42
/* *
43
43
* Returns field of [this], such that [methodId] is a setter for it (or null if methodId doesn't represent a setter)
44
44
*/
45
45
internal fun ClassId.fieldThisIsSetterFor (methodId : MethodId ): FieldId ? =
46
- allDeclaredFieldIds.firstOrNull { it.setter == methodId }
46
+ allDeclaredFieldIds.firstOrNull { ! it.isStatic && it.setter == methodId }
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import org.utbot.framework.plugin.api.util.voidClassId
15
15
*/
16
16
// TODO: change parameter from packageName: String to context: CgContext in ClassId.isAccessibleFrom and ExecutableId.isAccessibleFrom ?
17
17
internal infix fun FieldId.isAccessibleFrom (context : CgContext ): Boolean {
18
- if (context.codegenLanguage == CodegenLanguage .KOTLIN ) {
18
+ if (! isStatic && context.codegenLanguage == CodegenLanguage .KOTLIN ) {
19
19
// Here we call field accessible iff its getter is accessible, checks for setter are made in FieldId.canBeSetIn
20
20
return declaringClass.allMethods.contains(getter) && getter.isAccessibleFrom(context.testClassPackageName)
21
21
}
@@ -31,7 +31,7 @@ internal infix fun FieldId.isAccessibleFrom(context: CgContext): Boolean {
31
31
* Whether or not a field can be set without reflection
32
32
*/
33
33
internal fun FieldId.canBeSetIn (context : CgContext ): Boolean {
34
- if (context.codegenLanguage == CodegenLanguage .KOTLIN ) {
34
+ if (! isStatic && context.codegenLanguage == CodegenLanguage .KOTLIN ) {
35
35
return declaringClass.allMethods.contains(setter) && setter.isAccessibleFrom(context.testClassPackageName)
36
36
}
37
37
return isAccessibleFrom(context) && ! isFinal
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public static void setStaticBoxedInt(@NotNull Integer staticBoxedInt) {
21
21
}
22
22
23
23
@ SuppressWarnings ("NullableProblems" )
24
- public Integer getBoxedInt () {
24
+ public @ NotNull Integer getBoxedInt () {
25
25
return boxedInt ;
26
26
}
27
27
}
You can’t perform that action at this time.
0 commit comments