Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.7.10
-
Fix Version/s: None
-
Component/s: Swing
-
Labels:None
-
Number of attachments :
Description
When within SwingBuilder.edt, the instantiation of anonymous inner classes to appears to be broken.
Example code:
import groovy.swing.SwingBuilder import javax.swing.SwingWorker; import javax.swing.JFrame import java.awt.BorderLayout class TestEDT { public static void main( String[] args ) { def myLabel def swing = new SwingBuilder() swing.edt { frame(pack:true, show:true, defaultCloseOperation:JFrame.EXIT_ON_CLOSE){ borderLayout() myLabel = label("Hello", constraints:BorderLayout.CENTER) } def sw = new SwingWorker() { protected Object doInBackground() throws Exception { return 10 } protected void done() { myLabel.text = get() } }.execute(); } } }
This throws:
Exception in thread "main" groovy.lang.GroovyRuntimeException: Could not find matching constructor for: TestEDT$1(java.lang.Class, groovy.lang.Reference) at groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1481) at groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1397) at org.codehaus.groovy.runtime.callsite.MetaClassConstructorSite.callConstructor(MetaClassConstructorSite.java:46) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:52) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:202) at TestEDT$_main_closure1.doCall(TestEDT.groovy:17)
Cannot be reproduced with 1.8.6, the code works OK.