You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import org.checkerframework.checker.initialization.qual.UnknownInitialization;
class Demo {
@UnknownInitialization Integer n;
Demo() {
int y = n;
}
public static void main(String[] args) {
new Demo();
}
}
passes the Nullness Checker without an error or warning.
Executing it produces an NPE.
When the field n is not annotated, making it UnderInitialization in the constructor, the correct error is raised.
Neither version warns about the field not being initialized by the constructor, which is maybe OK when a different error is raised.
The text was updated successfully, but these errors were encountered:
This example:
passes the Nullness Checker without an error or warning.
Executing it produces an NPE.
When the field
n
is not annotated, making itUnderInitialization
in the constructor, the correct error is raised.Neither version warns about the field not being initialized by the constructor, which is maybe OK when a different error is raised.
The text was updated successfully, but these errors were encountered: