Skip to content

Commit 6c4fe19

Browse files
committed
Code cleanup
1 parent 7d73eee commit 6c4fe19

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import java.lang.reflect.Type;
2424
import java.util.List;
25+
import java.util.Objects;
2526
import java.util.Optional;
2627

2728
import static java.lang.String.format;
@@ -75,7 +76,7 @@ public <U> Codec<U> get(final Class<U> clazz, final List<Type> typeArguments) {
7576
clazz, typeArguments.size()),
7677
clazz.getTypeParameters().length == typeArguments.size());
7778
if (hasCycles(clazz)) {
78-
return new LazyCodec<U>(registry, clazz, typeArguments);
79+
return new LazyCodec<>(registry, clazz, typeArguments);
7980
} else {
8081
return registry.get(new ChildCodecRegistry<>(this, clazz, typeArguments));
8182
}
@@ -86,9 +87,8 @@ public <U> Codec<U> get(final Class<U> clazz, final CodecRegistry registry) {
8687
return this.registry.get(clazz, registry);
8788
}
8889

89-
@SuppressWarnings("rawtypes")
9090
private <U> Boolean hasCycles(final Class<U> theClass) {
91-
ChildCodecRegistry current = this;
91+
ChildCodecRegistry<?> current = this;
9292
while (current != null) {
9393
if (current.codecClass.equals(theClass)) {
9494
return true;
@@ -109,12 +109,12 @@ public boolean equals(final Object o) {
109109
return false;
110110
}
111111

112-
ChildCodecRegistry<?> that = (ChildCodecRegistry) o;
112+
ChildCodecRegistry<?> that = (ChildCodecRegistry<?>) o;
113113

114114
if (!codecClass.equals(that.codecClass)) {
115115
return false;
116116
}
117-
if (parent != null ? !parent.equals(that.parent) : that.parent != null) {
117+
if (!Objects.equals(parent, that.parent)) {
118118
return false;
119119
}
120120
if (!registry.equals(that.registry)) {

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import static org.bson.assertions.Assertions.isTrueArgument;
3131
import static org.bson.assertions.Assertions.notNull;
3232

33-
public final class ProvidersCodecRegistry implements CodecRegistry, CycleDetectingCodecRegistry {
33+
public final class ProvidersCodecRegistry implements CycleDetectingCodecRegistry {
3434
private final List<CodecProvider> codecProviders;
3535
private final CodecCache codecCache = new CodecCache();
3636

@@ -54,7 +54,6 @@ public <T> Codec<T> get(final Class<T> clazz, final List<Type> typeArguments) {
5454
return get(new ChildCodecRegistry<T>(this, clazz, typeArguments));
5555
}
5656

57-
@SuppressWarnings("rawtypes")
5857
public <T> Codec<T> get(final Class<T> clazz, final CodecRegistry registry) {
5958
for (CodecProvider provider : codecProviders) {
6059
Codec<T> codec = provider.get(clazz, registry);

0 commit comments

Comments
 (0)