Try to avoid This property is in an unexpected state
errors
#294
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before this PR
Internally, we are seeing a lot of errors with #286 of this form:
I think this is similar to what we encountered in #51. baseline-java-versions/Gradle gets JDKs in parallel on different threads. Gradle really isn't set up to handle this multi-threading, especially when it comes to finalizing property values. Gradle even has this comment:
I think when making stuff
finalizeValueOnRead
we now encounter this bug.After this PR
==COMMIT_MSG==
Try to avoid
This property is in an unexpected state
errors==COMMIT_MSG==
We do this by not doing
finalizeValueOnRead
.I also removed some of the "extra" laziness I introduced in the previous PR. This extra laziness gave more places where this property could be finalised on different threads, and I don't think we need the extra laziness (or at least did fine without it before).
Possible downsides?
I can't repro this locally. It seems to happen on <1% of builds according to the build scan server. So no tests, this is purely an educated guess whether it will fix this.