This is an automated email from the ASF dual-hosted git repository.
chia7712 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new 6586446850a MINOR: remove an unused method and adjust method
visibility in Utils.java (#21398)
6586446850a is described below
commit 6586446850a91d3cec11dcbc8d81c4f233501bef
Author: Jian <[email protected]>
AuthorDate: Sat Feb 7 10:39:04 2026 +0800
MINOR: remove an unused method and adjust method visibility in Utils.java
(#21398)
Removed safe(List<T> other): This method is not used.
Removed getKafkaClassLoader(): This method was a simple one-line
wrapper. It has been removed, and its logic
(Utils.class.getClassLoader()) has been inlined into
getContextOrKafkaClassLoader() to simplify the code.
Reviewers: PoAn Yang <[email protected]>, Ken Huang
<[email protected]>, Chia-Ping Tsai <[email protected]>
---
.../java/org/apache/kafka/common/utils/Utils.java | 21 +--------------------
1 file changed, 1 insertion(+), 20 deletions(-)
diff --git a/clients/src/main/java/org/apache/kafka/common/utils/Utils.java
b/clients/src/main/java/org/apache/kafka/common/utils/Utils.java
index 51cb86f5c88..f8b8456d5f8 100644
--- a/clients/src/main/java/org/apache/kafka/common/utils/Utils.java
+++ b/clients/src/main/java/org/apache/kafka/common/utils/Utils.java
@@ -901,25 +901,6 @@ public final class Utils {
});
}
- /**
- * Returns an empty list if the provided list is null, otherwise returns
the list itself.
- * <p>
- * This method is useful for avoiding {@code NullPointerException} when
working with potentially null lists.
- *
- * @param other the list to check for null
- * @return an empty list if the provided list is null, otherwise the
original list
- */
- public static <T> List<T> safe(List<T> other) {
- return other == null ? Collections.emptyList() : other;
- }
-
- /**
- * Get the ClassLoader which loaded Kafka.
- */
- public static ClassLoader getKafkaClassLoader() {
- return Utils.class.getClassLoader();
- }
-
/**
* Get the Context ClassLoader on this thread or, if not present, the
ClassLoader that
* loaded Kafka.
@@ -929,7 +910,7 @@ public final class Utils {
public static ClassLoader getContextOrKafkaClassLoader() {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null)
- return getKafkaClassLoader();
+ return Utils.class.getClassLoader();
else
return cl;
}