Repository navigation
Description
Describe the bug
I have a Spring Maven application based on the Eclipse IDE. The application contains several plug-in fragments. These fragments use properties files (see below). I use STS 4 of version 4.21.
I have a Kotlin file for configuration properties:
file FoobarConnectProperties.kt:
@Component @ConfigurationProperties(prefix = "foobar.connect") data class FoobarConnectProperties(var host: String = "", var port: Int = 8081) { var project: MutableMap<String, MySecurityProperties> = mutableMapOf() }
Also, I have another Kotlin file with properties (in a different package):
file MySecurityProperties.kt:
@kotlinx.serialization.Serializable data class MySecurityProperties(var user: String, var password: String, var useOAuth: Boolean)
To Reproduce
Run the application. Open the application.yml file. For foobar.connect.project properties try to make an auto-complete (by pressing Ctrl+Space). This auto-completion attempt gives a StackOverFlow error and shows "No proposals" for the given property as a result:
Oct 10, 2021 3:27:48 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint fallbackResponseError SEVERE: Internal error: java.lang.StackOverflowError java.util.concurrent.CompletionException: java.lang.StackOverflowError at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314) at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319) at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718) at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506) at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1705) at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1692) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183) Caused by: java.lang.StackOverflowError at java.base/java.lang.StringBuffer.append(StringBuffer.java:312) at java.base/java.io.StringWriter.write(StringWriter.java:106) at java.base/java.io.StringWriter.append(StringWriter.java:150) at java.base/java.io.StringWriter.append(StringWriter.java:41) at com.google.gson.stream.JsonWriter.beforeValue(JsonWriter.java:650) at com.google.gson.stream.JsonWriter.open(JsonWriter.java:326) at com.google.gson.stream.JsonWriter.beginObject(JsonWriter.java:309) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:240) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:127) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:245) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:127) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:245) ...
If a Kotlin data class with properties is not annotated as Serializable, then everything works just fine without errors.
UPD: In STS3 it works without errors.
Activity
martinlippert commentedon Oct 11, 2021
Hey @Daogreen, can you please share a complete sample project that we could use to reproduce this? That would be awesome. Many many many thanks in advance!!!
Daogreen commentedon Oct 18, 2021
Hello, @martinlippert ! Sorry for the late response.
You can find a sample project here - https://github.com/Daogreen/spring-maven-sample-project.
To reproduce:
For the foo:bar:security properties it shows "No proposals" message and gives
[t=1634537564975] LSP4E to org.eclipse.languageserver.languages.springboot: {"jsonrpc":"2.0","id":"1210","error":{"code":-32603,"message":"Internal error.","data":"java.util.concurrent.CompletionException:...It happens only if a Kotlin data class with properties is annotated as @serializable, without this annotation it works fine.
Please, let me know if you need additional information.
GH-693: avoid random objects to be included in JavaType DTO by flatte…
martinlippert commentedon Dec 3, 2021
Thanks to the sample project and the great description of what exactly to do, I was able to reproduce this error and debug it nicely. Found the issue, this is fixed now for the upcoming STS 4.13.0.RELEASE (coming up next week).
Thanks again @Daogreen for filing this bug report with all those details and the sample project, much appreciated, and of great help. Many many thanks!!!