facebook / facebook/infer

False positive: NULL_DEREFERENCE for Drift

Open
#780 0 comments 0 reactions 0 assignees View on GitHub
false-positive
Dominant language
OCaml
Stars
15.7k
Forks
2.1k
Avg merge
19h 36m
Merged PRs (30d)
13

Description

Infer version v0.13.0-4488ab099
repo: https://github.com/airlift/drift
commit: `ec21ec853535ccbbfea74a8981da97b81b68b3c0`

```
drift-codec/src/main/java/io/airlift/drift/codec/ThriftCodecManager.java:131: error: NULL_DEREFERENCE
object returned by `type.getKeyTypeReference()` could be null and is dereferenced by call to `getElementCodec(...)` at line 131.
129. return factory.generateThriftTypeCodec(ThriftCodecManager.this, type.getStructMetadata());
130. case MAP:
131. > return new MapThriftCodec<>(type, getElementCodec(type.getKeyTypeReference()), getElementCodec(type.getValueTypeReference()));
132. case SET:
133. return new SetThriftCodec<>(type, getElementCodec(type.getValueTypeReference()));
```

The method cannot return a null value:
```java
public ThriftTypeReference getKeyTypeReference()
{
checkState(keyTypeReference != null, "%s does not have a key", protocolType);
return keyTypeReference;
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.