eclipse-xtext / eclipse-xtext/xtext

Exception thrown when providing multiple resolutions for diagnostic

Open
#2,406 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
831
Forks
330
Avg merge
3d 7h
Merged PRs (30d)
12

Description

For example:

@QuickFix(ISSUE_CODE)
def fixIssueCode(DiagnosticResolutionAcceptor it) {
  accept("Option 1")[applyOption1]
  accept("Option 2")[applyOption2]
}

The exception in 2.29.0.M1 is
https://github.com/eclipse/xtext-core/blob/0a6606ee5091c48a716f74932bb6dd693cbee227/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/serializer/impl/ChangeSerializer.java#L133

It looks like the modifications end up reusing the same ChangeSerializer instance from the factory without resetting it but get a fresh resource set to apply:
https://github.com/eclipse/xtext-core/blob/294a6ec4ee0086a613dd44b013b61ccc6ae65959/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/quickfix/DiagnosticResolution.java#L112

I had this problem in 2.28.0 too, so it's not a regression.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the @QuickFix example, then inspect ChangeSerializer.java around line 133 and DiagnosticResolution.java around line 112. Trace how multiple accepted resolutions reuse the serializer with a fresh resource set. Done means both options can be provided and applied without the reported exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.