[JAVA-3918] Nested wildcard generic type stops automatic POJO codec creation Created: 22/Dec/20  Updated: 19/Apr/23

Status: Backlog
Project: Java Driver
Component/s: POJO
Affects Version/s: 4.1.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Sebastian Bober Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: Investigate our POJO implementation
Quarter: FY23Q4, FY24Q2
Case:

 Description   

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.



 Comments   
Comment by Jeffrey Yemin [ 23/Dec/20 ]

Hi guntermartens@fico.com

Thanks, I see that the cases have already been linked.

Comment by Jeffrey Yemin [ 22/Dec/20 ]

Hi sebastianbober@fico.com,

Thanks for reporting this issue. We will investigate and get back to you, though probably slower than usual due to the upcoming holidays.

If you have already opened a support case, please let me know.

Regards,
Jeff

Generated at Thu Feb 08 09:00:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.