-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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] NPE on @SuperBuilder HandleSuperBuilder.constructorExists(HandleSuperBuilder.java:1198) #2704
Comments
FYI I've managed to fix this by adding a null check on that line and adding a new if condition for no args constructor like so:
If it makes sense maybe include it in a PR |
Can confirm. Changing the failing line to |
Similar reproduce scenario:
Running from command line it works as expected:
Looking forward to the fix to be included in next version. Thank you for all your help! |
…ists [fixes #2704] SuperBuilder: avoid NPE on existing constructors
Describe the bug
I'm getting a nullPointerException when I have a @SuperBuilder and also have a default, no args, costructor.
This only happens on Eclipse! Both IntelliJ and VSCode behaves fine with the same code
To Reproduce
Have the following classes on Eclipse IDE
Parent.java
Child.java
Expected behavior
Child class to have a .builder() method.
Current Behavior
!ENTRY org.eclipse.jdt.core 4 0 2021-01-06 16:51:38.377 !MESSAGE Lombok annotation handler class lombok.eclipse.handlers.HandleSuperBuilder failed !STACK 0 java.lang.NullPointerException at lombok.eclipse.handlers.HandleSuperBuilder.constructorExists(HandleSuperBuilder.java:1198) at lombok.eclipse.handlers.HandleSuperBuilder.handle(HandleSuperBuilder.java:316) 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:267) at lombok.eclipse.EclipseNode.traverse(EclipseNode.java:107) at lombok.eclipse.EclipseAST.traverseChildren(EclipseAST.java:233) at lombok.eclipse.EclipseNode.traverse(EclipseNode.java:74) at lombok.eclipse.EclipseAST.traverseChildren(EclipseAST.java:233) at lombok.eclipse.EclipseNode.traverse(EclipseNode.java:69) at lombok.eclipse.EclipseAST.traverse(EclipseAST.java:226) at lombok.eclipse.TransformEclipseAST.go(TransformEclipseAST.java:224) at lombok.eclipse.TransformEclipseAST.transform(TransformEclipseAST.java:185) at lombok.eclipse.TransformEclipseAST.transform_swapped(TransformEclipseAST.java:110) at jdk.internal.reflect.GeneratedMethodAccessor45.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at lombok.launch.PatchFixesHider$Util.invokeMethod(PatchFixesHider.java:119) at lombok.launch.PatchFixesHider$Transform.transform_swapped(PatchFixesHider.java:190) at org.eclipse.jdt.internal.compiler.parser.Parser.endParse(Parser.java:11687) at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:12880) at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:13104) at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:13061) at org.eclipse.jdt.internal.compiler.parser.SourceTypeConverter.convert(SourceTypeConverter.java:144) at org.eclipse.jdt.internal.compiler.parser.SourceTypeConverter.buildCompilationUnit(SourceTypeConverter.java:100) at org.eclipse.jdt.internal.core.hierarchy.HierarchyResolver.resolve(HierarchyResolver.java:755) at org.eclipse.jdt.internal.core.hierarchy.IndexBasedHierarchyBuilder.buildForProject(IndexBasedHierarchyBuilder.java:265) at org.eclipse.jdt.internal.core.hierarchy.IndexBasedHierarchyBuilder.buildFromPotentialSubtypes(IndexBasedHierarchyBuilder.java:350) at org.eclipse.jdt.internal.core.hierarchy.IndexBasedHierarchyBuilder.build(IndexBasedHierarchyBuilder.java:166) at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.compute(TypeHierarchy.java:323) at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.refresh(TypeHierarchy.java:1319) at org.eclipse.jdt.internal.core.CreateTypeHierarchyOperation.executeOperation(CreateTypeHierarchyOperation.java:94) at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:740) at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:806) at org.eclipse.jdt.internal.core.SourceType.newTypeHierarchy(SourceType.java:950) at org.eclipse.jdt.internal.core.SourceType.newTypeHierarchy(SourceType.java:907) at org.eclipse.jdt.internal.ui.javaeditor.codemining.JavaImplementationCodeMining.countMethodImplementations(JavaImplementationCodeMining.java:195) at org.eclipse.jdt.internal.ui.javaeditor.codemining.JavaImplementationCodeMining.lambda$0(JavaImplementationCodeMining.java:105) at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736) at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1728) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Version info (please complete the following information):
The text was updated successfully, but these errors were encountered: