Friday, November 8, 2024

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

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.

On Friday, November 8, 2024 at 8:58:37 AM UTC-6 gardella...@gmail.com wrote:
@Colin Alworth what is "will likely only contain that fix plus one other long-standing issue that impacts latest jsinterop-base and elemental2"?

On Fri, Nov 8, 2024 at 11:22 AM Colin Alworth <co...@colinalworth.com> wrote:
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.

On Friday, November 8, 2024 at 8:06:27 AM UTC-6 ora...@gmail.com wrote:
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


On Fri, Nov 8, 2024 at 8:09 AM Colin Alworth <co...@colinalworth.com> wrote:
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.

On Friday, November 8, 2024 at 6:53:40 AM UTC-6 ora...@gmail.com wrote:
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

--
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.

--
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.

--
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-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/22a811c1-93c0-461f-8a47-a37ae0c4d250n%40googlegroups.com.

No comments:

Post a Comment