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
    • 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:
            Unassigned
            Reporter:
            Ken Robinson
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: