Wednesday, November 30, 2016

Re: GWT 2.8 compile fails; 2.7 works

Oops! I do get the error. I was wrong when I said it worked for me. When I attempted to change the GWT version from 2.7.0 to 2.8.0 in eclipse, eclipse switched it back to 2.7.0 for reasons I cannot figure out. Given below are the offending UiBinder code, the corresponding Java code, and the stack trace when switching a running application from GWT 2.7 to 2.8. Any help would be greatly appreciated.

<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
  xmlns:g="urn:import:com.google.gwt.user.client.ui"
 
xmlns:m="urn:import:gwt.material.design.client.ui">
 
<g:HTMLPanel>
   
<g:PopupPanel ui:field="launchPad" styleName="launch">
          <m:MaterialColumn ui:field="container" shadow="3">
                  <!-- Dialog title -->
                  <m:MaterialPanel styleName="centeredContentDiv peruseStandardBackground noPadding">
                    <m:MaterialLabel styleName="launchTitle">PeruseLab - Loading your drawings...</m:MaterialLabel>
                    <m:MaterialProgress type="INDETERMINATE" enabled="false" ui:field="progressBar" />
                    <!-- The above shows the progress bar while retrieving drawing(s) for user -->
                  </m:MaterialPanel>
               </m:MaterialColumn>
            </g:PopupPanel>
      </g:HTMLPanel>
</ui:UiBinder>

public class Loader extends Composite {

   
interface LoaderUiBinder extends UiBinder<Widget, Loader> {
   
}

    
private static LoaderUiBinder uiBinder = GWT.create(LoaderUiBinder.class);

   
@UiField
   
PopupPanel launchPad;

    
@UiField
   
MaterialColumn container;

    
public Loader() {
        initWidget
(uiBinder.createAndBindUi(this));
   
}

    public void hide() {
        clear
();
        launchPad
.hide(true);
   
}

   
public void show() {
        launchPad
.show();
   
}

    private void clear() {
       
while (container.getWidgetCount() > 0) {
            container
.remove(0);
       
}
   
}
}


Caused by: java.lang.NoSuchMethodError: com.google.gwt.uibinder.rebind.UiBinderWriter.<init>(Lcom/google/gwt/core/ext/typeinfo/JClassType;Ljava/lang/String;Ljava/lang/String;Lcom/google/gwt/core/ext/typeinfo/TypeOracle;Lcom/google/gwt/uibinder/rebind/MortalLogger;Lcom/google/gwt/uibinder/rebind/FieldManager;Lcom/google/gwt/uibinder/rebind/messages/MessagesWriter;Lcom/google/gwt/uibinder/rebind/DesignTimeUtils;Lcom/google/gwt/uibinder/rebind/UiBinderContext;ZZLjava/lang/String;Lcom/google/gwt/dev/resource/ResourceOracle;Lcom/google/gwt/resources/rg/GssResourceGenerator$GssOptions;)V
 at com
.google.gwt.uibinder.rebind.UiBinderGenerator.generateOnce(UiBinderGenerator.java:174)
 at com
.google.gwt.uibinder.rebind.UiBinderGenerator.generate(UiBinderGenerator.java:128)
 at com
.google.gwt.core.ext.IncrementalGenerator.generateNonIncrementally(IncrementalGenerator.java:40)
 at com
.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:745)
 at com
.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:103)
 at com
.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:78)
 at com
.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:262)
 at com
.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:251)
 at com
.google.gwt.dev.PrecompilationContextCreator$1.getAllPossibleRebindAnswers(PrecompilationContextCreator.java:86)
 at com
.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.createStaticRebindExpression(UnifyAst.java:519)
 at com
.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.createRebindExpression(UnifyAst.java:487)
 at com
.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.maybeHandleMagicMethodCall(UnifyAst.java:415)
 at com
.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.visit(UnifyAst.java:402)
 at com
.google.gwt.dev.jjs.ast.JMethodCall.traverse(JMethodCall.java:265)
 at com
.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
 at com
.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
 
... 46 more
           
[ERROR] at Loader.java(29): GWT.create(Loader$LoaderUiBinder.class)
               com
.google.gwt.dev.jjs.ast.JMethodCall
           
[ERROR] at Loader.java(29): (Loader$LoaderUiBinder) GWT.create(Loader$LoaderUiBinder.class)
               com
.google.gwt.dev.jjs.ast.JCastOperation
           
[ERROR] at Loader.java(29): static Loader$LoaderUiBinder uiBinder = (Loader$LoaderUiBinder) GWT.create(Loader$LoaderUiBinder.class)
               com
.google.gwt.dev.jjs.ast.JDeclarationStatement
           
[ERROR] at Loader.java(24): {
 
Composite.$clinit();
 
static Loader$LoaderUiBinder uiBinder = (Loader$LoaderUiBinder) GWT.create(Loader$LoaderUiBinder.class);
}
               com
.google.gwt.dev.jjs.ast.JBlock
           
[ERROR] at Loader.java(24): {
 
Composite.$clinit();
 
static Loader$LoaderUiBinder uiBinder = (Loader$LoaderUiBinder) GWT.create(Loader$LoaderUiBinder.class);
}
               com
.google.gwt.dev.jjs.ast.JMethodBody
           
[ERROR] at Loader.java(24): com.snkv.peruse.client.Loader.$clinit()V
               com
.google.gwt.dev.jjs.ast.JMethod
     
[ERROR] Compiler returned false
     
[WARN] recompile failed


On Monday, November 21, 2016 at 4:07:42 PM UTC-5, jgindin wrote:
In our app, we have a UiBinder widget (SomeViewImpl) which has, as its root element, a widget which itself is a UiBinder widget (CollectionManagementLayout).

My UiBinder declaration in SomeViewImpl looks like this:
interface CollectionManagementPanelUiBinder extends UiBinder<CollectionManagementLayout, SomeViewImpl> {}


The UiBinder XML for the SomeViewImpl class starts off like this:
  <collectionmanagement:CollectionManagementLayout ui:field="layout">
    . . . 
  </collectionmanagement:CollectionManagementLayout>



This code compiles just fine in GWT 2.7, but with 2.8, I get the following error:

[ERROR] Errors in 'generated://09CDEAB17C92C8C75AB00C9F2F0DF847/com/myco/myproduct/client/stuff/collections/SomeViewImpl_CollectionManagementPanelUiBinderImpl.java'
      [ERROR] Line 17: The interface UiBinder cannot be implemented more than once with different arguments: UiBinder<CollectionManagementLayout,SomeViewImpl> and UiBinder<CollectionManagementLayout,SomeViewImpl>
      See snapshot: /tmp/com.myco.myproduct.client.stuff.collections.SomeViewImpl_CollectionManagementPanelUiBinderImpl3472216513944602205.java
   Tracing compile failure path for type 'com.myco.myproduct.client.stuff.collections.SomeViewImpl_CollectionManagementPanelUiBinderImpl'
      [ERROR] Errors in 'generated://09CDEAB17C92C8C75AB00C9F2F0DF847/com/myco/myproduct/client/stuff/collections/SomeViewImpl_CollectionManagementPanelUiBinderImpl.java'
         [ERROR] Line 17: The interface UiBinder cannot be implemented more than once with different arguments: UiBinder<CollectionManagementLayout,SomeViewImpl> and UiBinder<CollectionManagementLayout,SomeViewImpl>



The generated code looks like this:
public class SomeViewImpl_CollectionManagementPanelUiBinderImpl 
  implements UiBinder<CollectionManagementLayout, SomeViewImpl>, 
  SomeViewImpl.CollectionManagementPanelUiBinder {


I worked around this by changing the UiBinder declaration in SomeViewImpl to be:
interface CollectionManagementPanelUiBinder extends UiBinder<Widget, SomeViewImpl> {}


My question is: Should this have failed in GWT 2.7? Or is there a bug in GWT 2.8?

thanks,

jay

--
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 post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment