chia7712 commented on code in PR #19069: URL: https://github.com/apache/kafka/pull/19069#discussion_r1986355627
########## metadata/src/main/java/org/apache/kafka/metadata/authorizer/StandardAuthorizerData.java: ########## @@ -437,14 +436,14 @@ private void checkSection( /** * The set of operations which imply DESCRIBE permission, when used in an ALLOW acl. */ - private static final Set<AclOperation> IMPLIES_DESCRIBE = Collections.unmodifiableSet( - EnumSet.of(DESCRIBE, READ, WRITE, DELETE, ALTER)); + private static final Set<AclOperation> IMPLIES_DESCRIBE = + EnumSet.of(DESCRIBE, READ, WRITE, DELETE, ALTER); /** * The set of operations which imply DESCRIBE_CONFIGS permission, when used in an ALLOW acl. */ - private static final Set<AclOperation> IMPLIES_DESCRIBE_CONFIGS = Collections.unmodifiableSet( - EnumSet.of(DESCRIBE_CONFIGS, ALTER_CONFIGS)); + private static final Set<AclOperation> IMPLIES_DESCRIBE_CONFIGS = + EnumSet.of(DESCRIBE_CONFIGS, ALTER_CONFIGS); Review Comment: the return set of `EnumSet.of` is not immutable. Maybe we can use `Set.of` instead? ########## metadata/src/test/java/org/apache/kafka/image/FakeSnapshotWriter.java: ########## @@ -33,11 +32,7 @@ public class FakeSnapshotWriter implements SnapshotWriter<ApiMessageAndVersion> private boolean closed = false; public List<List<ApiMessageAndVersion>> batches() { - List<List<ApiMessageAndVersion>> result = new ArrayList<>(); - for (List<ApiMessageAndVersion> batch : batches) { - result.add(Collections.unmodifiableList(batch)); - } - return Collections.unmodifiableList(result); + return new ArrayList<>(batches); Review Comment: if we want to follow origin design, all lists in this method should be immutable. ```java return batches.stream().map(List::copyOf).toList(); ``` -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org