Filter out local classes on JSR-223 properties mapping

fixes e.g. Spring framework usages of the JSR-223 engine
This commit is contained in:
Ilya Chernikov
2019-07-26 15:46:55 +02:00
parent 2ae19e1d42
commit 333c7ff688
@@ -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)