• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

uber / NullAway / #584
93%

Build:
DEFAULT BRANCH: master
Ran 19 Oct 2021 09:44PM UTC
Jobs 1
Files 43
Run time 11s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
#584

push

github-actions

web-flow
Add basic library support for grpc Metadata through GrpcHandler (#505)

The primary goal of this PR is to support the usage of the class `io.grpc.Metadata` in a way that feels natural to how NullAway already handles maps. 

Handling `io.grpc.Metadata` is complicated by two factors:

* It implements `containsKey(...)` and `get(...)` methods that appear similar to the API of java maps, without actually implementing `java.util.Map`. Thus our existing support for maps can't handle this class, and this likely breaks developer expectations unless they are familiar with the implementation of both the grpc library and NullAway.
* Keys for `io.grpc.Metadata` aren't ever primitive types, but instead are usually references to fields of type `io.grpc.Metadata.Key<T>`. These fields are usually static and final (and the type is immutable), so they can safely be treated as constants, but our existing handling of compile-time constants in access paths is not enough here.

To solve this, we:

1) Implement equivalent logic to our usual map handling as a handler (`GrpcHandler`), which sets `x.y.z.get($foo)` as `@NonNull` on the then-branch whenever it sees a method node representing `x.y.z.containsKey($foo)`.
2) Improve on our handling of AccessPaths which include methods whose arguments point to static final fields of structurally immutable types (i.e. initialization-time constants, as opposed to compile-time). We allow handlers to declare the structurally immutable types they know (and care) about, rather than try to prove immutability as part of NullAway's analysis.

Note that a significant part of the code for implementing (2) involves threading knowledge of immutable types through the stateless AccessPath APIs. We accomplish this by creating a new `AccessPath.APContext` class, which is initialized by collecting information from all handlers whenever the dataflow analysis is initialized, and passed through all the operations manipulating access paths.

3597 of 4024 relevant lines covered (89.39%)

0.89 hits per line

Jobs
ID Job ID Ran Files Coverage
1 #584.1 19 Oct 2021 09:44PM UTC 0
89.39
Source Files on build #584
Detailed source file information is not available for this build.
  • Back to Repo
  • c970ea82 on github
  • Prev Build on master
  • Next Build on master
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc