Hi,
in Eclipse there is a setting to ignore optional compile errors, that can be configured for the generated sources.
In my projects those are always on, because AutoValue generates problems.
What cause the problems:
See the attached example...
AutoValueNNBD.zip
In this minimal example class, the generated code has 4 errors and 5 warnings.
In Eclipse (JDT) there are 3 null annotations: @NonNull, @Nullable and @NonNullByDefault
The @NonNullByDefault can be put onto field/method/class or event the package. Like in this example I have put it into the package-info.java.
In the example, I created a AutoValue_KeyValueProposal.java, to illustrate how it should look like from my POV to make it compile error free.
- Local variable instead of accessing the field twice for null-check then use
- All builder field to be
@Nullable
- No
@NonNull ever if the @NonNullByDefault is active
regards
Frank
Hi,
in Eclipse there is a setting to ignore optional compile errors, that can be configured for the generated sources.
In my projects those are always on, because AutoValue generates problems.
What cause the problems:
See the attached example...
AutoValueNNBD.zip
In this minimal example class, the generated code has 4 errors and 5 warnings.
In Eclipse (JDT) there are 3 null annotations:
@NonNull,@Nullableand@NonNullByDefaultThe
@NonNullByDefaultcan be put onto field/method/class or event the package. Like in this example I have put it into the package-info.java.In the example, I created a
AutoValue_KeyValueProposal.java, to illustrate how it should look like from my POV to make it compile error free.@Nullable@NonNullever if the@NonNullByDefaultis activeregards
Frank