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

uber / NullAway / #950
93%

Build:
DEFAULT BRANCH: master
Ran 12 Sep 2022 11:21PM UTC
Jobs 1
Files 73
Run time 3s
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
#950

push

github-actions

web-flow
Fix crash when querying null-markedness of $primitive.class expressions. (#654)

NullAway 0.10.0 introduces a crash when performing dataflow and encountering expressions of the form `${primitive}.class` (e.g. `int.class`, `boolean.class`, `void.class`).

These expressions look to dataflow and AST analysis like standard field accesses, but calling `ASTHelpers.enclosingClass(symbol)` on the symbol representing e.g. `boolean.class`, returns `null`. 

This is despite `symbol.owner` for these expressions being a non-null `ClassSymbol`. What happens there is that the class symbol for int/boolean/etc is one for which `encClass()` returns `null` rather than itself, which is the behavior for "real" classes. 

Before 0.10.0, we were  skipping this kind of expressions via `NullabilityUtil.mayBeNullFieldFromType(...)`, but after #652, we have a new path through handlers that might attempt to query them for null-markedness.

We _could_ skip these fields by partitioning `NullabilityUtil.mayBeNullFieldFromType(...)` into two different methods performing two separate checks:

- One checking for `symbol.getSimpleName().toString().equals("class") || symbol.isEnum()` and aborting `visitFieldAccess(...)` early, without worrying about `handler.onDataflowVisitFieldAccess(...)`
- One checking for `!codeAnnotationInfo.isSymbolUnannotated(symbol, config) && Nullness.hasNullableAnnotation(symbol, config)` and combined with the results from any handler.

That said, a potentially more robust approach (and the one this PR takes), requiring less careful maintenance of invariants, is to add handling of `${primitive}.class` directly into  `CodeAnnotationInfo::isSymbolUnannotated`. This should prevent a similar bug from being re-introduced through a different checking path, which is important given the difficultly of debugging dataflow issues.

This PR also contains a small unrelated test case for static import that appeared to be related during triage of this bug, but... (continued)

4926 of 5321 relevant lines covered (92.58%)

0.93 hits per line

Jobs
ID Job ID Ran Files Coverage
1 #950.1 12 Sep 2022 11:21PM UTC 0
92.58
Source Files on build #950
Detailed source file information is not available for this build.
  • Back to Repo
  • Build #950
  • de1a12bf 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