Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-5287

Regression (4.9.x to 4.11.x) lack of generic support in Maps

    • Type: Icon: Bug Bug
    • Resolution: Gone away
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: 4.11.0, 4.11.1, 4.11.2
    • Component/s: None
    • None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Summary

      4.9.x versions of the Java driver would handle this scenario gracefully:

      A class with a property like:

      public Map<String, MyGenericType<Animal>> decorators;

      where Animal is an abstract class with a discriminator.

      Such a field in a class now produces:

      CodecConfigurationException with the message: "[x] contains generic types that have not been specialised. Top level classes with generic types are not supported by the PojoCodec."

      Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).

      Version 4.11.x of the Java driver produces the error.  Version 4.9.x of the driver works fine.

      This is also affecting a widely used Java library, Quarkus: https://github.com/quarkusio/quarkus/issues/36397

       

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            robert@unitydynamics.com Robert Fox
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: