Skip to content

Commit e134901

Browse files
committed
Add the fix to ValueConstructor too
1 parent cc7edf4 commit e134901

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

utbot-framework/src/main/kotlin/org/utbot/engine/ValueConstructor.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package org.utbot.engine
33
import org.utbot.common.findField
44
import org.utbot.common.findFieldOrNull
55
import org.utbot.common.invokeCatching
6+
import org.utbot.common.withAccessibility
67
import org.utbot.framework.plugin.api.ClassId
78
import org.utbot.framework.plugin.api.ConstructorId
89
import org.utbot.framework.plugin.api.EnvironmentModels
@@ -390,12 +391,19 @@ class ValueConstructor {
390391
*/
391392
private fun value(model: UtModel) = construct(model, null).value
392393

393-
394394
private fun MethodId.call(args: List<Any?>, instance: Any?): Any? =
395-
method.invokeCatching(obj = instance, args = args).getOrThrow()
395+
method.run {
396+
withAccessibility {
397+
invokeCatching(obj = instance, args = args).getOrThrow()
398+
}
399+
}
396400

397401
private fun ConstructorId.call(args: List<Any?>): Any? =
398-
constructor.newInstance(*args.toTypedArray())
402+
constructor.run {
403+
withAccessibility {
404+
newInstance(*args.toTypedArray())
405+
}
406+
}
399407

400408
/**
401409
* Fetches primitive value from NutsModel to create array of primitives.

0 commit comments

Comments
 (0)