Repository navigation
batch of javadoc revisions for clarity and completeness - #671
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
netdpb
left a comment
There was a problem hiding this comment.
Thanks, this is good editing!
|
Sorry for the delay; I am still embroiled in the epic journey of getting approval to sign the CLA. |
|
This is not in "PTAL" status just yet but it's coming. |
|
I believe I addressed everything above, but at this point this is basically a whole new PR and should just be reviewed holistically. Happy to back out of any of these changes, whatever works. |
|
I'm also happy to make subsequent editing passes after this goes in if anyone wants, such as to maybe trim it all down. |
| * | ||
| * <p>For a comprehensive introduction to JSpecify, please see <a | ||
| * href="https://jspecify.dev">jspecify.org</a>. | ||
| * <p>The {@linkplain org.jspecify.annotations package documentation} has some important general |
There was a problem hiding this comment.
The old "For a comprehensive introduction..." opening set the stage here a bit more for readers."
We could keep that general approach with something like:
"For some general information common to all four nulless annotations, see the package documentation. For a comprehensive introduction...."
(and similarly in the other files once we have something that we're happy with)
There was a problem hiding this comment.
Okay this here in NonNull.java is my current proposal to duplicate to the other places.
There was a problem hiding this comment.
"Where do I go for the unimportant general information?" :)
So I might cut that one word, but I don't mind it even as much as the joke suggests.
There was a problem hiding this comment.
Eh, maybe it's not even that important? Can go either way. Will leave this open just a bit before I start cloning.
There was a problem hiding this comment.
(I'm still overall more a fan of opening with "For some [important] general information..." than with "The package documentation," and I might like "See the package documentation..." somewhere in between how much I like those two, but I'm also still willing to let this go.)
| * annotations of that type are synonymous with {@code @NullMarked}. It has the same meaning | ||
| * as it does anywhere else. | ||
| * <li>These annotations have no meaning when applied to a <b>record component</b> declaration (as | ||
| * in {@code record Foo(@NullMarked String bar) {}}). ({@link Nullable} and {@link NonNull} |
There was a problem hiding this comment.
I think you asked somewhere about where/whether to bother with {@link Nullable @Nullable} and likewise for @NonNull. I guess I'm in favor of always bothering?
There was a problem hiding this comment.
Trying what I hope is a consistent policy, which is that if it seems like we're talking about what you see or write at the use-site then we need the @. I think that ended up applying in most cases.
There was a problem hiding this comment.
By the way though, I mean, these annotations do get copied to a generated accessor method, so I guess that could have an effect?
There was a problem hiding this comment.
- I think these were the only ones that jumped out to me as possibly "missing" the
@. Above, we say "where @nullable and @nonnull are not applicable," and here we say "Nullable and NonNull are still meaningful," so, while I'm sure we can argue that there's a difference there, it seems unlikely that the average reader would expect a difference. - Yes, they would end up being copied to the generated accessor method, so they would have an effect downstream. We were aware of that when we made our decision, but I think we might have felt more "We have bigger fish to fry" than "We feel that this is overwhelmingly the correct decision." I think that our goal was more to discourage people from writing it than to pretend that it wouldn't have an effect downstream.
|
Can you resolve the merge conflicts? |
|
Okay I've finally finished my round of updates, merged, pushed and all that. Sorry about the flood of premature emails. |
cpovirk
left a comment
There was a problem hiding this comment.
I ran out of time at the end of my day, but have a few comments in case you want to start on them early or in case they save anyone else the time of typing something similar.
| * | ||
| * <p>For a comprehensive introduction to JSpecify, please see <a | ||
| * href="https://jspecify.dev">jspecify.org</a>. | ||
| * <p>The {@linkplain org.jspecify.annotations package documentation} has some important general |
There was a problem hiding this comment.
"Where do I go for the unimportant general information?" :)
So I might cut that one word, but I don't mind it even as much as the joke suggests.
| * Indicates that the annotated <a href="https://github.com/jspecify/jspecify/wiki/type-usages">type | ||
| * usage</a> (commonly a parameter type or return type) is considered to <i>exclude</i> {@code null} | ||
| * as a value; rarely needed within {@linkplain NullMarked null-marked} code. | ||
| * as a value; rarely needed within {@linkplain NullMarked null-marked} context. |
There was a problem hiding this comment.
We have definitely used "context" in discussions of this before. My thoughts are:
- I am trying to remember whether we discussed it and decided to try to move toward / away from it. But I don't remember. I could also be thinking of some different word, like "scope." Oh, yes, here we go.
- My brain expects "a null-marked context." (Here's a post in which you used it both ways :)) Gemini cites JLS precedent at me:
- "in a static context"
- "in an assignment context"
- "in a boolean/numeric context"
- (I see only "in a numeric arithmetic context" in a quick search.)
There was a problem hiding this comment.
JLS uses the word in two ways, as shown by your first example versus the others. The others are, like a "countable" noun, a single context is a place where some single thing gets plugged in. Chief example of course being "type context".
"In a static context" is different and if I were editing the JLS I might consider phrasing it "in static context" instead of implying it is a countable thing like the other cases. And this is the sense in which I'm trying to use the word here now. Purely: "hey what kind of context are we currently in here, A or B?" Our case is the cleaner one since I think "static context" is relative to which containing class you're talking about.
Good 'nuff?
There was a problem hiding this comment.
For "type context," I'm seeing "a type context," "type contexts," and "any type context," right?
It's reasonable to argue that the JLS should drop the "the" as a more general rule, and I don't need to push on that if you just want to buck the trend, but to check: Are we in agreement that you are in fact bucking the JLS trend, or is there more that hasn't yet registered with me?
There was a problem hiding this comment.
Not sure what your first question means, but those are all valid phrases treating type contexts as the "countable kind of context" if you want to think of it that way.
Then there are the other kind, of which we've noted two examples, "static context", and "null-marked context". The way I see it, as far as a user knows maybe JSpecify does have weird rules to learn of the form "sure, that's true for that null-marked context, but not for the other null-marked context that is three null-marked contexts down from where you are." It's relevant that we don't have any rules like that, so I thinks, I'll drop the "a".
There was a problem hiding this comment.
That makes sense. I think I prefer "code" to "context": Even with you explanation, "null-marked context" continues to jump out to me, and I'd expect it to jump out a bit to a decent number of other users. Plus, it's longer, and it's one of those words that is used so widely for Java class names (and often in ways that would have me clutching my pearls) that it doesn't really add anything from my perspective. I am not particularly invested in the phrasing here, either, but I assume you have a sales pitch for "context," and I'm up for trying to evaluate it if that sounds like a good time to you.
There was a problem hiding this comment.
This is oh very subjective, but for whatever reason, "null-marked code" gives me slightly more of a "but what do they mean by 'code'? What is the definition of 'code' here?" reaction. Whereas somehow when I hit "context" I don't feel like it might be implying something specific I have to go learn about. I dunno.
| * annotations of that type are synonymous with {@code @NullMarked}. It has the same meaning | ||
| * as it does anywhere else. | ||
| * <li>These annotations have no meaning when applied to a <b>record component</b> declaration (as | ||
| * in {@code record Foo(@NullMarked String bar) {}}). ({@link Nullable} and {@link NonNull} |
There was a problem hiding this comment.
- I think these were the only ones that jumped out to me as possibly "missing" the
@. Above, we say "where @nullable and @nonnull are not applicable," and here we say "Nullable and NonNull are still meaningful," so, while I'm sure we can argue that there's a difference there, it seems unlikely that the average reader would expect a difference. - Yes, they would end up being copied to the generated accessor method, so they would have an effect downstream. We were aware of that when we made our decision, but I think we might have felt more "We have bigger fish to fry" than "We feel that this is overwhelmingly the correct decision." I think that our goal was more to discourage people from writing it than to pretend that it wouldn't have an effect downstream.
| * | ||
| * <p>For a comprehensive introduction to JSpecify, please see <a | ||
| * href="https://jspecify.dev">jspecify.org</a>. | ||
| * <p>The {@linkplain org.jspecify.annotations package documentation} has some important general |
There was a problem hiding this comment.
(I'm still overall more a fan of opening with "For some [important] general information..." than with "The package documentation," and I might like "See the package documentation..." somewhere in between how much I like those two, but I'm also still willing to let this go.)
| * Indicates that the annotated <a href="https://github.com/jspecify/jspecify/wiki/type-usages">type | ||
| * usage</a> (commonly a parameter type or return type) is considered to <i>exclude</i> {@code null} | ||
| * as a value; rarely needed within {@linkplain NullMarked null-marked} code. | ||
| * as a value; rarely needed within {@linkplain NullMarked null-marked} context. |
There was a problem hiding this comment.
That makes sense. I think I prefer "code" to "context": Even with you explanation, "null-marked context" continues to jump out to me, and I'd expect it to jump out a bit to a decent number of other users. Plus, it's longer, and it's one of those words that is used so widely for Java class names (and often in ways that would have me clutching my pearls) that it doesn't really add anything from my perspective. I am not particularly invested in the phrasing here, either, but I assume you have a sales pitch for "context," and I'm up for trying to evaluate it if that sounds like a good time to you.
I honestly don't remember everything I did here or why :-) so let's just go ahead and discuss how to make it best from here!