Skip to content

Fix sorting when using a TreePathViewerSorter in AbstractTreeViewer#3901

Merged
iloveeclipse merged 1 commit intoeclipse-platform:masterfrom
FlorianKroiss:fix-sorting-using-common-viewer-sorter
Apr 22, 2026
Merged

Fix sorting when using a TreePathViewerSorter in AbstractTreeViewer#3901
iloveeclipse merged 1 commit intoeclipse-platform:masterfrom
FlorianKroiss:fix-sorting-using-common-viewer-sorter

Conversation

@FlorianKroiss
Copy link
Copy Markdown
Contributor

@FlorianKroiss FlorianKroiss commented Apr 18, 2026

Fixes #3900

I tried to minimize code duplication by making the outer if clause include both cases and then checking for the actual type again

@FlorianKroiss
Copy link
Copy Markdown
Contributor Author

FlorianKroiss commented Apr 18, 2026

@akurtakov I tested this change locally with the affected LSP4E version and the test passed again when using CommonViewerSorter.

@FlorianKroiss FlorianKroiss changed the title Fix sorting for CommonViewerSorter Fix sorting when using a TreePathViewerSorter in AbstractTreeViewer Apr 18, 2026
@merks
Copy link
Copy Markdown
Contributor

merks commented Apr 18, 2026

The baseline errors look kind of bogus and seem to be related to signed versus unsigned.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 18, 2026

Test Results

   852 files  ±0     852 suites  ±0   53m 38s ⏱️ - 5m 26s
 7 913 tests +2   7 670 ✅ +2  243 💤 ±0  0 ❌ ±0 
20 241 runs  +6  19 586 ✅ +6  655 💤 ±0  0 ❌ ±0 

Results for commit 9ea0a5e. ± Comparison against base commit b7b54fc.

♻️ This comment has been updated with latest results.

@akurtakov
Copy link
Copy Markdown
Member

Looks good to me but I'll not merge it now to give sometime for the verification issue to be investigated.

@merks
Copy link
Copy Markdown
Contributor

merks commented Apr 18, 2026

Is this PR based on master? @laeubi suggested this signing problem looks like one caused by being out of sync with master. Or maybe @HannesWell made build changes. Something is obviously fishy here...

@HannesWell
Copy link
Copy Markdown
Member

Or maybe @HannesWell made build changes. Something is obviously fishy here...

Not explicitly, but that it only affects tests is noticeable.

Error:  Failed to execute goal org.eclipse.tycho.extras:tycho-p2-extras-plugin:5.0.3-SNAPSHOT:compare-version-with-baselines (compare-attached-artifacts-with-release) on project org.eclipse.e4.core.commands.tests: Baseline and reactor have the same fully qualified version, but different content
Error:  different
Error:     META-INF/ECLIPSE_.RSA: present in baseline only
Error:     META-INF/ECLIPSE_.SF: present in baseline only

Maybe it's because of the recent removal of tests from the p2 repository. But as far as I know artifacts missing in the baseline are ignored.
But because that removal was only very recently, it could be that there are still older builds in the I-build composite that still contain the tests. And thus the baseline comparison sees an older version of the tests?

@HannesWell
Copy link
Copy Markdown
Member

made build changes. Something is obviously fishy here...

Since this happens in almost all repositories I've created a dedicated issue for that now:

@vogella
Copy link
Copy Markdown
Contributor

vogella commented Apr 19, 2026

Nit: the switch with an unreachable default -> throw new IllegalStateException() is awkward. The sibling method internalCompare at
AbstractTreeViewer.java:654-663 already handles the same dual-type case cleanly with two instanceof checks. Mirroring that pattern here
would be more consistent and drop the dead branch:

  if (comparator instanceof TreePathViewerSorter sorter) {                                                                                  
      sorter.sort(this, path, result);                                                                                                      
  } else if (comparator instanceof TreePathViewerComparator tpvc) {                                                                         
      tpvc.sort(this, path, result);                                                                                                        
  }  

@FlorianKroiss FlorianKroiss force-pushed the fix-sorting-using-common-viewer-sorter branch from b49305e to 6cc4385 Compare April 19, 2026 10:14
@FlorianKroiss
Copy link
Copy Markdown
Contributor Author

Thanks @vogella for taking a look. I adjusted the code accordingly.

I also added tests to make sure both cases work as expected.

@vogella vogella force-pushed the fix-sorting-using-common-viewer-sorter branch from 6cc4385 to 9ea0a5e Compare April 22, 2026 08:37
Copy link
Copy Markdown
Member

@iloveeclipse iloveeclipse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@iloveeclipse iloveeclipse merged commit d0eb817 into eclipse-platform:master Apr 22, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CommonViewerSorter broken since 2026-03

6 participants