-
Notifications
You must be signed in to change notification settings - Fork 360
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
RLC: Handling CreatesMustCall on NotOwning fields #6577
Comments
This is intentional: non-owning fields cannot be the target of a The code example you provided looks similar to some "unconnected sockets" cases that we've seen before, and which partially motivated the creation of
Note that I had to make a couple of changes to how the socket is initialized/connected - using a socket in this style requires us to defer providing the actual connection information until we call |
One more thing I just realized: we can also make the parameter to the constructor |
Thanks for clarifying this! |
This program creates a MustCall on a NotOwning field and tries to satisfy it by calling n.nos.close(). I would expect this to have no errors but the checker's output is
NotOwningCreatesMustCallFor.java:25: error: [reset.not.owning] Calling method bar resets the must-call obligations of the expression n.nos, which is non-owning. Either annotate its declaration with an @Owning annotation, extract it into a local variable, or write a corresponding @CreatesMustCallFor annotation on the method that encloses this statement. n.bar();
Is this a pattern the checker cannot handle or are NotOwning fields not supposed to have CreatesMustCallFor?
The text was updated successfully, but these errors were encountered: