PiotrDuz opened a new issue, #3572:
URL: https://github.com/apache/fory/issues/3572

   ### Search before asking
   
   - [x] I had searched in the [issues](https://github.com/apache/fory/issues) 
and found no similar issues.
   
   
   ### Version
   
   Hello, 
   We were using apache fory 0.11.1 successfully. After updating to 0.16.0 , we 
no longer can serialise our complex cyclic object graph. Apache fory was chosen 
specifically because it had that capability. 
   I am reporting is as a bug because I hope the functionality can be bring 
back. 
   
   
   ### Component(s)
   
   Java
   
   ### Minimal reproduce step
   
   Reproduction example is here: 
   https://github.com/PiotrDuz/fory-compiler-error-repro
   Just please run a test. 
   It seems that 
   
   ### What did you expect to see?
   
   I want the object to be serialised and deserialised properly. 
   In reproduction example, test should be green.
   
   ### What did you see instead?
   
   The exception in auto-generated code: 
   
   `Caused by: 
org.apache.fory.shaded.org.codehaus.commons.compiler.CompileException: File 
'io/cashforce/ng/platformapi/data/masterdata/mdsnapshot/ReproNodeForyRefCodec_0.java',
 Line 387, Column 9: Assignment conversion not possible from type 
"java.lang.Enum" to type 
"io.cashforce.ng.platformapi.data.masterdata.mdsnapshot.ReproType"
        at 
org.apache.fory.shaded.org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:13228)
        at 
org.apache.fory.shaded.org.codehaus.janino.UnitCompiler.assignmentConversion(UnitCompiler.java:11445)
        at 
org.apache.fory.shaded.org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:4186)
        at 
org.apache.fory.shaded.org.codehaus.janino.UnitCompiler.access$6300(UnitCompiler.java:240)
        at 
org.apache.fory.shaded.org.codehaus.janino.UnitCompiler$13.visitAssignment(UnitCompiler.java:4143)
        at 
org.apache.fory.shaded.org.codehaus.janino.UnitCompiler$13.visitAssignment(UnitCompiler.java:4126)
        at 
org.apache.fory.shaded.org.codehaus.janino.Java$Assignment.accept(Java.java:4864)
        at 
org.apache.fory.shaded.org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:4126)`
   
   ### Anything Else?
   
   I have used AI to generate simple reproducible example, as I could not 
attach our production code. 
   Please do not be repelled by some AI artefacts.
   The test successfully shows the error we see in our staging environment. 
   Also, here is  AI found root cause (which looks sound, but I am warning that 
haven't put much thought to review): 
   
   Root cause: The generated serializer (ReproNodeForyRefCodec_0) for a 
Map<ReproType, Set<ReproNode>> field emits:
     ReproType key = ((Enum) entry.getKey());  // line 387
     But Enum cannot be assigned to ReproType without a cast. It should 
generate:
     ReproType key = ((ReproType) entry.getKey());
   
   
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to