Skip to content

Referenced method returns @Nullable, but functional interface method java.util.function.Function.apply(T) returns @NonNull #1186

Closed
@daniel-b2c2

Description

@daniel-b2c2

How does one satisfy NullAway here:

public interface RedisCache {
...
    @Nullable
    <T> Map<String, T> hgetall(CachedKey key);
...
}

...

public class Example {
   private final Function<RedisCache.CachedKey, Map<String, String>> retrieveFn;
   ...
   public Example() {
      retrieveFn = redisCache::hgetall;     // <<<<<<<<<<<<
   }
Example.java error: [NullAway] referenced method returns @Nullable, but functional interface method java.util.function.Function.apply(T) returns @NonNull
            retrieveFn = redisCache::hgetall;
                         ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions