Skip to content
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

False positive regarding @KeyFor #181

Open
d367wang opened this issue Jul 21, 2021 · 0 comments
Open

False positive regarding @KeyFor #181

d367wang opened this issue Jul 21, 2021 · 0 comments

Comments

@d367wang
Copy link

d367wang commented Jul 21, 2021

The following test case works with https://github.com/typetools/checker-framework, while gets false positive with the opprop version.

import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.*;

class A {

    public HashMap<Integer, Date> call_hashmap = new HashMap<>();
    public HashMap<Integer, Date> getMap() {return call_hashmap;}

}

class NonNullMapValue {

    public void process_unmatched_procedure_entries(A a) {
        for (Integer i : a.getMap().keySet()) {
            @NonNull Date d = a.getMap().get(i);
        }
    }
}

gets false positive as

case/KeyForDemo.java:33: error: [assignment.type.incompatible] incompatible types in assignment.
@nonnull Date d = a.getMap().get(i);
^
found : @initialized @nullable Date
required: @UnknownInitialization @nonnull Date
1 error

@wmdietl wmdietl transferred this issue from opprop/checker-framework-inference Jul 21, 2021
wmdietl pushed a commit to zcai1/checker-framework that referenced this issue Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant