Annotate java.io.PrintWriter.

You can see the source files with the annotations in
https://android-review.googlesource.com/c/platform/libcore/+/701254
(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.

Most of this is straightforward.

The constructors mostly don't actually throw NPE if you pass a null to
them, but you do get a useless PrintWriter back, so it seems sensible
to annotate those as @NonNull.

You can pass a null array to the printf-style methods with something
like this: printf("message", (Object[]) null). The javadoc doesn't
specify what happens if you try. The implementation seems to accept
it. However, without a guarantee, it seems safer to mark that argument
as @NonNull. It's a very odd thing to write, anyway. The contents of
the array/varargs are @Nullable since it is legal to write
e.g. printf("this is %s", null) which passes a non-null array
containing a null object.

Test: make docs
Bug: 64930165

(cherry picked from commit df047a2dcf17fc2841d0f8aaed3094cf6e13940c)

Change-Id: Ia23c9176c386ec8630d642c6fb48bd5d03b652c8
Merged-In: I2d2788714a2df24b253490c83dd0f8b4316feef9
2 files changed