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

   ### Search before asking
   
   - [x] I had searched in the [issues](https://github.com/apache/fory/issues) 
and found no similar issues.
   
   
   ### Version
   
   Fory version: 0.17.0
   
   ### Component(s)
   
   Java
   
   ### Minimal reproduce step
   
   ```java
   @Value.Immutable
   interface Price {}
   
   record Order(int id, Price price) {}
   
   // Fory COMPATIBLE mode:
   // 1. Order is serialized; Price enters META_SHARE
   // 2. Fory JIT-compiles codec for Price
   // 3. On deserialization: Unsafe.allocateInstance(Price.class) → 
InstantiationException
   ```
   
   ### What did you expect to see?
   
   Fory should detect that a META_SHARE type is an interface (or abstract 
class) and either:
   - Not JIT-compile an instantiating codec for it, or
   - Use the concrete runtime type from `TypeResolver` for allocation
   
   ### What did you see instead?
   
   When the type graph of a serialized payload includes a field declared as an 
interface type, Fory adds that interface to the META_SHARE type table and 
JIT-compiles a codec for it. During deserialization the JIT codec calls 
`Unsafe.allocateInstance(InterfaceClass)`, which throws 
`InstantiationException` — interfaces cannot be instantiated.
   
   ### Anything Else?
   
   I'm running into this issue when using 
[Immutables.org](https://immutables.github.io/) annotated interfaces.
   
   ### 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