typetools / typetools/checker-framework

Nullness Checker makes wrong assumptions about unannotated libraries

Open
#12 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
1.1k
Forks
440
Avg merge
1d 12h
Merged PRs (30d)
134

Description

The Nullness Checker issues no warnings for uses of unannotated libraries
where its methods returns null.

From Mike:


I speculate that maybe with NNEL as the default, that the Checker Framework
by default assumes all parameters and return values are non-null in
unannotated code.  This is an unfortunate default.

One idea for working around it would be to set the default to NNEL if there
is any evidence in the class of consideration of the nullness checker:
 * class was mentioned explicitly on the command line
 * import of any of its packages
 * use of any of its annotations or methods
 * use of @SuppressWarnings with any of its keys
If none of this evidence is present, the default would be "non-null except
return values are @Nullable and public fields are @PolyNull".

I'm not convinced this is a perfect solution, but it does seem to be an
improvement over the current situation.

Original issue reported on code.google.com by msaeed43 on 24 Oct 2009 at 12:22

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Nullness Checker behavior with an unannotated library whose method returns null. Read the existing handling of unannotated code and the proposed NNEL default conditions in the issue. Done means the checker no longer silently assumes non-null returns in the described cases, with tests covering the revised defaults.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.