Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » WindowBuilder » Window Builder Crashes, but code still runs fine
Window Builder Crashes, but code still runs fine [message #1821702] Tue, 18 February 2020 20:46 Go to next message
Paul Hands is currently offline Paul HandsFriend
Messages: 1
Registered: February 2020
Junior Member
Hi, fellow Eclipse & Window Builder users!

I'm using the "Last Good" version of Window Builder in Eclipse 2019-12, on Mac OS X Catalina.

I had some code which I had Eclipse refactor to extract some methods into a reusable class.

Prior to the refactor, WindowBuilder worked just fine, but now it crashes on switching to the design view. The code itself runs just fine, showing the correct window when I launch it from Eclipse, which is puzzling, because that presumably means it is valid code.

The error is...

Quote:
Exception during constructor evaluation

An exception happened during evaluation of

new GroupLayout(customerDataDBCon.getContentPane())

Constructor GroupLayout(Container) was used with the parameters {<null>}.
Note: null values may occur when parsing complex expressions that can't be resolved at design-time.
java.lang.IllegalArgumentException: Container must be non-null
at java.desktop/javax.swing.GroupLayout.<init>(GroupLayout.java:377)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
Show stack trace.


The offending line of code is....

final GroupLayout gl_contentPane = new GroupLayout(customerDataDBCon.getContentPane());

where customerDataDBCon is an instance of the refactored class, which in turn is an extended JFrame.

Does anyone have any idea what the problem is? I stress that the code executes just fine.

Attached is a zipped report from WIndowBuilder.

Thanks,

Paul




Re: Window Builder Crashes, but code still runs fine [message #1821929 is a reply to message #1821702] Sun, 23 February 2020 13:44 Go to previous message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 493
Registered: July 2009
Senior Member

Hi Paul,

Windowbuilder is not able to statically track all possible permutations. Basically, WB can understand code that is has generated.

Therefore, when you refactor code with Eclipse, it is possible that WB cannot parse it anymore.

Over the years, I have developed this pattern for myself:

1. Design a gui in a standalone class. For example, let it subclass composite.
2. In my logic for example a view, instead of creating the GUI there, I just use my subclass of composite.

This enables me to divide into "generated" code and "handwritten" code. The latter I would offer to eclipse for refactoring, the former I would not.

** HOW TO RECOVER
Looking at the exception, WB does not know how to execute: 'customerDataDBCon.getContentPane()' and therefore it throws an NPE.

There might still the possibility to give WB some hints.

Look at the preferences documentation here: https://help.eclipse.org/2019-12/topic/org.eclipse.wb.doc.user/html/preferences/preferences_code_parsing.html

or here https://help.eclipse.org/2019-12/topic/org.eclipse.wb.doc.user/html/preferences/index.html?cp=94_8

Hope this helps,

Wim
Previous Topic:WindowBuilder Pro: Delete window configuration
Next Topic:Annoying graphic bug on Ubuntu
Goto Forum:
  


Current Time: Sun May 05 14:05:08 GMT 2024

Powered by FUDForum. Page generated in 0.04534 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top