Skip to content

Commit 5b9c7af

Browse files
committed
Code review updates
1 parent 51307f1 commit 5b9c7af

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

bson-record-codec/src/main/org/bson/codecs/record/RecordCodec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ private static <T extends Annotation> void validateAnnotationOnlyOnField(final R
270270
}
271271

272272
RecordCodec(final Class<T> clazz, final CodecRegistry codecRegistry, final List<Type> types) {
273-
if (types.size() != clazz.getTypeParameters().length) {
273+
if (types.size() != clazz.getTypeParameters().length || types.isEmpty()) {
274274
throw new CodecConfigurationException("Unexpected number of type parameters for record class " + clazz);
275275
}
276276
this.clazz = notNull("class", clazz);

bson/src/main/org/bson/internal/ChildCodecRegistry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public <U> Codec<U> get(final Class<U> clazz) {
7070
@Override
7171
public <U> Codec<U> get(final Class<U> clazz, final List<Type> typeArguments) {
7272
notNull("typeArguments", typeArguments);
73-
isTrueArgument("typeArguments is not empty", typeArguments.size() >= 1);
73+
isTrueArgument("typeArguments is not empty", !typeArguments.isEmpty());
7474
isTrueArgument(format("typeArguments size should equal the number of type parameters in class %s, but is %d",
7575
clazz, typeArguments.size()),
7676
clazz.getTypeParameters().length == typeArguments.size());

bson/src/main/org/bson/internal/ProvidersCodecRegistry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public <T> Codec<T> get(final Class<T> clazz) {
4747
@Override
4848
public <T> Codec<T> get(final Class<T> clazz, final List<Type> typeArguments) {
4949
notNull("typeArguments", typeArguments);
50-
isTrueArgument("typeArguments is not empty", typeArguments.size() >= 1);
50+
isTrueArgument("typeArguments is not empty", !typeArguments.isEmpty());
5151
isTrueArgument(format("typeArguments size should equal the number of type parameters in class %s, but is %d",
5252
clazz, typeArguments.size()),
5353
clazz.getTypeParameters().length == typeArguments.size());

0 commit comments

Comments
 (0)