Fix type parameters not being passed to fallback property codec#1765
Fix type parameters not being passed to fallback property codec#1765GliczDev wants to merge 2 commits intomongodb:mainfrom
Conversation
|
@rozza , I am not sure about the validity of the code changes proposed. For one thing, it breaks 6 unit testing cases; secondly it seems |
|
@GliczDev looks like this PR needs some tests and as @NathanQingyangXu mentioned this does appear to break some existing test cases. To run the bson tests and checks run |
There was a problem hiding this comment.
I added a couple of requested changes - to support java 8+ and to ensure that types are only provided if the list is not empty.
The LookupCountingCodecRegistry implementation in tests will need to implement <T> Codec<T> get(Class<T> clazz, List<Type> typeArguments) inorder not to throw an exception.
eg:
@Override
public <T> Codec<T> get(final Class<T> clazz, final List<Type> typeArguments) {
incrementCount(clazz);
for (CodecProvider provider : codecProviders) {
Codec<T> codec = provider.get(clazz, typeArguments, this);
if (codec != null) {
return codec;
}
}
return null;
}
It would also be good to add a regression test where this code path is used.
bson/src/main/org/bson/codecs/pojo/FallbackPropertyCodecProvider.java
Outdated
Show resolved
Hide resolved
@rozza I'm sorry, I'm not familiar with mongo-java-driver project structure and tests really. Could you point me where I should add things? |
For some reason, type parameters weren't passed to fallback property codec, which caused an exception when trying to access them. Now, this issue is fixed.