-
Notifications
You must be signed in to change notification settings - Fork 232
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
Default final fields are randomized when using Lombok @Builder #364
Comments
I was able to reproduce the case. Easy Random tries to create an instance of the target bean using the default constructor (A Java Bean should provide a default constructor btw), and falls back to objenesis if no such constructor exists. However, looks like this is a bug in lombok: combining Trying to add So when this combination of lombok annotations is fixed, Easy Random should work as expected. I'm closing this as duplicate of #228 (See known limitations section). |
Using easy-random-core:4.0.0
When using lombok
@Builder
with a class (like the one below), some of the final fields with default values are randomized:I would expect the following code to pass:
However all the fields get randomized.
I did find a way of creating this class:
This does work as expected. Perhaps the builder class could be detected? I think the issue is that the objenesis generated constructor that is being used doesn't pick up any of the defaults.
The text was updated successfully, but these errors were encountered: