@@ -444,7 +444,7 @@ private static Map<String, String> clientProperties(Map<String, String> fromPara
444
444
fromParameters = fromParameters == null ? Collections .emptyMap () : fromParameters ;
445
445
Map <String , String > clientProperties = new HashMap <>(fromParameters );
446
446
clientProperties .putAll (ClientProperties .DEFAULT_CLIENT_PROPERTIES );
447
- return Collections . unmodifiableMap (clientProperties );
447
+ return Map . copyOf (clientProperties );
448
448
}
449
449
450
450
static void checkMessageFitsInFrame (int maxFrameSize , Codec .EncodedMessage encodedMessage ) {
@@ -2224,7 +2224,7 @@ static class StreamStatsResponse extends Response {
2224
2224
2225
2225
StreamStatsResponse (short responseCode , Map <String , Long > info ) {
2226
2226
super (responseCode );
2227
- this .info = Collections . unmodifiableMap ( new HashMap <>( info ) );
2227
+ this .info = Map . copyOf ( info );
2228
2228
}
2229
2229
2230
2230
public Map <String , Long > getInfo () {
@@ -2249,7 +2249,7 @@ public StreamMetadata(String stream, short responseCode, Broker leader, List<Bro
2249
2249
this .replicas =
2250
2250
(replicas == null || replicas .isEmpty ())
2251
2251
? Collections .emptyList ()
2252
- : Collections . unmodifiableList (replicas );
2252
+ : List . copyOf (replicas );
2253
2253
}
2254
2254
2255
2255
public short getResponseCode () {
@@ -2264,8 +2264,9 @@ public Broker getLeader() {
2264
2264
return leader ;
2265
2265
}
2266
2266
2267
+ @ SuppressFBWarnings ("EI_EXPOSE_REP" )
2267
2268
public List <Broker > getReplicas () {
2268
- return this .replicas . isEmpty () ? Collections . emptyList () : new ArrayList <>( this . replicas ) ;
2269
+ return this .replicas ;
2269
2270
}
2270
2271
2271
2272
boolean hasReplicas () {
@@ -2562,7 +2563,7 @@ int port() {
2562
2563
}
2563
2564
2564
2565
Map <String , String > clientProperties () {
2565
- return Collections . unmodifiableMap (this .clientProperties );
2566
+ return Map . copyOf (this .clientProperties );
2566
2567
}
2567
2568
2568
2569
Codec codec () {
0 commit comments