-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API error on SWT on a 4.34 master #1386
Comments
Previous SWT related bug: #1283 |
@merks, @HannesWell, @ptziegler : If I see that right, the fix for that in #1292 was undone in #1302, see |
I felt like this was a ground hog day issue that was fixed but now its back. 😱 That's what happens when there is no test. 😭 |
Interestingly, I can't reproduce JDT errors after switching default workspace JDK to Java 17 version (I had 21 before and tried to change that because I've assued that would "mute" SWT errors) and back. But instead, JDT errors disappeared but SWT still has errors ??? |
I see in debugger in |
Which JDK is set as default in the workspace? Could you try to change that?0 |
Could you just try to change it to 21, restart & rebuild JDT? That helped me, and after that I was able to switch back and still no errors. |
I see contract violation in Stack is
I can't say anything about that, it looks wrong, I will push a smaller workaround that fixes SWT error in a moment. |
Don't try to add EE to bundles that don't have any requirements defined in manifest. ManifestUtils.getRequiredExecutionEnvironments() currently returns "generic" bundle runtime requirements from OSGI for bundles that don't define anything, and it seem to be violation of the org.osgi.framework.wiring.BundleRevision.getDeclaredRequirements(String) contract that isn't supposed to return anything if nothing is specified in the manifest. At least for API baseline tooling use of OSGI generic requirements not specified in the manifest do not make sense, as we compare what's written in the manifest and not what is derived from the platform or host. Fixes eclipse-pde#1386
The problem is there for 21 and when I switch back. |
If I understand the issue correctly I think the new method in ManifestUtils should filter these artificial requirement out. That method is supposed to return what is declared in the manifest. The test-case added in #1302 could also be extended to test the case if no EE is required. I can look into both later this evening. IIRC I checked the code for these artificial EE requirements when reviewing #1302, but it was probably only for the |
This issue is effectively the inverse of what I ran into, based on the two possible configurations where an error may be shown:
My issue is related to the first case, where the problem lied in the workspace component specifying the EE via the The issue @iloveeclipse is having is related to the second case, where the gtk fragment doesn't have an EE on the update site (and therefore in the baseline), but does have it in the SWT workspace. |
GTK fragment does not have EE in the manifest! |
This checks whether no error is produced when both the Require-Capability and the Bundle-RequiredExecutionEvironment headers are missing from the manifest. See eclipse-pde#1386
This checks whether no error is produced when both the Require-Capability and the Bundle-RequiredExecutionEvironment headers are missing from the manifest. See eclipse-pde#1386
Then I must've overlooked it... You are correct, of course. I've created #1388 to handle this regression and also tested it against your PR, which makes the test succeed. Though that must mean the ManifestUtils method somehow still adds those artificial requirements, even if they are not in the manifest. |
This checks whether no error is produced when both the Require-Capability and the Bundle-RequiredExecutionEvironment headers are missing from the manifest. See eclipse-pde#1386
See above: #1386 (comment) |
Thanks, would be good to have the fix merged soon |
I'm investigating why this is happening, but didn't found the cause yet. |
We would like to merge an SWT PR that will bump the minor version of the SWT bundles (eclipse-platform/eclipse.platform.swt#1409) From my understanding, that will "implicitly" resolve the discussed API errors. I would like to make sure that merging it will not make analysis of this issue more complicated. So do you think we can merge that PR or should we wait for more progress or resolution of this issue? That would, of course, also apply to any further SWT PR that might require a minor version bump. |
I think the problem is understood and we have also a test case now via #1388.
Feel free to merge SWT code that can be merged. |
FYI, I did a completely from scratch platform SDK setup and the JDT problem recurs there: But it doesn't occur from a debug launch. 😢 And trying to simplify the workspace before remote debugging, when the project is the only thing in the workspace and the rest is in the target platform, there are no API errors: |
It looks like things are going wrong here The first description is processed and it has the correct information, but then the second one is processed for the mock thing and that one is inappropriate. I'm not sure if the order of these things is deterministic because the last one always wins. And while exact has been set, but a wrapper object is returned and so nothing determines that the thing is exact. How best to fix this... |
Ed, do you mean, that analysis of the "mock" bundle makes the core bundle data corrupt, or the "mock" bundle analysis reports results to the wrong bundle? Why is "mock" thing analyzed at all? |
There are two descriptions and the last one wins. So the mock bundle's description wins. I assume everything in the workspace is analyzed. That mock thing has an NonAPIProjectDescription, whatever that is. Keep in mind I really don't know the design of the API tools. I'm considering either how to make use of exact information better how to prioritize a ProjectAPIDescription's annotation over those of a NonAPIProjectDecription. So I'm continuing to debug and try out solutions. |
@merks : thanks to your great observation, I can reproduce too. The |
I have prototyped what I believe is an appropriate fix so the method will be like this:
I added a default isExact method to IApiAnnotations and make TypeAnnotations delegate to the IApiAnnotations that it wraps. This does fix the problem in debug mode. But I have to go out now and will create a PR later and we can hope it causes no regressions. |
- CompositeApiDescription.resolveAnnotations should be able to properly find the best match annotation using IApiAnnotations.isExact which is now also implemented by TypeAnnotations.isExact. eclipse-pde#1386
There was a "going out" delays so now there is a PR being built. |
- CompositeApiDescription.resolveAnnotations should be able to properly find the best match annotation using IApiAnnotations.isExact which is now also implemented by TypeAnnotations.isExact. eclipse-pde#1386
- CompositeApiDescription.resolveAnnotations should be able to properly find the best match annotation using IApiAnnotations.isExact which is now also implemented by TypeAnnotations.isExact. #1386
Don't try to add EE to bundles that don't have any requirements defined in manifest. ManifestUtils.getRequiredExecutionEnvironments() currently returns "generic" bundle runtime requirements from OSGI for bundles that don't define anything, and it seem to be violation of the org.osgi.framework.wiring.BundleRevision.getDeclaredRequirements(String) contract that isn't supposed to return anything if nothing is specified in the manifest. At least for API baseline tooling use of OSGI generic requirements not specified in the manifest do not make sense, as we compare what's written in the manifest and not what is derived from the platform or host. Fixes eclipse-pde#1386
This checks whether no error is produced when both, the Bundle-RequiredExecutionEvironment header as well as an 'osgi.ee' element for the Require-Capability are missing from the manifest. See eclipse-pde#1386
And if consider no EE. Fixes eclipse-pde#1386
And assume no EE if that check is positive. Fixes eclipse-pde#1386
OK, I found the cause for this and PDE itself is actually to blame, eclipse.pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/MinimalState.java Lines 141 to 160 in 0953a33
From the comments I believe we should really leave the injection of the synthetic EE in place. To fix this issue we should just restore the check for an explicit EE in Alternatively we could also add another synthetic capability provided by a bundle with no EE and could check its existence. eclipse.pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/util/ManifestUtils.java Lines 316 to 321 in 0953a33
|
And assume no EE if that check is positive. Restores main part of eclipse-pde#1292 Fixes eclipse-pde#1386
This checks whether no error is produced when both, the Bundle-RequiredExecutionEvironment header as well as an 'osgi.ee' element for the Require-Capability are missing from the manifest. See #1386
I see API error on SWT if using https://download.eclipse.org/eclipse/downloads/drops4/S-4.33RC2a-202409030240/ as API baseline and https://download.eclipse.org/eclipse/downloads/drops4/I20240904-0530/ as IDE.
SWT error is about changed execution environment.
I've rebuilt everything few times, no changes, errors do not disappear.
Note: originally reported API errors for JDT were gone after switching default workspace JDK from 21 to 17 and back, only SWT error remains.
The text was updated successfully, but these errors were encountered: