eclipse-pde / eclipse.pde

Eclipse Public License 2.0
24 stars 58 forks source link

API error on SWT "execution environments have been changed since" #1283

Closed iloveeclipse closed 3 weeks ago

iloveeclipse commented 3 weeks ago

I've set my baseline to 4.32RC2a build and see now this API error on SWT:

The minor version should be incremented in version 3.126.0, since execution environments have been changed since version 3.126.0

I'm not aware about any execution environment change in SWT, so why do we have that error now? Is something broken again with API descriptions, like we had it in 4.31 (se https://github.com/eclipse-pde/eclipse.pde/issues/1187)?

merks commented 3 weeks ago

The API baseline I find to be notoriously hard to update. If you to to the preference, double click it and refresh it, does that help? If not, restart, and do that again maybe helps?

iloveeclipse commented 3 weeks ago

Does it mean, you can't reproduce? I see it on both my Linux/Windows workspaces, so I assume this should be reproducible.

merks commented 3 weeks ago

Iā€™m driving around so not tried yet. So it was just a thought.

merks commented 3 weeks ago

Yes, I have that error too:

image

The thing doesn't have a BREE though and never did. Last release cycle it was version bumped without a reason...

merks commented 3 weeks ago

Debugging, here is the problem:

image

The API reference indicates there is no EE at all, but from the bundle description the current project computes that it has EE Java-17 even though that value is not present in the MANIFEST.MF.

While building the description, the entry is in the map, but not in the file itself:

image

And finally, we see here that PDE is adding the EE property, computed from the JRE associated with the project, to the manifest properties as if it were present in the loaded resource:

image

It's not entirely clear to me how to fix this problem. For validation would need to should be able to distinguish between a computed/implicit default value versus an explicitly-present value... I don't think it makes so much sense that the baseline ought to record some value not actually present and one that depends on the workspace's JRE. Note in particular that if one associates the JavaSE-17 EE with a Java 21 JRE/JDK, the computed value changes:

image

What to do...

iloveeclipse commented 3 weeks ago

The API reference indicates there is no EE at all

So this is not stored somewhere anymore? Where was it stored and which change broke that?

merks commented 3 weeks ago

It seems to me that every release I have this problem in SWT, and then it soon goes away. In hindsight now, I expect it goes away because the first change to SWT increments versions and then presto, all is good again. And then the next release cycle the problem comes back for a whoel while. That's my theory.

Also please read carefully what I wrote though. The computed value depends on which JDK/JRE version is bound which which EE in the user's workspace. So it is not correct, in my opinion, to store a EE compute value when none is specified. Of course PDE must have some good reason to inject an EE as if one were specified for some appropriate reasons, but the validation step should know the difference between such a computed value (that may be different from workspace to workspace) versus an actual specified value that may be deliberated changed over time.

I looked at the whole call chain that is producing the description and see nothing that would allow such information to be recorded easily. Perhaps via org.eclipse.osgi.service.resolver.BaseDescription.setUserObject(Object) if there isn't something else already using that "slot".

Of course another way to make this problem go away is to specify an EE. šŸ˜±

iloveeclipse commented 3 weeks ago

Ed, I haven't looked into debugger / git history yet, but what I can't understand: why was it working before? The check was fine with whatever was computed or stored or not stored for 4.31.

merks commented 3 weeks ago

@iloveeclipse

Yes, those are good question. If I restore a 4.31 baseline I can see if the baseline reference in that case was returned as non-null. It just seems to me that any non-null value is bogus because it's unspecified. Moreover the workspace the value will definitely be non-null but not a value that is the same across all machines. So even if JavaSE-17 was stored for the baseline, if you only have a Java 21 JRE for the workspace JRE, you'd also get an error that the EE was changed when nothing was changed.

Anyway, more investigation is required and I'm not sure when next I will find time. But it's super annoying to have a workspace with errors. šŸ˜±

merks commented 3 weeks ago

Maybe the EE check was disabled but now that we have shared preferences maybe it's no longer disabled?

image

merks commented 3 weeks ago

I can't launch anymore now either. šŸ˜±

java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: no swt-win32-4966 in java.library.path: C:\Program Files\Java\jdk-17.0.9+9\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jdk-21.0.2+13/bin/server;C:/Program Files/Java/jdk-21.0.2+13/bin;C:/Program Files/Java/jdk-17.0.9+9/bin/server;C:/Program Files/Java/jdk-17.0.9+9/bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Program Files\Git\usr\bin;C:\Program Files\dotnet\;C:\Program Files\TortoiseSVN\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%SYSTEMROOT%\System32\OpenSSH\;C:\Users\merks\AppData\Local\Microsoft\WindowsApps;;D:\Users\merks\platform-sdk-4.31\eclipse;;D:\Users\merks\platform-sdk-4.31\eclipse;;. no swt-win32 in java.library.path: C:\Program Files\Java\jdk-17.0.9+9\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jdk-21.0.2+13/bin/server;C:/Program Files/Java/jdk-21.0.2+13/bin;C:/Program Files/Java/jdk-17.0.9+9/bin/server;C:/Program Files/Java/jdk-17.0.9+9/bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Program Files\Git\usr\bin;C:\Program Files\dotnet\;C:\Program Files\TortoiseSVN\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%SYSTEMROOT%\System32\OpenSSH\;C:\Users\merks\AppData\Local\Microsoft\WindowsApps;;D:\Users\merks\platform-sdk-4.31\eclipse;;D:\Users\merks\platform-sdk-4.31\eclipse;;. no swt in java.library.path: C:\Program Files\Java\jdk-17.0.9+9\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jdk-21.0.2+13/bin/server;C:/Program Files/Java/jdk-21.0.2+13/bin;C:/Program Files/Java/jdk-17.0.9+9/bin/server;C:/Program Files/Java/jdk-17.0.9+9/bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Program Files\Git\usr\bin;C:\Program Files\dotnet\;C:\Program Files\TortoiseSVN\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%SYSTEMROOT%\System32\OpenSSH\;C:\Users\merks\AppData\Local\Microsoft\WindowsApps;;D:\Users\merks\platform-sdk-4.31\eclipse;;D:\Users\merks\platform-sdk-4.31\eclipse;;. Can't load library: C:\Users\merks.swt\lib\win32\x86_64\swt-win32-4966.dll Can't load library: C:\Users\merks.swt\lib\win32\x86_64\swt-win32.dll Can't load library: C:\Users\merks.swt\lib\win32\x86_64\swt.dll

HannesWell commented 3 weeks ago

I can't launch anymore now either. šŸ˜±

Probably due to https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/2085#issuecomment-2150007561 ff

iloveeclipse commented 3 weeks ago

I can't launch anymore now either. šŸ˜±

Probably due to eclipse-platform/eclipse.platform.releng.aggregator#2085 (comment) ff

Not probably, for sure because of missing SWT native libraries.

merks commented 3 weeks ago

I hope tomorrow is a better day.

iloveeclipse commented 3 weeks ago

I hope tomorrow is a better day.

My hope almost every day :)

merks commented 3 weeks ago

It's a little tricky to test the older baseline because the logic is preempted by many earlier guards, but if I force it to reach the logic where it checks the BREEs, it's clear that the baseline for Eclipse 4.31 for this fragment also has no BREE in the baseline reference:

image

So I don't think anything new is wrong nor that there was some regression. The bottom line is that the API baseline reads purely the bundle in the API baseline and used purely the contents of the actual MANIFEST.MF which has no BREE to create the bundle description. The workspace bundles are created using the manifest as returned by org.eclipse.pde.internal.core.MinimalState.loadWorkspaceBundleManifest(File, IResource) which adds a synthetic computed BREE. So the baseline will generally never have a BREE if there is no explicit BREE while the workspace bundle will generally always have a BREE even when there is no explicit BREE.

So my conclusion is that this can only be fixed in the API tools if there is somewhere, somehow, recorded information about whether the BREE the workspace bundle is implicit versus explicit.

merks commented 3 weeks ago

I'll leave this open until I verify that the actual update tomorrow fixes this problem.

merks commented 3 weeks ago

The update fixed the problem (after forcing it to rebuild).