Copied from <#C0B8H786P|intellij> --&gt; I've tri...
# scripting
d
Copied from #intellij --> I've tried every trick I have found documented and many I have not to get Intellij kotlin "script" to interop properly with Java 1.8. Whether in REPL or in a scratch if its a '.kts' the exact same code that works for .kt files fails with .kts files when I use an inline function that was compiled using jvm 1.8 (as ALL my settings and projects specify). The complaint is the well known "cant use inline bytecode from 1.8 when compiling into 1.6 bytecode pleas use -jvm-target" -- but from inside intellij you cant specify it (I tried -- ,as well as all the settings, facets, hand-editing the .iml files etc no go. Take the exact same .kts file and rename it to ".kt" works fine. Looking in the kotin compiler source doesnt seem to be another global way to fix this -- its got to be passed down through intellij somewhere -- I've put ever variant I can find in my gradle scripts to no affect. My conclusion is that kotlin script compilation doesnt follow the same paths as kotlin compiling. Any suggestions ?
i
What version are you having problems with? There was an issue https://youtrack.jetbrains.com/issue/KT-29319 that should be completely fixed in 1.3.31 or maybe even earlier. I’m not aware of any other related issues yet.
If this is unrelated to your problem, please file a new issue in YT.
d
This is running 2019.1.2 IU-191-7141.32 That is the exact error message
The latest version I see availble in Toolbox is 2019.1.2
i
And which kotlin version are you using? And could you try to upgrade it to the latest 1.3.31 and see whether the problem is solved?
d
3 months later same issue - using the latest intellij ultimate relase and kotlin 1.3.41 Cannot run any .kts files in intellij -- either as scratchs or in REPL or checked in a s source ".kts" if they invoke any inline code (1.8 error)
i
This is definitely not the behavior I observe. E.g. I created an empty gradle project, set jvmTarget there to 1.8, and added a simple script with inlined lambda - it compiles as expected. Scratch file works as well. Could you please help me to reproduce it? Do you have a sample?
d
I will experiment and get back to you thanks