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

Lombok, Eclipse and JDK10 fails when using the var keyword #1676

Closed
polle opened this issue May 2, 2018 · 22 comments
Closed

Lombok, Eclipse and JDK10 fails when using the var keyword #1676

polle opened this issue May 2, 2018 · 22 comments

Comments

@polle
Copy link

polle commented May 2, 2018

If using the 'var' keyword in Eclipse with Lombok and JDK10 I get the following error in Eclipse:

'var' is not allowed here
Using the latest Edge build of Lombok: version: 1.16.21 (2018-04-23 21:43:58 UTC)

If I remove Lombok it works.

java10-vs-lombok-var

@MikeWrightDev
Copy link

I'm also seeing this. I presume that because JDK 10 also has a "var" this is somehow clashing with the Lombok "var" feature. I suspect we will need a release of Lombok that does not contain the "var" feature for JDK 10 onwards?

If guess I could do build a custom build of Lombok that does not contain "var" feature... Any clues as the difficulty before I dive in?

@rcsoyer
Copy link

rcsoyer commented May 12, 2018

I have the same problem. I'm using the latest release of Eclipse Oxygen. If I put lombok on eclipse, "var" doesn't work. In another issues of lombok project, people said that using lombok edge (https://projectlombok.org/download-edge) would fix. Even with the referred version of lombok, I can't use "var".

@rspilker
Copy link
Collaborator

Did you remove import lombok.var?

@rspilker rspilker added the parked Without further feedback this bug cannot be processed. If no feedback is provided, we close these. label May 14, 2018
@MikeWrightDev
Copy link

Yep, there is no trace of Lombok in any import. Here is some sample code:

package perfparse;
public class TestLombok {
	public static void main(String[] args) {
		var i = 0;
	}
}

In eclipse the "var" has a error on it which says:
'var' is not allowed here Parse.java /perfparse/src/main/java/perfparse line 49 Java Problem

@gajatko
Copy link

gajatko commented May 29, 2018

Same in Intellij IDEA. Since a "full JDK 10 supported" had been anounced, I have migrated to JAVA 10 and removed all import lombok.var to switch to JAVA's var and got IDE errors.
What's even worse, a maven compilation succeds after removing imports, but it fails when imports are present. So I have to migrate back to JDK 8 (because BOTH IDE and maven compilation must work)

@re-thc
Copy link

re-thc commented May 29, 2018

The new 1.6.22 release seems to have fixed this. At least it did for me on Eclipse.

@gajatko
Copy link

gajatko commented May 30, 2018

I'll give it a shot. Is an IntelliJ user here other than me, who can confirm the issue?

@MikeWrightDev
Copy link

Still not working on Eclipse Oxygen.3a for me. Same problem as before.

@eerokosk
Copy link

Same problem in Visual Studio Code with Lombok version 1.16.22.

If you are using "import lombok.var" VSCode thinks that code is fine but Gradle doesn't build it. If you aren't using import VSCode thinks that code has errors, but Gradle build it without problems.

@gajatko
Copy link

gajatko commented May 30, 2018

Looks like a plugin(s) problem to me. I propose to change title of the issue to:
"Lombok, Eclipse/IntelliJ Idea/VSCode and JDK10 fails when using the var keyword"

@MikeWrightDev
Copy link

Is this commit related to fixing this issue?

@gajatko
Copy link

gajatko commented Jun 4, 2018

Is there any progress on resolving the issue?

@rspilker rspilker removed the parked Without further feedback this bug cannot be processed. If no feedback is provided, we close these. label Jun 4, 2018
@rspilker
Copy link
Collaborator

rspilker commented Jun 4, 2018

Not progress yet, we do not know why if the import is not present the IDEs give errors.

@rspilker
Copy link
Collaborator

rspilker commented Jun 4, 2018

Did someone test this in an IDE without lombok installed?

@rspilker
Copy link
Collaborator

rspilker commented Jun 4, 2018

@rspilker
Copy link
Collaborator

rspilker commented Jun 4, 2018

Hmm, on the other hand https://www.kevinhooke.com/2018/03/26/update-java-10-with-eclipse-oxygen-3a-4-7-3a-rc2-working/ seems to get it working.

@rspilker
Copy link
Collaborator

rspilker commented Jun 4, 2018

We fixed it for Eclipse. for IntelliJ or VSCode, please register issues in their projects.

@MikeWrightDev
Copy link

Roel, it looks like your patch reacts to the presence of the import lombok.var. Pretty cool. I was expecting some patch that just detected JDK 10+ and just disabled the feature. This is cool because (I think) it says "if the import is there, apply Lombok".

@akrestan
Copy link

akrestan commented Oct 15, 2018

Hello, may I ask about this issue: how it has been resolved if it's been resolved?

With the latest Eclipse Java EE IDE for Web Developers Version: 2018-09 and the latest lombok 1.18.2 I am still getting this error when the Eclipse's JVM is instrumented with -javaagent:lombok.jar even if there is no import of the lombok.var type anywhere in the Java source code and the lombok.jar is not among the project's dependencies. It does not matter if the compiler compliance level is Java 10 or Java 11

@eerokosk
Copy link

With current version of Lombok (1.18.2) and VS Code everything work like charm when you are using Java 8, Java 9, Java 10 or Java 11. Haven't tested with Java 12 EA yet ;)

VS Code and Eclipse are using similar technologies for Java so i am quite sure that everything works with latest Eclipse as well especially if configured right.

With VS Code i am using following configuration:

{
"folders": [
{
"path": "."
}
],
"settings": {
"java.home": "/opt/java/java-11",
"java.configuration.updateBuildConfiguration": "automatic"
"java.jdt.ls.vmargs": "-javaagent:/home/eero/java/lombok/1.18.2/lombok.jar -Xbootclasspath/a:/home/eero/java/lombok/1.18.2/lombok.jar"
}
}

Best,

Eero.

@akrestan
Copy link

akrestan commented Oct 16, 2018

....

"java.jdt.ls.vmargs": "-javaagent:/home/eero/java/lombok/1.18.2/lombok.jar -Xbootclasspath/a:/home/eero/java/lombok/1.18.2/lombok.jar"

Thanks for coming back to me on this. However, with C:\Eclipse4.9\eclipse.exe -vm c:\JDK11\bin\javaw.exe -vmargs -javaagent:lombok.jar

with lombok.jar being @ 1.18.2, latest Eclipse for Java EE developers and JDK11 being OpenJDK there is still:

'var' is not allowed here

If the instrumentation of the JVM with lombok.jar is removed everything works fine.

@akrestan
Copy link

akrestan commented Nov 7, 2018

With the very latest patch of Eclipse Java EE IDE for Web Developers, Version: 2018-09 (4.9.0) for Java 11 it has begun to work.

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

No branches or pull requests

8 participants