Skip to content
This repository has been archived by the owner on Mar 15, 2022. It is now read-only.

Compile time errors using @CreatWith in web mode #17

Open
hpehl opened this issue Oct 18, 2013 · 1 comment
Open

Compile time errors using @CreatWith in web mode #17

hpehl opened this issue Oct 18, 2013 · 1 comment
Assignees
Milestone

Comments

@hpehl
Copy link
Owner

hpehl commented Oct 18, 2013

I’m hoping to serialize a list of objects to XML using polymorphic references. My setup seems to work successfully in GWT dev mode, however I run into compile time errors on my official build machine. I have a base class with xml reader/writers defined, subclasses with xml reader/writers also defined, and a wrapper class that contains only a list of base class objects, also with its own xml reader/writer. The compilation error involves the wrapper class, and seems to come from the fact that it both utilizes the @createwith annotation, and also has xml readers/writers defined for it. If I comment out the @createwith annotation, my project compiles successfully. Below is the wrapper class in its entirety. I have attached the error log, which contains 2 distinct errors. First is a classnotfoundexception, but I noticed that this disappears when I comment out the reader/writer in the wrapper class, so perhaps it is a symptom of the second error? Second is an IllegalArgumentException, complaining of object is not an instance of declaring class.

Is it that the existence of the @createwith tag is somehow mucking up compilation? Any insight you could provide would be greatly appreciated. For reference, I am using the following versions:

  • GWT 2.4
  • Gin 2.1.1
  • Guice 3.0
  • Piriti 0.8 (same results swapping in 0.10)
  • Totoe 0.4
  • Velocity 1.7
public class SavedWorkspace {
    public interface SavedWorkspaceReader extends XmlReader<SavedWorkspace> {}
    public static final SavedWorkspaceReader XmlReader = GWT.create(SavedWorkspaceReader.class);

    public interface SavedWorkspaceWriter extends XmlWriter<SavedWorkspace> {}
    public static final SavedWorkspaceWriter XmlWriter = GWT.create(SavedWorkspaceWriter.class);

    @CreateWith(WorkspaceViewStateCreator.class)
    @Path("viewStates/view")
    private List<WorkspaceViewState> viewStates;

    public SavedWorkspace() {       
    }

    public SavedWorkspace(List<WorkspaceViewState> viewStates) {
        this.viewStates = viewStates;
    }

    public List<WorkspaceViewState> getViewStates() {
        return viewStates;
    }

    public void setViewStates(List<WorkspaceViewState> viewStates) {
        this.viewStates = viewStates;
    }
 }
@ghost ghost assigned hpehl Oct 18, 2013
@hpehl
Copy link
Owner Author

hpehl commented Oct 18, 2013

Stacktrace

[java] Compiling module com.opnet.acelive.WebConsole
     [java]    Resolving com.opnet.acelive.client.settings.SavedWorkspace
     [java]       Found type 'com.opnet.acelive.client.settings.SavedWorkspace'
     [java]          [ERROR] Annotation error: cannot resolve com.opnet.acelive.client.settings.WorkspaceViewStateCreator
     [java] java.lang.ClassNotFoundException: com.opnet.acelive.client.settings.WorkspaceViewStateCreator
     [java]     at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
     [java]     at java.security.AccessController.doPrivileged(Native Method)
     [java]     at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
     [java]     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
     [java]     at java.lang.Class.forName0(Native Method)
     [java]     at java.lang.Class.forName(Class.java:264)
     [java]     at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotationValue(TypeOracleMediator.java:750)
     [java]     at com.google.gwt.dev.javac.TypeOracleMediator.createAnnotation(TypeOracleMediator.java:498)
     [java]     at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotation(TypeOracleMediator.java:648)
     [java]     at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotations(TypeOracleMediator.java:663)
     [java]     at com.google.gwt.dev.javac.TypeOracleMediator.resolveField(TypeOracleMediator.java:964)
     [java]     at com.google.gwt.dev.javac.TypeOracleMediator.resolveClass(TypeOracleMediator.java:872)
     [java]     at com.google.gwt.dev.javac.TypeOracleMediator.addNewTypes(TypeOracleMediator.java:439)
     [java]     at com.google.gwt.dev.javac.TypeOracleMediatorFromSource.addNewUnits(TypeOracleMediatorFromSource.java:52)
     [java]     at com.google.gwt.dev.javac.CompilationState.assimilateUnits(CompilationState.java:164)
     [java]     at com.google.gwt.dev.javac.CompilationState.<init>(CompilationState.java:82)
     [java]     at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:450)
     [java]     at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:370)
     [java]     at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:360)
     [java]     at com.google.gwt.dev.Precompile.precompile(Precompile.java:252)
     [java]     at com.google.gwt.dev.Precompile.precompile(Precompile.java:233)
     [java]     at com.google.gwt.dev.Precompile.precompile(Precompile.java:145)
     [java]     at com.google.gwt.dev.Compiler.run(Compiler.java:232)
     [java]     at com.google.gwt.dev.Compiler.run(Compiler.java:198)
     [java]     at com.google.gwt.dev.Compiler$1.run(Compiler.java:170)
     [java]     at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:88)
     [java]     at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:82)
     [java]     at com.google.gwt.dev.Compiler.main(Compiler.java:177)
     [java]    Scanning for additional dependencies: file:/u1/builds/9.0_matt/NPui/uiWebInsights/sources/com/opnet/acelive/client/settings/SavedWorkspace.java
     [java]       Computing all possible rebind results for 'com.opnet.acelive.client.settings.SavedWorkspace.SavedWorkspaceReader'
     [java]          Rebinding com.opnet.acelive.client.settings.SavedWorkspace.SavedWorkspaceReader
     [java]             Invoking generator name.pehl.piriti.rebind.xml.XmlReaderGenerator
     [java]                [ERROR] Generator 'name.pehl.piriti.rebind.xml.XmlReaderGenerator' threw an exception while rebinding 'com.opnet.acelive.client.settings.SavedWorkspace.SavedWorkspaceReader'
     [java] java.lang.IllegalArgumentException: object is not an instance of declaring class
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
     [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     [java]     at java.lang.reflect.Method.invoke(Method.java:616)
     [java]     at com.google.gwt.dev.javac.AnnotationProxyFactory$AnnotationProxyInvocationHandler.invoke(AnnotationProxyFactory.java:247)
     [java]     at $Proxy42.value(Unknown Source)
     [java]     at name.pehl.piriti.rebind.type.PojoTypeProcessor$FieldPropertySource.getInstanceCreator(PojoTypeProcessor.java:285)
     [java]     at name.pehl.piriti.rebind.property.PropertyContextCreator.createPropertyContext(PropertyContextCreator.java:65)
     [java]     at name.pehl.piriti.rebind.type.AbstractTypeProcessor.createPropertyContext(AbstractTypeProcessor.java:170)
     [java]     at name.pehl.piriti.rebind.type.AbstractTypeProcessor.addProperty(AbstractTypeProcessor.java:116)
     [java]     at name.pehl.piriti.rebind.type.PojoTypeProcessor.doProcess(PojoTypeProcessor.java:64)
     [java]     at name.pehl.piriti.rebind.type.AbstractTypeProcessor.process(AbstractTypeProcessor.java:77)
     [java]     at name.pehl.piriti.rebind.VelocityGenerator.generate(VelocityGenerator.java:56)
     [java]     at com.google.gwt.core.ext.GeneratorExtWrapper.generate(GeneratorExtWrapper.java:48)
     [java]     at com.google.gwt.core.ext.GeneratorExtWrapper.generateIncrementally(GeneratorExtWrapper.java:60)
      [java]     at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:647)
     [java]     at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41)
     [java]     at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:78)
     [java]     at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:268)
     [java]     at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:257)
     [java]     at com.google.gwt.dev.DistillerRebindPermutationOracle.getAllPossibleRebindAnswers(DistillerRebindPermutationOracle.java:91)
     [java]     at com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.doFindAdditionalTypesUsingRebinds(WebModeCompilerFrontEnd.java:96)
     [java]     at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.process(AbstractCompiler.java:254)
     [java]     at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:444)
     [java]     at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.compile(AbstractCompiler.java:173)
     [java]     at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.compile(AbstractCompiler.java:288)
     [java]     at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.access$400(AbstractCompiler.java:139)
     [java]     at com.google.gwt.dev.jdt.AbstractCompiler.compile(AbstractCompiler.java:588)
     [java]     at com.google.gwt.dev.jdt.BasicWebModeCompiler.getCompilationUnitDeclarations(BasicWebModeCompiler.java:97)
     [java]     at com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.getCompilationUnitDeclarations(WebModeCompilerFrontEnd.java:52)
     [java]     at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:569)
     [java]     at com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:33)
     [java]     at com.google.gwt.dev.Precompile.precompile(Precompile.java:284)
     [java]     at com.google.gwt.dev.Precompile.precompile(Precompile.java:233)
     [java]     at com.google.gwt.dev.Precompile.precompile(Precompile.java:145)
     [java]     at com.google.gwt.dev.Compiler.run(Compiler.java:232)
     [java]     at com.google.gwt.dev.Compiler.run(Compiler.java:198)
     [java]     at com.google.gwt.dev.Compiler$1.run(Compiler.java:170)
     [java]     at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:88)
     [java]     at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:82)
     [java]     at com.google.gwt.dev.Compiler.main(Compiler.java:177)
     [java]       Computing all possible rebind results for 'com.opnet.acelive.client.settings.SavedWorkspace.SavedWorkspaceWriter'
     [java]          Rebinding com.opnet.acelive.client.settings.SavedWorkspace.SavedWorkspaceWriter
     [java]             Invoking generator name.pehl.piriti.rebind.xml.XmlWriterGenerator
     [java]                [ERROR] Generator 'name.pehl.piriti.rebind.xml.XmlWriterGenerator' threw an exception while rebinding 'com.opnet.acelive.client.settings.SavedWorkspace.SavedWorkspaceWriter'
     [java] java.lang.IllegalArgumentException: object is not an instance of declaring class
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
     [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     [java]     at java.lang.reflect.Method.invoke(Method.java:616)
     [java]     at com.google.gwt.dev.javac.AnnotationProxyFactory$AnnotationProxyInvocationHandler.invoke(AnnotationProxyFactory.java:247)
     [java]     at $Proxy42.value(Unknown Source)
     [java]     at name.pehl.piriti.rebind.type.PojoTypeProcessor$FieldPropertySource.getInstanceCreator(PojoTypeProcessor.java:285)
     [java]     at name.pehl.piriti.rebind.property.PropertyContextCreator.createPropertyContext(PropertyContextCreator.java:65)
     [java]     at name.pehl.piriti.rebind.type.AbstractTypeProcessor.createPropertyContext(AbstractTypeProcessor.java:170)
     [java]     at name.pehl.piriti.rebind.type.AbstractTypeProcessor.addProperty(AbstractTypeProcessor.java:116)
     [java]     at name.pehl.piriti.rebind.type.PojoTypeProcessor.doProcess(PojoTypeProcessor.java:64)
     [java]     at name.pehl.piriti.rebind.type.AbstractTypeProcessor.process(AbstractTypeProcessor.java:77)
     [java]     at name.pehl.piriti.rebind.VelocityGenerator.generate(VelocityGenerator.java:56)
     [java]     at com.google.gwt.core.ext.GeneratorExtWrapper.generate(GeneratorExtWrapper.java:48)
     [java]     at com.google.gwt.core.ext.GeneratorExtWrapper.generateIncrementally(GeneratorExtWrapper.java:60)
     [java]     at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:647)
     [java]     at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41)
     [java]     at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:78)
     [java]     at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:268)
     [java]     at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:257)
     [java]     at com.google.gwt.dev.DistillerRebindPermutationOracle.getAllPossibleRebindAnswers(DistillerRebindPermutationOracle.java:91)
     [java]     at com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.doFindAdditionalTypesUsingRebinds(WebModeCompilerFrontEnd.java:96)
     [java]     at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.process(AbstractCompiler.java:254)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant