typetools / typetools/checker-framework

A static variable that's a key for a field is a key for the field in every object

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

Nobody has claimed this yet.

bug False Positive (false warning or imprecision) JavaExpressions
Dominant language
Java
Stars
1.1k
Forks
440
Avg merge
1d 12h
Merged PRs (30d)
134

Description

When a static field has type @KeyFor("this.map"), then it should be known to be a key into field map in every instance, not just this.

There is a test case in file tests/nullness/KeyForStaticField.java.

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 with tests/nullness/KeyForStaticField.java and run the test case to observe the current behavior. Trace the Checker Framework handling for @KeyFor on static fields, then update it so the annotation is recognized as a key for the named map in every instance and confirm the test passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.