kotlin-eclipse-2022 icon indicating copy to clipboard operation
kotlin-eclipse-2022 copied to clipboard

StackOverflowError

Open schaarda opened this issue 3 years ago • 8 comments

I was hoping this fork would allow me to work with Kotlin in Eclipse, but whenever I open a .kts-File (Kotlin Script Editor) Eclipse hangs for a while and then gives me this error:

java.lang.StackOverflowError at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:380) at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedNotNullLazyValue.invoke(LockBasedStorageManager.java:489) at org.jetbrains.kotlin.storage.StorageKt.getValue(storage.kt:42) at org.jetbrains.kotlin.descriptors.impl.LazyPackageViewDescriptorImpl.getFragments(LazyPackageViewDescriptorImpl.kt) at org.jetbrains.kotlin.core.resolve.BuiltInsReferenceResolver.initialize(BuiltInsReferenceResolver.java:119) at org.jetbrains.kotlin.core.resolve.BuiltInsReferenceResolver.<init>(BuiltInsReferenceResolver.java:78) at org.jetbrains.kotlin.core.model.KotlinCommonEnvironment.<init>(KotlinCommonEnvironment.kt:152) at org.jetbrains.kotlin.core.model.KotlinScriptEnvironment.<init>(KotlinEnvironment.kt:118) at org.jetbrains.kotlin.core.model.KotlinScriptEnvironment.<init>(KotlinEnvironment.kt:114) at org.jetbrains.kotlin.core.model.KotlinScriptEnvironment$Companion$getEnvironment$1.invoke(KotlinEnvironment.kt:174) at org.jetbrains.kotlin.core.model.KotlinScriptEnvironment$Companion$getEnvironment$1.invoke(KotlinEnvironment.kt:163) at org.jetbrains.kotlin.core.model.CachedEnvironment.getOrCreateEnvironment(CachedEnvironment.kt:37) at org.jetbrains.kotlin.core.model.KotlinScriptEnvironment$Companion.getEnvironment(KotlinEnvironment.kt:173) at org.jetbrains.kotlin.core.model.KotlinEnvironmentKt.getEnvironment(KotlinEnvironment.kt:90) at org.jetbrains.kotlin.core.builder.KotlinPsiManager.parseText(KotlinPsiManager.kt:366) at org.jetbrains.kotlin.core.builder.KotlinPsiManager.parseFile(KotlinPsiManager.kt:360) at org.jetbrains.kotlin.core.builder.ScriptsFilesStorage.getPsiFile(KotlinPsiManager.kt:68) at org.jetbrains.kotlin.core.builder.KotlinPsiManager.getParsedFile(KotlinPsiManager.kt:268) at org.jetbrains.kotlin.core.model.KotlinScriptEnvironment.<init>(KotlinEnvironment.kt:121) at org.jetbrains.kotlin.core.model.KotlinScriptEnvironment.<init>(KotlinEnvironment.kt:114) at org.jetbrains.kotlin.core.model.KotlinScriptEnvironment$Companion$getEnvironment$1.invoke(KotlinEnvironment.kt:174) at org.jetbrains.kotlin.core.model.KotlinScriptEnvironment$Companion$getEnvironment$1.invoke(KotlinEnvironment.kt:163) at org.jetbrains.kotlin.core.model.CachedEnvironment.getOrCreateEnvironment(CachedEnvironment.kt:37) at org.jetbrains.kotlin.core.model.KotlinScriptEnvironment$Companion.getEnvironment(KotlinEnvironment.kt:173) at org.jetbrains.kotlin.core.model.KotlinEnvironmentKt.getEnvironment(KotlinEnvironment.kt:90) at org.jetbrains.kotlin.core.builder.KotlinPsiManager.parseText(KotlinPsiManager.kt:366) at org.jetbrains.kotlin.core.builder.KotlinPsiManager.parseFile(KotlinPsiManager.kt:360) at org.jetbrains.kotlin.core.builder.ScriptsFilesStorage.getPsiFile(KotlinPsiManager.kt:68) at org.jetbrains.kotlin.core.builder.KotlinPsiManager.getParsedFile(KotlinPsiManager.kt:268) at org.jetbrains.kotlin.core.model.KotlinScriptEnvironment.<init>(KotlinEnvironment.kt:121) at org.jetbrains.kotlin.core.model.KotlinScriptEnvironment.<init>(KotlinEnvironment.kt:114) at org.jetbrains.kotlin.core.model.KotlinScriptEnvironment$Companion$getEnvironment$1.invoke(KotlinEnvironment.kt:174) at org.jetbrains.kotlin.core.model.KotlinScriptEnvironment$Companion$getEnvironment$1.invoke(KotlinEnvironment.kt:163) at org.jetbrains.kotlin.core.model.CachedEnvironment.getOrCreateEnvironment(CachedEnvironment.kt:37) at org.jetbrains.kotlin.core.model.KotlinScriptEnvironment$Companion.getEnvironment(KotlinEnvironment.kt:173) at org.jetbrains.kotlin.core.model.KotlinEnvironmentKt.getEnvironment(KotlinEnvironment.kt:90) at org.jetbrains.kotlin.core.builder.KotlinPsiManager.parseText(KotlinPsiManager.kt:366) at org.jetbrains.kotlin.core.builder.KotlinPsiManager.parseFile(KotlinPsiManager.kt:360) at org.jetbrains.kotlin.core.builder.ScriptsFilesStorage.getPsiFile(KotlinPsiManager.kt:68) at org.jetbrains.kotlin.core.builder.KotlinPsiManager.getParsedFile(KotlinPsiManager.kt:268) at org.jetbrains.kotlin.core.model.KotlinScriptEnvironment.<init>(KotlinEnvironment.kt:121) at org.jetbrains.kotlin.core.model.KotlinScriptEnvironment.<init>(KotlinEnvironment.kt:114) [...]

.kt-Files are working, but for editing Gradle-Buildfiles I need the Script Editor. I tested with Eclipse 2021-06 and 2021-09 (both fresh installs) and both had the same error.

schaarda avatar Nov 16 '21 07:11 schaarda

Try please update-site for eclipse 2021-09 once again. I get changes of @Niof and it works good for me.

bvfalcon avatar Nov 16 '21 14:11 bvfalcon

Hello Vladimir,

thanks for the update. The StackOverflowError ist gone now!

Unfortunately there seem to be even more problems along the road. I already answered to @Niof here: https://github.com/JetBrains/kotlin-eclipse/pull/141#issuecomment-972643329

schaarda avatar Nov 18 '21 08:11 schaarda

@schaarda: Thanks for the feedback. I fixed that issue in all branches of my repository. @bvfalcon: Maybe you can merge those again so she has the update site?`

Also there are new branches for kotlin 1.6.0: kotlin/1.6.0/idea/2021.2/eclipse/4.21

However you will get many errors when opening a build.gradle.kts file as there is no integration with gradle. So it wont know about gradle specific things like the project variable being available and so on. And i dont think that thats easy to implement in the near future.

JulianHahn96 avatar Nov 21 '21 15:11 JulianHahn96

Time to time i work on kotlin and i use this version of the plugin. I see there are not activity from Jetbrain side on improving this plugin recently. So should we put effort on a single fork all of us and maintain this plugin as much as we can ? May be we can see if we can find a FOSS subscription from jfrog for hosting the update sites. WDYT ?

gayanper avatar Nov 21 '21 17:11 gayanper

sounds good to me. I would be up for it.

JulianHahn96 avatar Nov 21 '21 18:11 JulianHahn96

Excellent idea :) For start, I can automatize plugin build. all subprojects are built with "mvn clean package", except one. kotlin-bundled-compiler is built with "gradlew clean getBundled". Then, in nearest days I make common unified build method and settings for Github Packages. After that update-site for plugin can be build fully automatized by everyone. And I hope, JetBrains will merge our changes into original Jetbrains/kotlin-eclipse repository. I am agree with @schaarda , they have conflict of interests (IntelliJ Idea is direct competitor of Eclipse), but the mind must win :)

bvfalcon avatar Nov 21 '21 19:11 bvfalcon

so we keep this fork as the main one or do we make a completely new one? Maybe we should set up some other form of chat for that topic tho. It does not really belong here in an issue

JulianHahn96 avatar Nov 21 '21 19:11 JulianHahn96

Looks like IntelliJ has not completely abandoned the plugin (yet). They just updated the Eclipse Marketplace today with a new version 1.5.31 - coincidence? The StackOverflowError is gone there, too. But the next error down the line still exists: Even if I create a new Kotlin Project (with the automatically added dependencies) whenever I create or edit a Kotlin Script I get the following error: Cannot access script base class 'org.jetbrains.kotlin.core.script.template.ProjectScriptTemplate'

It's the same with the version from the marketplace and with your branch. And it's old, too: https://youtrack.jetbrains.com/issue/KE-360

Guess I'll annoy them a little bit more...

schaarda avatar Nov 22 '21 08:11 schaarda