I have run into a weird issue with gwt dev mode debugging.
Following is a JSNI wrapper I am writing https://github.com/sillysachin/GWTAMChart
It is fairly small and simple project with lots of JSNI, JavaScriptObject and JSON code. It wraps over popular amcharts charting library. It works well when debugged in SuperDevMode and in Production.
However I am not able to debug the project in Internet Explorer with Dev Mode Debugging.
java.lang.ClassFormatError: Duplicate method name&signature in class file com/google/gwt/core/client/JavaScriptObject$
The main exception thrown is not helping me figure which part of code is breaking !!!!!
java.lang.ClassFormatError: Duplicate method name&signature in class file com/google/gwt/core/client/JavaScriptObject$
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.lang.ClassLoader.defineClass(ClassLoader.java:643)
at com.google.gwt.dev.shell.CompilingClassLoader.findClass(CompilingClassLoader.java:1142)
at com.google.gwt.dev.shell.CompilingClassLoader.loadClass(CompilingClassLoader.java:1215)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at com.google.gwt.dev.shell.JsValueGlue.set(JsValueGlue.java:220)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:130)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:589)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:315)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:359)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:530)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:368)
at java.lang.Thread.run(Thread.java:745)
The problematic class is
AmChartJSOimplementing theIsAmChartinterface - all the methods are declared twice inJavaScriptObject$. Snippet from the bytecode:It seems you've run into a limitation of overlay types - only one JavaScriptObject subtype can implement any given interface:
Looking at your code, this restriction is broken:
AmChartJSOimplementsIsAmChart, butAmCoordinateChartJSOimplementsIsAmCoordinateChartwhich extendsIsAmChart- and thus two JSOs implement the same interface. If I understand this restriction correctly, you can't even subclass a JSO that implements an interface.I've done a quick test and this code fails too:
With a similarly useless exception:
Please see this thread on GWT's mailing list for workarounds and general discussion of this problem.
To dump the generated class files yourself
For future reference, you can dump the generated
classfiled by setting thegwt.dev.classDumpsystem property (-Dgwt.dev.classDump=true). See this wiki page for more information. By default the classes are written to therewritten-classesfolder (in your case it will bewar/rewritten-classes). The classes are organized by packages, so findingJavaScriptObject$is easy:rewritten-classes/com/google/gwt/core/client/JavaScriptObject$.class.Now, all you need to do is disassemble it - I've used the Bytecode Outline plugin for Eclipse and got the bytecode of
JavaScriptObject$.class.To find out which methods were duplicated, I could just load the
classfile with a classloader and let the JVM figure it out... But I was feeling lazy so I've justgreped forpublic final syntheticin the bytecode and rununiq -Dto see only the duplicated entries.