creddy opened a new issue, #2249: URL: https://github.com/apache/fury/issues/2249
### Search before asking - [x] I had searched in the [issues](https://github.com/apache/fury/issues) and found no similar issues. ### Version ➜ fury-test sw_vers ProductName: macOS ProductVersion: 15.4.1 BuildVersion: 24E263 ➜ fury-test java -version openjdk version "21.0.4.0.101" 2024-10-15 LTS OpenJDK Runtime Environment Zulu21.37+12-SA (build 21.0.4.0.101+1-LTS) OpenJDK 64-Bit Server VM Zulu21.37+12-SA (build 21.0.4.0.101+1-LTS, mixed mode) Salesforce OneJDK 21.0.4.0.101+34 2024-11-20 ➜ fury-test sbt -version sbt version in this project: 1.10.11 sbt runner version: 1.10.11 ➜ fury-test cat build.sbt| grep scalaVersion scalaVersion := "2.13.15" ➜ fury-test cat build.sbt| grep org.apache.fury libraryDependencies += "org.apache.fury" % "fury-scala_2.13" % "0.10.2" ### Component(s) Other, Java ### Minimal reproduce step Main.scala ```scala import org.apache.fury.{ Fury, ThreadSafeFury } import org.apache.fury.serializer.scala.ScalaSerializers import java.nio.file.{Paths, Files} import java.nio.charset.StandardCharsets object Main extends App { val threadSafeFury: ThreadSafeFury = Fury .builder() .withScalaOptimizationEnabled(true) .requireClassRegistration(false) .withRefTracking(true) .buildThreadSafeFury() ScalaSerializers.registerSerializers(threadSafeFury) case class ThisReturnsNullUntilSerializeIsCalled(param: String) // Uncomment this line to generate the test file. Comment it out to reproduce the issue after generating the file // Files.write(Paths.get("test.txt"), threadSafeFury.serialize(ThisReturnsNullUntilSerializeIsCalled)) // Registering the class resolves the issue //threadSafeFury.register(Main.ThisReturnsNullUntilSerializeIsCalled.getClass) // Stored the serialized bytes in a previous run val byteArray = Files.readAllBytes(Paths.get("test.txt")) // This should print `ThisReturnsNullUntilSerializeIsCalled` but prints `null` println(threadSafeFury.deserialize(byteArray)) // After this call deserialization works val bytes = threadSafeFury.serialize(ThisReturnsNullUntilSerializeIsCalled) // Prints `ThisReturnsNullUntilSerializeIsCalled` println(threadSafeFury.deserialize(byteArray)) // Write out again to ensure that the file is up to date Files.write(Paths.get("test.txt"), bytes) } ``` build.sbt ``` scalaVersion := "2.13.15" name := "hello-world" organization := "ch.epfl.scala" version := "1.0" Dependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "2.3.0" libraryDependencies += "org.apache.fury" % "fury-scala_2.13" % "0.10.2" ``` ### What did you expect to see? ``` sbt:hello-world> run [info] compiling 1 Scala source to /Users/chethan.reddy/tmp/fury-test/fury-test/target/scala-2.13/classes ... [info] running Main 2025-05-20 09:29:16 WARN FuryBuilder:427 [sbt-bg-threads-9] - Class registration isn't forced, unknown classes can be deserialized. If the environment isn't secure, please enable class registration by `FuryBuilder#requireClassRegistration(true)` or configure ClassChecker by `ClassResolver#setClassChecker` 2025-05-20 09:29:16 INFO Fury:159 [sbt-bg-threads-9] - Created new fury org.apache.fury.Fury@39db8b6 ThisReturnsNullUntilSerializeIsCalled ThisReturnsNullUntilSerializeIsCalled [success] Total time: 0 s, completed May 20, 2025, 9:29:16 AM ``` ### What did you see instead? ``` sbt:hello-world> run [info] running Main 2025-05-20 09:28:45 WARN FuryBuilder:427 [sbt-bg-threads-7] - Class registration isn't forced, unknown classes can be deserialized. If the environment isn't secure, please enable class registration by `FuryBuilder#requireClassRegistration(true)` or configure ClassChecker by `ClassResolver#setClassChecker` 2025-05-20 09:28:45 INFO Fury:159 [sbt-bg-threads-7] - Created new fury org.apache.fury.Fury@784533a7 null ThisReturnsNullUntilSerializeIsCalled [success] Total time: 0 s, completed May 20, 2025, 9:28:45 AM ``` ### 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]
