File tree 6 files changed +20
-24
lines changed
android/guava/src/com/google/common/collect
guava/src/com/google/common/collect
6 files changed +20
-24
lines changed Original file line number Diff line number Diff line change @@ -785,8 +785,8 @@ public final boolean isEmpty() {
785
785
* copied
786
786
*/
787
787
@ GwtIncompatible // Array.newArray(Class, int)
788
- public final @ Nullable E [] toArray (Class <@ NonNull E > type ) {
789
- return Iterables .toArray (getDelegate (), type );
788
+ public final E [] toArray (Class <@ NonNull E > type ) {
789
+ return Iterables .< E > toArray (getDelegate (), type );
790
790
}
791
791
792
792
/**
Original file line number Diff line number Diff line change 36
36
import java .util .RandomAccess ;
37
37
import java .util .Set ;
38
38
import javax .annotation .CheckForNull ;
39
+ import org .checkerframework .checker .nullness .qual .NonNull ;
39
40
import org .checkerframework .checker .nullness .qual .Nullable ;
40
41
41
42
/**
@@ -323,12 +324,8 @@ public static String toString(Iterable<?> iterable) {
323
324
* @return a newly-allocated array into which all the elements of the iterable have been copied
324
325
*/
325
326
@ GwtIncompatible // Array.newInstance(Class, int)
326
- /*
327
- * If we could express Class<@Nonnull T>, we could generalize the type parameter to <T extends
328
- * @Nullable Object>, and then we could accept an Iterable<? extends T> and return a plain T[]
329
- * instead of a @Nullable T[].
330
- */
331
- public static <T > @ Nullable T [] toArray (Iterable <? extends @ Nullable T > iterable , Class <T > type ) {
327
+ public static <T extends @ Nullable Object > T [] toArray (
328
+ Iterable <? extends T > iterable , Class <@ NonNull T > type ) {
332
329
return toArray (iterable , ObjectArrays .newArray (type , 0 ));
333
330
}
334
331
Original file line number Diff line number Diff line change 47
47
import java .util .PriorityQueue ;
48
48
import java .util .Queue ;
49
49
import javax .annotation .CheckForNull ;
50
+ import org .checkerframework .checker .nullness .qual .NonNull ;
50
51
import org .checkerframework .checker .nullness .qual .Nullable ;
51
52
52
53
/**
@@ -344,10 +345,10 @@ public static String toString(Iterator<?> iterator) {
344
345
* @return a newly-allocated array into which all the elements of the iterator have been copied
345
346
*/
346
347
@ GwtIncompatible // Array.newInstance(Class, int)
347
- // For discussion of this signature, see the corresponding overload of *Iterables*. toArray.
348
- public static < T > @ Nullable T [] toArray ( Iterator <? extends @ Nullable T > iterator , Class <T > type ) {
349
- List <@ Nullable T > list = Lists .newArrayList (iterator );
350
- return Iterables .toArray (list , type );
348
+ public static < T extends @ Nullable Object > T [] toArray (
349
+ Iterator <? extends T > iterator , Class <@ NonNull T > type ) {
350
+ List <T > list = Lists .newArrayList (iterator );
351
+ return Iterables .< T > toArray (list , type );
351
352
}
352
353
353
354
/**
Original file line number Diff line number Diff line change @@ -777,8 +777,8 @@ public final boolean isEmpty() {
777
777
* copied
778
778
*/
779
779
@ GwtIncompatible // Array.newArray(Class, int)
780
- public final @ Nullable E [] toArray (Class <@ NonNull E > type ) {
781
- return Iterables .toArray (getDelegate (), type );
780
+ public final E [] toArray (Class <@ NonNull E > type ) {
781
+ return Iterables .< E > toArray (getDelegate (), type );
782
782
}
783
783
784
784
/**
Original file line number Diff line number Diff line change 39
39
import java .util .function .Consumer ;
40
40
import java .util .stream .Stream ;
41
41
import javax .annotation .CheckForNull ;
42
+ import org .checkerframework .checker .nullness .qual .NonNull ;
42
43
import org .checkerframework .checker .nullness .qual .Nullable ;
43
44
44
45
/**
@@ -285,12 +286,8 @@ public static String toString(Iterable<?> iterable) {
285
286
* @return a newly-allocated array into which all the elements of the iterable have been copied
286
287
*/
287
288
@ GwtIncompatible // Array.newInstance(Class, int)
288
- /*
289
- * If we could express Class<@Nonnull T>, we could generalize the type parameter to <T extends
290
- * @Nullable Object>, and then we could accept an Iterable<? extends T> and return a plain T[]
291
- * instead of a @Nullable T[].
292
- */
293
- public static <T > @ Nullable T [] toArray (Iterable <? extends @ Nullable T > iterable , Class <T > type ) {
289
+ public static <T extends @ Nullable Object > T [] toArray (
290
+ Iterable <? extends T > iterable , Class <@ NonNull T > type ) {
294
291
return toArray (iterable , ObjectArrays .newArray (type , 0 ));
295
292
}
296
293
Original file line number Diff line number Diff line change 47
47
import java .util .PriorityQueue ;
48
48
import java .util .Queue ;
49
49
import javax .annotation .CheckForNull ;
50
+ import org .checkerframework .checker .nullness .qual .NonNull ;
50
51
import org .checkerframework .checker .nullness .qual .Nullable ;
51
52
52
53
/**
@@ -344,10 +345,10 @@ public static String toString(Iterator<?> iterator) {
344
345
* @return a newly-allocated array into which all the elements of the iterator have been copied
345
346
*/
346
347
@ GwtIncompatible // Array.newInstance(Class, int)
347
- // For discussion of this signature, see the corresponding overload of *Iterables*. toArray.
348
- public static < T > @ Nullable T [] toArray ( Iterator <? extends @ Nullable T > iterator , Class <T > type ) {
349
- List <@ Nullable T > list = Lists .newArrayList (iterator );
350
- return Iterables .toArray (list , type );
348
+ public static < T extends @ Nullable Object > T [] toArray (
349
+ Iterator <? extends T > iterator , Class <@ NonNull T > type ) {
350
+ List <T > list = Lists .newArrayList (iterator );
351
+ return Iterables .< T > toArray (list , type );
351
352
}
352
353
353
354
/**
You can’t perform that action at this time.
0 commit comments