Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@MonotonicNonNull fields now prevent final-class constructors from calling a method at the end #610

Closed
cpovirk opened this issue Oct 23, 2023 · 0 comments · Fixed by #621
Assignees

Comments

@cpovirk
Copy link

cpovirk commented Oct 23, 2023

New in 3.39.0-eisop1:

$ cat I.java
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;

final class I {
  @MonotonicNonNull String s;

  I() {
    init();
  }

  void init() {}
}

$ checker/bin/javac -processor nullness I.java
I.java:7: error: [method.invocation.invalid] call to init() not allowed on the given receiver.
    init();
        ^
  found   : @UnderInitialization I
  required: @Initialized I
1 error

I could believe that this has actually been unsound all along for reasons that I hadn't noticed, but it looks to me like it ought to continue to be permitted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants