Stackoverflow in Eclipse plugin

I get a stack overflow each time I change the project settings. It is a multi project configuration with Gradle. I used Eclipse 2020-03 and Kotlin Plugin 0.8.20

The stack trace is

!ENTRY 4 2 2020-04-22 09:34:41.091
!MESSAGE An internal error occurred during: "Building".
	at java.base/java.util.HashMap.hash(
	at java.base/java.util.HashMap.get(
	at org.eclipse.jdt.internal.core.JavaModelManager.getPerProjectInfo(
	at org.eclipse.jdt.internal.core.JavaModelManager.getPerProjectInfoCheckExistence(
	at org.eclipse.jdt.internal.core.JavaProject.getPerProjectInfo(
	at org.eclipse.jdt.internal.core.JavaProject.getResolvedClasspath(
	at org.jetbrains.kotlin.core.utils.ProjectUtils.getDependencyProjects(ProjectUtils.kt:105)
	at org.jetbrains.kotlin.core.utils.ProjectUtils.getDependencyProjects(ProjectUtils.kt:109)
	at org.jetbrains.kotlin.core.utils.ProjectUtils.getDependencyProjects(ProjectUtils.kt:109)
	at org.jetbrains.kotlin.core.utils.ProjectUtils.getDependencyProjects(ProjectUtils.kt:109)
	at org.jetbrains.kotlin.core.utils.ProjectUtils.getDependencyProjects(ProjectUtils.kt:109)

I would recommend using Eclipse buildship plugin and use the gradle init command directly in eclipse which immediately creates a good working kotlin code with ready made generated codes

go to
Help → Eclipse Marketplace
and search for “gradle”
You will see “Buildship Gradle Integration 3.0”
Install it and restart eclipse

mostly it will come with Eclipse J2EE

Then create the project
File → New → Other → Gradle → Gradle Project
press next and give the project name
then finish

Then go to
Window → Show View → Console
WIndow → Show View → Gradle Tasks

it will show all the gradle tasks, double click it

I use Buildship already.

I imported an existing “multi project” Gradle project and added to 1 sub-project the Kotlin Nature. I did this with the project properties “Project Natures” by hand as I did not find out how to give the Kotlin nature to an existing project. Maybe I have to configure more places to get the full Kotlin features in my sub-project?

If you have another project which is made as new Kotlin Project based on kotlin plugin

you can transfer few lines from the “.project” file from that project to this project

Then kotlin nature will be added, this is actually common for all eclipse project

I copied the parts of the .project and .classpath from a fresh Kotlin project to my Gradle sub-project → still Stack Overflow when I start Eclipse.

I cannot use the Kotlin plugin at all as it does not work (at all)!

Why does the stack overflow occur?

Maybe it is related to this issue of the Buildship plugin: Gradle projects may produce circular references in Buildship. · Issue #460 · eclipse/buildship · GitHub

As Eclipse cannot have multiple source sets per project Buildship imports alle source sets of a Gradle project into 1 classpath. In my case project A depends on project B (compile time) and project B depends on project A (test compile time). For Gradle this does work but the mapping to Eclipse is not possible as of the JDT limitation so that JDT compiler thinks there is a circular dependency. I turned the error message of JDT into a warning.

Probably the Kotlin plugin follows the circular dependency and that causes the stack overflow.

Should the Kotlin plugin “know” that there is a circular dependency and that I allowed it by setting it as warning and not as an error?

Kotlin plugin you can use, Java Based auto completion happiness, like spring boot etc…,
you cannot fully depend on that plugin

but for building you need to use gradle, I would imagine some problem with your main gradle and sub project gradle, probably you need refer some android project from any examples

or I can help you if you give the project without code to me somehow

also let me know the version of gradle you use, I use 5.6.4

I use Gradle 5.6.2

that is fine, it is possible to provide only the two set gradle files, I will look into it
or you tell me what kind of sub project you want to achieve I will help you

In the mentioned Buildship issue is a sample project is given. You could use that. Just add the Kotlin nature and classpath. (62.8 KB) try this project

it has two sub project

include ‘:subproj’
include ‘:proj1’

and kotlin nature enabled

It is probably not about sub-projects. It is because in my case sub project A depends on sub project B (compile time) and sub project B depends on sub project A (test compile time). This is a legal Gradle configuration but does not work with the Kotlin plugin.

And it would be possible to map the Gradle project layout to Eclipse JDT classpath configuration. But it is not done properly neither in the Kotlin-Gradle plugin nor in the Buildship plugin.