eclipse-platform / eclipse.platform.swt

Eclipse SWT
https://www.eclipse.org/swt/
Eclipse Public License 2.0
118 stars 137 forks source link

Compilation error in Snippet382 on Linux/macOS #1460

Closed ptziegler closed 2 months ago

ptziegler commented 2 months ago

Describe the bug

This snippet sets the nativeZoom field of the GCData object. However, this field only exists on Windows, leading to a compilation error on both Linux and macOS.

https://github.com/eclipse-platform/eclipse.platform.swt/blob/ca113ca06e4e50bf46056fa46ef45f77998293ac/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet382.java#L105-L113

Screenshots

image

Environment:

  1. Select the platform(s) on which the behavior is seen:
      • [ ] All OS
      • [ ] Windows
      • [x] Linux
      • [x] macOS
akurtakov commented 2 months ago

Seems caused by https://github.com/eclipse-platform/eclipse.platform.swt/pull/1214

HeikoKlare commented 2 months ago

Looks like you have an invalid state of a .classpath file in the snippets project. The snippet is Windows only and accordingly excluded from the classpath files for MacOS and Linux: https://github.com/eclipse-platform/eclipse.platform.swt/blob/ca113ca06e4e50bf46056fa46ef45f77998293ac/examples/org.eclipse.swt.snippets/.classpath_cocoa#L5

https://github.com/eclipse-platform/eclipse.platform.swt/blob/ca113ca06e4e50bf46056fa46ef45f77998293ac/examples/org.eclipse.swt.snippets/.classpath_gtk#L5

You should remove the existing .classpath file in the snippet project and either copy and rename the correct or, if you have an Oomphed setup, perform setup tasks and have Oomph fix that for your.

ptziegler commented 2 months ago

Hm... the classpath is correctly pointing to .classpath_gtk:

image

And there the snippet is correctly excluded:

image

So it seems like the classpath is simply not updated properly :/ I've checked out a fresh workspace where the error doesn't show up anymore.

Thanks you both for your input!

HeikoKlare commented 2 months ago

You are showing the linked .classpath file of the SWT fragment (like org.eclipse.swt.gtk.linux.x86_64) , not of the snippets project (i.e., org.eclipse.swt.snippets). In the snippets project, there is no linking of the correct .classpath file. It is simply copied by the Oomph setup (or by hand, in a manual setup). This is how it looks like:

image