Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression bug: @Serdeable.Deserializable(as = ...) not working as expected #11532

Closed
Nahuel92 opened this issue Jan 23, 2025 · 1 comment
Closed

Comments

@Nahuel92
Copy link

Nahuel92 commented Jan 23, 2025

Expected Behavior

When using newer Micronaut versions (4.7.4 at the time of writing) and @Serdeable.Deserializable(as = com.google.common.collect.ImmutableList), Micronaut should deserialize it without errors.

With the following versions, it works well:

  • micronaut-parent 4.6.2
  • micronaut.version set to 4.6.5

Actual Behaviour

When using @Serdeable.Deserializable(as = com.google.common.collect.ImmutableList), Micronaut throws an exception:

Error decoding HTTP response body: No bean introspection available for type [class com.google.common.collect.ImmutableList]. Ensure the class is annotated with io.micronaut.core.annotation.Introspected.

This happens at least with the following versions (not sure when the bug was introduced):

  • micronaut-parent 4.7.4
  • micronaut.version set to 4.7.4

Steps To Reproduce

I attached an example app, but if you want to do it manually:

  1. Create a new Micronaut project with HTTP client, Guava and WireMock (or a similar one)
  2. Create a DTO and add collection field to it. Annotate it with @Serdeable.Deserializable(as = ...), for example @Serdeable.Deserializable(as = com.google.common.collect.ImmutableList)
  3. Create an HTTP client with a method that has the previously created DTO as return type
  4. Create a test, use WireMock (or a similar one) to stub the HTTP response and write a simple assert (e.g., assert that the collection is empty)
  5. When you run it, you'll get the exception.

Now, change the Micronaut parent and Micronaut Core versions to 4.6.2 and 4.6.5, respectively. Clean-compile and re-run the test, and this time it will pass.

I tried setting <micronaut.core.version>4.7.12</micronaut.core.version>, but the bug keeps happening.

It might be related to #11538

Let me know if more information is required. Thanks!

Environment Information

  • OS: Linux / Windows / MacOS
  • JDK Version: 21

Example Application

https://github.com/Nahuel92/poc-projects/tree/master/micronaut/micronaut-serdeable-deserializable-bug

Version

4.7.4

@Nahuel92
Copy link
Author

Closed, as I found out the bug comes from Micronaut Serialization. I opened a bug report there:

micronaut-projects/micronaut-serialization#1040

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant