Fix use-before-initialize (NPE) in TextDocumentState#1055
Merged
DavyLandman merged 4 commits intomainfrom Apr 15, 2026
Merged
Conversation
…roperly initialized yet when an inner class instance (`Update`) was created. The inner class instance would use an uninitialized field of the outer class instance, resulting in an NPE.
…xplicitly executed on the worker pool yet (but possibly on the request pool)
…ture debugging easier
toinehartman
approved these changes
Apr 15, 2026
…State.java Co-authored-by: Toine Hartman <toinehartman@users.noreply.github.com>
|
PieterOlivier
approved these changes
Apr 15, 2026
DavyLandman
approved these changes
Apr 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



The UI tests on Ubuntu have become flaky (#1034 and #1037). This PR fixes a bug in the constructor of
TextDocumentStateto remove one cause of the flakiness.Problem
Before this PR, the constructor of
TextDocumentState:Updateobject. The constructor ofUpdate:AtomicReferencefield ofTextDocumentState.AtomicReferenceobject to store a tree after parsing.Due to scheduling, it could happen that step 1.ii was executed before step 2. In that case, an NPE occurs, as an attempt is made to set the
AtomicReferencewith the tree, but it hasn't been initialized yet. This NPE is swallowed inside a completion stage, though, so only the fallout (of not having stored the tree) is observable -- this is what happened in the UI tests.Solution
This PR:
AtomicReferenceobject is initialized before use. This addresses the root cause of the issue.Related PRs (subsumed by this PR):