chia7712 commented on code in PR #22060:
URL: https://github.com/apache/kafka/pull/22060#discussion_r3311941493
##########
clients/src/main/java/org/apache/kafka/common/security/oauthbearer/internals/unsecured/OAuthBearerUnsecuredJws.java:
##########
@@ -361,6 +360,6 @@ private Set<String> calculateScope() {
retval.add(scope.trim());
}
}
- return Collections.unmodifiableSet(retval);
+ return Set.copyOf(retval);
Review Comment:
ditto
##########
clients/src/main/java/org/apache/kafka/common/security/oauthbearer/internals/unsecured/OAuthBearerUnsecuredJws.java:
##########
@@ -301,7 +300,7 @@ public static Map<String, Object> toMap(String split)
throws OAuthBearerIllegalT
for (Entry<String, JsonNode> entry : jsonNode.properties()) {
retval.put(entry.getKey(), convert(entry.getValue()));
}
- return Collections.unmodifiableMap(retval);
+ return Map.copyOf(retval);
Review Comment:
the `retval` is a new map already, so making another copy is a bit redundant
##########
clients/src/main/java/org/apache/kafka/common/security/oauthbearer/internals/unsecured/OAuthBearerUnsecuredJws.java:
##########
@@ -318,7 +317,7 @@ private List<String> extractCompactSerializationSplits() {
if (tmpSplits.size() != 3)
throw new
OAuthBearerIllegalTokenException(OAuthBearerValidationResult.newFailure(
"Unsecured JWS compact serializations must have 3
dot-separated Base64URL-encoded values"));
- return Collections.unmodifiableList(tmpSplits);
+ return List.copyOf(tmpSplits);
Review Comment:
ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]