|
Using nested wildcard generic types causes exception and no automatic POJO codec will be build. I have a helper method of this style in a model class:
@BsonIgnore
|
public List<? extends A<? extends B>> getSomeAObjects() {
|
cObject.getAObjects();
|
}
|
Processing the return type of this method via PojoBuilderHelper.configureClassModelBuilder() throws an exception in TypeDate.getNestedTypeData() in the type instanceof WildcardType branch. This tries to cast the result of ((WildcardType) type).getUpperBounds()[0] to Class which will not work in this case as the upper bound type is a ParameterizedType. An exception is thrown which stops the automatic Codec creation.
This issue was introduced in JAVA-3390 and prevents us from updating to a 4.x driver version. It is also unfortunate that even the @BsonIgnore does not prevent this from happening.
|