Bug 568914 - API analysis fails on compilation errors javax.annotation cannot be resolved
Summary: API analysis fails on compilation errors javax.annotation cannot be resolved
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Releng (show other bugs)
Version: 4.18   Edit
Hardware: All All
: P3 blocker (vote)
Target Milestone: 4.18 M3   Edit
Assignee: Mickael Istria CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-18 02:20 EST by Rolf Theunissen CLA
Modified: 2020-11-26 08:46 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rolf Theunissen CLA 2020-11-18 02:20:13 EST
Since the weekend, all the Gerrits on Platform-UI on current HEAD fail due to API errors, unrelated to the changes.
https://ci.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/

== Two projects fail
17:34:18 [ERROR] Failed to execute goal org.eclipse.tycho.extras:tycho-eclipserun-plugin:2.2.0-SNAPSHOT:eclipse-run (api-analysis) on project org.eclipse.e4.core.commands: Error while executing platform: Error while executing platform (return code: 10) -> [Help 1]
17:34:18 [ERROR] Failed to execute goal org.eclipse.tycho.extras:tycho-eclipserun-plugin:2.2.0-SNAPSHOT:eclipse-run (api-analysis) on project org.eclipse.e4.ui.swt.gtk: Error while executing platform: Error while executing platform (return code: 10) -> [Help 1]

== Cause
17:33:06 [INFO] Command line:
17:33:06 	[/opt/tools/java/openjdk/jdk-11/latest/bin/java, -Xmx2048M, -jar, /home/jenkins/agent/workspace/eclipse.platform.ui-Gerrit/.repository/p2/osgi/bundle/org.eclipse.equinox.launcher/1.6.0.v20200915-1508/org.eclipse.equinox.launcher-1.6.0.v20200915-1508.jar, -install, /home/jenkins/agent/workspace/eclipse.platform.ui-Gerrit/bundles/org.eclipse.e4.ui.swt.gtk/target/eclipserun-work, -configuration, /home/jenkins/agent/workspace/eclipse.platform.ui-Gerrit/bundles/org.eclipse.e4.ui.swt.gtk/target/eclipserun-work/configuration, -data, /home/jenkins/agent/workspace/eclipse.platform.ui-Gerrit/bundles/org.eclipse.e4.ui.swt.gtk/target/eclipserun-work/data, -data, /home/jenkins/agent/workspace/eclipse.platform.ui-Gerrit/bundles/org.eclipse.e4.ui.swt.gtk/../target/org.eclipse.e4.ui.swt.gtk-apiAnalyzer-workspace, -application, org.eclipse.pde.api.tools.apiAnalyzer, -project, /home/jenkins/agent/workspace/eclipse.platform.ui-Gerrit/bundles/org.eclipse.e4.ui.swt.gtk, -baseline, /home/jenkins/agent/workspace/eclipse.platform.ui-Gerrit/bundles/org.eclipse.e4.ui.swt.gtk/target/org.eclipse.e4.ui.swt.gtk-apiBaseline.target, -dependencyList, /home/jenkins/agent/workspace/eclipse.platform.ui-Gerrit/bundles/org.eclipse.e4.ui.swt.gtk/target/dependencies-list.txt, -failOnError]
17:33:18 Some blocking (most likely link/compilation) errors are present:
17:33:18 * Marker [on: /org.eclipse.e4.ui.swt.gtk/src/org/eclipse/e4/ui/swt/internal/gtk/DarkThemeProcessor.java, id: 0, type: org.eclipse.jdt.core.problem, attributes: [arguments: 1:javax.annotation.PostConstruct, categoryId: 30, charEnd: 627, charStart: 597, id: 268435846, lineNumber: 16, message: The import javax.annotation.PostConstruct cannot be resolved, severity: 2, sourceId: JDT], created: 11/17/20, 4:33 PM]
17:33:18 * Marker [on: /org.eclipse.e4.ui.swt.gtk/src/org/eclipse/e4/ui/swt/internal/gtk/DarkThemeProcessor.java, id: 1, type: org.eclipse.jdt.core.problem, attributes: [arguments: 1:javax.annotation.PreDestroy, categoryId: 30, charEnd: 663, charStart: 636, id: 268435846, lineNumber: 17, message: The import javax.annotation.PreDestroy cannot be resolved, severity: 2, sourceId: JDT], created: 11/17/20, 4:33 PM]
17:33:18 * Marker [on: /org.eclipse.e4.ui.swt.gtk/src/org/eclipse/e4/ui/swt/internal/gtk/DarkThemeProcessor.java, id: 2, type: org.eclipse.jdt.core.problem, attributes: [arguments: 1:PostConstruct, categoryId: 40, charEnd: 1133, charStart: 1120, id: 16777218, lineNumber: 35, message: PostConstruct cannot be resolved to a type, severity: 2, sourceId: JDT], created: 11/17/20, 4:33 PM]
17:33:18 * Marker [on: /org.eclipse.e4.ui.swt.gtk/src/org/eclipse/e4/ui/swt/internal/gtk/DarkThemeProcessor.java, id: 3, type: org.eclipse.jdt.core.problem, attributes: [arguments: 1:PreDestroy, categoryId: 40, charEnd: 1803, charStart: 1793, id: 16777218, lineNumber: 55, message: PreDestroy cannot be resolved to a type, severity: 2, sourceId: JDT], created: 11/17/20, 4:33 PM]
17:33:18 Some blocking (most likely link/compilation) errors are present ^^^
Comment 1 Mickael Istria CLA 2020-11-19 03:21:46 EST
This can be reproduced locally
$ eclipse.platform.ui/bundles/org.eclipse.e4.ui.swt.gtk$
$ mvn clean verify -Pbuild-individual-bundles -Papi-check
Comment 2 Andrey Loskutov CLA 2020-11-19 03:29:25 EST
I see only one probably related change in PDE - bug 568735. 
@Vikas: could that be the trigger?
Comment 3 Andrey Loskutov CLA 2020-11-19 03:31:18 EST
(In reply to Andrey Loskutov from comment #2)
> I see only one probably related change in PDE - bug 568735. 
> @Vikas: could that be the trigger?

If the problem started to occur later (Monday), bug 568836 could be related too.
Comment 4 Andrey Loskutov CLA 2020-11-19 03:40:07 EST
(In reply to Andrey Loskutov from comment #3)
> (In reply to Andrey Loskutov from comment #2)
> > I see only one probably related change in PDE - bug 568735. 
> > @Vikas: could that be the trigger?
> 
> If the problem started to occur later (Monday), bug 568836 could be related
> too.

No, I see it failing since 12.11 6:40 AM
https://ci.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/24162

12.11 3:52 AM fail is the different one:
https://ci.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/24161

So neither bug 568735 nor bug 568836 are related.
Comment 5 Andrey Loskutov CLA 2020-11-19 03:42:06 EST
(In reply to Andrey Loskutov from comment #4)
> No, I see it failing since 12.11 6:40 AM
> https://ci.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/24162
> 
> 12.11 3:52 AM fail is the different one:
> https://ci.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/24161
> 
> So neither bug 568735 nor bug 568836 are related.

Sorry, bug 568735 matches, it was committed 12.11 at 5:08 AM.
Comment 6 Mickael Istria CLA 2020-11-19 03:50:11 EST
Actually, the PDE changes did *fix* an issue which now makes the API Anlysis show a bug/limitation that was previously hidden by the bug in PDE.
The reason seems to be that the bundle in question has JavaSE-1.8 as BREE, but the IDE for API Analysis does not have a JavaSE-1.8 properly installed, so it fails back to the default one: JavaSE-11 which does *not* have javax.annotation while PDE seems to expect the JRE to have it (most likely because it consumes some JavaSE-1.8.profile file to resolve the dependencies). So now, this leads to PDE resolving against the BREE which is different from the resolved JRE, can lead to such missing packages. This can be reproduced in the IDE. I've opened https://bugs.eclipse.org/bugs/show_bug.cgi?id=568952 .
For this particular case, I suggest a quick fix/workaround: move BREE to JavaSE-11, so we have a perfect match of VM available to API Tools and BREE. I'm submitting a patch.
Comment 7 Eclipse Genie CLA 2020-11-19 03:53:58 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/172491
Comment 8 Alexander Kurtakov CLA 2020-11-19 03:58:24 EST
Thanks Mickael for the analysis. I'll land the bumps to Java 11 for RC1.
Comment 9 Mickael Istria CLA 2020-11-19 04:08:58 EST
More bundles are affected and can be made to work the same way:

$ grep -R -l JavaSE-1.8 | xargs grep -l javax.annotation
org.eclipse.e4.core.commands/META-INF/MANIFEST.MF
org.eclipse.e4.ui.progress/META-INF/MANIFEST.MF
org.eclipse.e4.ui.workbench.addons.swt/META-INF/MANIFEST.MF
org.eclipse.e4.ui.swt.win32/META-INF/MANIFEST.MF
org.eclipse.e4.ui.bindings/META-INF/MANIFEST.MF
org.eclipse.ui.ide/META-INF/MANIFEST.MF
org.eclipse.e4.ui.workbench/META-INF/MANIFEST.MF
org.eclipse.ui.workbench/META-INF/MANIFEST.MF
Comment 10 Andrey Loskutov CLA 2020-11-19 04:11:05 EST
(In reply to Mickael Istria from comment #9)
> More bundles are affected and can be made to work the same way:
> 
> $ grep -R -l JavaSE-1.8 | xargs grep -l javax.annotation
> org.eclipse.e4.core.commands/META-INF/MANIFEST.MF
> org.eclipse.e4.ui.progress/META-INF/MANIFEST.MF
> org.eclipse.e4.ui.workbench.addons.swt/META-INF/MANIFEST.MF
> org.eclipse.e4.ui.swt.win32/META-INF/MANIFEST.MF
> org.eclipse.e4.ui.bindings/META-INF/MANIFEST.MF
> org.eclipse.ui.ide/META-INF/MANIFEST.MF
> org.eclipse.e4.ui.workbench/META-INF/MANIFEST.MF
> org.eclipse.ui.workbench/META-INF/MANIFEST.MF

But *what* was the trigger for all this? Which change and where? Before we start to move each and every remaining UI bundle to Java 11 we should understand the root cause why it worked be fore and why it fails now.
Comment 11 Andrey Loskutov CLA 2020-11-19 04:18:53 EST
Is this the change from bug 567864?
Comment 12 Mickael Istria CLA 2020-11-19 04:24:19 EST
(In reply to Andrey Loskutov from comment #10)
> But *what* was the trigger for all this? Which change and where?

You did spot it, it's the changes for bug 567864 which by fixing one issue have revealed another one.

> Before we
> start to move each and every remaining UI bundle to Java 11 we should
> understand the root cause why it worked be fore and why it fails now.

I think we have a complete understanding of the change that highlights this issue, of the behavior and pre-conditions leading to this new issue, and a proper tracking of a possible fix in JDT. Is there anything missing?
Comment 13 Andrey Loskutov CLA 2020-11-19 04:34:01 EST
(In reply to Mickael Istria from comment #12)
> (In reply to Andrey Loskutov from comment #10)
> > But *what* was the trigger for all this? Which change and where?
> 
> You did spot it, it's the changes for bug 567864 which by fixing one issue
> have revealed another one.
> 
> > Before we
> > start to move each and every remaining UI bundle to Java 11 we should
> > understand the root cause why it worked be fore and why it fails now.
> 
> I think we have a complete understanding of the change that highlights this
> issue, of the behavior and pre-conditions leading to this new issue, and a
> proper tracking of a possible fix in JDT. Is there anything missing?

You mean PDE, not JDT I guess? 
*If* the root cause is bug 567864, I've missed reference to bug 567864.

But also I do not understand why bug 567864 change leads to compilation errors - it was about sort order of dependencies, but how the order change can lead to *missing* javax.annotation package?
Comment 14 Mickael Istria CLA 2020-11-19 04:38:34 EST
(In reply to Andrey Loskutov from comment #13)
> You mean PDE, not JDT I guess? 

Yes, sorry.

> But also I do not understand why bug 567864 change leads to compilation
> errors - it was about sort order of dependencies, but how the order change
> can lead to *missing* javax.annotation package?

Not about sorting order of depedencies, but more sorting the order of the *providers* for a given dependency resolution; when then are filtered/grouped/processed to a list of dependencies. It used to erroneously return the javax.annotation bundle for "Import-Package: javax.annotation" with BREE=JavaSE-1.8; this is fixed so now the BREE is used as provider and no bundle is added.
Then bug 568952 can surface and cascade to this issue in headless API Tools at build time.
Comment 15 Andrey Loskutov CLA 2020-11-19 04:45:19 EST
(In reply to Mickael Istria from comment #14)
> Not about sorting order of depedencies, but more sorting the order of the
> *providers* for a given dependency resolution; when then are
> filtered/grouped/processed to a list of dependencies. It used to erroneously
> return the javax.annotation bundle for "Import-Package: javax.annotation"
> with BREE=JavaSE-1.8; this is fixed so now the BREE is used as provider and
> no bundle is added.
> Then bug 568952 can surface and cascade to this issue in headless API Tools
> at build time.

OK, thanks, makes sense.
Comment 17 Mickael Istria CLA 2020-11-19 07:35:23 EST
Thanks for the report, discussion and review.
Comment 18 Eclipse Genie CLA 2020-11-19 08:19:03 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/172507
Comment 20 Rolf Theunissen CLA 2020-11-20 13:14:34 EST
Another issue appeared:

16:53:59 [INFO] Command line:
16:53:59 	[/opt/tools/java/openjdk/jdk-11/latest/bin/java, -Xmx2048M, -jar, /home/jenkins/agent/workspace/eclipse.platform.ui-Gerrit/.repository/p2/osgi/bundle/org.eclipse.equinox.launcher/1.6.0.v20200915-1508/org.eclipse.equinox.launcher-1.6.0.v20200915-1508.jar, -install, /home/jenkins/agent/workspace/eclipse.platform.ui-Gerrit/bundles/org.eclipse.e4.ui.services/target/eclipserun-work, -configuration, /home/jenkins/agent/workspace/eclipse.platform.ui-Gerrit/bundles/org.eclipse.e4.ui.services/target/eclipserun-work/configuration, -data, /home/jenkins/agent/workspace/eclipse.platform.ui-Gerrit/bundles/org.eclipse.e4.ui.services/target/eclipserun-work/data, -data, /home/jenkins/agent/workspace/eclipse.platform.ui-Gerrit/bundles/org.eclipse.e4.ui.services/../target/org.eclipse.e4.ui.services-apiAnalyzer-workspace, -application, org.eclipse.pde.api.tools.apiAnalyzer, -project, /home/jenkins/agent/workspace/eclipse.platform.ui-Gerrit/bundles/org.eclipse.e4.ui.services, -baseline, /home/jenkins/agent/workspace/eclipse.platform.ui-Gerrit/bundles/org.eclipse.e4.ui.services/target/org.eclipse.e4.ui.services-apiBaseline.target, -dependencyList, /home/jenkins/agent/workspace/eclipse.platform.ui-Gerrit/bundles/org.eclipse.e4.ui.services/target/dependencies-list.txt, -failOnError]
16:54:10 7 API ERRORS
16:54:10 * Marker [on: /org.eclipse.e4.ui.services/META-INF/MANIFEST.MF, id: 6, type: org.eclipse.pde.api.tools.version_numbering, attributes: [apiMarkerID: 4, charEnd: 143, charStart: 128, description: - The type org.eclipse.e4.ui.services.EMenuService in org.eclipse.e4.ui.services_1.4.0 is no longer an API
16:54:10 - The type org.eclipse.e4.ui.services.ContextServiceAddon in org.eclipse.e4.ui.services_1.4.0 is no longer an API
16:54:10 - The type org.eclipse.e4.ui.services.help.EHelpService in org.eclipse.e4.ui.services_1.4.0 is no longer an API
16:54:10 - The type org.eclipse.e4.ui.services.IServiceConstants in org.eclipse.e4.ui.services_1.4.0 is no longer an API
16:54:10 - The type org.eclipse.e4.ui.services.IStylingEngine in org.eclipse.e4.ui.services_1.4.0 is no longer an API
16:54:10 - The type org.eclipse.e4.ui.services.EContextService in org.eclipse.e4.ui.services_1.4.0 is no longer an API
16:54:10 , lineNumber: 4, message: The major version should be incremented in version 1.4.0, since API breakage occurred since version 1.3.700, messagearguments: 1.4.0#1.3.700, problemid: 923795461, severity: 2, sourceId: API Tools, version: 2.0.0.qualifier], created: 11/20/20, 3:54 PM]
Comment 21 Andrey Loskutov CLA 2020-11-20 13:23:11 EST
Rolf, please report new bug and link to the failed build.
Comment 22 Rolf Theunissen CLA 2020-11-21 10:45:03 EST
(In reply to Andrey Loskutov from comment #21)
> Rolf, please report new bug and link to the failed build.

It has been an intermittent error, a new build today succeeded. I will not report a bug. For reference: https://ci.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/24200/