Regression in PojoBuilderHelper 5.6.x

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: 5.6.0, 5.6.4
    • Component/s: POJO
    • None
    • None
    • Java Drivers
    • 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?
    • None
    • None
    • None
    • None
    • None
    • None

      Summary

      Serialization is broken in certain cases in the 6.x drivers that worked under the 5.x drivers.  Sample code reproducing case attached.

      It appears that PojoBuilderHelper was substantially rewritten between 5.5 and 5.6.  As it recurses up the class hierarchy, it appears to lose/overwrite type information supplied by subclasses.  

      Under 5.x - serializes successfully.  Under 6.x results in error

      In this sample case, the 'data' field is a Map<String, Object>, but in 5.6 is failing to recognize.

      org.bson.codecs.configuration.CodecConfigurationException: An exception occurred when encoding using the AutomaticPojoCodec.

      Failed to encode 'Conc'. Encoding 'data' errored with: Can't find a codec for CodecCacheKey{clazz=class java.lang.Object, types=null}.

      A custom Codec or PojoCodec may need to be explicitly configured and registered to handle this type.

       

      While this is a toy example, this is a representation of our entire setup.  A generic interface, an abstract generic implementation, and a concrete implementation that provides typing.  This worked through the entire 4.x series of drivers through 5.5.x.  I saw no notes in 5.6.x that indicated there were any changes in requirements, leading me to believe this is a driver regression.

            Assignee:
            Slav Babanin
            Reporter:
            Ken Robinson
            None
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: