lastnpe / eclipse-null-eea-augments

Eclipse External null Annotations (EEA) repository
http://lastnpe.org
Eclipse Public License 2.0
41 stars 22 forks source link

Collectors toList/toSet/toCollection should have a return value of Nonnull #138

Closed agentgt closed 3 years ago

agentgt commented 3 years ago

It appears the Collectors.eaa file is incorrect.

That is Collectors.toSet() and Collectors.toList() are reported as @Nullable.

Original toSet:

toSet
 <T:Ljava/lang/Object;>()Ljava/util/stream/Collector<TT;*Ljava/util/Set<TT;>;>;
 <T:Ljava/lang/Object;>()Ljava/util/stream/Collector<TT;*L1java/util/Set<TT;>;>;

Should be marked as L1

toSet
 <T:Ljava/lang/Object;>()Ljava/util/stream/Collector<TT;*Ljava/util/Set<TT;>;>;
 <T:Ljava/lang/Object;>()L1java/util/stream/Collector<TT;*L1java/util/Set<TT;>;>
                                        // ^^--- I guess this is the return value

I'm still learning the format of EEA so perhaps this is wrong but regardless my code inspection of toList/toSet to not be possible for it to return null.

J-N-K commented 3 years ago

Correct, Could you prepare a PR for that? I think that toCollection also results in a non-null Collector and requires a non-null Supplier.