生成器在重新绑定时抛出异常
Generator threw an exception while rebinding
我开发 GPS 监控系统的前端。我需要添加新功能 - 地理围栏。我已经创建了地理围栏模型及其 PropertyAccess 接口。
当我编译项目时出现错误:
这是地理围栏的模型:
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 "";
}
}
以及访问其属性的接口:
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();
}
这里是错误:
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.access0(JobRunner.java:34)
at com.google.gwt.dev.codeserver.JobRunner.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.access0(JobRunner.java:34)
at com.google.gwt.dev.codeserver.JobRunner.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
但是当我改变
Coordinate[]
到
List<Coordinate>
一切正常。我哪里做错了?
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)...
来自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);
}
}
这段代码(我实际上是几年前写的,但我今天不为 Sencha 工作)假定您的 bean 属性 中的类型是原始类型或对象(或接口) .在 GWT 中,显然这排除了使用数组的可能性。来自 GWT 的 JArrayType:
public JClassType isClass() {
// intentional null
return null;
}
您需要提交 GXT 本身的错误才能更改此设置。但是,无论如何,您的代码在此之后可能无法正常工作(几乎可以肯定这是 中问题的根源,您的另一个问题):
您不能让 JavaScript 对象的属性为非 JavaScript 类型。 GWT 生成的数组 几乎 看起来像 js 数组,但会丢失重要的类型细节,并且 java.util.List 根本不起作用。
相反,将 getCoordinates
更改为 return JsArray<Coordinate>
。
我开发 GPS 监控系统的前端。我需要添加新功能 - 地理围栏。我已经创建了地理围栏模型及其 PropertyAccess 接口。 当我编译项目时出现错误:
这是地理围栏的模型:
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 "";
}
}
以及访问其属性的接口:
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();
}
这里是错误:
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.access0(JobRunner.java:34) at com.google.gwt.dev.codeserver.JobRunner.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.access0(JobRunner.java:34) at com.google.gwt.dev.codeserver.JobRunner.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
但是当我改变
Coordinate[]
到
List<Coordinate>
一切正常。我哪里做错了?
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)...
来自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);
}
}
这段代码(我实际上是几年前写的,但我今天不为 Sencha 工作)假定您的 bean 属性 中的类型是原始类型或对象(或接口) .在 GWT 中,显然这排除了使用数组的可能性。来自 GWT 的 JArrayType:
public JClassType isClass() {
// intentional null
return null;
}
您需要提交 GXT 本身的错误才能更改此设置。但是,无论如何,您的代码在此之后可能无法正常工作(几乎可以肯定这是
您不能让 JavaScript 对象的属性为非 JavaScript 类型。 GWT 生成的数组 几乎 看起来像 js 数组,但会丢失重要的类型细节,并且 java.util.List 根本不起作用。
相反,将 getCoordinates
更改为 return JsArray<Coordinate>
。