-
Notifications
You must be signed in to change notification settings - Fork 357
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
Nullness Checker: support Q.isEmpty - Q.poll logic #399
Comments
Original comment by
|
Original comment by |
Original comment by
|
Consider the following test case (which is committed to the repository):
The Nullness Checker considers all calls to This cannot be handled via annotations in the JDK for two reasons.
Therefore, it must be handled by creating a new "non-empty" checker, which is analogous to the current Map Key Checker. |
This reverts commit a4d1da6.
Here are some more implementation notes. Precise handling of PriorityQueue.peek() and poll() The Nullness Checker issues a false positive warning for this code:
The Checker Framework does not determine that The contract of To handle this code precisely, the Nullness Checker needs to know, for each queue, whether it is empty. It should be handled the same way: by adding a new subchecker, called the Nonempty Checker to the Nullness Checker. Its types are:
There is a start at this type-checker in branch
However, it is not done. (In fact, it doesn't even compile.) The NonEmpty Subchecker itself has not been written. This will be similar to, but simpler than, the Map Key Subchecker. You will also need to annotate the JDK to indicate the behavior of library methods:
Handling When you are done, the Nullness Checker should issue only the |
Original issue reported on code.google.com by
[email protected]
on 12 Feb 2015 at 12:20Attachments:
The text was updated successfully, but these errors were encountered: