我有一些这样的代码,我将映射存储到java threadlocal,
import java.util.*;
class Foo {
private final ThreadLocal<Map<String, String>> barMap = ThreadLocal.withInitial(HashMap::new);
}
从 checkerframework 启用空值检查时,我得到
Error: [type.argument.type.incompatible] incompatible types in type argument.
found : @Initialized @NonNull Map<@Initialized @NonNull String, @Initialized @NonNull String>
required: [extends @Initialized @Nullable Object super null]
我不明白如何解决这个问题。