Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use
Class<@nonnull T>
in one more class, ObjectArrays
.
Arrays are weird, as discussed in cl/382268713, so we're still making compromises here. This CL at least: - lets users create arrays with nullable element types. That said, if people want a `@Nullable String[]`, we were already letting them create a `String[]` and then widen it to `@Nullable String`, at least under our current treatment of arrays. Kotlin wouldn't be so accommodating, but I doubt that Kotlin users need this class much, of at all. - lets users concatenate arrays with nullable element types: `ObjectArrays.concat(nullableStrings, moreNullableStrings, String.class)`. I don't remember how I had identified `Class<T>` usages to convert to `Class<@nonnull T>` previously; it might just have been that I remembered some offhand but not others. And perhaps I'd put `ObjectArrays` out of mind entirely on the grounds that arrays are weird. But now I tried to grep through our Javadoc in the `gh-pages` branch and then gradually filter out usages that didn't look related. It's still possible that I missed something, but I can report that `ObjectArrays` contained the only usages left at the end of the process: ``` git grep 'Class<[^?]' releases/snapshot-jre/api/docs/com/ | grep -v class-use | s 's/</</g' | s 's/>/>/g' | s 's/ / /g' | grep -v -e catching -e exceptionType -e exceptionClass -e declaredType -e Annotation -e Enum -e enum -e interfaceType -e wrap -e filter -e Iterables -e Iterators -e FluentIterable -e defaultValue -e CauseType -e InstanceOf -e ToInstanceMap -e ArrayTable -e Primitives -e Invokable -e TypeParameter -e TypeToken -e Sets.html ``` RELNOTES=n/a PiperOrigin-RevId: 539667000
- Loading branch information