Пример #1
0
 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);
 }
Пример #2
0
 void testRef1(@Nullable Object o) {
   // one way to use as a cast:
   @NonNull Object l1 = NullnessUtil.castNonNull(o);
 }
Пример #3
0
 void testRef3(@Nullable Object o) {
   // use as statement:
   NullnessUtil.castNonNull(o);
   o.toString();
 }
Пример #4
0
 void testRef2(@Nullable Object o) {
   // another way to use as a cast:
   NullnessUtil.castNonNull(o).toString();
 }