m1a2st commented on code in PR #20091:
URL: https://github.com/apache/kafka/pull/20091#discussion_r2180180201
##########
tools/src/main/java/org/apache/kafka/tools/consumer/group/ConsumerGroupCommandOptions.java:
##########
@@ -203,11 +202,11 @@ private ConsumerGroupCommandOptions(String[] args) {
.describedAs("regex")
.ofType(String.class);
- allGroupSelectionScopeOpts = new HashSet<>(Arrays.asList(groupOpt,
allGroupsOpt));
- allConsumerGroupLevelOpts = new HashSet<>(Arrays.asList(listOpt,
describeOpt, deleteOpt, resetOffsetsOpt));
- allResetOffsetScenarioOpts = new
HashSet<>(Arrays.asList(resetToOffsetOpt, resetShiftByOpt,
+ allGroupSelectionScopeOpts = new HashSet<>(List.of(groupOpt,
allGroupsOpt));
+ allConsumerGroupLevelOpts = new HashSet<>(List.of(listOpt,
describeOpt, deleteOpt, resetOffsetsOpt));
+ allResetOffsetScenarioOpts = new HashSet<>(List.of(resetToOffsetOpt,
resetShiftByOpt,
resetToDatetimeOpt, resetByDurationOpt, resetToEarliestOpt,
resetToLatestOpt, resetToCurrentOpt, resetFromFileOpt));
- allDeleteOffsetsOpts = new HashSet<>(Arrays.asList(groupOpt,
topicOpt));
+ allDeleteOffsetsOpts = new HashSet<>(List.of(groupOpt, topicOpt));
Review Comment:
Could these properties be made immutable?
##########
tools/src/main/java/org/apache/kafka/tools/streams/StreamsGroupCommandOptions.java:
##########
@@ -200,12 +199,12 @@ public StreamsGroupCommandOptions(String[] args) {
exportOpt = parser.accepts("export", EXPORT_DOC);
options = parser.parse(args);
- allResetOffsetScenarioOpts = new
HashSet<>(Arrays.asList(resetToOffsetOpt, resetShiftByOpt,
+ allResetOffsetScenarioOpts = new HashSet<>(List.of(resetToOffsetOpt,
resetShiftByOpt,
resetToDatetimeOpt, resetByDurationOpt, resetToEarliestOpt,
resetToLatestOpt, resetToCurrentOpt, resetFromFileOpt));
- allGroupSelectionScopeOpts = new HashSet<>(Arrays.asList(groupOpt,
allGroupsOpt));
- allStreamsGroupLevelOpts = new HashSet<>(Arrays.asList(listOpt,
describeOpt, deleteOpt));
- allDeleteOffsetsOpts = new HashSet<>(Arrays.asList(inputTopicOpt,
allInputTopicsOpt));
- allDeleteInternalGroupsOpts = new
HashSet<>(Arrays.asList(resetOffsetsOpt, deleteOpt));
+ allGroupSelectionScopeOpts = new HashSet<>(List.of(groupOpt,
allGroupsOpt));
+ allStreamsGroupLevelOpts = new HashSet<>(List.of(listOpt, describeOpt,
deleteOpt));
+ allDeleteOffsetsOpts = new HashSet<>(List.of(inputTopicOpt,
allInputTopicsOpt));
+ allDeleteInternalGroupsOpts = new HashSet<>(List.of(resetOffsetsOpt,
deleteOpt));
Review Comment:
ditto
##########
tools/src/main/java/org/apache/kafka/tools/AclCommand.java:
##########
@@ -272,8 +270,8 @@ private static Map<ResourcePatternFilter,
Set<AccessControlEntry>> getConsumerRe
Set<ResourcePatternFilter> groups = filters.stream().filter(f ->
f.resourceType() == ResourceType.GROUP).collect(Collectors.toSet());
//Read, Describe on topic, Read on consumerGroup
- Set<AccessControlEntry> topicAcls = getAcl(opts, new
HashSet<>(Arrays.asList(READ, DESCRIBE)));
- Set<AccessControlEntry> groupAcls = getAcl(opts,
Collections.singleton(READ));
+ Set<AccessControlEntry> topicAcls = getAcl(opts, new
HashSet<>(List.of(READ, DESCRIBE)));
Review Comment:
```suggestion
Set<AccessControlEntry> topicAcls = getAcl(opts, new Set.of(READ,
DESCRIBE));
```
##########
tools/src/main/java/org/apache/kafka/tools/consumer/group/ShareGroupCommandOptions.java:
##########
@@ -144,10 +143,10 @@ public ShareGroupCommandOptions(String[] args) {
verboseOpt = parser.accepts("verbose", VERBOSE_DOC)
.availableIf(describeOpt);
- allGroupSelectionScopeOpts = new HashSet<>(Arrays.asList(groupOpt,
allGroupsOpt));
- allShareGroupLevelOpts = new HashSet<>(Arrays.asList(listOpt,
describeOpt, deleteOpt, resetOffsetsOpt));
- allResetOffsetScenarioOpts = new
HashSet<>(Arrays.asList(resetToDatetimeOpt, resetToEarliestOpt,
resetToLatestOpt));
- allDeleteOffsetsOpts = new HashSet<>(Arrays.asList(groupOpt,
topicOpt));
+ allGroupSelectionScopeOpts = new HashSet<>(List.of(groupOpt,
allGroupsOpt));
+ allShareGroupLevelOpts = new HashSet<>(List.of(listOpt, describeOpt,
deleteOpt, resetOffsetsOpt));
+ allResetOffsetScenarioOpts = new HashSet<>(List.of(resetToDatetimeOpt,
resetToEarliestOpt, resetToLatestOpt));
+ allDeleteOffsetsOpts = new HashSet<>(List.of(groupOpt, topicOpt));
Review Comment:
ditto
##########
tools/src/main/java/org/apache/kafka/tools/AclCommand.java:
##########
@@ -249,8 +247,8 @@ private static Map<ResourcePatternFilter,
Set<AccessControlEntry>> getProducerRe
Set<ResourcePatternFilter> transactionalIds =
filters.stream().filter(f -> f.resourceType() ==
ResourceType.TRANSACTIONAL_ID).collect(Collectors.toSet());
boolean enableIdempotence = opts.options.has(opts.idempotentOpt);
- Set<AccessControlEntry> topicAcls = getAcl(opts, new
HashSet<>(Arrays.asList(WRITE, DESCRIBE, CREATE)));
- Set<AccessControlEntry> transactionalIdAcls = getAcl(opts, new
HashSet<>(Arrays.asList(WRITE, DESCRIBE)));
+ Set<AccessControlEntry> topicAcls = getAcl(opts, new
HashSet<>(List.of(WRITE, DESCRIBE, CREATE)));
+ Set<AccessControlEntry> transactionalIdAcls = getAcl(opts, new
HashSet<>(List.of(WRITE, DESCRIBE)));
Review Comment:
```suggestion
Set<AccessControlEntry> topicAcls = getAcl(opts, Set.of(WRITE,
DESCRIBE, CREATE));
Set<AccessControlEntry> transactionalIdAcls = getAcl(opts,
Set.of(WRITE, DESCRIBE));
```
--
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]