From 742c95b1fc137e05b952bd0da7fc4a3cf59b014f Mon Sep 17 00:00:00 2001 From: Hyeon Sung Date: Wed, 15 May 2024 02:15:18 +0900 Subject: [PATCH] Use instanceof Pattern Matching --- .../security/authentication/AbstractAuthenticationToken.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/springframework/security/authentication/AbstractAuthenticationToken.java b/core/src/main/java/org/springframework/security/authentication/AbstractAuthenticationToken.java index cfd066a912..d69483354f 100644 --- a/core/src/main/java/org/springframework/security/authentication/AbstractAuthenticationToken.java +++ b/core/src/main/java/org/springframework/security/authentication/AbstractAuthenticationToken.java @@ -112,8 +112,8 @@ public abstract class AbstractAuthenticationToken implements Authentication, Cre } private void eraseSecret(Object secret) { - if (secret instanceof CredentialsContainer) { - ((CredentialsContainer) secret).eraseCredentials(); + if (secret instanceof CredentialsContainer container) { + container.eraseCredentials(); } }