You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@beam.apache.org by Steve Niemitz <sn...@apache.org> on 2022/03/24 22:00:49 UTC

Weird AutoValue bug when compiling GenerateSequence.Builder

Seemingly randomly when I build beam (I'm building 2.37 right now), the
AutoValue builder for GenerateSequence seems to ignore the @Nullable
attribute on many of the fields, resulting in an AutoValue builder that
enforces all fields are set.

This breaks building eg GenerateSequence.from(...).to(...).

The code that gets generated looks like:
    @Override
    GenerateSequence build() {
      if (this.from == null
          || this.to == null
          || this.timestampFn == null
          || this.elementsPerPeriod == null
          || this.period == null
          || this.maxReadTime == null) {
        StringBuilder missing = new StringBuilder();

This happens most of the time, even persisting through ./gradlew clean.

Has anyone run into this before?

Re: Weird AutoValue bug when compiling GenerateSequence.Builder

Posted by Steve Niemitz <sn...@apache.org>.
So the first time I run with --rerun-tasks correctly generates the
builder.  If I run gradle again after making any change to sdks-java-core,
the incorrect builder is generated and persists until I run with
--rerun-tasks again.  I think another target is overwriting it after it's
generated, if I watch the file it looks correct for a minute, then changes
after sdks-java-core builds.

On Thu, Mar 24, 2022 at 8:02 PM Steve Niemitz <sn...@apache.org> wrote:

> ./gradlew --rerun-tasks fixed it.  I had tried a clean many times (and
> deleted the generated file even), who knows what was actually cached that
> was wrong...
>
> On Thu, Mar 24, 2022 at 7:57 PM Steve Niemitz <sn...@apache.org> wrote:
>
>> 2.37 is on 1.8.2, I also tried 1.9.0 (which is what's on master) and ran
>> into the same problem.  I feel like there must be something weird with my
>> setup, but I can't for the life of me think what it'd be.  I tried gradle
>> with --no-parallel as well which didn't help.
>>
>> Right now every time I build I end up with the wrong generated builder, I
>> had the correct one at some point, but now it's back to always being wrong.
>>
>> On Thu, Mar 24, 2022 at 7:03 PM Reuven Lax <re...@google.com> wrote:
>>
>>> Did we pick up a new version of AutoValue?
>>>
>>> On Thu, Mar 24, 2022 at 3:01 PM Steve Niemitz <sn...@apache.org>
>>> wrote:
>>>
>>>> Seemingly randomly when I build beam (I'm building 2.37 right now), the
>>>> AutoValue builder for GenerateSequence seems to ignore the @Nullable
>>>> attribute on many of the fields, resulting in an AutoValue builder that
>>>> enforces all fields are set.
>>>>
>>>> This breaks building eg GenerateSequence.from(...).to(...).
>>>>
>>>> The code that gets generated looks like:
>>>>     @Override
>>>>     GenerateSequence build() {
>>>>       if (this.from == null
>>>>           || this.to == null
>>>>           || this.timestampFn == null
>>>>           || this.elementsPerPeriod == null
>>>>           || this.period == null
>>>>           || this.maxReadTime == null) {
>>>>         StringBuilder missing = new StringBuilder();
>>>>
>>>> This happens most of the time, even persisting through ./gradlew clean.
>>>>
>>>> Has anyone run into this before?
>>>>
>>>

Re: Weird AutoValue bug when compiling GenerateSequence.Builder

Posted by Steve Niemitz <sn...@apache.org>.
./gradlew --rerun-tasks fixed it.  I had tried a clean many times (and
deleted the generated file even), who knows what was actually cached that
was wrong...

On Thu, Mar 24, 2022 at 7:57 PM Steve Niemitz <sn...@apache.org> wrote:

> 2.37 is on 1.8.2, I also tried 1.9.0 (which is what's on master) and ran
> into the same problem.  I feel like there must be something weird with my
> setup, but I can't for the life of me think what it'd be.  I tried gradle
> with --no-parallel as well which didn't help.
>
> Right now every time I build I end up with the wrong generated builder, I
> had the correct one at some point, but now it's back to always being wrong.
>
> On Thu, Mar 24, 2022 at 7:03 PM Reuven Lax <re...@google.com> wrote:
>
>> Did we pick up a new version of AutoValue?
>>
>> On Thu, Mar 24, 2022 at 3:01 PM Steve Niemitz <sn...@apache.org>
>> wrote:
>>
>>> Seemingly randomly when I build beam (I'm building 2.37 right now), the
>>> AutoValue builder for GenerateSequence seems to ignore the @Nullable
>>> attribute on many of the fields, resulting in an AutoValue builder that
>>> enforces all fields are set.
>>>
>>> This breaks building eg GenerateSequence.from(...).to(...).
>>>
>>> The code that gets generated looks like:
>>>     @Override
>>>     GenerateSequence build() {
>>>       if (this.from == null
>>>           || this.to == null
>>>           || this.timestampFn == null
>>>           || this.elementsPerPeriod == null
>>>           || this.period == null
>>>           || this.maxReadTime == null) {
>>>         StringBuilder missing = new StringBuilder();
>>>
>>> This happens most of the time, even persisting through ./gradlew clean.
>>>
>>> Has anyone run into this before?
>>>
>>

Re: Weird AutoValue bug when compiling GenerateSequence.Builder

Posted by Steve Niemitz <sn...@apache.org>.
2.37 is on 1.8.2, I also tried 1.9.0 (which is what's on master) and ran
into the same problem.  I feel like there must be something weird with my
setup, but I can't for the life of me think what it'd be.  I tried gradle
with --no-parallel as well which didn't help.

Right now every time I build I end up with the wrong generated builder, I
had the correct one at some point, but now it's back to always being wrong.

On Thu, Mar 24, 2022 at 7:03 PM Reuven Lax <re...@google.com> wrote:

> Did we pick up a new version of AutoValue?
>
> On Thu, Mar 24, 2022 at 3:01 PM Steve Niemitz <sn...@apache.org> wrote:
>
>> Seemingly randomly when I build beam (I'm building 2.37 right now), the
>> AutoValue builder for GenerateSequence seems to ignore the @Nullable
>> attribute on many of the fields, resulting in an AutoValue builder that
>> enforces all fields are set.
>>
>> This breaks building eg GenerateSequence.from(...).to(...).
>>
>> The code that gets generated looks like:
>>     @Override
>>     GenerateSequence build() {
>>       if (this.from == null
>>           || this.to == null
>>           || this.timestampFn == null
>>           || this.elementsPerPeriod == null
>>           || this.period == null
>>           || this.maxReadTime == null) {
>>         StringBuilder missing = new StringBuilder();
>>
>> This happens most of the time, even persisting through ./gradlew clean.
>>
>> Has anyone run into this before?
>>
>

Re: Weird AutoValue bug when compiling GenerateSequence.Builder

Posted by Reuven Lax <re...@google.com>.
Did we pick up a new version of AutoValue?

On Thu, Mar 24, 2022 at 3:01 PM Steve Niemitz <sn...@apache.org> wrote:

> Seemingly randomly when I build beam (I'm building 2.37 right now), the
> AutoValue builder for GenerateSequence seems to ignore the @Nullable
> attribute on many of the fields, resulting in an AutoValue builder that
> enforces all fields are set.
>
> This breaks building eg GenerateSequence.from(...).to(...).
>
> The code that gets generated looks like:
>     @Override
>     GenerateSequence build() {
>       if (this.from == null
>           || this.to == null
>           || this.timestampFn == null
>           || this.elementsPerPeriod == null
>           || this.period == null
>           || this.maxReadTime == null) {
>         StringBuilder missing = new StringBuilder();
>
> This happens most of the time, even persisting through ./gradlew clean.
>
> Has anyone run into this before?
>