Browse Source

Polishing

pull/28834/head
Sam Brannen 2 years ago
parent
commit
1f3ea5133f
  1. 4
      spring-beans/src/main/java/org/springframework/beans/BeanUtils.java
  2. 7
      spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java
  3. 3
      spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsInvocations.java
  4. 7
      spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsInvocationsAssert.java

4
spring-beans/src/main/java/org/springframework/beans/BeanUtils.java

@ -609,8 +609,8 @@ public abstract class BeanUtils { @@ -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();

7
spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java

@ -1,5 +1,5 @@ @@ -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 @@ -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);
}

3
spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsInvocations.java

@ -24,7 +24,8 @@ import org.assertj.core.api.AssertProvider; @@ -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

7
spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsInvocationsAssert.java

@ -34,15 +34,15 @@ import org.springframework.core.io.support.SpringFactoriesLoader; @@ -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<RuntimeHintsInvocationsAssert, RuntimeHintsInvocations> {
List<Consumer<RuntimeHints>> configurers = new ArrayList<>();
private final List<Consumer<RuntimeHints>> configurers = new ArrayList<>();
RuntimeHintsInvocationsAssert(RuntimeHintsInvocations invocations) {
super(invocations, RuntimeHintsInvocationsAssert.class);
@ -123,5 +123,4 @@ public class RuntimeHintsInvocationsAssert extends AbstractAssert<RuntimeHintsIn @@ -123,5 +123,4 @@ public class RuntimeHintsInvocationsAssert extends AbstractAssert<RuntimeHintsIn
return this;
}
}

Loading…
Cancel
Save