https://kotlinlang.org logo
s

SrSouza

07/03/2020, 11:23 PM
Hi @ilya.chernikov, in the previous versions I use
actualClassLoader
in the Evaluation Configuration, but now, it is not available with public access, there is any alternative to it? to load the script in a my custom classloader?
i

ilya.chernikov

07/06/2020, 7:35 AM
Yes,
actualClassloader
always meant to be an internal thing for the evaluator. The
baseClassloader
is the one you need.
s

SrSouza

07/07/2020, 12:13 AM
Do you have any examples using
baseClassLoader
? In my old implementation I was doing this using `actualClassLoader`: https://github.com/DevSrSouza/Bukkript/blob/master/host/src/main/kotlin/br/com/devsrsouza/bukkript/host/loader/BukkriptScriptClassLoaderImpl.kt#L20
The idea here is that I have Script in separated classloader but a other script can access the classes from the other script.
i

ilya.chernikov

07/08/2020, 12:21 PM
Just set the
ScriptEvaluationConfiguration.jvm.baseClassLoader
the same way you did it with
actualClassloader
. The
actualClassloader
is built on top of the base one by adding dependencies and other scopes when needed. It is saved into configuration to reuse it between imported scripts, and I see no reasons so far to make it open for modifications, it may lead to the subtly broken evaluations instead.