chia7712 commented on code in PR #19869: URL: https://github.com/apache/kafka/pull/19869#discussion_r2190761550
########## connect/api/src/main/java/org/apache/kafka/connect/storage/ConverterType.java: ########## @@ -37,7 +36,7 @@ public enum ConverterType { for (ConverterType type : types) { nameToType.put(type.name, type); } - NAME_TO_TYPE = Collections.unmodifiableMap(nameToType); + NAME_TO_TYPE = Map.copyOf(nameToType); Review Comment: ```java private static final Map<String, ConverterType> NAME_TO_TYPE = Arrays.stream(ConverterType.values()) .collect(Collectors.toUnmodifiableMap(ConverterType::getName, t -> t)); ``` WDYT? ########## connect/api/src/main/java/org/apache/kafka/connect/data/ConnectSchema.java: ########## @@ -44,31 +42,31 @@ public class ConnectSchema implements Schema { private static final Map<Class<?>, Type> JAVA_CLASS_SCHEMA_TYPES = new HashMap<>(); Review Comment: Could you please also make those maps immutable? This can be addressed by `Map.of` or `Collections.unmodifiableMap`? -- 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