From 333c7ff6881d1cc78ced8b763b0fc242bbebac80 Mon Sep 17 00:00:00 2001 From: Ilya Chernikov Date: Fri, 26 Jul 2019 15:46:55 +0200 Subject: [PATCH] Filter out local classes on JSR-223 properties mapping fixes e.g. Spring framework usages of the JSR-223 engine --- .../experimental/jvmhost/jsr223/propertiesFromContext.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)