Skip to content

Reflection-free Serialization issue when first accessed vs. second access or if multiple methods #46156

@kjq

Description

@kjq

Describe the bug

The weirdest issue and I do not understand why.

When reflection-free serialization is on I have a case where the object is not properly serialized the first time but if I reload the dev server it works the second time. In production it just did not work.

In our real code we can verify these issues:

  1. The 1st time we hit the endpoint the object is not correct / Reloading quarkus:dev then hitting the same endpoint the object is there
  2. If I instead move all the properties into the main object and do not extend it works fine.
  3. If I muck around with the JSON properties, remove @JsonIgnore and make them all @JsonProperty it seems to work fine.

I was finally able to replicated it after I compared the bytecode and then added the "list" endpoint so that it matched our scenario.

Expected behavior

Serialization works the same when reflection-free is enabled for simple POJOs

Actual behavior

Various issues but the children object happens to be missing in this case.

Reloading quarkus:dev and hitting the same URL works the 2nd time.

How to Reproduce?

Scenario 1:

  1. mvn clean install
  2. In the "rest" project run mvn quarkus:dev
  3. Navigate to http://localhost:8080/hello - no child objects
  4. Reload quarkus:dev (press S)
  5. Navigate to http://localhost:8080/hello - child object is there

Scenario 2:

  1. Comment out the "list" endpoint
  2. In the "rest" project run mvn quarkus:dev
  3. Navigate to http://localhost:8080/hello - child object is there

code-with-quarkus.zip

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

3.18.2

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

Maven

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