@NonNullByDefault
public class Example {
public String func(List<String> list){
return list.stream().collect(Collectors.joining(","));
}
}
I get these warnings:
Null type safety (type annotations): The expression of type 'Collector<CharSequence,capture#of ?,String>' needs unchecked conversion to conform to 'Collector<? super @NonNull String,capture#of ?,@NonNull String>'
Unsafe interpretation of method return type as '@NonNull' based on substitution 'R=@NonNull String'. Declaring type 'Stream<T>' doesn't seem to be designed with null type annotations in mind
I use this annotation:
class java/util/stream/Collectors
joining
(Ljava/lang/CharSequence;)Ljava/util/stream/Collector<Ljava/lang/CharSequence;*Ljava/lang/String;>;
(Ljava/lang/CharSequence;)L1java/util/stream/Collector<L1java/lang/CharSequence;*1L1java/lang/String;>;
Are those annotations good?
How can these warning be removed in the cleanest way?