Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import org.bson.codecs.Codec;
import org.bson.codecs.configuration.CodecRegistry;

import java.lang.reflect.Type;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import java.lang.reflect.Type;
import java.lang.reflect.Type;
import java.util.List;
import java.util.stream.Collectors;


final class FallbackPropertyCodecProvider implements PropertyCodecProvider {
private final CodecRegistry codecRegistry;
private final PojoCodec<?> pojoCodec;
Expand All @@ -35,6 +37,6 @@ public <S> Codec<S> get(final TypeWithTypeParameters<S> type, final PropertyCode
if (clazz == pojoCodec.getEncoderClass()) {
return (Codec<S>) pojoCodec;
}
return codecRegistry.get(type.getType());
return codecRegistry.get(type.getType(), type.getTypeParameters().stream().<Type>map(TypeWithTypeParameters::getType).toList());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return codecRegistry.get(type.getType(), type.getTypeParameters().stream().<Type>map(TypeWithTypeParameters::getType).toList());
List<Type> types = type.getTypeParameters().stream().<Type>map(TypeWithTypeParameters::getType).collect(Collectors.toList());
if (!types.isEmpty()) {
return codecRegistry.get(type.getType(), types);
}
return codecRegistry.get(type.getType());

}
}