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

build() can throw a NullpointerException when using box classes #119

Closed
Adrodoc opened this issue Aug 10, 2016 · 0 comments
Closed

build() can throw a NullpointerException when using box classes #119

Adrodoc opened this issue Aug 10, 2016 · 0 comments

Comments

@Adrodoc
Copy link
Contributor

Adrodoc commented Aug 10, 2016

The generated build method for a Pojo with a box class paramater in the constructor/factory method will throw a NullPointerException if no value was set. This only occurs when using withBuilderProperties = true.

Example:

public class Pojo {
  private Double value;

  @GeneratePojoBuilder(withBuilderProperties = true, withBuilderInterface = Builder.class)
  public Pojo(Double value) {
    this.value = value;
  }

  public Double getValue() {
    return value;
  }

  public static void main(String[] args) {
    NullPointerException act = null;
    try {
      new PojoBuilder().build();
    } catch (NullPointerException ex) {
      act = ex;
    }
    assert act != null;
  }
}
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

1 participant