这是我的错误
found : @Initialized @Nullable String
required: @Initialized @NonNull String
/Users/calebcushing/IdeaProjects/ppm/scaf/src/main/java/com/xenoterracide/scaf/Application.java:21: error: [initialization.fields.uninitialized] the constructor does not initialize fields: arg, args, dir
public final class Application implements Runnable {
^
3 errors
这些是由 picocli 初始化的,所以我添加了 SuppressWarnings,不确定为什么它仍然会发生。
@SuppressWarnings({ "NullAway.Init", "initialization.fields.uninitialize" })
@CommandLine.Parameters( index = "0", description = "first configuration directory" )
private String arg;
@SuppressWarnings({ "NullAway.Init", "initialization.fields.uninitialize" })
@CommandLine.Parameters(
index = "1..*",
description = "path to configuration directories separated by space"
)
private List<String> args;
@SuppressWarnings({ "NullAway.Init", "initialization.fields.uninitialize" })
@CommandLine.Option(
names = {"-d", "--dir"},
defaultValue = ".config/scaf",
showDefaultValue = CommandLine.Help.Visibility.ALWAYS,
description = "Directory path from the current working directory. " +
"Templates and configs are looked up relative to here"
)
private Path dir;
我试过把
@SuppressWarnings({ "NullAway.Init", "initialization.fields.uninitialize"})
在类、构造函数以及如您所见的字段上。如何让 checkerframework 开心?
这是完整的源代码检查器框架,因为如果我这样做了,它就不会编译。