Skip to content

fix: add ViewerComparator compatibility workaround for Outline view#1516

Merged
rubenporras merged 1 commit intoeclipse-lsp4e:mainfrom
iloveeclipse:issue_1515
Apr 9, 2026
Merged

fix: add ViewerComparator compatibility workaround for Outline view#1516
rubenporras merged 1 commit intoeclipse-lsp4e:mainfrom
iloveeclipse:issue_1515

Conversation

@iloveeclipse
Copy link
Copy Markdown
Contributor

CommonViewerComparator was introduced in Eclipse 4.39 and so Outline can't use this class on older Eclipse versions. Let use old CommonViewerSorter for compatibility with older Eclipse releases.

See eclipse-platform/eclipse.platform.ui#3621
Fixes #1515

@iloveeclipse
Copy link
Copy Markdown
Contributor Author

@rubenporras : I have to validate the fix with older SDK, just quickly coded that without testing for now.

@travkin79
Copy link
Copy Markdown
Contributor

I've created a target platform for Eclipse 4.38 and LSP4E (unfortunately, GitHub doesn't accept *.target files, so I added the code below). @iloveeclipse, your code doesn't compile using that target since org.eclipse.ui.navigator.CommonViewerComparator cannot be resolved.

target-platform-438.target

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target name="LSP4E Target-platform Eclipse 4.38">
  <locations>
    <location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
      <unit id="org.eclipse.lsp4j" version="0.0.0"/>
      <unit id="org.eclipse.lsp4j.jsonrpc" version="0.0.0"/>
      <unit id="org.eclipse.lsp4j.debug" version="0.0.0"/>
      <unit id="org.eclipse.lsp4j.jsonrpc.debug" version="0.0.0"/>
      <unit id="com.google.gson" version="0.0.0"/>
      <repository location="https://download.eclipse.org/lsp4j/updates/releases/1.0.0/"/>
    </location>
    <location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
      <unit id="org.eclipse.sdk.ide" version="0.0.0"/>
      <repository location="https://download.eclipse.org/releases/2025-12/"/>
    </location>
    <location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
      <unit id="org.eclipse.ui.tests.harness" version="0.0.0"/>
      <repository location="https://download.eclipse.org/eclipse/updates/4.38/"/>
    </location>
    <location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
      <repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/2025-12/"/>
      <unit id="org.commonmark" version="0.0.0"/>
      <unit id="org.commonmark.ext-gfm-tables" version="0.0.0"/>
      <unit id="com.google.guava" version="0.0.0"/>
      <unit id="com.google.guava.failureaccess" version="0.0.0"/>
    </location>
    <location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
      <unit id="org.eclipse.tm4e.feature.feature.group" version="0.0.0"/>
      <repository location="https://download.eclipse.org/tm4e/releases/0.17.2/"/>
    </location>
    <location includeDependencyDepth="none" includeDependencyScopes="compile" missingManifest="error" type="Maven">
      <dependencies>
        <dependency>
          <groupId>com.vegardit.no-npe</groupId>
          <artifactId>no-npe-eea-all</artifactId>
          <version>1.3.9</version>
          <type>jar</type>
        </dependency>
      </dependencies>
    </location>
  </locations>
  <targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21"/>
</target>

@iloveeclipse
Copy link
Copy Markdown
Contributor Author

your code doesn't compile using that target since org.eclipse.ui.navigator.CommonViewerComparator cannot be resolved

Sure, it is a workaround, but it compiles with current lsp4e target (whatever it is). The point is, it should work at runtime but not force lsp4e to change the target (for now). Whatever lsp4e decides regarding target handling is not part of this change / ticket.

@travkin79
Copy link
Copy Markdown
Contributor

@iloveeclipse, what I mean is, it doesn't work with Eclipse 4.38. I created an Eclipse 4.38 target to check your work-around and it doesn't work (doesn't compile), since the class CommonViewerComparator is not available in Eclipse 4.38.

If we just roll back the original PR #1512, the code compiles / works with Eclipse 4.38 and with Eclipse 4.39 (the current LSP4E target).

@iloveeclipse
Copy link
Copy Markdown
Contributor Author

If we just roll back the original PR #1512, the code compiles / works with Eclipse 4.38 and with Eclipse 4.39 (the current LSP4E target).

That is clear, but this is not my goal here, because it will cause troubles later once the CommonViewerSorter code will be removed from platform.

@travkin79
Copy link
Copy Markdown
Contributor

Ok, now I understand your approach. You still compile against Eclipse 4.39 (having CommonViewerComparator) and if someone using an older Eclipse version gets a NoClassDefFoundError, you catch that and fall back to CommonViewerSorter. So in that case it's ok that the code doesn't compile with Eclipse 4.38 (for now).

@iloveeclipse
Copy link
Copy Markdown
Contributor Author

Unfortunately current fix doesn't work. I still see the same error, looks like the class name is stored in the constant pool of the class even if it is only used in the method. I will try to provide something better.

@iloveeclipse iloveeclipse force-pushed the issue_1515 branch 2 times, most recently from 92a9730 to cc2c0ab Compare April 8, 2026 14:20
@iloveeclipse
Copy link
Copy Markdown
Contributor Author

Unfortunately current fix doesn't work.

Something strange happens here. In Eclipse patches work, but binaries produced by lsp4e Jenkins build don't work, looks like different compiler settings. This makes testing extremely hard...

CommonViewerComparator was introduced in Eclipse 4.39 and so Outline
can't use this class on older Eclipse versions. Let use old
CommonViewerSorter for compatibility with older Eclipse releases.

See eclipse-platform/eclipse.platform.ui#3621
Fixes eclipse-lsp4e#1515
@iloveeclipse
Copy link
Copy Markdown
Contributor Author

Finally, last build works on 4.38.

@rubenporras
Copy link
Copy Markdown
Contributor

Hi @iloveeclipse ,

thank you for the work. I will merge and do a new release.

@rubenporras rubenporras merged commit 4e015da into eclipse-lsp4e:main Apr 9, 2026
10 of 11 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.

0.30.1 breaks Eclipse compatibility for 4.38 and lower versions

3 participants