Checker Framework initialization.fields.uninitialize false positive

蓝咒 提交于 2020-12-15 03:44:47

问题


Here's my error

  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

These are initialized by picocli, so I added SuppressWarnings, not certain why it's still happening.

  @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;

I've tried putting

  @SuppressWarnings({ "NullAway.Init", "initialization.fields.uninitialize"})

on the class, the constructor and as you can see, the field. How do I make checkerframework happy?

来源:https://stackoverflow.com/questions/65245465/checker-framework-initialization-fields-uninitialize-false-positive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!