Annotate java.lang.Object.

You can see the source files with the annotations in
https://android-review.googlesource.com/c/platform/libcore/+/699804
(which obviously is not intended for submission). The .jaif changes
here were copy-and-pasted from the results of running the
extract-annotations tool on those sources.

This annotates the return type of toString() as @NonNull. This seems
justified on the grounds that (a) the javadoc says that it "returns a
string", (b) the vast majority of implementations don't return null,
and (c) the vast majority of callers don't do null checks on the
result. The risk is that users could get unexpected NPEs when using
Objects where toString() does return null. This seems better than the
alternative, which is to force all users to do null checks on the
result of toString().

Test: make docs
Bug: 64930165
Change-Id: Id71f15fe0c58d30866249511a541da33d8958aa4
2 files changed