22
22
23
23
import java .lang .reflect .Type ;
24
24
import java .util .List ;
25
+ import java .util .Objects ;
25
26
import java .util .Optional ;
26
27
27
28
import static java .lang .String .format ;
@@ -75,7 +76,7 @@ public <U> Codec<U> get(final Class<U> clazz, final List<Type> typeArguments) {
75
76
clazz , typeArguments .size ()),
76
77
clazz .getTypeParameters ().length == typeArguments .size ());
77
78
if (hasCycles (clazz )) {
78
- return new LazyCodec <U >(registry , clazz , typeArguments );
79
+ return new LazyCodec <>(registry , clazz , typeArguments );
79
80
} else {
80
81
return registry .get (new ChildCodecRegistry <>(this , clazz , typeArguments ));
81
82
}
@@ -86,9 +87,8 @@ public <U> Codec<U> get(final Class<U> clazz, final CodecRegistry registry) {
86
87
return this .registry .get (clazz , registry );
87
88
}
88
89
89
- @ SuppressWarnings ("rawtypes" )
90
90
private <U > Boolean hasCycles (final Class <U > theClass ) {
91
- ChildCodecRegistry current = this ;
91
+ ChildCodecRegistry <?> current = this ;
92
92
while (current != null ) {
93
93
if (current .codecClass .equals (theClass )) {
94
94
return true ;
@@ -109,12 +109,12 @@ public boolean equals(final Object o) {
109
109
return false ;
110
110
}
111
111
112
- ChildCodecRegistry <?> that = (ChildCodecRegistry ) o ;
112
+ ChildCodecRegistry <?> that = (ChildCodecRegistry <?> ) o ;
113
113
114
114
if (!codecClass .equals (that .codecClass )) {
115
115
return false ;
116
116
}
117
- if (parent != null ? ! parent .equals (that . parent ) : that .parent != null ) {
117
+ if (! Objects .equals (parent , that .parent ) ) {
118
118
return false ;
119
119
}
120
120
if (!registry .equals (that .registry )) {
0 commit comments