Browse Source

Polishing

pull/30123/head
Sam Brannen 2 years ago
parent
commit
b617e16d8d
  1. 3
      spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/AbstractBeanFactoryBasedTargetSourceCreator.java
  2. 2
      spring-aop/src/main/java/org/springframework/aop/target/CommonsPool2TargetSource.java
  3. 5
      spring-aspects/src/main/java/org/springframework/cache/aspectj/AnyThrow.java
  4. 32
      spring-beans/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionWrapper.java
  5. 1
      spring-beans/src/main/java/org/springframework/beans/factory/groovy/GroovyDynamicElementReader.java
  6. 2
      spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java
  7. 2
      spring-context/src/main/java/org/springframework/context/i18n/SimpleTimeZoneAwareLocaleContext.java
  8. 5
      spring-web/src/main/java/org/springframework/web/context/request/async/DeferredResult.java
  9. 2
      spring-web/src/main/java/org/springframework/web/context/request/async/DeferredResultProcessingInterceptor.java
  10. 2
      spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/ProducesRequestCondition.java

3
spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/AbstractBeanFactoryBasedTargetSourceCreator.java

@ -61,8 +61,7 @@ public abstract class AbstractBeanFactoryBasedTargetSourceCreator @@ -61,8 +61,7 @@ public abstract class AbstractBeanFactoryBasedTargetSourceCreator
private ConfigurableBeanFactory beanFactory;
/** Internally used DefaultListableBeanFactory instances, keyed by bean name. */
private final Map<String, DefaultListableBeanFactory> internalBeanFactories =
new HashMap<>();
private final Map<String, DefaultListableBeanFactory> internalBeanFactories = new HashMap<>();
@Override

2
spring-aop/src/main/java/org/springframework/aop/target/CommonsPool2TargetSource.java

@ -181,7 +181,7 @@ public class CommonsPool2TargetSource extends AbstractPoolingTargetSource implem @@ -181,7 +181,7 @@ public class CommonsPool2TargetSource extends AbstractPoolingTargetSource implem
}
/**
* Set whether the call should bock when the pool is exhausted.
* Set whether the call should block when the pool is exhausted.
*/
public void setBlockWhenExhausted(boolean blockWhenExhausted) {
this.blockWhenExhausted = blockWhenExhausted;

5
spring-aspects/src/main/java/org/springframework/cache/aspectj/AnyThrow.java vendored

@ -17,8 +17,8 @@ @@ -17,8 +17,8 @@
package org.springframework.cache.aspectj;
/**
* Utility to trick the compiler to throw a valid checked
* exceptions within the interceptor.
* Utility to trick the compiler to throw valid checked exceptions masked as
* runtime exceptions within the interceptor.
*
* @author Stephane Nicoll
*/
@ -36,4 +36,5 @@ final class AnyThrow { @@ -36,4 +36,5 @@ final class AnyThrow {
private static <E extends Throwable> void throwAny(Throwable e) throws E {
throw (E) e;
}
}

32
spring-beans/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionWrapper.java

@ -16,9 +16,9 @@ @@ -16,9 +16,9 @@
package org.springframework.beans.factory.groovy;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import groovy.lang.GroovyObjectSupport;
@ -51,18 +51,8 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport { @@ -51,18 +51,8 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport {
private static final String DESTROY_METHOD = "destroyMethod";
private static final String SINGLETON = "singleton";
private static final List<String> dynamicProperties = new ArrayList<>(8);
static {
dynamicProperties.add(PARENT);
dynamicProperties.add(AUTOWIRE);
dynamicProperties.add(CONSTRUCTOR_ARGS);
dynamicProperties.add(FACTORY_BEAN);
dynamicProperties.add(FACTORY_METHOD);
dynamicProperties.add(INIT_METHOD);
dynamicProperties.add(DESTROY_METHOD);
dynamicProperties.add(SINGLETON);
}
private static final Set<String> dynamicProperties = Set.of(PARENT, AUTOWIRE, CONSTRUCTOR_ARGS,
FACTORY_BEAN, FACTORY_METHOD, INIT_METHOD, DESTROY_METHOD, SINGLETON);
private String beanName;
@ -98,11 +88,11 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport { @@ -98,11 +88,11 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport {
return this.beanName;
}
public void setBeanDefinition(AbstractBeanDefinition definition) {
void setBeanDefinition(AbstractBeanDefinition definition) {
this.definition = definition;
}
public AbstractBeanDefinition getBeanDefinition() {
AbstractBeanDefinition getBeanDefinition() {
if (this.definition == null) {
this.definition = createBeanDefinition();
}
@ -126,19 +116,17 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport { @@ -126,19 +116,17 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport {
return bd;
}
public void setBeanDefinitionHolder(BeanDefinitionHolder holder) {
void setBeanDefinitionHolder(BeanDefinitionHolder holder) {
this.definition = (AbstractBeanDefinition) holder.getBeanDefinition();
this.beanName = holder.getBeanName();
}
public BeanDefinitionHolder getBeanDefinitionHolder() {
BeanDefinitionHolder getBeanDefinitionHolder() {
return new BeanDefinitionHolder(getBeanDefinition(), getBeanName());
}
public void setParent(Object obj) {
if (obj == null) {
throw new IllegalArgumentException("Parent bean cannot be set to a null runtime bean reference!");
}
void setParent(Object obj) {
Assert.notNull(obj, "Parent bean cannot be set to a null runtime bean reference.");
if (obj instanceof String name) {
this.parentName = name;
}
@ -152,7 +140,7 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport { @@ -152,7 +140,7 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport {
getBeanDefinition().setAbstract(false);
}
public GroovyBeanDefinitionWrapper addProperty(String propertyName, Object propertyValue) {
GroovyBeanDefinitionWrapper addProperty(String propertyName, Object propertyValue) {
if (propertyValue instanceof GroovyBeanDefinitionWrapper wrapper) {
propertyValue = wrapper.getBeanDefinition();
}

1
spring-beans/src/main/java/org/springframework/beans/factory/groovy/GroovyDynamicElementReader.java

@ -88,6 +88,7 @@ class GroovyDynamicElementReader extends GroovyObjectSupport { @@ -88,6 +88,7 @@ class GroovyDynamicElementReader extends GroovyObjectSupport {
String myNamespace = this.rootNamespace;
Map<String, String> myNamespaces = this.xmlNamespaces;
@SuppressWarnings("serial")
Closure<Object> callable = new Closure<>(this) {
@Override
public Object call(Object... arguments) {

2
spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java

@ -1732,7 +1732,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto @@ -1732,7 +1732,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
if (beanInstance != null) {
Integer candidatePriority = getPriority(beanInstance);
if (candidatePriority != null) {
if (highestPriorityBeanName != null) {
if (highestPriority != null) {
if (candidatePriority.equals(highestPriority)) {
throw new NoUniqueBeanDefinitionException(requiredType, candidates.size(),
"Multiple beans found with the same priority ('" + highestPriority +

2
spring-context/src/main/java/org/springframework/context/i18n/SimpleTimeZoneAwareLocaleContext.java

@ -61,7 +61,7 @@ public class SimpleTimeZoneAwareLocaleContext extends SimpleLocaleContext implem @@ -61,7 +61,7 @@ public class SimpleTimeZoneAwareLocaleContext extends SimpleLocaleContext implem
@Override
public String toString() {
return super.toString() + " " + (this.timeZone != null ? this.timeZone.toString() : "-");
return super.toString() + " " + (this.timeZone != null ? this.timeZone : "-");
}
}

5
spring-web/src/main/java/org/springframework/web/context/request/async/DeferredResult.java

@ -80,7 +80,7 @@ public class DeferredResult<T> { @@ -80,7 +80,7 @@ public class DeferredResult<T> {
* Create a DeferredResult.
*/
public DeferredResult() {
this(null, () -> RESULT_NONE);
this(null);
}
/**
@ -101,8 +101,7 @@ public class DeferredResult<T> { @@ -101,8 +101,7 @@ public class DeferredResult<T> {
* @param timeoutResult the result to use
*/
public DeferredResult(@Nullable Long timeoutValue, Object timeoutResult) {
this.timeoutValue = timeoutValue;
this.timeoutResult = () -> timeoutResult;
this(timeoutValue, () -> timeoutResult);
}
/**

2
spring-web/src/main/java/org/springframework/web/context/request/async/DeferredResultProcessingInterceptor.java

@ -78,7 +78,7 @@ public interface DeferredResultProcessingInterceptor { @@ -78,7 +78,7 @@ public interface DeferredResultProcessingInterceptor {
* timeout result.
* @param request the current request
* @param deferredResult the DeferredResult for the current request
* @param concurrentResult the result to which the {@code DeferredResult}
* @param concurrentResult the concurrent result
* @throws Exception in case of errors
*/
default <T> void postProcess(NativeWebRequest request, DeferredResult<T> deferredResult,

2
spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/ProducesRequestCondition.java

@ -57,7 +57,7 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro @@ -57,7 +57,7 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro
private final List<ProduceMediaTypeExpression> mediaTypeAllList =
Collections.singletonList(new ProduceMediaTypeExpression(MediaType.ALL_VALUE));
List.of(new ProduceMediaTypeExpression(MediaType.ALL_VALUE));
private final List<ProduceMediaTypeExpression> expressions;

Loading…
Cancel
Save