Apply 'instanceof pattern matching'

This commit is contained in:
Sam Brannen
2022-11-22 16:27:34 +01:00
parent 7816c9e411
commit 43f8d9e084
5 changed files with 27 additions and 25 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -238,8 +238,8 @@ public class SessionScopeTests {
@Override
public void postProcessBeforeDestruction(Object bean, String beanName) throws BeansException {
if (bean instanceof BeanNameAware) {
((BeanNameAware) bean).setBeanName(null);
if (bean instanceof BeanNameAware beanNameAware) {
beanNameAware.setBeanName(null);
}
}