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

[BUG] STS4 4.22.0 + Lombok 1.18.30 + JDK21 refuses to compile "onX" syntax in IDE. #3632

Closed
Ernio3 opened this issue Mar 18, 2024 · 4 comments

Comments

@Ernio3
Copy link

Ernio3 commented Mar 18, 2024

When trying to utilize "onX" feature according to Java>8 syntax, such as (any of the two):

@NoArgsConstructor(onConstructor_ = @Deprecated)
public class Dictionary
{
	@Setter(onMethod_ = @Deprecated)
	private String symbol;
}

...clean install of STS with Lombok refuses to work (IDE-side) even when everything points to proper installation (.ini and "About STS" window) and gives out this error:

Errors occurred during the build.
Errors running builder 'Java Builder' on project 'demo'.
Cannot invoke "org.eclipse.jdt.internal.compiler.lookup.Binding.setAnnotations(org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding[], boolean)" because "this.recipient" is null

...and in IDE view:

Multiple markers at this line
	- Lombok annotation handler class lombok.eclipse.handlers.HandleConstructor$HandleNoArgsConstructor failed - See error log.
	- Lombok annotation handler class lombok.eclipse.handlers.HandleSetter failed - See error log.

Project is set up as a fresh Spring Starter with Gradle 8.6 and Lombok (doesn't really matter tho, as Gradle builds successfully, but STS doesn't with IDE errors):

plugins {
	id 'java'
	id 'org.springframework.boot' version '3.2.3'
	id 'io.spring.dependency-management' version '1.1.4'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'

java {
	sourceCompatibility = '21'
}

repositories {
	mavenCentral()
}

dependencies {
	annotationProcessor 'org.projectlombok:lombok:1.18.30'
	compileOnly 'org.projectlombok:lombok:1.18.30'
	
	implementation 'org.springframework.boot:spring-boot-starter'
	testImplementation 'org.springframework.boot:spring-boot-starter-test'
	
}

To Reproduce
Just install it with versions given.
I've tested this on 2 PCs - Win10 and Win11.

Expected behavior
Well, it should work with clean-installs, shouldn't it? It is the most basic usage.

Version info

  • Lombok 1.18.30
  • STS 4.22.0
  • JDK 21

EDITS
Note 1: This issue is applicable only to "onX" feature. Other @annotations work (in IDE).
Note 2: Using https://projectlombok.org/setup/eclipse#via-eclipse-plugin-installer produces same results.

@Rawi01
Copy link
Collaborator

Rawi01 commented Mar 19, 2024

Please try the latest edge release.

@ahoehma
Copy link

ahoehma commented Mar 20, 2024

Everywhere where I'm using lombok annotations in my code I see now error-markers and eclipse log shows this for example:

java.lang.NoSuchMethodError: 'java.lang.StringBuffer org.eclipse.jdt.internal.compiler.ast.Expression.print(int, java.lang.StringBuffer)' at lombok.eclipse.handlers.EclipseHandlerUtil.createAnnotation(EclipseHandlerUtil.java:1335) at lombok.eclipse.HandlerLibrary$AnnotationHandlerContainer.handle(HandlerLibrary.java:105) at lombok.eclipse.HandlerLibrary.handleAnnotation(HandlerLibrary.java:237) at lombok.eclipse.TransformEclipseAST$AnnotationVisitor.visitAnnotationOnType(TransformEclipseAST.java:265) at lombok.eclipse.EclipseNode.traverse(EclipseNode.java:107) at lombok.eclipse.EclipseAST.traverseChildren(EclipseAST.java:231) at lombok.eclipse.EclipseNode.traverse(EclipseNode.java:74) at lombok.eclipse.EclipseAST.traverseChildren(EclipseAST.java:231) at lombok.eclipse.EclipseNode.traverse(EclipseNode.java:69) at lombok.eclipse.EclipseAST.traverse(EclipseAST.java:224) at lombok.eclipse.TransformEclipseAST.go(TransformEclipseAST.java:222) at lombok.eclipse.TransformEclipseAST.transform(TransformEclipseAST.java:183) at lombok.eclipse.TransformEclipseAST.transform_swapped(TransformEclipseAST.java:107) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at lombok.launch.PatchFixesHider$Util.invokeMethod(PatchFixesHider.java:133) at lombok.launch.PatchFixesHider$Transform.transform_swapped(PatchFixesHider.java:256) at org.eclipse.jdt.internal.compiler.parser.Parser.endParse(Parser.java:11465) at org.eclipse.jdt.internal.core.util.CommentRecorderParser.endParse(CommentRecorderParser.java:131) at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:12666) at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:12896) at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:12853) at org.eclipse.jdt.internal.compiler.parser.Parser.dietParse(Parser.java:11236) at org.eclipse.jdt.internal.compiler.Compiler.internalBeginToCompile(Compiler.java:850) at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:393) at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:1251) at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:790) at org.eclipse.jdt.core.dom.ASTParser.internalCreateASTCached(ASTParser.java:1242) at org.eclipse.jdt.core.dom.ASTParser.lambda$0(ASTParser.java:1120) at org.eclipse.jdt.internal.core.JavaModelManager.cacheZipFiles(JavaModelManager.java:5839) at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1120) at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:868) at org.eclipse.jdt.internal.ui.javaeditor.codemining.JavaMethodParameterCodeMiningProvider.getCompilationUnitNode(JavaMethodParameterCodeMiningProvider.java:97) at org.eclipse.jdt.internal.ui.javaeditor.codemining.JavaMethodParameterCodeMiningProvider.collectLineContentCodeMinings(JavaMethodParameterCodeMiningProvider.java:86) at org.eclipse.jdt.internal.ui.javaeditor.codemining.JavaMethodParameterCodeMiningProvider.lambda$0(JavaMethodParameterCodeMiningProvider.java:68) at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)

eclipse.buildId=4.22.0.202403071427
java.version=21.0.2
java.vendor=Eclipse Adoptium
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments: -product org.springframework.boot.ide.branding.sts4
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.springframework.boot.ide.branding.sts4

@ahoehma
Copy link

ahoehma commented Mar 20, 2024

I installed the eclipse-plugin 1.18.32 and using lombok 1.8.32 in my codebase and now the errors are gone.
PS: I also unistalled groovy-development-tools from my eclipse because I "know" that they override somehow internal jdt stuff or something like this ... not sure if this was related or not to the errors - I guess it was not.

@Ernio3
Copy link
Author

Ernio3 commented Mar 20, 2024

Please try the latest edge release.

Actually, 1.18.32 has just been released (it's almost funny it happened day after I wrote my issue) and my initial conclusion is that the problem is fixed and everything is working (with my setup described above).

@Ernio3 Ernio3 closed this as completed Mar 20, 2024
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

3 participants