bvfalcon / kotlin-eclipse-2024

Enhanced Kotlin Plugin for Eclipse
https://marketplace.eclipse.org/content/enhanced-kotlin-eclipse
Apache License 2.0
48 stars 7 forks source link

StackOverflowError #17

Open schaarda opened 2 years ago

schaarda commented 2 years ago

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.

bvfalcon commented 2 years ago

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

schaarda commented 2 years ago

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

JulianHahn96 commented 2 years ago

@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.

gayanper commented 2 years ago

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 ?

JulianHahn96 commented 2 years ago

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

bvfalcon commented 2 years ago

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 :)

JulianHahn96 commented 2 years ago

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

schaarda commented 2 years ago

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...