File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,7 @@ import org.utbot.framework.plugin.api.util.doubleStreamClassId
151
151
import org.utbot.framework.plugin.api.util.doubleStreamToArrayMethodId
152
152
import org.utbot.framework.plugin.api.util.intStreamClassId
153
153
import org.utbot.framework.plugin.api.util.intStreamToArrayMethodId
154
+ import org.utbot.framework.plugin.api.util.isPackagePrivate
154
155
import org.utbot.framework.plugin.api.util.isSubtypeOf
155
156
import org.utbot.framework.plugin.api.util.longStreamClassId
156
157
import org.utbot.framework.plugin.api.util.longStreamToArrayMethodId
@@ -1112,7 +1113,10 @@ open class CgMethodConstructor(val context: CgContext) : CgContextOwner by conte
1112
1113
private fun FieldId.getAccessExpression (variable : CgVariable ): CgExpression =
1113
1114
// Can directly access field only if it is declared in variable class (or in its ancestors)
1114
1115
// and is accessible from current package
1115
- if (variable.type.hasField(this ) && canBeReadFrom(context)) {
1116
+ if (variable.type.hasField(this )
1117
+ && (! isPackagePrivate || variable.type.packageName == context.testClassPackageName)
1118
+ && canBeReadFrom(context)
1119
+ ) {
1116
1120
if (jField.isStatic) CgStaticFieldAccess (this ) else CgFieldAccess (variable, this )
1117
1121
} else {
1118
1122
utilsClassId[getFieldValue](variable, this .declaringClass.name, this .name)
You can’t perform that action at this time.
0 commit comments