void testArr1b(@Nullable Object @Nullable [] a) { // one way to use as a cast: @NonNull Object[] l2 = NullnessUtil.castNonNullDeep(a); // Careful, the non-deep version only casts the main modifier. // :: error: (assignment.type.incompatible) @NonNull Object[] l2b = NullnessUtil.castNonNull(a); // OK @Nullable Object[] l2c = NullnessUtil.castNonNull(a); }
void testRef1(@Nullable Object o) { // one way to use as a cast: @NonNull Object l1 = NullnessUtil.castNonNull(o); }
void testRef3(@Nullable Object o) { // use as statement: NullnessUtil.castNonNull(o); o.toString(); }
void testRef2(@Nullable Object o) { // another way to use as a cast: NullnessUtil.castNonNull(o).toString(); }