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

toBuilder throws an NPE when a @SIngular collection field is null #1324

Closed
jgraglia opened this issue Mar 3, 2017 · 5 comments
Closed

toBuilder throws an NPE when a @SIngular collection field is null #1324

jgraglia opened this issue Mar 3, 2017 · 5 comments

Comments

@jgraglia
Copy link

jgraglia commented Mar 3, 2017

Hi, I'm facing the following pb :

Given this POJO :

@DaTa
@builder(toBuilder = true)
public class BuilderDemo {

private final Set<String> names;

@Singular
private final Set<String> singularNames;

}

a NPE is thrown when using toBuilder method on an instance created with a null singularNames field.

    final BuilderDemo nullNames = new BuilderDemo(Collections.EMPTY_SET, null);

    nullNames.toBuilder()  <= NPE ! 

    final BuilderDemo fromBuilder =  BuilderDemo.builder().build();

    fromBuilder.toBuilder()  <= NO NPE 

I can reproduce the problem always, and here is the link to a simple maven project demonstrating the problem :
https://github.com/jgraglia/lombokbuilderbug

I'm using lombok 1.16.14 on a JDK 8 project.

PS: I can not simply replace new BuilderDemo (...) with Builderdemo.builder() calls as this happens when deserializing a BuilderDemo from a json stream (using Jackson ObjectMapper)

Thx!

@jgraglia
Copy link
Author

still no luck with lombok 1.16.16

@sarthakn7
Copy link

+1, facing the same issue.

@jesantana
Copy link

+1

@DmitryWh
Copy link

still no luck with lombok 1.16.18

@rzwitserloot
Copy link
Collaborator

You can test it out in the current edge release: https://projectlombok.org/download-edge

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

5 participants