Skip to content

TypeChecker now called 3 times for ser/deser when previously only 1 time #3769

Description

@nealeu

Search before asking

  • I had searched in the issues and found no similar issues.

Version

Fory 1.2.0, JDK 25

Component(s)

Java

Minimal reproduce step

This might just be an unavoidable change as part of a refactor, but as our tests caught it, I thought it would be worth the team/community being aware of - perhaps add a similar test for regression capture.

  def "should log error for non-Serializable classes to ensure non-Fory compat"() {
    given:
    captureLogEvents(SerializableTypeChecker.class)
    def fory = Fory.builder()
      .withLanguage(Language.JAVA)
      .requireClassRegistration(false)
      .build()

    def checker = SerializableTypeChecker.lenient()
    fory.getTypeResolver().setTypeChecker(checker)

    when:
    def bytes = fory.serialize(new AnyClass())
    def result = fory.deserialize(bytes)
    logEventLatch.await()

    then:
    result.value == "test"
    logEvents.size() == 1 // Passed in 1.1.0 Now fails with 3 in Fory 1.2.0 
    logEvents.any { it.level.name() == 'ERROR' }

    cleanup:
    cleanupLogEvents(LoggingTypeChecker.class)
  }

What did you expect to see?

expected type checker to only be called once.

What did you see instead?

Type checker now called 3 times

Anything Else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions