diff --git a/spring-beans/src/main/java/org/springframework/beans/BeanUtils.java b/spring-beans/src/main/java/org/springframework/beans/BeanUtils.java index 1ba55688b19..aa38a0e2ab3 100644 --- a/spring-beans/src/main/java/org/springframework/beans/BeanUtils.java +++ b/spring-beans/src/main/java/org/springframework/beans/BeanUtils.java @@ -609,8 +609,8 @@ public abstract class BeanUtils { * @return a corresponding MethodParameter object */ public static MethodParameter getWriteMethodParameter(PropertyDescriptor pd) { - if (pd instanceof GenericTypeAwarePropertyDescriptor) { - return new MethodParameter(((GenericTypeAwarePropertyDescriptor) pd).getWriteMethodParameter()); + if (pd instanceof GenericTypeAwarePropertyDescriptor typeAwarePd) { + return new MethodParameter(typeAwarePd.getWriteMethodParameter()); } else { Method writeMethod = pd.getWriteMethod(); diff --git a/spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java b/spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java index df6ee2cede9..4f610998ae0 100644 --- a/spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java +++ b/spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 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. @@ -267,9 +267,8 @@ public class BeanWrapperImpl extends AbstractNestablePropertyAccessor implements @Override public void setValue(@Nullable Object value) throws Exception { - Method writeMethod = (this.pd instanceof GenericTypeAwarePropertyDescriptor ? - ((GenericTypeAwarePropertyDescriptor) this.pd).getWriteMethodForActualAccess() : - this.pd.getWriteMethod()); + Method writeMethod = (this.pd instanceof GenericTypeAwarePropertyDescriptor typeAwarePd ? + typeAwarePd.getWriteMethodForActualAccess() : this.pd.getWriteMethod()); ReflectionUtils.makeAccessible(writeMethod); writeMethod.invoke(getWrappedInstance(), value); } diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsInvocations.java b/spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsInvocations.java index 753d0186dcb..984d865a509 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsInvocations.java +++ b/spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsInvocations.java @@ -24,7 +24,8 @@ import org.assertj.core.api.AssertProvider; import org.springframework.aot.agent.RecordedInvocation; /** - * A wrapper for {@link RecordedInvocation} that is the starting point for {@code RuntimeHints} AssertJ assertions. + * A wrapper for {@link RecordedInvocation} that is the starting point for + * {@code RuntimeHints} AssertJ assertions. * * @author Brian Clozel * @since 6.0 diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsInvocationsAssert.java b/spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsInvocationsAssert.java index 06b46f26c8f..18209ba7fc7 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsInvocationsAssert.java +++ b/spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsInvocationsAssert.java @@ -34,15 +34,15 @@ import org.springframework.core.io.support.SpringFactoriesLoader; import org.springframework.util.Assert; /** - * AssertJ {@link org.assertj.core.api.Assert assertions} that can be applied to an {@link RuntimeHintsInvocations}. + * AssertJ {@link org.assertj.core.api.Assert assertions} that can be applied to + * {@link RuntimeHintsInvocations}. * * @author Brian Clozel * @since 6.0 */ public class RuntimeHintsInvocationsAssert extends AbstractAssert { - - List> configurers = new ArrayList<>(); + private final List> configurers = new ArrayList<>(); RuntimeHintsInvocationsAssert(RuntimeHintsInvocations invocations) { super(invocations, RuntimeHintsInvocationsAssert.class); @@ -123,5 +123,4 @@ public class RuntimeHintsInvocationsAssert extends AbstractAssert