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] ecj vs. javac difference: @NonNull + @Builder will not generate the nullcheck on the 'builder-setter' in ecj only #2120

Closed
rzwitserloot opened this issue May 6, 2019 · 0 comments

Comments

@rzwitserloot
Copy link
Collaborator

Describe the bug
Both @SuperBuilder and @Builder suffer from this (reproduced in lombok v1.18.6): When producing the builder-setter for a @NonNull-marked field, in javac the builder-setter has an explicit nullcheck, but the class file compiled with ecj does not.

To Reproduce

@lombok.Builder
public class Test {
    @lombok.NonNull String id;
}

and then ecj -cp lombok.jar Test.java, then javap -private -c Test and note how there's no null check on the Test.TestBuilder.id(String id) field, whereas if you produce the class files via javac -cp lombok.jar Test.java there's an explicit nullcheck there.

Expected behavior
Let's go with: Generate the null check. One could make an argument that build() will take care of it in the long term, but earlier is probably better here. Also, ecj-produced class files rarely end up in production so keeping the null check is far less backwards incompatible.

Version info (please complete the following information):

  • Lombok version: 1.18.6

context: https://groups.google.com/forum/?hl=en#!topic/project-lombok/zHMnp1o1zCw

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