This is an automated email from the ASF dual-hosted git repository.

mattsicker pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit ab262c60503dff0774a8c69a2e15d7bedd792103
Author: Matt Sicker <[email protected]>
AuthorDate: Tue Jan 2 17:16:06 2024 -0600

    Use instanceof casting
---
 .../src/main/java/org/apache/logging/log4j/plugins/di/Key.java         | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git 
a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/di/Key.java 
b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/di/Key.java
index cd11419571..33ceb76780 100644
--- a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/di/Key.java
+++ b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/di/Key.java
@@ -233,10 +233,9 @@ public class Key<T> implements StringBuilderFormattable, 
Comparable<Key<T>> {
         if (o == this) {
             return true;
         }
-        if (!(o instanceof Key<?>)) {
+        if (!(o instanceof final Key<?> that)) {
             return false;
         }
-        final Key<?> that = (Key<?>) o;
         return TypeUtil.isEqual(this.type, that.type)
                 && this.name.equalsIgnoreCase(that.name)
                 && this.namespace.equalsIgnoreCase(that.namespace)

Reply via email to