typetools / typetools/checker-framework

Improve -AstubWarnIfRedundantWithBytecode implementation

Open
#2,760 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

#2758 optionally issues a warning if a stub file specification is redundant with the existing annotations in bytecode.

One problem with that implementation is that at the moment stub files are parsed by each type hierarchy separately.
This is a problem for type systems like the Nullness Checker, which combines two hierarchies Nullness and Initialization as one combined hierarchy as well as the KeyFor hierarchy.

A stub file that only provides nullness annotations seems redundant to the keyfor hierarchy, whereas a stub file that only provides keyfor annotations seems redundant to the nullness hierarchy.
To avoid many spurious warnings, #2758 provides a way to suppress warnings from a particular hierarchy, using a shouldWarnIfStubRedundantWithBytecode() method in the AnnotatedTypeFactory.

A general solution to this problem would be to determine redundancy only once all type systems processed the stub file. A warning should only be issued if if no information for any type system was found.

At the moment we don't have a single location that knows when all type systems have processed the stub files. #2758 implements this feature for the Nullness Checker.
If we find the need for redundancy warnings for other type systems, we should investigate a more general implementation.

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 reviewing #2758 and the AnnotatedTypeFactory method shouldWarnIfStubRedundantWithBytecode(), then trace how stub files are processed by separate type hierarchies. The desired outcome is a general implementation that waits until all type systems have processed a stub file and warns only when no type system found information, avoiding spurious Nullness and KeyFor warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.