typetools / typetools/checker-framework

Covariant annotations for Java 8 stream classes

Open
#1,444 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I was trying to create a test case for someting similar to https://github.com/typetools/checker-framework/issues/886 when I got this:

A.java:10: warning: [argument.type.incompatible] incompatible types in argument.
        return t(sb, false);
                 ^
  found   : @Initialized @NonNull Supplier<@Initialized @NonNull Boolean>
  required: @Initialized @NonNull Supplier<@Initialized @Nullable Boolean>

Is this normal?

import java.util.function.Supplier;
import org.checkerframework.checker.nullness.qual.Nullable;

public class A {

    public boolean b(Supplier<Boolean> sb) {
        return t(sb, false);
    }

    public <T> T t(Supplier<@Nullable T> st, T ifNull) {
        T get = st.get();
        return get != null ? get : ifNull;
    }

}

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 compiling the supplied A.java reproduction with the Checker Framework and inspect how Java 8 Supplier and stream-related annotations are declared. Determine the intended treatment of the Supplier argument and use the existing annotation tests, if located, to verify the expected result.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.