Skip to content
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

[MacOS] E4 SWT Addons not triggered in first executed test case with Java 21 JVM #1784

Open
2 tasks done
HeikoKlare opened this issue Mar 28, 2024 · 0 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@HeikoKlare
Copy link
Contributor

Let's make sure issue is not already fixed in latest builds first.

Steps to reproduce

When executing test cases related to E4 SWT addons, i.e., the addons in org.eclipse.e4.ui.workbench.addons.swt, with a Java 21 JVM on MacOS, the first executed test case fails because the addon to be tested is not triggered. More precisely, the addon is not triggered for a topic it is registered for.

To reproduce, do the following:

  • Take any of the tests in org.eclipse.e4.ui.workbench.addons.swt.test, such as MaximizePartSashContainerPlaceholderTest or MaximizableChildrenTag
  • Create a run configuration for the test class with the following properties:
    • Run as headless application (Main tab -> "Run as application" -> "[No application] Headless Mode"), to ensure that no application is created by the JVM before the first test is run
    • Set execution environment to Java 21 (Main tab -> "Execution environment")
  • Execute the tests

You will see that the first test case is always failing:
image

Note that this does not happen in automated master builds because as long as some E4 application has been started before the one for the test is instantiated, everything seems to work fine (as can also be seen by all subsequent test cases succeeding). The bug can be seen in automated builds of #1775, where another addon test is introduced and the condition mentioned above is not fulfilled.

Detailed information for reproduction

You can see that the addon is not triggered for the topic on which a change happens while debugging the test. For example, the MaximizableChildrenTag.testPartStack1Max() triggers four changes on the tags topic with a Java 17 JVM, whereas it triggers only one change on that topic with a Java 21 JVM. This can be seen by setting a breakpoint in the topic-handling method of the addon:

private void subscribeTopicTagsChanged(
@UIEventTopic(UIEvents.ApplicationElement.TOPIC_TAGS) Event event) {
if (ignoreTagChanges) {

A breakpoint at the functionality that is tested by the test case is not triggered with a Java 21 JVM during execution of the first test case:

for (MUIElement toMinimize : elementsToMinimize) {
toMinimize.getTags().add(MINIMIZED);
toMinimize.getTags().add(MINIMIZED_BY_ZOOM);
}

Possible solution / workaround

I did not find a solution (as I did not find the reason for bug) so far. The only workaround is to instantiate an E4 application before executing the according test case once, e.g., by starting execution of a test class with an additional empty test case or by starting the tests under some application and not in headless mode.

Tested under this environment:

  • OS & version: MacOS 14.4.1
  • Eclipse IDE/Platform version (as shown in Help > About): I20240323-1800
  • OpenJDK 21.0.2

Community

  • I understand reporting an issue to this OSS project does not mandate anyone to fix it. Other contributors may consider the issue, or not, at their own convenience. The most efficient way to get it fixed is that I fix it myself and contribute it back as a good quality patch to the project.
@HeikoKlare HeikoKlare added the bug Something isn't working label Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant