Skip to content

Type becomes @UnknownInitialization after switch #6260

@cushon

Description

@cushon

The following program is accepted by the nullness checker in 3.38.0, and rejected in 3.39.0.

Is this a regression or a deliberate change?

enum E {
  FOO;

  E getIt() {
    return FOO;
  }

  String go() {
    E e = getIt();
    switch (e) {
      case FOO:
        return "foo";
    }
    throw new AssertionError(e);
  }
}
$ ./checker-framework-3.38.0/checker/bin/javac -processor Nullness E.java
$ ./checker-framework-3.39.0/checker/bin/javac -processor Nullness E.javaE.java:14: error: [argument] incompatible argument for parameter detailMessage of AssertionError constructor.
    throw new AssertionError(e);
                             ^
  found   : @UnknownInitialization @Nullable E
  required: @Initialized @Nullable Object
1 error

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions