-
Notifications
You must be signed in to change notification settings - Fork 26
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
Special handling for equals(Object) #70
Comments
See also google/guava#1819 Also: It looks like the need to annotate |
(This came up in the context of code generation: The code generator was smart enough to copy [ edit: also about generated code: #34 (comment) ] |
(Re: I think we should be able to agree that there should be no special treatment of (If the subparam is of "unspecified nullness" that's a whole other discussion that probably belongs in an issue that is specific to issues of unspecified nullness) |
I am personally in favor of no special case. But I am open to hearing that the fallout for, say AutoValue, is more complex than we'd hope. Ideally AutoValue comes to recognize us as the One True Nullness Annotation and then include it on the (I still don't see a need to Do Anything about this at the moment.) |
(I wonder if this is an issue for AutoValue at all. If it just doesn't output an annotation at all, it would generate a warning upon compiling the generated code, but imho users should not be shown warnings that come from compiling generated code anyway. Then everyone who access |
Oh, nice. I hadn't considered that warnings would probably be off for generated code. |
Optimistically closing, since we at least have a story here now. (I guess "we" always did, but I'm just now coming to understand it :)) |
In #301, I just mentioned that uber/NullAway#619 points out that record classes end up with an I don't think that's an argument for special cases for |
JSpecify can spin this in several ways:
|
A sentiment that I've heard in past discussions of nullness is: "
Object.equals(Object)
is known to be required to handle anull
input, so implementations ofequals
shouldn't need to annotate the parameter explicitly."I personally believe we should require people to annotate it anyway. (This is part of my general dislike for special cases [edit: link goes to a discussion of
java.lang.Void
]. FWIW, I believe the Checker Framework requires it to be annotated.) But I'm filing this bug in anticipation that we'll get such a request someday -- maybe from someone who is reading this right now and will tell me that I have it all wrong :) Even if not, we will eventually want to write up a justification of why we're going this direction.[note to self / other Googlers: internal issue 12964927]
The text was updated successfully, but these errors were encountered: