diff --git a/libraries/scripting/jvm-host/src/kotlin/script/experimental/jvmhost/jsr223/propertiesFromContext.kt b/libraries/scripting/jvm-host/src/kotlin/script/experimental/jvmhost/jsr223/propertiesFromContext.kt index ed66041f21c..cdbabb8676d 100644 --- a/libraries/scripting/jvm-host/src/kotlin/script/experimental/jvmhost/jsr223/propertiesFromContext.kt +++ b/libraries/scripting/jvm-host/src/kotlin/script/experimental/jvmhost/jsr223/propertiesFromContext.kt @@ -19,8 +19,8 @@ fun configureProvidedPropertiesFromJsr223Context(context: ScriptConfigurationRef putAll(engineBindings) } for ((k, v) in allBindings) { - // only adding bindings that are not already defined - if (!updatedProperties.containsKey(k)) { + // only adding bindings that are not already defined and also skip local classes + if (!updatedProperties.containsKey(k) && v::class.qualifiedName != null) { // TODO: add only valid names // TODO: find out how it's implemented in other jsr223 engines for typed languages, since this approach prevent certain usage scenarios, e.g. assigning back value of a "sibling" type updatedProperties[k] = KotlinType(v::class)