You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary of issue: A field that is nullable is nondeterministically having a null check in the generated code, depending on what other build tasks occurred.
interfaceCommittedBundle<T> extendsBundle<T, PCollection<T>> {
/** Returns the PCollection that the elements of this bundle belong to. */@Override@NullablePCollection<T> getPCollection();
...
}
In all cases the PCollection field should be nullable.
In a "good" build, the AutoValue generated code constructor does not check for null
The Java compiler has historically had a number of bugs with type-use annotations, like org.checkerframework.checker.nullness.qual.Nullable. Specifically, it reports them correctly to annotation processors like AutoValue if the code in question is being compiled at the same time, but it doesn't always report them correctly if they are in already-compiled code. To see whether this is indeed the problem, you could try using javax.annotation.Nullable instead. That's not a type-use annotation, and I see you already have javax.annotation.Nonnull in the same source file so presumably this should work.
If this is indeed the problem, I'm afraid I don't have a good solution other than that.
I agree this sounds like something that could happen if the incremental compilation was sometimes compiling both classes as source, and sometimes compiling just one of them and reading the other as a .class file. If that's what's happening, it's an interaction between gradle's incremental compilation behaviour and this javac issue: https://bugs.openjdk.org/browse/JDK-8225377
Summary of issue: A field that is nullable is nondeterministically having a null check in the generated code, depending on what other build tasks occurred.
See https://lists.apache.org/thread/cdw4y50r3hl37z8y7x470m2mddclkqgv (from here you can gather more info from the thread)
Inline, paraphrasing the thread...
To reproduce:
git clone https://github.com/apache/beam cd beam git checkout 4ffeae4d2b800f2df36d2ea2eab549f2204d5691~1 ./gradlew :runners:direct-java:compileJava less ./runners/direct-java/build/generated/sources/annotationProcessor/java/main/org/apache/beam/runners/direct/AutoValue_ImmutableListBundleFactory_CommittedImmutableListBundle.java git checkout 4ffeae4d2b800f2df36d2ea2eab549f2204d5691 ./gradlew :runners:direct-java:compileJava less ./runners/direct-java/build/generated/sources/annotationProcessor/java/main/org/apache/beam/runners/direct/AutoValue_ImmutableListBundleFactory_CommittedImmutableListBundle.java ./gradlew :runners:direct-java:compileJava --rerun-tasks less ./runners/direct-java/build/generated/sources/annotationProcessor/java/main/org/apache/beam/runners/direct/AutoValue_ImmutableListBundleFactory_CommittedImmutableListBundle.java
The class at https://github.com/apache/beam/blob/1dff59b4ff26310f88f927edfcf44709ed6ea9c2/runners/direct-java/src/main/java/org/apache/beam/runners/direct/ImmutableListBundleFactory.java#L130
extends https://github.com/apache/beam/blob/1dff59b4ff26310f88f927edfcf44709ed6ea9c2/runners/direct-java/src/main/java/org/apache/beam/runners/direct/CommittedBundle.java#L35
In all cases the
PCollection
field should be nullable.In a "good" build, the AutoValue generated code constructor does not check for null
in a 'bad' build, the autovalue java is re-generated, but has an added nullness check:
and then with
--rerun-tasks
it gets re-re-generated without the nullness check.The text was updated successfully, but these errors were encountered: