vert-x3 / vertx-service-proxy

EventBus Proxy generation
Apache License 2.0
67 stars 58 forks source link

Updating to 3.4.2 generates error #56

Closed fpmk closed 7 years ago

fpmk commented 7 years ago

Hi everybody, when I moved from vertx 3.4.1 to 3.4.2, proxygen fails with error.

PS: clean classes and other stuff not helped

ProxyDealSpread annotated with @DataObject and has contructor @SuppressWarnings("unused") public ProxyDealSpread(JsonObject obj) {...}

Could not generate element for com.novice.proxyapi.transport.object.ProxyDealSpread: null java.lang.UnsupportedOperationException at java.util.AbstractCollection.add(AbstractCollection.java:262) at io.vertx.codegen.DataObjectModel.lambda$processMethods$7(DataObjectModel.java:324) at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) at java.util.Iterator.forEachRemaining(Iterator.java:116) at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:270) at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) at java.util.Iterator.forEachRemaining(Iterator.java:116) at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) at io.vertx.codegen.DataObjectModel.processMethods(DataObjectModel.java:324) at io.vertx.codegen.DataObjectModel.traverse(DataObjectModel.java:217) at io.vertx.codegen.DataObjectModel.process(DataObjectModel.java:154) at io.vertx.codegen.CodeGen.getDataObjectModel(CodeGen.java:184) at io.vertx.codegen.CodeGen.lambda$null$15(CodeGen.java:112) at io.vertx.codegen.CodeGen$ModelEntry.getValue(CodeGen.java:218) at io.vertx.codegen.CodeGen$ModelEntry.getValue(CodeGen.java:200) at io.vertx.codegen.CodeGenProcessor.lambda$process$5(CodeGenProcessor.java:204) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1691) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:312) at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:742) at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) at io.vertx.codegen.CodeGenProcessor.process(CodeGenProcessor.java:202) at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794) at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705) at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91) at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035) at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176) at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170) at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856) at com.sun.tools.javac.main.Main.compile(Main.java:523) at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129) at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138) at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:46) at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:33) at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:104) at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:53) at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:38) at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:35) at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:25) at org.gradle.api.tasks.compile.JavaCompile.performCompilation(JavaCompile.java:206) at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:187)

vietj commented 7 years ago

@cescoffier it looks similar to an issue you fixed

cescoffier commented 7 years ago

@vietj yes definitely similar to the one I fixed.

@fpmk does your data object use annotations (in addition to DataObject)? If not, can you share your class.

fpmk commented 7 years ago

@cescoffier

ProxyDealSpread.zip

@JsonProperty("trader_pos")
private ProxyTraderExecutedPostion traderPos;

@JsonProperty("broker_pos")
private List<ProxyBrokerExecutedPostion> brokerPos;

the same DataObjects with primitive properties.

extended class

public class TDataObject {
    public JsonObject toJson() {
        return new JsonObject(Json.encode(this));
    }
}
vietj commented 7 years ago

thanks @fpmk for the reproducer we will investigate

cescoffier commented 7 years ago

@vietj @fpmk Good news, already fixed in codegen.

I've added a @JsonProperty annotation to the TestDataObject so we can detect regression on this.

fpmk commented 7 years ago

Thanks guys, I will check this in my project.