Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid generation of @JsonRpcData when using lsp4j 0.21 and xtend 2.31.0 #742

Closed
dvojtise opened this issue Jun 19, 2023 · 12 comments · Fixed by #798
Closed

Invalid generation of @JsonRpcData when using lsp4j 0.21 and xtend 2.31.0 #742

dvojtise opened this issue Jun 19, 2023 · 12 comments · Fixed by #798

Comments

@dvojtise
Copy link

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
image

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

@cdietrich
Copy link
Contributor

cdietrich commented Jun 19, 2023

how does your manifest look like? package import (org.eclipse.lsp4j.util)? require bundle?

@dvojtise
Copy link
Author

(The example project is joined if you want to try)

this is using require bundle

@cdietrich
Copy link
Contributor

cdietrich commented Jun 19, 2023

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

@dvojtise
Copy link
Author

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.

@cdietrich
Copy link
Contributor

simply copy the ToStringBuilder class to xxx.util package

@dvojtise
Copy link
Author

Thanks, it works

I'll update my projects with that

@dvojtise
Copy link
Author

dvojtise commented Jun 19, 2023

@cdietrich
Copy link
Contributor

yes it is the same, but we dont have a util place that is available from both

dvojtise added a commit to eclipse-gemoc/gemoc-studio-modeldebugging that referenced this issue Jun 19, 2023
@jonahgraham
Copy link
Contributor

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

@cdietrich
Copy link
Contributor

cdietrich commented Jun 21, 2023

@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

Screenshot 2023-06-21 070742

dvojtise added a commit to eclipse-gemoc/gemoc-studio-modeldebugging that referenced this issue Jul 5, 2023
* use xtend 2.27 in order to compile with java 17

* use tycho 3.0.4

* adapt pom form tycho 3.0.4

* enforce java 17

* pomfirst use xtend 2.31

* add ToStringBuilder required by lsp4j 0.21

cf. eclipse-lsp4j/lsp4j#742

* use lsp4j 0.21

* use newer version of the MergeableManifest from xtext
jonahgraham added a commit that referenced this issue Feb 12, 2024
When the dependency on xbase.lib was removed in #529 it put the
implicit requirement that there is a class called ToStringBuilder
in a sub-package of the xtend class called `util`.

This change provides the ToStringBuilder in an util package
in the org.eclipse.lsp4j.jsonrpc bundle so that consumers
of LSP4J do not need to copy ToStringBuilder into their
own source code.

Fixes #742
@jonahgraham
Copy link
Contributor

The same problem occurs with the less often used reference to Preconditions.

@pisv
Copy link
Contributor

pisv commented Feb 13, 2024

The same problem occurs with the less often used reference to Preconditions.

Looks like it would make sense to handle it in the same way, after #798 is merged.

pisv added a commit that referenced this issue Feb 13, 2024
This is a follow-up to #798, which handles `Preconditions` similarly to `ToStringBuilder`.

See #742 for detailied discussion.
pisv added a commit that referenced this issue Feb 13, 2024
This is a follow-up to #798, which handles `Preconditions` similarly to
`ToStringBuilder`.

See #742 for detailed discussion.
jonahgraham added a commit to jonahgraham/lsp4j that referenced this issue Feb 13, 2024
When the dependency on xbase.lib was removed in eclipse-lsp4j#529 it put the
implicit requirement that there is a class called ToStringBuilder
in a sub-package of the xtend class called `util`.

This change provides the ToStringBuilder in an util package
in the org.eclipse.lsp4j.jsonrpc bundle so that consumers
of LSP4J do not need to copy ToStringBuilder into their
own source code.

Fixes eclipse-lsp4j#742
jonahgraham added a commit that referenced this issue Feb 13, 2024
When the dependency on xbase.lib was removed in #529 it put the
implicit requirement that there is a class called ToStringBuilder
in a sub-package of the xtend class called `util`.

This change provides the ToStringBuilder in an util package
in the org.eclipse.lsp4j.jsonrpc bundle so that consumers
of LSP4J do not need to copy ToStringBuilder into their
own source code.

Fixes #742
jonahgraham added a commit that referenced this issue Feb 13, 2024
When the dependency on xbase.lib was removed in #529 it put the
implicit requirement that there is a class called ToStringBuilder
in a sub-package of the xtend class called `util`.

This change provides the ToStringBuilder in an util package
in the org.eclipse.lsp4j.jsonrpc bundle so that consumers
of LSP4J do not need to copy ToStringBuilder into their
own source code.

Fixes #742
jonahgraham added a commit that referenced this issue Feb 13, 2024
This change provides the Preconditions in an util package in the
org.eclipse.lsp4j.jsonrpc bundle so that consumers of LSP4J do not
need to copy Preconditions into their own source code.

Related to #742
jonahgraham pushed a commit that referenced this issue Feb 13, 2024
This is a follow-up to #798, which handles `Preconditions` similarly to
`ToStringBuilder`.

See #742 for detailed discussion.
jonahgraham pushed a commit that referenced this issue Feb 13, 2024
This is a follow-up to #798, which handles `Preconditions` similarly to
`ToStringBuilder`.

See #742 for detailed discussion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants