2016-06-02 2 views
0

GPS 모니터링 시스템의 프론트 엔드를 개발했습니다. 지오 펜스라는 새로운 기능을 추가해야합니다. 지오 펜스 모델과 PropertyAccess 인터페이스를 만들었습니다.리 바인드 중에 생성기가 예외를 throw했습니다.

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

그러나 변경할 때

Coordinate[] 

List<Coordinate> 

에 모두 잘 작동합니다. 내가 실수 한 곳? ValueProviderCreator.java에서

답변

0

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

:

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); 
    } 
} 

이 코드 (나는 실제로 몇 년 전에 쓴,하지만 난 오늘 센차 작동하지 않습니다)는 가정 하나 여러분의 빈 속성에있는 유형인지 프리미티브 또는 객체 (또는 인터페이스). GWT에서 이것은 배열을 사용할 가능성을 배제합니다. 당신이 변경 얻을 GXT 자체에 버그를 제출해야합니다

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

: GWT의 JArrayType에서. 그러나 어쨌든이 코드는 이후에 작동하지 않을 수도 있습니다. (대부분의 경우 이것이 Can't parse JSON string to Java/JavaScriptObject in GWT의 문제의 근원입니다.)

JavaScript 유형이 아닌 자바 스크립트 유형은 사용할 수 없습니다. GWT의 생성 된 배열 은 거의처럼 js 배열처럼 보이지만 중요한 유형의 세부 정보가 누락되어 java.util.List가 전혀 작동하지 않습니다.

대신 getCoordinatesJsArray<Coordinate>으로 변경하십시오.

+0

많은 감사, Colin. 정말 도움이되었습니다. – driversti

관련 문제