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

uber / NullAway / #1098
93%

Build:
DEFAULT BRANCH: master
Ran 01 Jun 2023 04:35PM UTC
Jobs 1
Files 79
Run time 2s
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
#1098

push

github-actions

web-flow
Fix error inside Lombok generated code for @Nullable @Builder.Default (#765)

When given code such as:

```
@Builder
public class LombokDTO {
  @Nullable @Builder.Default private String fieldWithNullDefault = null;
}
```

Lombok internally generates the following method:

```
@java.lang.SuppressWarnings(value = "all")
@lombok.Generated()
private static String $default$fieldWithNullDefault() {
    return null;
}
```

which does not propagate `@Nullable` to the method's return type!

While this method is marked as `@Generated` code and `@SuppressWarnings("all")`, that does not suppress NullAway under all configurations. In fact, we sometimes want to check generated code (setters/getters for auto-annotation, for example), so just counting all Lombok Generated code as unannotated is not always the desired behavior (it's optional behavior, enabled by the `TreatGeneratedAsUnannotated=true` flag).

Instead, we want to internally and implicitly propagate the `@Nullable` annotation from `fieldWithNullDefault` to the generated `$default$fieldWithNullDefault()`.

We do this in two steps:

1. We modify our checking of return statements to allow handlers' existing overriding of method return nullability to be taken into account when deciding if `return [nullable expression];` should result in a NullAway error.
2. We add a new handler for fixing the Lombok nullability propagation, by detecting these `$default$foo()` methods and looking at the nullability of `foo` to determine if the method should also be `@Nullable`.

In addition to this, we can suggest a fix upstream in Lombok to propagate `@Nullable` to these `$default$` methods when present on the field, but this would not obviate the need for this PR, since we are keeping compatibility with multiple older Lombok releases internally.

Edit: Also, note that coverage on `LombokHandler` is bad in terms of unit tests, but that's because coveralls doesn't count `test-java-lib-lombok/` ... (continued)

5550 of 5987 relevant lines covered (92.7%)

0.93 hits per line

Jobs
ID Job ID Ran Files Coverage
1 #1098.1 01 Jun 2023 04:35PM UTC 0
92.7
Source Files on build #1098
Detailed source file information is not available for this build.
  • Back to Repo
  • Build #1098
  • d09ff9b9 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