jspecify icon indicating copy to clipboard operation
jspecify copied to clipboard

Put appropriate "(Why?)" links in the user guide as we did for the javadoc

Open bjmi opened this issue 3 years ago • 3 comments

Please spent a short paragraph in Nullness User Guide why I have to write <T extends @Nullable Object> T firstOrDefault(List<T> list, T defaultValue) { instead of <@Nullable T> T firstOrDefault(List<T> list, T defaultValue) {
and / or provide a comprehensible explanation what latter actually means.

(Out of scope: is it possible to pass Consumer<@Nullable String> c to void process(Consumer<String> s))

bjmi avatar Jan 05 '23 14:01 bjmi

You can find a little discussion of that in the design FAQ, which is currently linked from the bottom of one page in the general FAQ in the wiki. It's definitely going to need to be somewhere more prominent someday :)

For the Consumer question, see https://github.com/jspecify/jspecify/issues/72. [edit: tl;dr "Not yet, maybe someday."]

cpovirk avatar Jan 05 '23 16:01 cpovirk

Thanks for the feedback! I'd like to make sure we have enough "(Why?)" breadcrumbs in the various documents to point people to the FAQ. You can see a few of those in the javadoc. I'll make this issue about doing that in the user guide too.

kevinb9n avatar Jan 13 '23 01:01 kevinb9n

(For the record Chris :-) the Design FAQ is also linked from the start-here page but it's very easy for the eyes to pass over that part.)

As for a comprehensible explanation of where <T extends @Nullable Object> comes from, the "understanding the null-aware type system" doc will try to tackle that. Its early unsatisfactory form is [here](https://github.com/jspecify/jspecify/wiki/null-aware-type-system .. I will work more on it, give it some diagrams and so forth.

kevinb9n avatar Jan 13 '23 01:01 kevinb9n