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

   ### Search before asking
   
   - [x] I had searched in the [issues](https://github.com/apache/fory/issues) 
and found no similar issues.
   
   
   ### Version
   
   OS: `macOS 26.1`
   Fory: `0.13.1`
   Java : `java 21.0.3 2024-04-16 LTS`
   
   ### Component(s)
   
   Java
   
   ### Minimal reproduce step
   
   ```
   import org.apache.fory.Fory;
   import org.apache.fory.config.Language;
   
   import java.util.concurrent.CopyOnWriteArraySet;
   
   public class CopyOnWriteArraySetTest {
       public static void main(String[] args) {
           Fory fory = Fory.builder()
                   .withLanguage(Language.JAVA)
                   .requireClassRegistration(false)
                   .build();
   
           CopyOnWriteArraySet<String> set = new CopyOnWriteArraySet<>();
           set.add("Value1");
           set.add("Value2");
   
           byte[] serialized = fory.serialize(set);
           CopyOnWriteArraySet deserialised = fory.deserialize(serialized, 
CopyOnWriteArraySet.class);
           System.out.println("deserialised=" + deserialised);
       }
   }
   ```
   
   ### What did you expect to see?
   
   Fory should be able to serialize `java.util.concurrent.CopyOnWriteArraySet` 
objects.
   
   ### What did you see instead?
   
   Serialization fails with a `ClassCastException`.
   
   <details>
   <summary>View full stack trace</summary>
   
   ```
   Exception in thread "main" org.apache.fory.exception.SerializationException: 
java.lang.ClassCastException: class 
org.apache.fory.collection.CollectionSnapshot cannot be cast to class 
java.util.List (org.apache.fory.collection.CollectionSnapshot is in unnamed 
module of loader 'app'; java.util.List is in module java.base of loader 
'bootstrap')
        at org.apache.fory.Fory.processSerializationError(Fory.java:362)
        at org.apache.fory.Fory.serialize(Fory.java:331)
        at org.apache.fory.Fory.serialize(Fory.java:278)
        at 
com.fory_tests.CopyOnWriteArraySetTest.main(CopyOnWriteArraySetTest.java:19)
   Caused by: java.lang.ClassCastException: class 
org.apache.fory.collection.CollectionSnapshot cannot be cast to class 
java.util.List (org.apache.fory.collection.CollectionSnapshot is in unnamed 
module of loader 'app'; java.util.List is in module java.base of loader 
'bootstrap')
        at 
org.apache.fory.builder.CopyOnWriteArraySetForyCodec_0.writeFields$(CopyOnWriteArraySetForyCodec_0.java:113)
        at 
org.apache.fory.builder.CopyOnWriteArraySetForyCodec_0.write(CopyOnWriteArraySetForyCodec_0.java:224)
        at 
org.apache.fory.serializer.collection.CollectionSerializers$DefaultJavaCollectionSerializer.write(CollectionSerializers.java:729)
        at org.apache.fory.Fory.writeData(Fory.java:654)
        at org.apache.fory.Fory.write(Fory.java:405)
        at org.apache.fory.Fory.serialize(Fory.java:325)
   
   ```
   
   </details>
   
   ### Anything Else?
   
   _No response_
   
   ### 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