Skip to content

Reflection-free serializers generated but not used by Jackson #47571

@tsegismont

Description

@tsegismont

Describe the bug

I tried to enable reflection-free serializers in a project. The serializers are generated but not used by Jackson.

With some debugging info, I found that io.quarkus.resteasy.reactive.jackson.runtime.serialisers.GeneratedSerializersRegister.MappingModuleHolder#createMappingModule is invoked before io.quarkus.resteasy.reactive.jackson.runtime.ResteasyReactiveServerJacksonRecorder#recordGeneratedSerializer.

Expected behavior

Serializers are generated and used by Jackson

Actual behavior

Serializers are generated but not used by Jackson

How to Reproduce?

https://github.com/TechEmpower/FrameworkBenchmarks

Update this file: frameworks/Java/quarkus/resteasy-reactive-hibernate-reactive/src/main/resources/application.properties

Add:

quarkus.rest.jackson.optimization.enable-reflection-free-serializers=true
quarkus.package.jar.decompiler.enabled=true

You can comment out quarkus.datasource.username, quarkus.datasource.password, quarkus.datasource.reactive.url and %dev.quarkus.datasource.reactive.url so that, on startup a dev services starts a database for you.

Then populate the DB with http :8080/createData (using HTTPie).

Finally, query an endpoint with http :8080/db

If you add breakpoints to the io.quarkus.benchmark.model.World, you will notice that when Jackson serializes it, it uses reflection.

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/jacksonIssues related to Jackson (JSON library)kind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions