eclipse-windowbuilder / windowbuilder

Eclipse Windowbuilder
https://projects.eclipse.org/projects/tools.windowbuilder
Eclipse Public License 1.0
78 stars 30 forks source link

Lambda expressions for buttons causes eclipse to hang #729

Closed igarshep closed 5 months ago

igarshep commented 5 months ago

I'm not entirely sure what triggers it, as some lambda expressions for buttons are fine, while others are not. I have verified that switching the method back to to a standard action listener action performed method works fine, so I suspect its related to it being in a lambda expression.

Whatever is causing the lambda expression to be interpreted, causes eclipse to freeze indefinitely when switching to the design tab.

This is in windowbuilder 1.15 (current, I believe)

ptziegler commented 5 months ago

Can you provide a small example or a short description on how to reproduce this problem?

As a follow-up question: What platform are you using? We had some problem in the past with Linux/GTK, due to the AWT and the SWT UI thread both blocking each other.

igarshep commented 5 months ago

I'm trying to figure out what it takes to reproduce it, it has something to do with the content of the lambda because as I start commenting lines out, at a certain point it starts working again.

I am experiencing it on OSX.

Not sure if this is relevant, but in the process of trying to recreate the conditions, I went to the Properties tab of the menu item with a lambda expression, and saw this:

image

If I double click, even though it does not change anything in the code, I get this stack trace: java.lang.ClassNotFoundException: org.eclipse.jdt.core.dom.LambdaTypeStub cannot be found by org.eclipse.jdt.core_3.37.0.v20240215-1452 at org.eclipse.osgi.internal.loader.BundleLoader.generateException(BundleLoader.java:562) at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:557) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:434) at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:174) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525) at org.eclipse.wb.internal.core.utils.ast.LambdaTypeDeclaration.create(LambdaTypeDeclaration.java:35) at org.eclipse.wb.internal.core.model.property.event.ListenerMethodProperty.findListenerType(ListenerMethodProperty.java:251) at org.eclipse.wb.internal.core.model.property.event.ListenerMethodProperty.findListenerMethod(ListenerMethodProperty.java:795) at org.eclipse.wb.internal.core.model.property.event.ListenerMethodProperty.findStubMethod(ListenerMethodProperty.java:996) at org.eclipse.wb.internal.core.model.property.event.ListenerMethodProperty.openStubMethod(ListenerMethodProperty.java:816) at org.eclipse.wb.internal.core.model.property.event.ListenerMethodPropertyEditor$1.run(ListenerMethodPropertyEditor.java:90) at org.eclipse.wb.internal.core.utils.execution.ExecutionUtils.run(ExecutionUtils.java:331) at org.eclipse.wb.internal.core.model.property.event.ListenerMethodPropertyEditor.openStubMethod(ListenerMethodPropertyEditor.java:87) at org.eclipse.wb.internal.core.model.property.event.ListenerMethodPropertyEditor.doubleClick(ListenerMethodPropertyEditor.java:65) at org.eclipse.wb.internal.core.model.property.table.PropertyTable.handleMouseDoubleClick(PropertyTable.java:400) at org.eclipse.wb.internal.core.model.property.table.PropertyTable$1.mouseDoubleClick(PropertyTable.java:167) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:200) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4643) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1524) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1547) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1532) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1325) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4410) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3986) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:152) at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:639) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:546) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:143) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:109) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:439) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:271) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:651) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:588) at org.eclipse.equinox.launcher.Main.run(Main.java:1459)

ptziegler commented 5 months ago

java.lang.ClassNotFoundException: org.eclipse.jdt.core.dom.LambdaTypeStub

Curious... it seems like org.eclipse.wb.jdt.fragment was never part of any release and therefore this mechanism couldn't have worked on a user workpace.

ptziegler commented 5 months ago

And the reason this issue doesn't happen for the standard action listeners because we've checked in the class file... That's nasty.

ptziegler commented 5 months ago

@igarshep @rosennej Can you two check with tomorrows nightly build whether this issue still persists?

rosennej commented 5 months ago

I tested it superficially and it works fine.

However, the update failed with the message "operation plan must be resolved" so I uninstalled WindowBuilder and reinstalled it in order to test it.

This is the error log: eclipse.buildId=4.31.0.20240307-1200 java.version=17.0.10 java.vendor=Eclipse Adoptium BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US Framework arguments: -product org.eclipse.epp.package.jee.product Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product

org.eclipse.epp.mpc.ui Error Wed Apr 03 23:19:21 IDT 2024 Problems occurred while performing provisioning operation: operation plan must be resolved

java.lang.IllegalStateException: operation plan must be resolved at org.eclipse.equinox.internal.p2.ui.ProvUI.toCurrentJREOperation(ProvUI.java:338) at org.eclipse.equinox.internal.p2.ui.ProvUI.toCompabilityWithCurrentJREProvisioningPlan(ProvUI.java:325) at org.eclipse.epp.internal.mpc.ui.wizards.MarketplaceWizard.lambda$5(MarketplaceWizard.java:876) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:124)

Best Regards,

Jonathan Rosenne

From: Patrick Ziegler @.> Sent: Tuesday, April 2, 2024 11:36 PM To: eclipse-windowbuilder/windowbuilder @.> Cc: Jonathan Rosenne @.>; Mention @.> Subject: Re: [eclipse-windowbuilder/windowbuilder] Lambda expressions for buttons causes eclipse to hang (Issue #729)

@igarshephttps://github.com/igarshep @rosennejhttps://github.com/rosennej Can you two check with tomorrows nightly build whether this issue still persists?

— Reply to this email directly, view it on GitHubhttps://github.com/eclipse-windowbuilder/windowbuilder/issues/729#issuecomment-2033046032, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACFKVDJCRCPEQGCGPJXY2ODY3MJEFAVCNFSM6AAAAABE6HDIOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZTGA2DMMBTGI. You are receiving this because you were mentioned.Message ID: @.***>

ptziegler commented 5 months ago
java.lang.IllegalStateException: operation plan must be resolved
          at org.eclipse.equinox.internal.p2.ui.ProvUI.toCurrentJREOperation(ProvUI.java:338)
          at org.eclipse.equinox.internal.p2.ui.ProvUI.toCompabilityWithCurrentJREProvisioningPlan(ProvUI.java:325)
          at org.eclipse.epp.internal.mpc.ui.wizards.MarketplaceWizard.lambda$5(MarketplaceWizard.java:876)
          at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:124)

That's a very weird error message... I've just tried installing the nightly build with the latest Eclipse IDE for Java Developers without problems. Perhaps this was just a fluke?

Edit: Updating from the 1.15.0 to 1.16.0 also worked... 🤔

rosennej commented 5 months ago

I am using a freshly installed Eclipse 2024-03:

Eclipse IDE for Enterprise Java and Web Developers (includes Incubating components)

Version: 2024-03 (4.31.0) Build id: 20240307-1437

Attached is my configuration. It could have been a fluke.

Best Regards,

Jonathan Rosenne

From: Patrick Ziegler @.> Sent: Thursday, April 4, 2024 7:39 AM To: eclipse-windowbuilder/windowbuilder @.> Cc: Jonathan Rosenne @.>; Mention @.> Subject: Re: [eclipse-windowbuilder/windowbuilder] Lambda expressions for buttons causes eclipse to hang (Issue #729)

java.lang.IllegalStateException: operation plan must be resolved

      at org.eclipse.equinox.internal.p2.ui.ProvUI.toCurrentJREOperation(ProvUI.java:338)

      at org.eclipse.equinox.internal.p2.ui.ProvUI.toCompabilityWithCurrentJREProvisioningPlan(ProvUI.java:325)

      at org.eclipse.epp.internal.mpc.ui.wizards.MarketplaceWizard.lambda$5(MarketplaceWizard.java:876)

      at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:124)

That's a very weird error message... I've just tried installing the nightly build with the latest Eclipse IDE for Java Developershttps://www.eclipse.org/downloads/packages/release/2024-03/r/eclipse-ide-java-developers without problems. Perhaps this was just a fluke?

— Reply to this email directly, view it on GitHubhttps://github.com/eclipse-windowbuilder/windowbuilder/issues/729#issuecomment-2036178146, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACFKVDP3JEOD4NIFCQNVMYLY3TKOVAVCNFSM6AAAAABE6HDIOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZWGE3TQMJUGY. You are receiving this because you were mentioned.Message ID: @.***>

Axis2 Tools 1.2.0.v202308010354 org.eclipse.jst.ws.axis2tools.feature.feature.group Eclipse Web Tools Platform Buildship: Eclipse Plug-ins for Gradle 3.1.9.v20240115-1636 org.eclipse.buildship.feature.group Eclipse Buildship Bytecode Outline View 1.2.300.v20240118-1157 org.eclipse.jdt.bcoview.feature.feature.group Eclipse.org CXF Web Services 1.1.1200.v202311232240 org.eclipse.jst.ws.cxf.feature.feature.group Eclipse Web Tools Platform Dali Java Persistence Tools - Common 1.5.200.v202308172102 org.eclipse.jpt.common.feature.feature.group Eclipse Web Tools Platform Dali Java Persistence Tools - EclipseLink Common 1.3.300.v202307260736 org.eclipse.jpt.common.eclipselink.feature.feature.group Eclipse Web Tools Platform Dali Java Persistence Tools - EclipseLink JAXB Support 1.4.203.v202104080213 org.eclipse.jpt.jaxb.eclipselink.feature.feature.group Eclipse Web Tools Platform Dali Java Persistence Tools - EclipseLink JPA Support 3.4.101.v202308172102 org.eclipse.jpt.jpa.eclipselink.feature.feature.group Eclipse Web Tools Platform Dali Java Persistence Tools - JAXB Support 1.5.201.v202301061019 org.eclipse.jpt.jaxb.feature.feature.group Eclipse Web Tools Platform Dali Java Persistence Tools - JPA Support 3.7.0.v202308172102 org.eclipse.jpt.jpa.feature.feature.group Eclipse Web Tools Platform DTP Connectivity 1.16.0.202311071345 org.eclipse.datatools.connectivity.feature.feature.group Eclipse Data Tools Platform DTP Connectivity Documentation 1.15.0.202311071249 org.eclipse.datatools.connectivity.doc.user.feature.group Eclipse Data Tools Platform DTP Enablement 1.15.0.202311071249 org.eclipse.datatools.enablement.feature.feature.group Eclipse Data Tools Platform DTP Enablement Extender SDK 1.15.0.202311071249 org.eclipse.datatools.enablement.sdk.feature.feature.group Eclipse Data Tools Platform DTP Enablement for Apache Derby 1.15.0.202311071249 org.eclipse.datatools.enablement.apache.derby.feature.feature.group Eclipse Data Tools Platform DTP Enablement for HSQLDB 1.15.0.202311071249 org.eclipse.datatools.enablement.hsqldb.feature.feature.group Eclipse Data Tools Platform DTP Enablement for IBM 1.15.0.202311071249 org.eclipse.datatools.enablement.ibm.feature.feature.group Eclipse Data Tools Platform DTP Enablement for Ingres 1.15.0.202311071249 org.eclipse.datatools.enablement.ingres.feature.feature.group Eclipse Data Tools Platform DTP Enablement for JDBC 1.15.0.202311071249 org.eclipse.datatools.enablement.jdbc.feature.feature.group Eclipse Data Tools Platform DTP Enablement for Microsoft 1.16.0.202311071307 org.eclipse.datatools.enablement.msft.feature.feature.group Eclipse Data Tools Platform DTP Enablement for MySQL 1.15.0.202311071249 org.eclipse.datatools.enablement.mysql.feature.feature.group Eclipse Data Tools Platform DTP Enablement for ODA Designer 1.15.0.202311071249 org.eclipse.datatools.enablement.oda.designer.feature.feature.group Eclipse Data Tools Platform DTP Enablement for ODA Runtime 1.15.0.202311071249 org.eclipse.datatools.enablement.oda.feature.feature.group Eclipse Data Tools Platform DTP Enablement for Oracle 1.15.0.202311071249 org.eclipse.datatools.enablement.oracle.feature.feature.group Eclipse Data Tools Platform DTP Enablement for PostgreSQL 1.15.0.202311071249 org.eclipse.datatools.enablement.postgresql.feature.feature.group Eclipse Data Tools Platform DTP Enablement for SAP MaxDB 1.15.0.202311071249 org.eclipse.datatools.enablement.sap.feature.feature.group Eclipse Data Tools Platform DTP Enablement for Sqlite 1.15.0.202311071249 org.eclipse.datatools.enablement.sqlite.feature.feature.group Eclipse Data Tools Platform DTP Enablement for Sybase 1.15.0.202311071249 org.eclipse.datatools.enablement.sybase.feature.feature.group Eclipse Data Tools Platform DTP Extender SDK 1.16.1.202403060734 org.eclipse.datatools.sdk.feature.feature.group Eclipse Data Tools Platform DTP Intro 1.15.0.202311071249 org.eclipse.datatools.intro.feature.group Eclipse Data Tools Platform DTP JDT Enablement 1.15.0.202311071249 org.eclipse.datatools.enablement.jdt.feature.feature.group Eclipse Data Tools Platform DTP Model Base 1.15.0.202311071249 org.eclipse.datatools.modelbase.feature.feature.group Eclipse Data Tools Platform DTP Open Data Access Designer 1.15.0.202311071249 org.eclipse.datatools.connectivity.oda.designer.feature.feature.group Eclipse Data Tools Platform DTP Open Data Access Designer Core 1.16.0.202311071345 org.eclipse.datatools.connectivity.oda.designer.core.feature.feature.group Eclipse Data Tools Platform DTP Open Data Access Runtime 1.15.0.202311071249 org.eclipse.datatools.connectivity.oda.feature.feature.group Eclipse Data Tools Platform DTP SQL Dev Tools Documentation 1.15.0.202311071249 org.eclipse.datatools.sqltools.doc.user.feature.group Eclipse Data Tools Platform DTP SQL Development Tools 1.16.0.202403060703 org.eclipse.datatools.sqldevtools.feature.feature.group Eclipse Data Tools Platform DTP SQL Development Tools Data Functions 1.15.0.202311071249 org.eclipse.datatools.sqldevtools.data.feature.feature.group Eclipse Data Tools Platform DTP SQL Development Tools DDL Functionality 1.15.0.202311071249 org.eclipse.datatools.sqldevtools.ddl.feature.feature.group Eclipse Data Tools Platform DTP SQL Development Tools DDL Generation Functionality 1.16.0.202403060703 org.eclipse.datatools.sqldevtools.ddlgen.feature.feature.group Eclipse Data Tools Platform DTP SQL Development Tools Results View 1.15.0.202311071249 org.eclipse.datatools.sqldevtools.results.feature.feature.group Eclipse Data Tools Platform DTP SQL Parsers 1.16.0.202311071638 org.eclipse.datatools.sqldevtools.parsers.feature.feature.group Eclipse Data Tools Platform DTP SQL Query Builder 1.16.0.202403060703 org.eclipse.datatools.sqldevtools.sqlbuilder.feature.feature.group Eclipse Data Tools Platform DTP SQL Schema Object Editor Feature 1.15.0.202311071249 org.eclipse.datatools.sqldevtools.schemaobjecteditor.feature.feature.group Eclipse Data Tools Platform DTP Tutorial Documentation 1.15.0.202311071249 org.eclipse.datatools.common.doc.user.feature.group Eclipse Data Tools Platform DTP User Documentation 1.16.0.202311071249 org.eclipse.datatools.doc.user.feature.group Eclipse Data Tools Platform EclEmma Java Code Coverage 3.1.8.202312121452 org.eclipse.eclemma.feature.feature.group Eclipse EclEmma Eclipse Checkstyle Plug-in 10.14.2.202403262245 net.sf.eclipsecs.feature.group Eclipse Checkstyle Plugin Development Team Eclipse Faceted Project Framework 3.7.4.v202308161955 org.eclipse.wst.common.fproj.feature.group Eclipse Web Tools Platform Eclipse Faceted Project Framework JDT Enablement 3.29.0.v202308161955 org.eclipse.jst.common.fproj.enablement.jdt.feature.group Eclipse Web Tools Platform Eclipse IDE for Enterprise Java and Web Developers 4.31.0.20240307-1200 epp.package.jee Eclipse Packaging Project Eclipse Java Development Tools 3.19.400.v20240229-0520 org.eclipse.jdt.feature.group Eclipse.org Eclipse Java EE Developer Tools 3.33.0.v202401080452 org.eclipse.jst.enterprise_ui.feature.feature.group Eclipse Web Tools Platform Eclipse Java Web Developer Tools 3.33.0.v202402161256 org.eclipse.jst.web_ui.feature.feature.group Eclipse Web Tools Platform Eclipse Plug-in Development Environment 3.15.300.v20240229-0520 org.eclipse.pde.feature.group Eclipse.org Eclipse XSL Developer Tools 1.3.1500.v202307260701 org.eclipse.wst.xsl.feature.feature.group Eclipse Web Tools Platform Git integration for Eclipse 6.9.0.202403050737-r org.eclipse.egit.feature.group Eclipse EGit Java implementation of Git 6.9.0.202403050737-r org.eclipse.jgit.feature.group Eclipse JGit JAX-WS DOM Tools 1.0.600.v202308010354 org.eclipse.jst.ws.jaxws.dom.feature.feature.group Eclipse Web Tools Platform JAX-WS Tools 1.2.1000.v202311280000 org.eclipse.jst.ws.jaxws.feature.feature.group Eclipse Web Tools Platform JSF Tools 3.13.0.v202308300413 org.eclipse.jsf.feature.feature.group Eclipse Web Tools Platform JSF Tools - Tag Library Metadata (Apache Trinidad) 2.8.0.v202307262303 org.eclipse.jst.jsf.apache.trinidad.tagsupport.feature.feature.group Eclipse Web Tools Platform JSF Tools - Web Page Editor 2.12.0.v202307262216 org.eclipse.jst.webpageeditor.feature.feature.group Eclipse Web Tools Platform JST Server Adapters 3.33.0.v202401292308 org.eclipse.jst.server_adapters.feature.feature.group Eclipse Web Tools Platform JST Server Adapters Extensions (Apache Tomcat) 3.4.900.v202402192305 org.eclipse.jst.server_adapters.ext.feature.feature.group Eclipse Web Tools Platform JST Server UI 3.4.500.v202401292331 org.eclipse.jst.server_ui.feature.feature.group Eclipse Web Tools Platform JustJ JRE for IDE Packages 17.0.0.v20240120-1430 org.eclipse.justj.epp.feature.group Eclipse JustJ M2E - Maven Integration for Eclipse 2.6.0.20240220-1109 org.eclipse.m2e.feature.feature.group Eclipse.org - m2e M2E - PDE Integration 2.3.1.20240203-0902 org.eclipse.m2e.pde.feature.feature.group Eclipse.org - m2e M2E - POM Editor using LemMinX language server (includes Incubating components) 2.0.600.20240219-1707 org.eclipse.m2e.lemminx.feature.feature.group Eclipse.org - m2e M2E - SLF4J over Logback Logging 2.6.0.20240217-1525 org.eclipse.m2e.logback.feature.feature.group Eclipse.org - m2e m2e-wtp - JAX-RS configurator for WTP (Optional) 1.6.1.20231024-1618 org.eclipse.m2e.wtp.jaxrs.feature.feature.group Eclipse.org - m2e-wtp m2e-wtp - JPA configurator for WTP (Optional) 1.6.1.20231024-1618 org.eclipse.m2e.wtp.jpa.feature.feature.group Eclipse.org - m2e-wtp m2e-wtp - JSF configurator for WTP (Optional) 1.6.1.20231024-1618 org.eclipse.m2e.wtp.jsf.feature.feature.group Eclipse.org - m2e-wtp m2e-wtp - Maven Integration for WTP 1.6.1.20231024-1618 org.eclipse.m2e.wtp.feature.feature.group Eclipse.org - m2e-wtp Marketplace Client 1.10.3.v20240228-1000 org.eclipse.epp.mpc.feature.group Eclipse Marketplace Client Mylyn Builds Connector: Jenkins 4.2.0.v20240212-0246 org.eclipse.mylyn.jenkins.feature.feature.group Eclipse Mylyn Mylyn Commons Activity 4.2.0.v20240203-1124 org.eclipse.mylyn.commons.activity.feature.feature.group Eclipse Mylyn Mylyn Context Connector: Eclipse IDE 4.2.0.v20240220-1733 org.eclipse.mylyn.ide.feature.feature.group Eclipse Mylyn Mylyn Context Connector: Java Development 4.2.0.v20240220-1733 org.eclipse.mylyn.jdt.feature.feature.group Eclipse Mylyn Mylyn Context Connector: Plug-in Development 4.2.0.v20240220-1733 org.eclipse.mylyn.pde.feature.feature.group Eclipse Mylyn Mylyn Git integration - Task focused interface 4.2.0.v20240202-0700 org.eclipse.mylyn.egit.feature.feature.group Eclipse Mylyn Mylyn Reviews 4.2.0.v20240207-0731 org.eclipse.mylyn.reviews.feature.feature.group Eclipse Mylyn Mylyn Tasks Connector: GitHub 6.4.0.v20240209-1319 org.eclipse.mylyn.github.feature.feature.group Eclipse Mylyn Mylyn Versions Connector: Git 4.2.0.v20240208-0919 org.eclipse.mylyn.git.feature.feature.group Eclipse Mylyn Mylyn WikiText 4.2.0.v20240302-0923 org.eclipse.mylyn.wikitext.feature.feature.group Eclipse Mylyn Node.js embedder from Wild Web Developer 1.0.7.202310251358 org.eclipse.wildwebdeveloper.embedder.node.feature.feature.group Eclipse Wild Web Developer project Oomph Setup 1.31.0.v20240306-1109 org.eclipse.oomph.setup.feature.group Eclipse Oomph Project SonarLint for Eclipse 10.0.1.81733 org.sonarlint.eclipse.feature.feature.group SonarSource SpotBugs 4.8.3.r202312121044-1e42fc9 com.github.spotbugs.plugin.eclipse.feature.group SpotBugs Project Subclipse 4.3.4.202306191346 org.tigris.subversion.subclipse.feature.group Subclipse Subversion 1.14 JavaHL 1.14.0.202005311413 org.tigris.subversion.clientadapter.javahl.feature.feature.group Subclipse Subversion Revision Graph 4.2.0.1 org.tigris.subversion.subclipse.graph.feature.feature.group Subclipse SVNKit Client Adapter 1.8.12.3 org.tigris.subversion.clientadapter.svnkit.feature.feature.group Subclipse TestNG 7.9.0.202312310355 org.testng.eclipse.feature.group Cedric Beust TestNG M2E (Maven) Integration (Optional) 7.9.0.202312310355 org.testng.eclipse.maven.feature.feature.group TestNG Team Tip of the Day UI Feature 0.4.300.v20240207-1044 org.eclipse.tips.feature.feature.group Eclipse.org TM Terminal 11.5.0.202312062348 org.eclipse.tm.terminal.feature.feature.group Eclipse CDT Wild Web Developer HTML, CSS, JSON, Yaml, JavaScript, TypeScript, Node tools 1.3.3.202311211923 org.eclipse.wildwebdeveloper.feature.feature.group Eclipse Wild Web Developer project WindowBuilder Core 1.16.0.202403281023 org.eclipse.wb.core.feature.feature.group Eclipse WindowBuilder WindowBuilder Core Documentation 1.16.0.202403132032 org.eclipse.wb.doc.user.feature.feature.group Eclipse WindowBuilder WindowBuilder Core UI 1.16.0.202403132032 org.eclipse.wb.core.ui.feature.feature.group Eclipse WindowBuilder WindowBuilder GroupLayout Support 1.16.0.202403132032 org.eclipse.wb.layout.group.feature.feature.group Eclipse WindowBuilder WindowBuilder Java Core 1.16.0.202404031918 org.eclipse.wb.core.java.feature.feature.group Eclipse WindowBuilder WindowBuilder Swing Designer 1.16.0.202404031918 org.eclipse.wb.swing.feature.feature.group Eclipse WindowBuilder WindowBuilder Swing Designer Documentation 1.16.0.202403132032 org.eclipse.wb.swing.doc.user.feature.feature.group Eclipse WindowBuilder WindowBuilder SWT Designer 1.16.0.202403132118 org.eclipse.wb.rcp.feature.feature.group Eclipse WindowBuilder WindowBuilder SWT Designer Core 1.16.0.202403191905 org.eclipse.wb.swt.feature.feature.group Eclipse WindowBuilder WST Server Adapters 3.33.0.v202401292308 org.eclipse.wst.server_adapters.feature.feature.group Eclipse Web Tools Platform

igarshep commented 5 months ago

There is still a hang on something about the contents of my lambda expressions. I wonder what I can do to debug this. However, the issue of the action performed line number is now resolved and is found correctly without any errors.

ptziegler commented 5 months ago

I wonder what I can do to debug this.

If it's stuck, then I would suggest to profile the IDE via VisualVM. If you can take and upload a snapshot of e.g. the sampler, I can also take a look at it.

igarshep commented 5 months ago

Very cool tool! I am able to trace where the hanging is coming from, it comes from a .setVisible() call in a JDialog when a lambda expression has one as part of a constructor of an instance it calls. Here are the two files needed to reproduce this:

public class MainUI extends JPanel { public MainUI() {

    final JButton btnNewButton = new JButton("New button");
    btnNewButton.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            System.out.println("test");
            WindowInstance picker = new WindowInstance();
        }
    });
    /**
    btnNewButton.addActionListener(e -> {
        System.out.println("test");
        WindowInstance picker = new WindowInstance();
    });*/
    add(btnNewButton);
}

}

and

public class WindowInstance extends JDialog {

public WindowInstance() {
    initialize();
    setModal(true);
    toFront();
    setAlwaysOnTop(true);
    setVisible(true);
}

private final void initialize() {
    setBounds(100, 100, 470, 120);
    setTitle("test");
}

}

When using the standard action listener and going into the design tab, it works just fine, but switching to the lambda expression causes it to hang.

ptziegler commented 5 months ago

@igarshep Thanks! That helped me reproduce the issue. Hm... it seems like this is a general problem when lambda expressions are used and not just something exclusive to the listeners. Here's a small variation of your example, which suffers from the same problem.

public class MainUI extends JPanel {
    public MainUI() {

        final JButton btnNewButton = new JButton("New button");
        btnNewButton.addActionListener(new ActionListener() {
            public void actionPerformed(final ActionEvent arg0) {
                System.out.println("test");
                WindowInstance picker = new WindowInstance();
            }
        });
        test(() -> {
            System.out.println("test");
            WindowInstance picker = new WindowInstance();
        });
        add(btnNewButton);
    }

    private void test(Runnable r) {
        r.run();
    }
}
ptziegler commented 5 months ago

@igarshep After simplifying the problem further, I think this is a conceptional problem with the widget.

This is the minimal reproducer I came up with, based on your example:

public class MyFrame extends JFrame {
    public static void main(String[] args) {
        new MyFrame();
    }

    public MyFrame() {
        new MyDialog();
        System.out.println("All done~");
    }

    public static class MyDialog extends JDialog {
        public MyDialog() {
            setModal(true);
            setVisible(true);
        }
    }
}

If I try to run this class using the main method, the code blocks indefinitely. If I comment out setModal(true), then everything works and the string is printed to the console.

The same can be observed with your example. And if it doesn't even work with plain Java, I'm not sure how WindowBuilder can do a better job...

Edit: A search led me to this problem, so it might even be a proper JDK bug

igarshep commented 5 months ago

What you described is standard modal behavior, its mostly the whole point. If I run your example, a window with just the close/minimize buttons comes up. If you close the window, then you get the string printed.

However, this isn't the behavior that seems to be the problem. There's clearly a difference in my example between a lambda calling the same set of code vs a standard action listener. If I toggle between one by commenting out the other, I get different behavior with the lambda causing eclipse to hang.

rosennej commented 5 months ago

Is this a valid lambda? Doesn't it have side effects?

Best Regards,

Jonathan Rosenne

From: Igar Shepelev @.> Sent: Thursday, April 4, 2024 11:46 PM To: eclipse-windowbuilder/windowbuilder @.> Cc: Jonathan Rosenne @.>; Mention @.> Subject: Re: [eclipse-windowbuilder/windowbuilder] Lambda expressions for buttons causes eclipse to hang (Issue #729)

What you described is standard modal behavior, its mostly the whole point. If I run your example, a window with just the close/minimize buttons comes up. If you close the window, then you get the string printed.

However, this isn't the behavior that seems to be the problem. There's clearly a difference in my example between a lambda calling the same set of code vs a standard action listener. If I toggle between one by commenting out the other, I get different behavior with the lambda causing eclipse to hang.

— Reply to this email directly, view it on GitHubhttps://github.com/eclipse-windowbuilder/windowbuilder/issues/729#issuecomment-2038184133, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACFKVDMHBG4MGHZUWRLQ2ZTY3W3YPAVCNFSM6AAAAABE6HDIOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZYGE4DIMJTGM. You are receiving this because you were mentioned.Message ID: @.**@.>>

ptziegler commented 5 months ago

What you described is standard modal behavior, its mostly the whole point. If I run your example, a window with just the close/minimize buttons comes up. If you close the window, then you get the string printed.

Right... apologies. I didn't notice the small frame popping up. But you have the same behavior with WindowBuilder. The modal dialog is opened, blocking WindowBuilder from switching to the design page. If you click on it, everything works again.

There's clearly a difference in my example between a lambda calling the same set of code vs a standard action listener.

When using the lambda expression, WindowBuilder tries to create a proper instance of the dialog, while it doesn't with anonymous classes. My point is that this is a general problem that will pop whenever modal dialogs are used, not just with listeners or lambda expressions.

ptziegler commented 5 months ago

I've created #741 to keep track of the issue. As mentioned, the problem is the modal dialog. The lambda expression is merely the catalyst, but not the cause.