-
Notifications
You must be signed in to change notification settings - Fork 75
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
@ParametersAreNonnullByDefault should mean fields are too #308
Labels
Comments
Hi, thanks for reporting this. Indeed, EqualsVerifier doesn't support this annotation (yet). I wasn't familiar with it -- where does it come from? Do you have a Javadoc page or Maven coordinates or something, so that I can do some tests? I haven't been able to find that on google. |
It's from JSR305:
https://www.javadoc.io/doc/com.google.code.findbugs/jsr305/3.0.1/javax/annotation/ParametersAreNonnullByDefault.html
…On Wed., May 20, 2020, 05:41 Jan Ouwens, ***@***.***> wrote:
Hi, thanks for reporting this.
Indeed, EqualsVerifier doesn't support this annotation (yet). I wasn't
familiar with it -- where does it come from? Do you have a Javadoc page or
Maven coordinates or something, so that I can do some tests? I haven't been
able to find that on google.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#308 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABF3NBPNLWIC5R2MS4XVPFDRSPFYPANCNFSM4NFNQXYQ>
.
|
Thanks! I'll look into it. |
jqno
added a commit
that referenced
this issue
Jun 11, 2020
I've just released version 3.4, which adds support for |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What steps will reproduce the problem?
Create a class annotated with
@ParametersAreNonnullByDefault
and a final object field that's not@Nullable
, and test it with EqualsVerifier.What is the code that triggers this problem?
Class under test:
Test:
What error message or stack trace does EqualsVerifier give?
What did you expect?
EqualsVerifier recognizes
@javax.annotation.ParametersAreNonnullByDefault
and does not try to set any field to null unless it's annotated@Nullable
.Which version of EqualsVerifier are you using?
3.3
Please provide any additional information below.
Static analysis of the constructors would reveal that
@Nullable
immutable fields are always copied directly from@Nullable
constructor parameters. For classes whose initialization isn't provably "trivial" in this sense, a workaround for the field/parameter disconnect might be to create the instances under test using constructors, only passing null to@Nullable
parameters, or by cloning other instances that were created this way.The text was updated successfully, but these errors were encountered: