He-Pin opened a new pull request, #3188: URL: https://github.com/apache/pekko/pull/3188
### Motivation Java 9+ provides `List.of()`, `Map.of()`, `Set.of()` factory methods that are more concise and return truly immutable collections. Many Java source files still use Java 8-era patterns like `Arrays.asList()`, `Collections.singletonList()`, `Collections.emptyList()`, and `Collections.unmodifiableList()`. ### Modification - Replace `Arrays.asList(...)` with `List.of(...)` (~490 occurrences) - Replace `Collections.emptyList()` with `List.of()` - Replace `Collections.emptyMap()` with `Map.of()` - Replace `Collections.emptySet()` with `Set.of()` - Replace `Collections.singletonList(x)` with `List.of(x)` - Replace `Collections.unmodifiableList(list)` with `List.copyOf(list)` - Replace `Collections.unmodifiableSet(set)` with `Set.copyOf(set)` - Replace `Collections.unmodifiableMap(map)` with `Map.copyOf(map)` - Replace `new HashSet<>(Arrays.asList(...))` with `Set.of(...)` - Update imports: remove unused `java.util.Arrays`, `java.util.Collections`; add `java.util.List`, `java.util.Map`, `java.util.Set` as needed - Skip protobuf-generated code (`ReliableDelivery.java`, `ReplicatedEventSourcing.java`) ### Result Cleaner, more idiomatic Java 17 code using immutable collection factories. ~90 files changed. ### Tests Not run - compile-only test file changes ### References None - Java 17 API modernization -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
