-
Notifications
You must be signed in to change notification settings - Fork 355
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 crashes when a class extends a MustCall Empty class #6576
Comments
Thanks for reporting this. Fixed by #6578.
It's not unsound (and it's the intended design). Consider the fact that The key idea for why this design is sound is that it's not possible to assign a concrete object of type
But this code is not:
|
I see. That makes sense. Thanks for clarifying this and fixing the issue so quickly! I tried to check the following code reading your comment but I did not get any incompatible assignment error. Is there something I am missing?
|
@Nausheen15 I ran the checker on the following full test case, which is based on your example with minimum modifications that are necessary so that the Java compiler accepts it. The expected error on line 26 is issued.
|
@kelloggm The error generated has the following error message Here the super class also implements close and close is called on n. Though, there is no resource leak in this code (since the subclass close is the one actually called at runtime) I'd expect a type error at the assignment but this program doesn't give me any errors. |
@Nausheen15 sorry, I definitely made a mistake when I wrote my previous comment - I left a warning suppression in place (on line 6) that was hiding the error that you're talking about. When I remove it, I see the same behavior.
That we see a To see an assignment error, we'd need to make
I think there's more to the example that you're actually thinking of than is present in the code you've linked, because in the code you've linked the superclass does not implement |
Oh I didn't know of the CLIMB-to-top rule. This was very helpful. Thanks! Sorry, I forgot to add the required imports in my example perhaps that's why you couldn't compile it. I've edited my earlier comment to include them now. The updated code should be compilable. I also tried replacing the assignment statement with |
The Resource Leak Checker crashes on the above program. Here is the output.txt of the crash.
However, when I remove the MustCall() annotation from class NoMustCall, there is no crash or error. It does not even give the declaration.inconsistent.with.extends.clause error that is expected. Isn't that unsound?
The text was updated successfully, but these errors were encountered: