[1.3.30] copyOfRange in a loaded Class

Hello,

We have an updater which starts the application

Example code:

The executed application via the Updater has different dependencies which use the method copyOfRange some of them use 1.2.71 and other 1.3.30 kotlin version.

The ones which are compiled using 1.3.30 version throw this execution exception:

“message”: “tried to access method kotlin.collections.ArraysKt___ArraysJvmKt.copyOfRange([BII)[B from class asdf.asdf”,
** “exception”: “IllegalAccessError”**

The execution of the method copyOfRange on the 1.2.71 dependencies does not fail.

But, when the application is executed directly (java -jar app.jar) everything works fine.

In resume, when the application is loaded in run time via loadClass the method copyOfRange fails for 1.3.30 dependencies.

It’s most likely a classpath problem of the classloader used to load your class. If the class was compiled against the Kotlin 1.3.30 standard library, it requires the standard library 1.3.x or higher in classpath at run time.

1 Like

You were right.

Thanks for the incredible fast support.