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] Potential NPE in EclipseHandlerUtil.setDocComment(..) #3706

Closed
andi-huber opened this issue Jul 10, 2024 · 2 comments · Fixed by #3726
Closed

[BUG] Potential NPE in EclipseHandlerUtil.setDocComment(..) #3706

andi-huber opened this issue Jul 10, 2024 · 2 comments · Fixed by #3726
Milestone

Comments

@andi-huber
Copy link

Seeing stacktraces in Eclipse's Error Log

java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "compilationUnit" is null
	at lombok.eclipse.handlers.EclipseHandlerUtil.setDocComment(EclipseHandlerUtil.java:2841)
	at lombok.eclipse.handlers.EclipseHandlerUtil.setDocComment(EclipseHandlerUtil.java:2830)
	at lombok.eclipse.handlers.HandleConstructor.generateConstructorJavadoc(HandleConstructor.java:609)
	at lombok.eclipse.handlers.HandleConstructor.generate(HandleConstructor.java:290)
	at lombok.eclipse.handlers.HandleConstructor.generateConstructor(HandleConstructor.java:246)
	at lombok.eclipse.handlers.HandleBuilder.handle(HandleBuilder.java:359)
	at lombok.eclipse.HandlerLibrary$AnnotationHandlerContainer.handle(HandlerLibrary.java:106)
	at lombok.eclipse.HandlerLibrary.handleAnnotation(HandlerLibrary.java:237)
	at lombok.eclipse.TransformEclipseAST$AnnotationVisitor.visitAnnotationOnType(TransformEclipseAST.java:269)

I don't have spent time to provide a reproducible example. However, the mitigation seems trivial. E.g. adding a null guard like

ICompilationUnit compilationUnit = cud.compilationResult.compilationUnit;
if (compilationUnit == null) return; // add null guard, line 2841 in EclipseHandlerUtil

Version info:

  • Lombok 1.18.34
  • Platform Eclipse 4.32 (Release)
@famod
Copy link

famod commented Jul 17, 2024

Same here.

It seems the issue comes from (perfectly legal) Javadoc of members in @Builder classes.
(edit: or maybe that's just yet another issue)

Hi @Rawi01, I'm under the impression that #3669 broke a few things (see also #3709).

@smil2k
Copy link

smil2k commented Aug 21, 2024

Removing javadoc from the class and the methods resolves the problem at my end.

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