Invalid generation of @JsonRpcData when using lsp4j 0.21 and xtend 2.31.0
dvojtise opened this issue · comments
When installing lsp4j and xtend from the current Eclipse release update site (2023-06) It installs lspj4 0.21.0 and xtend 2.31.0
(I started from Eclipse Modeling 2023-06 and then installed lsp4j using the updatesite https://download.eclipse.org/releases/2023-06/ )
A simple project using @JsonRpcData from lsp4j.generator will now fail. The generated java class is incorrect. (the toString
package bug_lsp4j_xtend
import org.eclipse.lsp4j.generator.JsonRpcData
@JsonRpcData
class MyAnnotatedClass {
}
will generate a code that doesn't compile
An equivalent code was working in the previous release I tried (xtend 2.25.0 + lsp4j 0.14.0) (I haven't tried yet to find the exact last working version ...)
project showing the issue joined
bug_lsp4j_xtend_2023-06.zip
how does your manifest look like? package import (org.eclipse.lsp4j.util)? require bundle?
(The example project is joined if you want to try)
this is using require bundle
you dont have a dependency to lsp4j itself? is this intentional?
if yes you have to provide your own ToStringBuilder in
bug_lsp4j_xtend.util package
@jonahgraham maybe we should move the ToStringBuilder class to jsonrpc module? the problem is this is not a runtime dependency
I mainly need to use the same approach as lsp4j in order to generate similar protocols. JSONRPC based but neither DAP nor LSP. (your jsonrpc lib is cool ;-) )
I added several of the other bundles in the dependencies, without better result on this example.
simply copy the ToStringBuilder class to xxx.util package
Thanks, it works
I'll update my projects with that
BTW, I second your proposal about moving the ToStringBuilder class since I haven't seen any differences between
https://github.com/eclipse-lsp4j/lsp4j/blob/main/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/util/ToStringBuilder.java
and
https://github.com/eclipse-lsp4j/lsp4j/blob/main/org.eclipse.lsp4j.debug/src/main/java/org/eclipse/lsp4j/debug/util/ToStringBuilder.java
yes it is the same, but we dont have a util place that is available from both
@jonahgraham maybe we should move the ToStringBuilder class to jsonrpc module?
Yes that makes sense. The generator makes code that works with jsonrpc, so having the ToStringBuilder in (e.g.) new package org.eclipse.lsp4j.jsonrpc.util
makes sense to me.
the problem is this is not a runtime dependency
Sorry, I don't know what you mean here? Does this mean that org.eclipse.lsp4j.jsonrpc
is not a runtime dep of the generator? Is it a problem adding it?
@jonahgraham no its not a (runtime) dependency of org.eclipse.lsp4j itself. so it wont work at runtime
or pde is fooling me. in the manifest i can see a package import