Search code examples
javagwtgxt

Generator threw an exception while rebinding


I develop the front-end for the GPS-monitoring system. I need to add the new feature - geofence. I have created geofence model and its PropertyAccess interface. When I compile the project I getting the error:

Here is the model of geofence:

public class Geofence extends JavaScriptObject {

protected Geofence() {}

public final native int getId() /*-{ return this.id; }-*/;
public final native String getName() /*-{ return this.name; }-*/;
public final native String getDescription() /*-{ return this.description; }-*/;
public final native Type getType() /*-{ return this.type; }-*/;
public final native Coordinate[] getCoordinates() /*-{ return this.coordinates; }-*/;
public final native double getRadius() /*-{ return this.radius; }-*/;
public final native int getUserId() /*-{ return this.userId; }-*/;

public final native void setId(int id) /*-{ this.id = id; }-*/;
public final native void setName(String name) /*-{ this.name = name; }-*/;
public final native void setDescription(String description) /*-{ this.description = description; }-*/;
public final native void setType(Type type) /*-{ this.type = type; }-*/;
public final native void setCoordinates(Coordinate[] coordinates) /*-{ this.coordinates = coordinates; }-*/;
public final native void setRadius(double radius) /*-{ this.radius = radius; }-*/;
public final native void setUserId(int userId) /*-{ this.userId = userId; }-*/;

public final String getEmpty() {
    return "";
}
}

and the interface to access its properties:

public interface GeofenceProperties extends PropertyAccess<Geofence> {

@Editor.Path("id")
ModelKeyProvider<Geofence> key();

ValueProvider<Geofence, Integer> id();
ValueProvider<Geofence, String> name();
ValueProvider<Geofence, String> description();
ValueProvider<Geofence, Coordinate[]> coordinates();
ValueProvider<Geofence, Double> radius();
ValueProvider<Geofence, Integer> userId();
ValueProvider<Geofence, String> empty();
}

Here is the error:

Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors. Computing all possible rebind results for 'org.bitbucket.treklab.client.model.GeofenceProperties' Rebinding org.bitbucket.treklab.client.model.GeofenceProperties Invoking generator com.sencha.gxt.data.rebind.PropertyAccessGenerator [ERROR] Generator 'com.sencha.gxt.data.rebind.PropertyAccessGenerator' threw an exception while rebinding 'org.bitbucket.treklab.client.model.GeofenceProperties' java.lang.NullPointerException at com.sencha.gxt.data.rebind.ValueProviderCreator.typesMatch(ValueProviderCreator.java:315) at com.sencha.gxt.data.rebind.ValueProviderCreator.getSetterExpression(ValueProviderCreator.java:297) at com.sencha.gxt.data.rebind.ValueProviderCreator.appendSetterBody(ValueProviderCreator.java:134) at com.sencha.gxt.data.rebind.ValueProviderCreator.create(ValueProviderCreator.java:93) at com.sencha.gxt.core.rebind.AbstractCreator.create(AbstractCreator.java:48) at com.sencha.gxt.data.rebind.PropertyAccessGenerator.generate(PropertyAccessGenerator.java:94) at com.google.gwt.core.ext.IncrementalGenerator.generateNonIncrementally(IncrementalGenerator.java:40) at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:760) at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:160) at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:79) at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:276) at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:265) at com.google.gwt.dev.DistillerRebindPermutationOracle.getAllPossibleRebindAnswers(DistillerRebindPermutationOracle.java:87) at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.createStaticRebindExpression(UnifyAst.java:485) at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.createRebindExpression(UnifyAst.java:443) at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.handleMagicMethodCall(UnifyAst.java:576) at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.endVisit(UnifyAst.java:306) at com.google.gwt.dev.jjs.ast.JMethodCall.traverse(JMethodCall.java:248) at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381) at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293) at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:285) at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:128) at com.google.gwt.dev.jjs.ast.JCastOperation.traverse(JCastOperation.java:67) at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381) at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293) at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:285) at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:128) at com.google.gwt.dev.jjs.ast.JDeclarationStatement.traverse(JDeclarationStatement.java:49) at com.google.gwt.dev.jjs.ast.JModVisitor$ListContext.traverse(JModVisitor.java:95) at com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemove(JModVisitor.java:351) at com.google.gwt.dev.jjs.ast.JBlock.traverse(JBlock.java:92) at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381) at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293) at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:149) at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:145) at com.google.gwt.dev.jjs.ast.JMethodBody.traverse(JMethodBody.java:83) at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381) at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293) at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:285) at com.google.gwt.dev.jjs.ast.JMethod.visitChildren(JMethod.java:600) at com.google.gwt.dev.jjs.ast.JMethod.traverse(JMethod.java:569) at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381) at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293) at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:285) at com.google.gwt.dev.jjs.impl.UnifyAst.mainLoop(UnifyAst.java:1505) at com.google.gwt.dev.jjs.impl.UnifyAst.exec(UnifyAst.java:870) at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler$Precompiler.unifyJavaAst(JavaToJavaScriptCompiler.java:1305) at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler$Precompiler.constructJavaAst(JavaToJavaScriptCompiler.java:1038) at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler$Precompiler.precompile(JavaToJavaScriptCompiler.java:954) at com.google.gwt.dev.jjs.MonolithicJavaToJavaScriptCompiler.precompile(MonolithicJavaToJavaScriptCompiler.java:303) at com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:38) at com.google.gwt.dev.Precompile.precompile(Precompile.java:286) at com.google.gwt.dev.Precompile.precompile(Precompile.java:229) at com.google.gwt.dev.Precompile.precompile(Precompile.java:145) at com.google.gwt.dev.Compiler.run(Compiler.java:206) at com.google.gwt.dev.codeserver.Recompiler.doCompile(Recompiler.java:333) at com.google.gwt.dev.codeserver.Recompiler.compile(Recompiler.java:161) at com.google.gwt.dev.codeserver.Recompiler.recompile(Recompiler.java:119) at com.google.gwt.dev.codeserver.Outbox.recompile(Outbox.java:128) at com.google.gwt.dev.codeserver.JobRunner.recompile(JobRunner.java:81) at com.google.gwt.dev.codeserver.JobRunner.access$100(JobRunner.java:34) at com.google.gwt.dev.codeserver.JobRunner$2.run(JobRunner.java:73) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) [ERROR] Errors in 'org/bitbucket/treklab/client/view/DeviceView.java' [ERROR] Line 145: Failed to resolve 'org.bitbucket.treklab.client.model.GeofenceProperties' via deferred binding Computing all possible rebind results for 'org.bitbucket.treklab.client.resources.Resources' Rebinding org.bitbucket.treklab.client.resources.Resources Invoking generator com.google.gwt.resources.rebind.context.InlineClientBundleGenerator Preparing method cogWheel [WARN] Resource 'org/bitbucket/treklab/client/theme/icon/cogWheel.png' was located via ClassLoader. As a result changes in that resource will not be reflected in per-file recompiles. It should be registered via or entry in your .gwt.xml. In a future version of GWT, we will remove this fallback and your application will stop compiling [WARN] For the following type(s), generated source was never committed (did you forget to call commit()?) [WARN] org.bitbucket.treklab.client.model.GeofencePropertiesImpl [WARN] org.bitbucket.treklab.client.model.Geofence_coordinates_ValueProviderImpl Computing all possible rebind results for 'org.bitbucket.treklab.client.model.GeofenceProperties' Rebinding org.bitbucket.treklab.client.model.GeofenceProperties Invoking generator com.sencha.gxt.data.rebind.PropertyAccessGenerator [ERROR] Generator 'com.sencha.gxt.data.rebind.PropertyAccessGenerator' threw an exception while rebinding 'org.bitbucket.treklab.client.model.GeofenceProperties' java.lang.NullPointerException at com.sencha.gxt.data.rebind.ValueProviderCreator.typesMatch(ValueProviderCreator.java:315) at com.sencha.gxt.data.rebind.ValueProviderCreator.getSetterExpression(ValueProviderCreator.java:297) at com.sencha.gxt.data.rebind.ValueProviderCreator.appendSetterBody(ValueProviderCreator.java:134) at com.sencha.gxt.data.rebind.ValueProviderCreator.create(ValueProviderCreator.java:93) at com.sencha.gxt.core.rebind.AbstractCreator.create(AbstractCreator.java:48) at com.sencha.gxt.data.rebind.PropertyAccessGenerator.generate(PropertyAccessGenerator.java:94) at com.google.gwt.core.ext.IncrementalGenerator.generateNonIncrementally(IncrementalGenerator.java:40) at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:760) at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:160) at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:79) at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:276) at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:265) at com.google.gwt.dev.DistillerRebindPermutationOracle.getAllPossibleRebindAnswers(DistillerRebindPermutationOracle.java:87) at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.createStaticRebindExpression(UnifyAst.java:485) at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.createRebindExpression(UnifyAst.java:443) at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.handleMagicMethodCall(UnifyAst.java:576) at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.endVisit(UnifyAst.java:306) at com.google.gwt.dev.jjs.ast.JMethodCall.traverse(JMethodCall.java:248) at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381) at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293) at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:285) at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:128) at com.google.gwt.dev.jjs.ast.JCastOperation.traverse(JCastOperation.java:67) at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381) at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293) at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:285) at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:128) at com.google.gwt.dev.jjs.ast.JDeclarationStatement.traverse(JDeclarationStatement.java:49) at com.google.gwt.dev.jjs.ast.JModVisitor$ListContext.traverse(JModVisitor.java:95) at com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemove(JModVisitor.java:351) at com.google.gwt.dev.jjs.ast.JBlock.traverse(JBlock.java:92) at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381) at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293) at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:149) at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:145) at com.google.gwt.dev.jjs.ast.JMethodBody.traverse(JMethodBody.java:83) at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381) at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293) at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:285) at com.google.gwt.dev.jjs.ast.JMethod.visitChildren(JMethod.java:600) at com.google.gwt.dev.jjs.ast.JConstructor.traverse(JConstructor.java:142) at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381) at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293) at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:285) at com.google.gwt.dev.jjs.impl.UnifyAst.mainLoop(UnifyAst.java:1505) at com.google.gwt.dev.jjs.impl.UnifyAst.exec(UnifyAst.java:870) at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler$Precompiler.unifyJavaAst(JavaToJavaScriptCompiler.java:1305) at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler$Precompiler.constructJavaAst(JavaToJavaScriptCompiler.java:1038) at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler$Precompiler.precompile(JavaToJavaScriptCompiler.java:954) at com.google.gwt.dev.jjs.MonolithicJavaToJavaScriptCompiler.precompile(MonolithicJavaToJavaScriptCompiler.java:303) at com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:38) at com.google.gwt.dev.Precompile.precompile(Precompile.java:286) at com.google.gwt.dev.Precompile.precompile(Precompile.java:229) at com.google.gwt.dev.Precompile.precompile(Precompile.java:145) at com.google.gwt.dev.Compiler.run(Compiler.java:206) at com.google.gwt.dev.codeserver.Recompiler.doCompile(Recompiler.java:333) at com.google.gwt.dev.codeserver.Recompiler.compile(Recompiler.java:161) at com.google.gwt.dev.codeserver.Recompiler.recompile(Recompiler.java:119) at com.google.gwt.dev.codeserver.Outbox.recompile(Outbox.java:128) at com.google.gwt.dev.codeserver.JobRunner.recompile(JobRunner.java:81) at com.google.gwt.dev.codeserver.JobRunner.access$100(JobRunner.java:34) at com.google.gwt.dev.codeserver.JobRunner$2.run(JobRunner.java:73) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) [ERROR] Errors in 'org/bitbucket/treklab/client/Application.java' [ERROR] Line 43: Failed to resolve 'org.bitbucket.treklab.client.model.GeofenceProperties' via deferred binding [WARN] For the following type(s), generated source was never committed (did you forget to call commit()?) [WARN] org.bitbucket.treklab.client.model.Geofence_coordinates_ValueProviderImpl [WARN] org.bitbucket.treklab.client.model.GeofencePropertiesImpl Unification traversed 1267 fields and methods and 1208 types. 18 are considered part of the current module and 18 had all of their fields and methods traversed. [WARN] Some stale types ([org.bitbucket.treklab.client.model.Geofence_description_ValueProviderImpl, org.bitbucket.treklab.client.model.GeofencePropertiesImpl, org.bitbucket.treklab.client.model.Geofence_userId_ValueProviderImpl, org.bitbucket.treklab.client.model.Geofence_coordinates_ValueProviderImpl, org.bitbucket.treklab.client.model.Geofence_radius_ValueProviderImpl, org.bitbucket.treklab.client.model.Geofence_name_ValueProviderImpl, org.bitbucket.treklab.client.model.Geofence_id_ModelKeyProviderImpl, org.bitbucket.treklab.client.model.Geofence_empty_ValueProviderImpl, org.bitbucket.treklab.client.model.Geofence_id_ValueProviderImpl]) were not reprocessed as was expected. This is either a compiler bug or a Generator has legitimately stopped creating these types. [ERROR] Compiler returned false [WARN] recompile failed [WARN] continuing to serve previous version

But when I change

Coordinate[] 

to

List<Coordinate>

all works fine. Where I made a mistake?


Solution

  • com.sencha.gxt.data.rebind.PropertyAccessGenerator [ERROR] Generator 'com.sencha.gxt.data.rebind.PropertyAccessGenerator' threw an exception while rebinding 'org.bitbucket.treklab.client.model.GeofenceProperties' java.lang.NullPointerException at com.sencha.gxt.data.rebind.ValueProviderCreator.typesMatch(ValueProviderCreator.java:315)...

    From ValueProviderCreator.java:

    private boolean typesMatch(JClassType a, JType b) {
      if (b.isPrimitive() != null) {
        return a.getQualifiedSourceName().equals(b.isPrimitive().getQualifiedBoxedSourceName());
      } else {
        assert b.isClassOrInterface() != null;
    
        return b.isClassOrInterface().isAssignableTo(a);
      }
    }
    

    This code (which I actually wrote several years ago, but I don't work for Sencha today) assumes either that the type in your bean property is either a primitive or an object (or interface). In GWT, apparently this excludes the possibility of using an array. From GWT's JArrayType:

    public JClassType isClass() {
      // intentional null
      return null;
    }
    

    You'll need to file a bug with GXT itself to get this changed. However, your code might not work after this anyway (and almost certainly this is the root of your problem in Can't parse JSON string to Java/JavaScriptObject in GWT, your other question):

    You can't have a JavaScriptObject's properties be non-JavaScript types. GWT's generated arrays almost look like js arrays, but will be missing important type details, and java.util.List won't work at all.

    Instead, change your getCoordinates to return JsArray<Coordinate>.