diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/YamlProcessor.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/YamlProcessor.java index 75149c09f435b511b95df47cff71b68798b39635..40413554f543422b413f51ce80b57a0f9a1ab60d 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/YamlProcessor.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/YamlProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 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. @@ -156,8 +156,7 @@ public abstract class YamlProcessor { if (logger.isDebugEnabled()) { logger.debug("Loading from YAML: " + resource); } - Reader reader = new UnicodeReader(resource.getInputStream()); - try { + try (Reader reader = new UnicodeReader(resource.getInputStream())) { for (Object object : yaml.loadAll(reader)) { if (object != null && process(asMap(object), callback)) { count++; @@ -171,9 +170,6 @@ public abstract class YamlProcessor { " from YAML resource: " + resource); } } - finally { - reader.close(); - } } catch (IOException ex) { handleProcessError(resource, ex); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java index 84b748b0b0b3ff8dbf995492c6089c80c5312e3b..b4bf8f8d9076169d044f7af04c88ded1d64b3cda 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 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. @@ -663,7 +663,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess * Return whether this bean has the specified qualifier. */ public boolean hasQualifier(String typeName) { - return this.qualifiers.keySet().contains(typeName); + return this.qualifiers.containsKey(typeName); } /** diff --git a/spring-context/src/main/java/org/springframework/context/annotation/DeferredImportSelector.java b/spring-context/src/main/java/org/springframework/context/annotation/DeferredImportSelector.java index 3eab155304b0074c1820da691ec31c6f98e23275..e043dcc191db74483af6b7f3adffffca400333d5 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/DeferredImportSelector.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/DeferredImportSelector.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 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. @@ -40,8 +40,10 @@ import org.springframework.lang.Nullable; public interface DeferredImportSelector extends ImportSelector { /** - * Return a specific import group or {@code null} if no grouping is required. - * @return the import group class or {@code null} + * Return a specific import group. + *
The default implementations return {@code null} for no grouping required.
+ * @return the import group class, or {@code null} if none
+ * @since 5.0
*/
@Nullable
default Class extends Group> getImportGroup() {
@@ -61,11 +63,12 @@ public interface DeferredImportSelector extends ImportSelector {
void process(AnnotationMetadata metadata, DeferredImportSelector selector);
/**
- * Return the {@link Entry entries} of which class(es) should be imported for this
- * group.
+ * Return the {@link Entry entries} of which class(es) should be imported
+ * for this group.
*/
Iterable An {@link ImportSelector} may implement any of the following
- * {@link org.springframework.beans.factory.Aware Aware} interfaces, and their respective
- * methods will be called prior to {@link #selectImports}:
+ * {@link org.springframework.beans.factory.Aware Aware} interfaces,
+ * and their respective methods will be called prior to {@link #selectImports}:
* ImportSelectors are usually processed in the same way as regular {@code @Import}
- * annotations, however, it is also possible to defer selection of imports until all
- * {@code @Configuration} classes have been processed (see {@link DeferredImportSelector}
- * for details).
+ * {@code ImportSelector} implementations are usually processed in the same way
+ * as regular {@code @Import} annotations, however, it is also possible to defer
+ * selection of imports until all {@code @Configuration} classes have been processed
+ * (see {@link DeferredImportSelector} for details).
*
* @author Chris Beams
* @since 3.1
diff --git a/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java b/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java
index 25831f3a6b5eeef6c754e258a3eedd8d5f14e0c9..211c246c4f48cd2acf3328ccb50fea93de6d5bd0 100644
--- a/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java
+++ b/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java
@@ -92,24 +92,24 @@ import org.springframework.util.ReflectionUtils;
* to detect special beans defined in its internal bean factory:
* Therefore, this class automatically registers
* {@link org.springframework.beans.factory.config.BeanFactoryPostProcessor BeanFactoryPostProcessors},
- * {@link org.springframework.beans.factory.config.BeanPostProcessor BeanPostProcessors}
+ * {@link org.springframework.beans.factory.config.BeanPostProcessor BeanPostProcessors},
* and {@link org.springframework.context.ApplicationListener ApplicationListeners}
* which are defined as beans in the context.
*
* A {@link org.springframework.context.MessageSource} may also be supplied
* as a bean in the context, with the name "messageSource"; otherwise, message
* resolution is delegated to the parent context. Furthermore, a multicaster
- * for application events can be supplied as "applicationEventMulticaster" bean
+ * for application events can be supplied as an "applicationEventMulticaster" bean
* of type {@link org.springframework.context.event.ApplicationEventMulticaster}
* in the context; otherwise, a default multicaster of type
* {@link org.springframework.context.event.SimpleApplicationEventMulticaster} will be used.
*
- * Implements resource loading through extending
+ * Implements resource loading by extending
* {@link org.springframework.core.io.DefaultResourceLoader}.
* Consequently treats non-URL resource paths as class path resources
* (supporting full class path resource names that include the package path,
* e.g. "mypackage/myresource.dat"), unless the {@link #getResourceByPath}
- * method is overwritten in a subclass.
+ * method is overridden in a subclass.
*
* @author Rod Johnson
* @author Juergen Hoeller
@@ -390,7 +390,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
else {
applicationEvent = new PayloadApplicationEvent<>(this, event);
if (eventType == null) {
- eventType = ((PayloadApplicationEvent) applicationEvent).getResolvableType();
+ eventType = ((PayloadApplicationEvent>) applicationEvent).getResolvableType();
}
}
@@ -713,7 +713,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
}
/**
- * Instantiate and invoke all registered BeanPostProcessor beans,
+ * Instantiate and register all BeanPostProcessor beans,
* respecting explicit order if given.
* Must be called before any instantiation of application beans.
*/
diff --git a/spring-core/src/main/java/org/springframework/util/ObjectUtils.java b/spring-core/src/main/java/org/springframework/util/ObjectUtils.java
index 2511858a9792a479fb9c4ed044f5b5245db7c1e3..07267e30e098deac410e4efac99d62afa63f5d01 100644
--- a/spring-core/src/main/java/org/springframework/util/ObjectUtils.java
+++ b/spring-core/src/main/java/org/springframework/util/ObjectUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -639,7 +639,7 @@ public abstract class ObjectUtils {
/**
* Determine the class name for the given object.
- * Returns {@code "null"} if {@code obj} is {@code null}.
+ * Returns a {@code "null"} String if {@code obj} is {@code null}.
* @param obj the object to introspect (may be {@code null})
* @return the corresponding class name
*/
@@ -650,7 +650,7 @@ public abstract class ObjectUtils {
/**
* Return a String representation of the specified Object.
* Builds a String representation of the contents in case of an array.
- * Returns {@code "null"} if {@code obj} is {@code null}.
+ * Returns a {@code "null"} String if {@code obj} is {@code null}.
* @param obj the object to build a String representation for
* @return a String representation of {@code obj}
*/
@@ -696,8 +696,8 @@ public abstract class ObjectUtils {
* Return a String representation of the contents of the specified array.
* The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
- * by the characters {@code ", "} (a comma followed by a space). Returns
- * {@code "null"} if {@code array} is {@code null}.
+ * by the characters {@code ", "} (a comma followed by a space).
+ * Returns a {@code "null"} String if {@code array} is {@code null}.
* @param array the array to build a String representation for
* @return a String representation of {@code array}
*/
@@ -727,8 +727,8 @@ public abstract class ObjectUtils {
* Return a String representation of the contents of the specified array.
* The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
- * by the characters {@code ", "} (a comma followed by a space). Returns
- * {@code "null"} if {@code array} is {@code null}.
+ * by the characters {@code ", "} (a comma followed by a space).
+ * Returns a {@code "null"} String if {@code array} is {@code null}.
* @param array the array to build a String representation for
* @return a String representation of {@code array}
*/
@@ -759,8 +759,8 @@ public abstract class ObjectUtils {
* Return a String representation of the contents of the specified array.
* The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
- * by the characters {@code ", "} (a comma followed by a space). Returns
- * {@code "null"} if {@code array} is {@code null}.
+ * by the characters {@code ", "} (a comma followed by a space).
+ * Returns a {@code "null"} String if {@code array} is {@code null}.
* @param array the array to build a String representation for
* @return a String representation of {@code array}
*/
@@ -790,8 +790,8 @@ public abstract class ObjectUtils {
* Return a String representation of the contents of the specified array.
* The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
- * by the characters {@code ", "} (a comma followed by a space). Returns
- * {@code "null"} if {@code array} is {@code null}.
+ * by the characters {@code ", "} (a comma followed by a space).
+ * Returns a {@code "null"} String if {@code array} is {@code null}.
* @param array the array to build a String representation for
* @return a String representation of {@code array}
*/
@@ -821,8 +821,8 @@ public abstract class ObjectUtils {
* Return a String representation of the contents of the specified array.
* The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
- * by the characters {@code ", "} (a comma followed by a space). Returns
- * {@code "null"} if {@code array} is {@code null}.
+ * by the characters {@code ", "} (a comma followed by a space).
+ * Returns a {@code "null"} String if {@code array} is {@code null}.
* @param array the array to build a String representation for
* @return a String representation of {@code array}
*/
@@ -853,8 +853,8 @@ public abstract class ObjectUtils {
* Return a String representation of the contents of the specified array.
* The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
- * by the characters {@code ", "} (a comma followed by a space). Returns
- * {@code "null"} if {@code array} is {@code null}.
+ * by the characters {@code ", "} (a comma followed by a space).
+ * Returns a {@code "null"} String if {@code array} is {@code null}.
* @param array the array to build a String representation for
* @return a String representation of {@code array}
*/
@@ -885,8 +885,8 @@ public abstract class ObjectUtils {
* Return a String representation of the contents of the specified array.
* The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
- * by the characters {@code ", "} (a comma followed by a space). Returns
- * {@code "null"} if {@code array} is {@code null}.
+ * by the characters {@code ", "} (a comma followed by a space).
+ * Returns a {@code "null"} String if {@code array} is {@code null}.
* @param array the array to build a String representation for
* @return a String representation of {@code array}
*/
@@ -916,8 +916,8 @@ public abstract class ObjectUtils {
* Return a String representation of the contents of the specified array.
* The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
- * by the characters {@code ", "} (a comma followed by a space). Returns
- * {@code "null"} if {@code array} is {@code null}.
+ * by the characters {@code ", "} (a comma followed by a space).
+ * Returns a {@code "null"} String if {@code array} is {@code null}.
* @param array the array to build a String representation for
* @return a String representation of {@code array}
*/
@@ -947,8 +947,8 @@ public abstract class ObjectUtils {
* Return a String representation of the contents of the specified array.
* The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
- * by the characters {@code ", "} (a comma followed by a space). Returns
- * {@code "null"} if {@code array} is {@code null}.
+ * by the characters {@code ", "} (a comma followed by a space).
+ * Returns a {@code "null"} String if {@code array} is {@code null}.
* @param array the array to build a String representation for
* @return a String representation of {@code array}
*/
diff --git a/spring-jms/src/main/java/org/springframework/jms/config/MethodJmsListenerEndpoint.java b/spring-jms/src/main/java/org/springframework/jms/config/MethodJmsListenerEndpoint.java
index 5bdbec6f6c82db64893867ccf70ded8eba94eebc..ffe8d071ac9c9ba1ffa56d244dedaa79fb31e562 100644
--- a/spring-jms/src/main/java/org/springframework/jms/config/MethodJmsListenerEndpoint.java
+++ b/spring-jms/src/main/java/org/springframework/jms/config/MethodJmsListenerEndpoint.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -147,8 +147,11 @@ public class MethodJmsListenerEndpoint extends AbstractJmsListenerEndpoint imple
Assert.state(this.messageHandlerMethodFactory != null,
"Could not create message listener - MessageHandlerMethodFactory not set");
MessagingMessageListenerAdapter messageListener = createMessageListenerInstance();
+ Object bean = getBean();
+ Method method = getMethod();
+ Assert.state(bean != null && method != null, "No bean+method set on endpoint");
InvocableHandlerMethod invocableHandlerMethod =
- this.messageHandlerMethodFactory.createInvocableHandlerMethod(getBean(), getMethod());
+ this.messageHandlerMethodFactory.createInvocableHandlerMethod(bean, method);
messageListener.setHandlerMethod(invocableHandlerMethod);
String responseDestination = getDefaultResponseDestination();
if (StringUtils.hasText(responseDestination)) {
diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/MethodArgumentNotValidException.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/MethodArgumentNotValidException.java
index 9a724478f3c8933ff723fc75a710e05e5574b1e0..8671d1765bb3c1e67d416b8058070883078a4432 100644
--- a/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/MethodArgumentNotValidException.java
+++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/MethodArgumentNotValidException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -34,6 +34,7 @@ import org.springframework.validation.ObjectError;
@SuppressWarnings("serial")
public class MethodArgumentNotValidException extends MethodArgumentResolutionException {
+ @Nullable
private final BindingResult bindingResult;
diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java
index b1a6a6f41bc112c9745db103eb8aefae893c4f5f..1ef5c4e2860955dfbd7085cbf61ef0bbf5617d41 100644
--- a/spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java
+++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -67,18 +67,20 @@ import org.springframework.validation.Validator;
* protocols such as STOMP.
*
* {@link #clientInboundChannel()} and {@link #clientOutboundChannel()} deliver
- * messages to and from remote clients to several message handlers such as
+ * messages to and from remote clients to several message handlers such as the
+ * following.
* {@link #brokerChannel()} delivers messages from within the application to the
* the respective message handlers. {@link #brokerMessagingTemplate()} can be injected
* into any application component to send messages.
*
- * Subclasses are responsible for the part of the configuration that feed messages
+ * Subclasses are responsible for the parts of the configuration that feed messages
* to and from the client inbound/outbound channels (e.g. STOMP over WebSocket).
*
* @author Rossen Stoyanchev
@@ -403,7 +405,7 @@ public abstract class AbstractMessageBrokerConfiguration implements ApplicationC
* Override this method to add custom message converters.
* @param messageConverters the list to add converters to, initially empty
* @return {@code true} if default message converters should be added to list,
- * {@code false} if no more converters should be added.
+ * {@code false} if no more converters should be added
*/
protected boolean configureMessageConverters(List In order, this method tries to get a Validator instance:
* Implementations of this method are responsible for loading the
* application context if the corresponding context has not already been
* loaded, potentially caching the context as well.
- * @return the application context
+ * @return the application context (never {@code null})
* @throws IllegalStateException if an error occurs while retrieving the
* application context
*/
@@ -62,7 +64,7 @@ public interface TestContext extends AttributeAccessor, Serializable {
/**
* Get the current {@linkplain Object test instance} for this test context.
* Note: this is a mutable property.
- * @return the current test instance (may be {@code null})
+ * @return the current test instance (never {@code null})
* @see #updateState(Object, Method, Throwable)
*/
Object getTestInstance();
@@ -70,7 +72,7 @@ public interface TestContext extends AttributeAccessor, Serializable {
/**
* Get the current {@linkplain Method test method} for this test context.
* Note: this is a mutable property.
- * @return the current test method
+ * @return the current test method (never {@code null})
* @see #updateState(Object, Method, Throwable)
*/
Method getTestMethod();
diff --git a/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultMockServerSpec.java b/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultMockServerSpec.java
index 11a0e033cb72af0570dd326a2c6bdf42b016be80..aa4ca8b88061b9d5f46cad2a912a0c649d465a52 100644
--- a/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultMockServerSpec.java
+++ b/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultMockServerSpec.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2017 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.springframework.test.web.reactive.server;
import org.springframework.util.Assert;
@@ -32,7 +33,7 @@ class DefaultMockServerSpec extends AbstractMockServerSpec For example URL patterns, HTTP request methods, param expressions, etc.
+ * @return a collection of objects (never {@code null})
+ */
+ protected abstract Collection> getContent();
+
+ /**
+ * The notation to use when printing discrete items of content.
+ * For example {@code " || "} for URL patterns or {@code " && "}
+ * for param expressions.
+ */
+ protected abstract String getToStringInfix();
+
+
@Override
public boolean equals(@Nullable Object other) {
if (this == other) {
@@ -62,28 +86,4 @@ public abstract class AbstractRequestCondition For example {@code " || "} for URL patterns or {@code " && "}
- * for param expressions.
- */
- protected abstract String getToStringInfix();
-
}
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractRequestCondition.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractRequestCondition.java
index 50a99f04a1872c413e7acbe196ab9fa1419c4c55..7735d62fd1c905139abbe214209d07eae7de2589 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractRequestCondition.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractRequestCondition.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -44,7 +44,7 @@ public abstract class AbstractRequestCondition
*
*
- *
*
- * while {@link #brokerChannel()} delivers messages from within the application to the
+ *
+ *
*