Bug 526098 - WindowBuilder fails to work on Java 9
Summary: WindowBuilder fails to work on Java 9
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: WindowBuilder (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 10
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: Michael Golubev CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 521162 522680 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-10-16 12:58 EDT by Ahmed Ghannam CLA
Modified: 2021-06-04 16:45 EDT (History)
5 users (show)

See Also:


Attachments
The error that appears. (60.85 KB, image/png)
2017-10-16 12:58 EDT, Ahmed Ghannam CLA
no flags Details
Exception when opening a source file in the WB editor (15.39 KB, text/plain)
2017-11-07 17:44 EST, Tyler Cook CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmed Ghannam CLA 2017-10-16 12:58:43 EDT
Created attachment 271023 [details]
The error that appears.

So I installed Eclipse Oxygen 1a on Oct 11th. It came pre-packaged with Java 9 which was nice. After installing the WindowBuilder plugin, I was surprised to see that I can't use it. The plugin installs successfully, but when I click on any of its components under Swing Designer, I get an error message that says that the 'selected wizard could not be started.' 

I've not been able to find out exactly what's causing this. I had Neon with Java 8 just weeks ago and WindowBuilder worked fine there. But after starting from scratch with Oxygen and Java 9, I can't seem to be able to use WindowBuilder anymore. 

Please see the attachment for an image of the error I get.
Comment 1 Lars Vogel CLA 2017-10-17 09:12:17 EDT
IIRC this is most likely due to Java 9, I have seen other reports in which WB is failing if Java 9 is used. WB is currently low in priority list, but I can review incoming Gerrits.
Comment 2 Mickael Istria CLA 2017-10-17 09:51:34 EDT
@Ahmed: can you please share if there are interesting messages shown in <workspace>/.metadata/.log? An exception with a stacktrace would be perfect if you can see it ;)
Comment 3 Ahmed Ghannam CLA 2017-10-17 15:23:34 EDT
(In reply to Mickael Istria from comment #2)
> @Ahmed: can you please share if there are interesting messages shown in
> <workspace>/.metadata/.log? An exception with a stacktrace would be perfect
> if you can see it ;)

Thanks for the suggestion, Mickael. Unfortunately there is no relevant info in that location. The only thing I get is what you can see in the provided attachment. It doesn't tell me much else.
Comment 4 Ahmed Ghannam CLA 2017-10-17 15:25:58 EDT
(In reply to Lars Vogel from comment #1)
> IIRC this is most likely due to Java 9, I have seen other reports in which
> WB is failing if Java 9 is used. WB is currently low in priority list, but I
> can review incoming Gerrits.
If it's Java 9, then I guess I will just wait it out. I'd suspected it must be something to do with either Java 9 or the plugin itself. I reckon it's nothing a future update won't solve. But it's still kind of frustrating.
Comment 5 Tyler Cook CLA 2017-11-07 17:42:11 EST
I can confirm this bug on 4.7.1a on both Ubuntu and Arch Linux. Also the WB editor fails to open anything which I expect is the same bug. I will post a stacktrace.
Comment 6 Tyler Cook CLA 2017-11-07 17:44:23 EST
Created attachment 271365 [details]
Exception when opening a source file in the WB editor
Comment 7 Eclipse Genie CLA 2017-11-22 09:28:14 EST
New Gerrit change created: https://git.eclipse.org/r/112076
Comment 8 Eclipse Genie CLA 2017-11-22 10:04:20 EST
New Gerrit change created: https://git.eclipse.org/r/112086
Comment 9 Michael Golubev CLA 2017-11-22 10:26:18 EST
I have manually verified that the change from https://git.eclipse.org/r/112086 does fix the problem described at Bug 526098, at least when running WB from sources. 

I was able to run the WB tests, and at least majority of the them passed with the change. There are still clearly quite a lot of Java-9 specific failures in the tests, but the fix at least allows to move forward.

Reviving of the tests will be my the goal for the next gerrit, since in the actual repository state they don't compile due to the removing of the wb.css under Bug 502542
Comment 10 Lars Vogel CLA 2017-11-22 10:33:17 EST
(In reply to Michael Golubev from comment #9)

Please see comment in the Gerrit, IMHO we should simply remove the code which checks the Java version in WB instead of updating the lib (if that is possible, I did not yet check the code)

> Reviving of the tests will be my the goal for the next gerrit, since in the
> actual repository state they don't compile due to the removing of the wb.css
> under Bug 502542

Tests which refers to the removed plug-ins should also be retired. Please open a new bug for this (I thought I did cleanup them but sounds like I missed some....)
Comment 11 Lars Vogel CLA 2017-11-23 05:05:35 EST
Created piggy back CQ https://dev.eclipse.org/ipzilla/show_bug.cgi?id=15005 for org.apache.commons.lang Version: 2.6.0
Comment 12 Lars Vogel CLA 2017-11-24 04:05:54 EST
Can someone post a Swing snippet which make WB fail if I start Eclipse with Java9? Working on SWT with the following release works fine for me:

----------
Eclipse SDK
Version: Oxygen.1a (4.7.1a)
Build id: M20171009-0410
OS: Linux, v.4.13.0-16-generic, x86_64 / gtk 3.22.25
------------
Comment 13 Michael Golubev CLA 2017-11-24 04:28:03 EST
(In reply to Lars Vogel from comment #12)
> Can someone post a Swing snippet which make WB fail if I start Eclipse with
> Java9? Working on SWT with the following release works fine for me:

Please check that you have exactly 9.0 JDK, it worked for me with 9.0.1 until I downgraded target JRE to 9.0, which has unusual `System.getProperty("java.version").equals("9")`
Comment 14 Lars Vogel CLA 2017-11-24 04:29:52 EST
openjdk version "9.0.1.3"
OpenJDK Runtime Environment (Zulu build 9.0.1.3+11)
OpenJDK 64-Bit Server VM (Zulu build 9.0.1.3+11, mixed mode)
Comment 16 Lars Vogel CLA 2017-11-24 06:05:56 EST
Thanks Mickael, for the patch.

@Ahmed, could you try the WB build of tomorrow or later and tells us if your scenario works now?

Update site: http://download.eclipse.org/windowbuilder/WB/integration/4.8/
Comment 17 Michael Golubev CLA 2017-11-24 07:45:47 EST
Well, not quite yet. 

I tried the tutorial [1] under java 9.0 and at the step 5.1, switching to the design view produces the similar error which now comes from some other static initializer from other library: 

java.lang.NoClassDefFoundError: Could not initialize class org.mvel2.util.ParseTools

Caused by: java.lang.StringIndexOutOfBoundsException: begin 0, end 3, length 1
	at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3116)
	at java.base/java.lang.String.substring(String.java:1885)
	at org.mvel2.util.ParseTools.<clinit>(ParseTools.java:58)
	... 146 more

[1] https://examples.javacodegeeks.com/desktop-java/ide/eclipse/eclipse-windowbuilder-tutorial/
Comment 18 Michael Golubev CLA 2017-11-24 08:02:44 EST
And the bad part of the latter is that MVEL comes from custom "/lib/MWEL-fork.jar" so fixing it would require more than just update of the orbit library to the newer version. 

Fortunately there is also "/lib/MWEL-fork.zip" archive, so I will try to check whether we can re-compile just a single class and replace it in the custom jar. 

(no idea whether it is ok from the IP point of view, but lets solve technical problem first)
Comment 19 Eclipse Genie CLA 2017-11-24 09:21:34 EST
New Gerrit change created: https://git.eclipse.org/r/112257
Comment 20 Michael Golubev CLA 2017-11-24 09:32:16 EST
(In reply to Michael Golubev from comment #17)
> Well, not quite yet. 
> 
> I tried the tutorial [1] under java 9.0 and at the step 5.1, switching to
> the design view produces the similar error which now comes from some other
> static initializer from other library: 

With the gerrit https://git.eclipse.org/r/112257 I can see the Design view for a fresh SWT application.

I still have no idea how to run the new build (neither locally nor at the HIPP), so I only was able to check it running from sources.
Comment 21 Lars Vogel CLA 2017-11-24 09:34:31 EST
(In reply to Michael Golubev from comment #20)

> I still have no idea how to run the new build (neither locally nor at the
> HIPP), so I only was able to check it running from sources.

"mvn clean verify" should build the whole thing.
Comment 22 Michael Golubev CLA 2017-11-24 10:22:20 EST
(In reply to Lars Vogel from comment #21)

> "mvn clean verify" should build the whole thing.

I am confused now. Without the pom.xml in every project I haven't spotted the tycho build at all, pom-less build is really cool.

Anyway, with the new ability to build locally, I have fixed the gerrit and verified that the old-new class is actually included into the built jars.
Comment 23 Michael Golubev CLA 2017-11-26 17:34:52 EST
*** Bug 521162 has been marked as a duplicate of this bug. ***
Comment 24 Michael Golubev CLA 2017-11-26 17:35:47 EST
*** Bug 522680 has been marked as a duplicate of this bug. ***
Comment 26 Michael Golubev CLA 2018-02-21 16:33:04 EST
With the last commit, this should be finally fixed for all Java 9 versions