Updating to GWT 2.12 SuperDevMode on start: JSwitchStatement cannot be cast to class com.google.gwt.dev.jjs.ast.JExpression

9 views
Skip to first unread message

Oleg Ravun

unread,
7:53 AM (8 hours ago) 7:53 AM
to google-we...@googlegroups.com
Hello,

I have updated from GWT 2.11 to 2.12. SuperDevMode does not start in Intellij IDEA with the following exception. Any idea how to fix this?
com.google.gwt.dev.jjs.InternalCompilerException: Error constructing Java AST
at com.google.gwt.dev.jjs.impl.GwtAstBuilder.translateException(GwtAstBuilder.java:4181)
at com.google.gwt.dev.jjs.impl.GwtAstBuilder$AstVisitor.endVisit(GwtAstBuilder.java:1091)
at org.eclipse.jdt.internal.compiler.ast.IfStatement.traverse(IfStatement.java:335)
at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse(MethodDeclaration.java:437)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1699)
at com.google.gwt.dev.jjs.impl.GwtAstBuilder.processImpl(GwtAstBuilder.java:4117)
at com.google.gwt.dev.jjs.impl.GwtAstBuilder.process(GwtAstBuilder.java:4155)
at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater$UnitProcessorImpl.process(CompilationStateBuilder.java:128)
at com.google.gwt.dev.javac.JdtCompiler$CompilerImpl.process(JdtCompiler.java:322)
at org.eclipse.jdt.internal.compiler.Compiler.processCompiledUnits(Compiler.java:575)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:475)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:426)
at com.google.gwt.dev.javac.JdtCompiler.doCompile(JdtCompiler.java:1021)
at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:322)
at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:532)
at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:464)
at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:426)
at com.google.gwt.dev.codeserver.Recompiler.initWithoutPrecompile(Recompiler.java:213)
at com.google.gwt.dev.codeserver.Outbox.maybePrecompile(Outbox.java:89)
at com.google.gwt.dev.codeserver.Outbox.<init>(Outbox.java:61)
at com.google.gwt.dev.codeserver.CodeServer.makeOutboxTable(CodeServer.java:192)
at com.google.gwt.dev.codeserver.CodeServer.start(CodeServer.java:151)
at com.google.gwt.dev.codeserver.CodeServer.main(CodeServer.java:104)
at com.google.gwt.dev.codeserver.CodeServer.main(CodeServer.java:55)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.google.gwt.dev.shell.SuperDevListener.runCodeServer(SuperDevListener.java:118)
at com.google.gwt.dev.shell.SuperDevListener.start(SuperDevListener.java:97)
at com.google.gwt.dev.DevMode.ensureCodeServerListener(DevMode.java:664)
at com.google.gwt.dev.DevModeBase.doStartup(DevModeBase.java:785)
at com.google.gwt.dev.DevMode.doStartup(DevMode.java:549)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:888)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:705)
at com.google.gwt.dev.DevMode.main(DevMode.java:430)
Caused by: java.lang.ClassCastException: class com.google.gwt.dev.jjs.ast.JSwitchStatement cannot be cast to class com.google.gwt.dev.jjs.ast.JExpression (com.google.gwt.dev.jjs.ast.JSwitchStatement and com.google.gwt.dev.jjs.ast.JExpression are in unnamed module of loader 'app')
at com.google.gwt.dev.jjs.impl.GwtAstBuilder$AstVisitor.pop(GwtAstBuilder.java:2816)
at com.google.gwt.dev.jjs.impl.GwtAstBuilder$AstVisitor.endVisit(GwtAstBuilder.java:1087)
... 34 more

Thanks,
Oleg

Colin Alworth

unread,
8:08 AM (7 hours ago) 8:08 AM
to GWT Users
Thanks for the report, looks like you're running into https://github.com/gwtproject/gwt/issues/10024. We have a fix for that merged, you can test the HEAD-SNAPSHOT release from the sonatype snapshots repository (https://oss.sonatype.org/content/repositories/snapshots/), or wait for the 2.12.1 release (see https://github.com/gwtproject/gwt/milestone/24, will likely only contain that fix plus one other long-standing issue that impacts latest jsinterop-base and elemental2).

You can also find the failing code (easier to spot running the compiler) and add the missing "{}"s in the "if" that contains the switch statement, that will work around this bug.

Oleg Ravun

unread,
9:06 AM (6 hours ago) 9:06 AM
to google-we...@googlegroups.com
Thank you Colin.
The compiler gives a different issue though. I have updated to the latest guava but it does not help.

 Caused by: java.lang.NoSuchMethodError: 'void com.google.gwt.thirdparty.guava.common.base.Preconditions.checkState(boolean, java.lang.String, java.lang.Object)'

[INFO] at com.google.gwt.safehtml.rebind.HtmlTemplateParser.getHtmlContextFromParseState(HtmlTemplateParser.java:269)

[INFO] at com.google.gwt.safehtml.rebind.HtmlTemplateParser.parseTemplate(HtmlTemplateParser.java:205)

[INFO] at com.google.gwt.safehtml.rebind.SafeHtmlTemplatesImplMethodCreator.emitMethodBodyFromTemplate(SafeHtmlTemplatesImplMethodCreator.java:220)

[INFO] at com.google.gwt.safehtml.rebind.SafeHtmlTemplatesImplMethodCreator.createMethodFor(SafeHtmlTemplatesImplMethodCreator.java:120)

[INFO] at com.google.gwt.safehtml.rebind.SafeHtmlTemplatesImplCreator.emitMethodBody(SafeHtmlTemplatesImplCreator.java:43)

[INFO] at com.google.gwt.user.rebind.AbstractGeneratorClassCreator.genMethod(AbstractGeneratorClassCreator.java:277)

[INFO] at com.google.gwt.user.rebind.AbstractGeneratorClassCreator.emitMethods(AbstractGeneratorClassCreator.java:239)

[INFO] at com.google.gwt.user.rebind.AbstractGeneratorClassCreator.emitClass(AbstractGeneratorClassCreator.java:118)

[INFO] at com.google.gwt.safehtml.rebind.SafeHtmlTemplatesGenerator.generate(SafeHtmlTemplatesGenerator.java:65)

[INFO] at com.google.gwt.core.ext.IncrementalGenerator.generateNonIncrementally(IncrementalGenerator.java:40)

[INFO] at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:745)

[INFO] at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:103)

[INFO] at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:78)

[INFO] at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:262)

[INFO] at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:251)

[INFO] at com.google.gwt.dev.PrecompilationContextCreator$1.getAllPossibleRebindAnswers(PrecompilationContextCreator.java:86)

[INFO] at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.createStaticRebindExpression(UnifyAst.java:519)

[INFO] at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.createRebindExpression(UnifyAst.java:487)

[INFO] at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.maybeHandleMagicMethodCall(UnifyAst.java:415)

[INFO] at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.visit(UnifyAst.java:402)

[INFO] at com.google.gwt.dev.jjs.ast.JMethodCall.traverse(JMethodCall.java:265)

[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)

[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)

[INFO] ... 51 more

[INFO]       [ERROR] at VerticalFloatAppearance_VerticalFloatLayoutTemplateImpl.java(21): GWT.create(VerticalFloatAppearance_VerticalFloatLayoutTemplate_render_SafeHtml__CssFloatLayoutStyle_style___SafeHtmlTemplates.class)

[INFO]          com.google.gwt.dev.jjs.ast.JMethodCall

[INFO]       [ERROR] at VerticalFloatAppearance_VerticalFloatLayoutTemplateImpl.java(21): (VerticalFloatAppearance_VerticalFloatLayoutTemplate_render_SafeHtml__CssFloatLayoutStyle_style___SafeHtmlTemplates) GWT.create(VerticalFloatAppearance_VerticalFloatLayoutTemplate_render_SafeHtml__CssFloatLayoutStyle_style___SafeHtmlTemplates.class)

[INFO]          com.google.gwt.dev.jjs.ast.JCastOperation

[INFO]       [ERROR] at VerticalFloatAppearance_VerticalFloatLayoutTemplateImpl.java(21): ((VerticalFloatAppearance_VerticalFloatLayoutTemplate_render_SafeHtml__CssFloatLayoutStyle_style___SafeHtmlTemplates) GWT.create(VerticalFloatAppearance_VerticalFloatLayoutTemplate_render_SafeHtml__CssFloatLayoutStyle_style___SafeHtmlTemplates.class)).render0(CssFloatLayoutDefaultAppearance_CssFloatLayoutStyle_container_ValueProviderImpl.INSTANCE.getValue(style))

[INFO]          com.google.gwt.dev.jjs.ast.JMethodCall

[INFO]       [ERROR] at VerticalFloatAppearance_VerticalFloatLayoutTemplateImpl.java(21): outer = ((VerticalFloatAppearance_VerticalFloatLayoutTemplate_render_SafeHtml__CssFloatLayoutStyle_style___SafeHtmlTemplates) GWT.create(VerticalFloatAppearance_VerticalFloatLayoutTemplate_render_SafeHtml__CssFloatLayoutStyle_style___SafeHtmlTemplates.class)).render0(CssFloatLayoutDefaultAppearance_CssFloatLayoutStyle_container_ValueProviderImpl.INSTANCE.getValue(style))

[INFO]          com.google.gwt.dev.jjs.ast.JBinaryOperation

[INFO]       [ERROR] at VerticalFloatAppearance_VerticalFloatLayoutTemplateImpl.java(21): outer = ((VerticalFloatAppearance_VerticalFloatLayoutTemplate_render_SafeHtml__CssFloatLayoutStyle_style___SafeHtmlTemplates) GWT.create(VerticalFloatAppearance_VerticalFloatLayoutTemplate_render_SafeHtml__CssFloatLayoutStyle_style___SafeHtmlTemplates.class)).render0(CssFloatLayoutDefaultAppearance_CssFloatLayoutStyle_container_ValueProviderImpl.INSTANCE.getValue(style))

[INFO]          com.google.gwt.dev.jjs.ast.JExpressionStatement

[INFO]       [ERROR] at VerticalFloatAppearance_VerticalFloatLayoutTemplateImpl.java(8): {

[INFO]   SafeHtml outer;

[INFO]   outer = ((VerticalFloatAppearance_VerticalFloatLayoutTemplate_render_SafeHtml__CssFloatLayoutStyle_style___SafeHtmlTemplates) GWT.create(VerticalFloatAppearance_VerticalFloatLayoutTemplate_render_SafeHtml__CssFloatLayoutStyle_style___SafeHtmlTemplates.class)).render0(CssFloatLayoutDefaultAppearance_CssFloatLayoutStyle_container_ValueProviderImpl.INSTANCE.getValue(style));

[INFO]   return outer;

[INFO] }

[INFO]          com.google.gwt.dev.jjs.ast.JBlock

[INFO]       [ERROR] at VerticalFloatAppearance_VerticalFloatLayoutTemplateImpl.java(8): {

[INFO]   SafeHtml outer;

[INFO]   outer = ((VerticalFloatAppearance_VerticalFloatLayoutTemplate_render_SafeHtml__CssFloatLayoutStyle_style___SafeHtmlTemplates) GWT.create(VerticalFloatAppearance_VerticalFloatLayoutTemplate_render_SafeHtml__CssFloatLayoutStyle_style___SafeHtmlTemplates.class)).render0(CssFloatLayoutDefaultAppearance_CssFloatLayoutStyle_container_ValueProviderImpl.INSTANCE.getValue(style));

[INFO]   return outer;

[INFO] }

[INFO]          com.google.gwt.dev.jjs.ast.JMethodBody

[INFO]       [ERROR] at VerticalFloatAppearance_VerticalFloatLayoutTemplateImpl.java(8): com.company.framework.core.client.ui.component.VerticalFloatAppearance_VerticalFloatLayoutTemplateImpl.render(Lcom/sencha/gxt/theme/base/client/container/CssFloatLayoutDefaultAppearance$CssFloatLayoutStyle;)Lcom/google/gwt/safehtml/shared/SafeHtml;

[INFO]          com.google.gwt.dev.jjs.ast.JMethod


--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/374c0074-6ec0-4ced-a70f-ee713141b0d0n%40googlegroups.com.

Colin Alworth

unread,
9:22 AM (6 hours ago) 9:22 AM
to GWT Users
I'm afraid I can't tell a lot from that, except that the line numbers of UnifyAst don't match up with GWT 2.12 - they do however line up with 2.11 (though I didn't test any other versions), so you may additionally have a classpath issue of some kind. That could potentially cause this NoSuchMethodError.

Juan Pablo Gardella

unread,
9:58 AM (5 hours ago) 9:58 AM
to google-we...@googlegroups.com, Colin Alworth
@Colin Alworth what is "will likely only contain that fix plus one other long-standing issue that impacts latest jsinterop-base and elemental2"?

Colin Alworth

unread,
10:15 AM (5 hours ago) 10:15 AM
to GWT Users
Presently the only other ticket in the 2.12.1 milestone (see https://github.com/gwtproject/gwt/milestone/24) is a backported fix for https://github.com/gwtproject/gwt/issues/10020. This was already merged to main, so is available in HEAD-SNAPSHOT.

This bug has been present for a long time, but was apparently only reported by the Guava team inside of Google (see https://github.com/google/jsinterop-base/issues/19#issuecomment-2442674784), and never to the GWT issue tracker. The effect is that some annotations on some elements would fail if their source was missing, and the fix aims to ensure that there will never be a failure no matter where the annotation is located or the kind of annotation (how many fields it has).

Once those are reviewed and approved we can turn around and ship an updated release.

Oleg Ravun

unread,
10:24 AM (5 hours ago) 10:24 AM
to google-we...@googlegroups.com
The UnifyAst stack trace was from running Maven. I use gwt-maven-plugin version 2.10? Could it be the reason for the classpath issue? There is no newer version. And I know that there exists a new maven plugin to run the GWT compiler. I am digging through the maven log trying to figure out what is wrong with the classpath but perhaps GWT 2.12 cannot work with gwt-maven-plugin 2.10. Can it?

Thanks,
Oleg

Colin Alworth

unread,
10:30 AM (5 hours ago) 10:30 AM
to GWT Users
From the homepage for the plugin you're using, https://gwt-maven-plugin.github.io/gwt-maven-plugin/, last updated in 2017 with GWT 2.8.2:
>  NOTICE There is a new plugin (archetypes and eclipse integration), a fresh start that correctly support multi-module projects, it is not version-bounded with GWT, support multiples GWT versions and other fixes, improvements and best practices. This plugin is now considered the legacy GWT maven plugin (aka mojo GWT maven plugin) and the new one is considered the new generation GWT maven plugin (aka tbroyer GWT maven plugin). The legacy maven plugin is still supported but it is strongly encouraged to use the new one for new projects.


GWT 2.12 can work with the old gwt-maven-plugin - be sure to specify <dependencies> _inside_ the plugin tag, and reference gwt-user and gwt-dev there. Otherwise, the plugin will continue to use the version of GWT it was built with. The "new" maven plugin does not have this limitation.

May I ask how you were building with GWT 2.11 with the 2.10 plugin? If you weren't doing this, you potentially weren't using the full GWT 2.10 classpath after all...

Oleg Ravun

unread,
10:54 AM (5 hours ago) 10:54 AM
to google-we...@googlegroups.com
I was using gwt-maven-plugin version 2.10 with GWT 2.11 but there was no dependencies section under the plugin in the pom file. So I guess I was using GWT 2.10 when the project was built using maven. Though I was using GWT 2.11 in Intellij IDEA in SuperDevMode. Let me try to add the dependencies. Thank you so much. 

Reply all
Reply to author
Forward
0 new messages