Skip to content

Conversation

@Achal1607
Copy link
Collaborator

@Achal1607 Achal1607 commented Nov 12, 2025

Fixes crashes and incorrect behavior when resolving completion items across different javac contexts.

When completion items are created, they capture Element references from the initial javac context. Later, when the LSP client calls completionItem/resolve to fetch additionalTextEdits, a new javac context may be used (especially if the file was modified). The old Element instances are invalid in the new context, causing Assertion Error rootPackage missing!; currModule: java.base.

So, store ElementHandles instead of stale Elements when creating completion items.

Thanks @lahodaj for helping out.

@Achal1607 Achal1607 requested a review from lahodaj November 12, 2025 08:40
@Achal1607 Achal1607 added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) LSP [ci] enable Language Server Protocol tests labels Nov 12, 2025
@apache apache locked and limited conversation to collaborators Nov 12, 2025
@apache apache unlocked this conversation Nov 12, 2025
@mbien mbien added this to the NB29 milestone Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) LSP [ci] enable Language Server Protocol tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants