From 82ca27e46f28267a2778d93291fe32a5acd32ce5 Mon Sep 17 00:00:00 2001 From: Marc Wrobel Date: Tue, 12 Jul 2022 15:51:25 +0200 Subject: [PATCH 1/4] Fix and improve Javadoc in spring-messaging See gh-28800 --- .../org/springframework/messaging/MessageChannel.java | 2 +- .../messaging/converter/AbstractMessageConverter.java | 2 +- .../AbstractNamedValueMethodArgumentResolver.java | 2 +- .../annotation/reactive/MessageMappingMessageHandler.java | 4 ++-- .../support/AbstractNamedValueMethodArgumentResolver.java | 2 +- .../support/AnnotationExceptionHandlerMethodResolver.java | 2 +- .../AbstractExceptionHandlerMethodResolver.java | 4 ++-- .../handler/invocation/AbstractMethodMessageHandler.java | 2 +- .../handler/invocation/InvocableHandlerMethod.java | 2 +- .../invocation/reactive/AbstractMethodMessageHandler.java | 8 ++++---- .../invocation/reactive/InvocableHandlerMethod.java | 2 +- .../messaging/rsocket/RSocketRequester.java | 6 +++--- .../messaging/rsocket/RSocketStrategies.java | 2 +- .../rsocket/annotation/support/MessagingRSocket.java | 2 +- .../support/RSocketFrameTypeMessageCondition.java | 2 +- .../rsocket/annotation/support/RSocketMessageHandler.java | 2 +- .../messaging/simp/SimpMessageHeaderAccessor.java | 4 ++-- .../simp/broker/AbstractBrokerMessageHandler.java | 4 ++-- .../simp/broker/OrderedMessageChannelDecorator.java | 2 +- .../simp/stomp/StompBrokerRelayMessageHandler.java | 2 +- .../messaging/simp/stomp/StompDecoder.java | 4 ++-- .../messaging/simp/stomp/StompSession.java | 2 +- .../messaging/support/ExecutorChannelInterceptor.java | 2 +- .../springframework/messaging/support/MessageBuilder.java | 4 ++-- .../messaging/support/MessageHeaderAccessor.java | 8 ++++---- .../messaging/support/NativeMessageHeaderAccessor.java | 6 +++--- .../handler/invocation/TestExceptionResolver.java | 2 +- 27 files changed, 43 insertions(+), 43 deletions(-) diff --git a/spring-messaging/src/main/java/org/springframework/messaging/MessageChannel.java b/spring-messaging/src/main/java/org/springframework/messaging/MessageChannel.java index ff92e0c364..0423ac265d 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/MessageChannel.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/MessageChannel.java @@ -39,7 +39,7 @@ public interface MessageChannel { *

This method may block indefinitely, depending on the implementation. * To provide a maximum wait time, use {@link #send(Message, long)}. * @param message the message to send - * @return whether or not the message was sent + * @return whether the message was sent */ default boolean send(Message message) { return send(message, INDEFINITE_TIMEOUT); diff --git a/spring-messaging/src/main/java/org/springframework/messaging/converter/AbstractMessageConverter.java b/spring-messaging/src/main/java/org/springframework/messaging/converter/AbstractMessageConverter.java index b8400e046c..56269e9ba3 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/converter/AbstractMessageConverter.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/converter/AbstractMessageConverter.java @@ -127,7 +127,7 @@ public abstract class AbstractMessageConverter implements SmartMessageConverter * Whether this converter should convert messages for which no content type * could be resolved through the configured * {@link org.springframework.messaging.converter.ContentTypeResolver}. - *

A converter can configured to be strict only when a + *

A converter can be configured to be strict only when a * {@link #setContentTypeResolver contentTypeResolver} is configured and the * list of {@link #getSupportedMimeTypes() supportedMimeTypes} is not be empty. *

When this flag is set to {@code true}, {@link #supportsMimeType(MessageHeaders)} diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/reactive/AbstractNamedValueMethodArgumentResolver.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/reactive/AbstractNamedValueMethodArgumentResolver.java index 2075aa9e88..f35a97eae8 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/reactive/AbstractNamedValueMethodArgumentResolver.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/reactive/AbstractNamedValueMethodArgumentResolver.java @@ -186,7 +186,7 @@ public abstract class AbstractNamedValueMethodArgumentResolver implements SyncHa /** * Invoked when a value is required, but {@link #resolveArgumentInternal} - * returned {@code null} and there is no default value. Sub-classes can + * returned {@code null} and there is no default value. Subclasses can * throw an appropriate exception for this case. * @param name the name for the value * @param parameter the target method parameter diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/reactive/MessageMappingMessageHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/reactive/MessageMappingMessageHandler.java index 86bd272085..771680dbc4 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/reactive/MessageMappingMessageHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/reactive/MessageMappingMessageHandler.java @@ -65,7 +65,7 @@ import org.springframework.validation.Validator; /** * Extension of {@link AbstractMethodMessageHandler} for reactive, non-blocking * handling of messages via {@link MessageMapping @MessageMapping} methods. - * By default such methods are detected in {@code @Controller} Spring beans but + * By default, such methods are detected in {@code @Controller} Spring beans but * that can be changed via {@link #setHandlerPredicate(Predicate)}. * *

Payloads for incoming messages are decoded through the configured @@ -74,7 +74,7 @@ import org.springframework.validation.Validator; * *

There is no default handling for return values but * {@link #setReturnValueHandlerConfigurer} can be used to configure custom - * return value handlers. Sub-classes may also override + * return value handlers. Subclasses may also override * {@link #initReturnValueHandlers()} to set up default return value handlers. * * @author Rossen Stoyanchev diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/AbstractNamedValueMethodArgumentResolver.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/AbstractNamedValueMethodArgumentResolver.java index f64407b18d..4d6be65ccd 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/AbstractNamedValueMethodArgumentResolver.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/AbstractNamedValueMethodArgumentResolver.java @@ -198,7 +198,7 @@ public abstract class AbstractNamedValueMethodArgumentResolver implements Handle /** * Invoked when a value is required, but {@link #resolveArgumentInternal} - * returned {@code null} and there is no default value. Sub-classes can + * returned {@code null} and there is no default value. Subclasses can * throw an appropriate exception for this case. * @param name the name for the value * @param parameter the target method parameter diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/AnnotationExceptionHandlerMethodResolver.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/AnnotationExceptionHandlerMethodResolver.java index 21493b4692..9be3e2d504 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/AnnotationExceptionHandlerMethodResolver.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/AnnotationExceptionHandlerMethodResolver.java @@ -29,7 +29,7 @@ import org.springframework.messaging.handler.annotation.MessageExceptionHandler; import org.springframework.messaging.handler.invocation.AbstractExceptionHandlerMethodResolver; /** - * A sub-class of {@link AbstractExceptionHandlerMethodResolver} that looks for + * A subclass of {@link AbstractExceptionHandlerMethodResolver} that looks for * {@link MessageExceptionHandler}-annotated methods in a given class. The actual * exception types handled are extracted either from the annotation, if present, * or from the method signature as a fallback option. diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractExceptionHandlerMethodResolver.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractExceptionHandlerMethodResolver.java index 6bf11cf119..86d7471d26 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractExceptionHandlerMethodResolver.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractExceptionHandlerMethodResolver.java @@ -67,8 +67,8 @@ public abstract class AbstractExceptionHandlerMethodResolver { /** * Extract the exceptions this method handles. This implementation looks for - * sub-classes of Throwable in the method signature. - *

The method is static to ensure safe use from sub-class constructors. + * subclasses of Throwable in the method signature. + *

The method is static to ensure safe use from subclass constructors. */ @SuppressWarnings("unchecked") protected static List> getExceptionsFromMethodSignature(Method method) { diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractMethodMessageHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractMethodMessageHandler.java index f160d506ee..2c2517bc70 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractMethodMessageHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractMethodMessageHandler.java @@ -340,7 +340,7 @@ public abstract class AbstractMethodMessageHandler /** * Provide the mapping for a handler method. * @param method the method to provide a mapping for - * @param handlerType the handler type, possibly a sub-type of the method's declaring class + * @param handlerType the handler type, possibly a subtype of the method's declaring class * @return the mapping, or {@code null} if the method is not mapped */ @Nullable diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java index 3dc5e2ec26..0b84083d8f 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java @@ -78,7 +78,7 @@ public class InvocableHandlerMethod extends HandlerMethod { /** - * Set {@link HandlerMethodArgumentResolver HandlerMethodArgumentResolvers} to use to use for resolving method argument values. + * Set {@link HandlerMethodArgumentResolver HandlerMethodArgumentResolvers} to use for resolving method argument values. */ public void setMessageMethodArgumentResolvers(HandlerMethodArgumentResolverComposite argumentResolvers) { this.resolvers = argumentResolvers; diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/AbstractMethodMessageHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/AbstractMethodMessageHandler.java index a240f4d8ef..b8a72642ce 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/AbstractMethodMessageHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/AbstractMethodMessageHandler.java @@ -113,7 +113,7 @@ public abstract class AbstractMethodMessageHandler /** * Configure a predicate for selecting which Spring beans to check for the * presence of message handler methods. - *

This is not set by default. However sub-classes may initialize it to + *

This is not set by default. However, subclasses may initialize it to * some default strategy (e.g. {@code @Controller} classes). * @see #setHandlers(List) */ @@ -235,7 +235,7 @@ public abstract class AbstractMethodMessageHandler /** * Return the argument resolvers initialized during {@link #afterPropertiesSet()}. - * Primarily for internal use in sub-classes. + * Primarily for internal use in subclasses. * @since 5.2.2 */ protected HandlerMethodArgumentResolverComposite getArgumentResolvers() { @@ -362,7 +362,7 @@ public abstract class AbstractMethodMessageHandler /** * Obtain the mapping for the given method, if any. * @param method the method to check - * @param handlerType the handler type, possibly a sub-type of the method's declaring class + * @param handlerType the handler type, possibly a subtype of the method's declaring class * @return the mapping, or {@code null} if the method is not mapped */ @Nullable @@ -418,7 +418,7 @@ public abstract class AbstractMethodMessageHandler /** * This method is invoked just before mappings are added. It allows - * sub-classes to update the mapping with the {@link HandlerMethod} in mind. + * subclasses to update the mapping with the {@link HandlerMethod} in mind. * This can be useful when the method signature is used to refine the * mapping, e.g. based on the cardinality of input and output. *

By default this method returns the mapping that is passed in. diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/InvocableHandlerMethod.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/InvocableHandlerMethod.java index 18f17b5a27..b3be50c33d 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/InvocableHandlerMethod.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/InvocableHandlerMethod.java @@ -77,7 +77,7 @@ public class InvocableHandlerMethod extends HandlerMethod { /** - * Configure the argument resolvers to use to use for resolving method + * Configure the argument resolvers to use for resolving method * argument values against a {@code ServerWebExchange}. */ public void setArgumentResolvers(List resolvers) { diff --git a/spring-messaging/src/main/java/org/springframework/messaging/rsocket/RSocketRequester.java b/spring-messaging/src/main/java/org/springframework/messaging/rsocket/RSocketRequester.java index 365d894cb9..80b18ec170 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/rsocket/RSocketRequester.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/rsocket/RSocketRequester.java @@ -91,7 +91,7 @@ public interface RSocketRequester extends Disposable { * If a formatted variable contains a "." it is replaced with the escape * sequence "%2E" to avoid treating it as separator by the responder . *

If the connection is set to use composite metadata, the route is - * encoded as {@code "message/x.rsocket.routing.v0"}. Otherwise the route + * encoded as {@code "message/x.rsocket.routing.v0"}. Otherwise, the route * is encoded according to the mime type for the connection. * @param route the route expressing a remote handler mapping * @param routeVars variables to be expanded into the route template @@ -105,7 +105,7 @@ public interface RSocketRequester extends Disposable { * to a {@link Publisher} via {@link ReactiveAdapterRegistry}. * @param metadata the metadata value to encode * @param mimeType the mime type that describes the metadata; - * This is required for connection using composite metadata. Otherwise the + * This is required for connection using composite metadata. Otherwise, the * value is encoded according to the mime type for the connection and this * argument may be left as {@code null}. */ @@ -434,7 +434,7 @@ public interface RSocketRequester extends Disposable { *

If the return type is {@code Mono}, the {@code Mono} will * complete after all data is consumed. *

Note: This method will raise an error if - * the request payload is a multi-valued {@link Publisher} as there is + * the request payload is a multivalued {@link Publisher} as there is * no many-to-one RSocket interaction. * @param dataType the expected data type for the response * @param parameter for the expected data type diff --git a/spring-messaging/src/main/java/org/springframework/messaging/rsocket/RSocketStrategies.java b/spring-messaging/src/main/java/org/springframework/messaging/rsocket/RSocketStrategies.java index 332603561a..8e8a43a10f 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/rsocket/RSocketStrategies.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/rsocket/RSocketStrategies.java @@ -183,7 +183,7 @@ public interface RSocketStrategies { Builder routeMatcher(@Nullable RouteMatcher routeMatcher); /** - * Configure the registry for reactive type support. This can be used to + * Configure the registry for reactive type support. This can be used * to adapt to, and/or determine the semantics of a given * {@link org.reactivestreams.Publisher Publisher}. *

By default this {@link ReactiveAdapterRegistry#getSharedInstance()}. diff --git a/spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/MessagingRSocket.java b/spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/MessagingRSocket.java index f7b06d8be3..a483b32dde 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/MessagingRSocket.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/MessagingRSocket.java @@ -104,7 +104,7 @@ class MessagingRSocket implements RSocket { */ public Mono handleConnectionSetupPayload(ConnectionSetupPayload payload) { // frameDecoder does not apply to connectionSetupPayload - // so retain here since handle expects it.. + // so retain here since handle expects it. payload.retain(); return handle(payload, FrameType.SETUP); } diff --git a/spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/RSocketFrameTypeMessageCondition.java b/spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/RSocketFrameTypeMessageCondition.java index b8e1f303e8..925c61edc8 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/RSocketFrameTypeMessageCondition.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/RSocketFrameTypeMessageCondition.java @@ -169,7 +169,7 @@ public class RSocketFrameTypeMessageCondition extends AbstractMessageConditionThe table below shows the selections made: * diff --git a/spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/RSocketMessageHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/RSocketMessageHandler.java index a779b32726..27fb1a5d76 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/RSocketMessageHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/RSocketMessageHandler.java @@ -193,7 +193,7 @@ public class RSocketMessageHandler extends MessageMappingMessageHandler { * likewise when this property is set the {@code RSocketStrategies} are * mutated to change the extractor in it. *

By default this is set to the - * {@link org.springframework.messaging.rsocket.RSocketStrategies.Builder#metadataExtractor(MetadataExtractor)} defaults} + * {@link org.springframework.messaging.rsocket.RSocketStrategies.Builder#metadataExtractor(MetadataExtractor) defaults} * from {@code RSocketStrategies}. * @param extractor the extractor to use */ diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/SimpMessageHeaderAccessor.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/SimpMessageHeaderAccessor.java index 307b1071e5..b32c3836ed 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/SimpMessageHeaderAccessor.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/SimpMessageHeaderAccessor.java @@ -91,7 +91,7 @@ public class SimpMessageHeaderAccessor extends NativeMessageHeaderAccessor { /** * A constructor for creating new message headers. - * This constructor is protected. See factory methods in this and sub-classes. + * This constructor is protected. See factory methods in this and subclasses. */ protected SimpMessageHeaderAccessor(SimpMessageType messageType, @Nullable Map> externalSourceHeaders) { @@ -104,7 +104,7 @@ public class SimpMessageHeaderAccessor extends NativeMessageHeaderAccessor { /** * A constructor for accessing and modifying existing message headers. This - * constructor is protected. See factory methods in this and sub-classes. + * constructor is protected. See factory methods in this and subclasses. */ protected SimpMessageHeaderAccessor(Message message) { super(message); diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/AbstractBrokerMessageHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/AbstractBrokerMessageHandler.java index 1babc663eb..b504047a77 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/AbstractBrokerMessageHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/AbstractBrokerMessageHandler.java @@ -247,7 +247,7 @@ public abstract class AbstractBrokerMessageHandler * Check whether this message handler is currently running. *

Note that even when this message handler is running the * {@link #isBrokerAvailable()} flag may still independently alternate between - * being on and off depending on the concrete sub-class implementation. + * being on and off depending on the concrete subclass implementation. */ @Override public final boolean isRunning() { @@ -260,7 +260,7 @@ public abstract class AbstractBrokerMessageHandler * indicates whether this message handler is running. In other words the message * handler must first be running and then the {@code #isBrokerAvailable()} flag * may still independently alternate between being on and off depending on the - * concrete sub-class implementation. + * concrete subclass implementation. *

Application components may implement * {@code org.springframework.context.ApplicationListener<BrokerAvailabilityEvent>} * to receive notifications when broker becomes available and unavailable. diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/OrderedMessageChannelDecorator.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/OrderedMessageChannelDecorator.java index 7a55adde7c..f4312910dc 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/OrderedMessageChannelDecorator.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/OrderedMessageChannelDecorator.java @@ -35,7 +35,7 @@ import org.springframework.util.Assert; /** * Decorator for an {@link ExecutorSubscribableChannel} that ensures messages * are processed in the order they were published to the channel. Messages are - * sent one at a time with the next one released when the prevoius has been + * sent one at a time with the next one released when the previous has been * processed. This decorator is intended to be applied per session. * * @author Rossen Stoyanchev diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandler.java index a0285a2d2f..d1f0c45171 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandler.java @@ -923,7 +923,7 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler /** * After a DISCONNECT there should be no more client frames so we can - * close the connection pro-actively. However, if the DISCONNECT has a + * close the connection proactively. However, if the DISCONNECT has a * receipt header we leave the connection open and expect the server will * respond with a RECEIPT and then close the connection. * @see diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompDecoder.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompDecoder.java index d71f78752c..b8c5e6cbf7 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompDecoder.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompDecoder.java @@ -92,9 +92,9 @@ public class StompDecoder { * Decodes one or more STOMP frames from the given {@code buffer} and returns * a list of {@link Message Messages}. *

If the given ByteBuffer contains only partial STOMP frame content and no - * complete STOMP frames, an empty list is returned, and the buffer is reset to + * complete STOMP frames, an empty list is returned, and the buffer is reset * to where it was. - *

If the buffer contains one ore more STOMP frames, those are returned and + *

If the buffer contains one or more STOMP frames, those are returned and * the buffer reset to point to the beginning of the unused partial content. *

The output partialMessageHeaders map is used to store successfully parsed * headers in case of partial content. The caller can then check if a diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompSession.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompSession.java index 61e0b68489..01ad81b8d4 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompSession.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompSession.java @@ -82,7 +82,7 @@ public interface StompSession { /** * An overloaded version of {@link #subscribe(String, StompFrameHandler)} * with full {@link StompHeaders} instead of just a destination. - * @param headers the headers for the subscribe message frame + * @param headers the headers for the subscribed message frame * @param handler the handler for received messages * @return a handle to use to unsubscribe and/or track receipts */ diff --git a/spring-messaging/src/main/java/org/springframework/messaging/support/ExecutorChannelInterceptor.java b/spring-messaging/src/main/java/org/springframework/messaging/support/ExecutorChannelInterceptor.java index c53869f48b..ef34ae90ec 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/support/ExecutorChannelInterceptor.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/support/ExecutorChannelInterceptor.java @@ -60,7 +60,7 @@ public interface ExecutorChannelInterceptor extends ChannelInterceptor { * @param message the message handled * @param channel the channel on which the message was sent to * @param handler the target handler that handled the message - * @param ex any exception that may been raised by the handler + * @param ex any exception that may have been raised by the handler */ default void afterMessageHandled(Message message, MessageChannel channel, MessageHandler handler, @Nullable Exception ex) { diff --git a/spring-messaging/src/main/java/org/springframework/messaging/support/MessageBuilder.java b/spring-messaging/src/main/java/org/springframework/messaging/support/MessageBuilder.java index 64d75f2d0f..4e58b578db 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/support/MessageBuilder.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/support/MessageBuilder.java @@ -110,7 +110,7 @@ public final class MessageBuilder { /** * Copy the name-value pairs from the provided Map. This operation will overwrite any - * existing values. Use { {@link #copyHeadersIfAbsent(Map)} to avoid overwriting + * existing values. Use {@link #copyHeadersIfAbsent(Map)} to avoid overwriting * values. Note that the 'id' and 'timestamp' header values will never be overwritten. */ public MessageBuilder copyHeaders(@Nullable Map headersToCopy) { @@ -169,7 +169,7 @@ public final class MessageBuilder { /** - * Create a builder for a new {@link Message} instance pre-populated with all of the + * Create a builder for a new {@link Message} instance pre-populated with all the * headers copied from the provided message. The payload of the provided Message will * also be used as the payload for the new message. *

If the provided message is an {@link ErrorMessage}, the diff --git a/spring-messaging/src/main/java/org/springframework/messaging/support/MessageHeaderAccessor.java b/spring-messaging/src/main/java/org/springframework/messaging/support/MessageHeaderAccessor.java index 95e04b63f4..8ea3f28539 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/support/MessageHeaderAccessor.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/support/MessageHeaderAccessor.java @@ -43,12 +43,12 @@ import org.springframework.util.StringUtils; * strongly typed accessors for specific headers, the ability to leave headers * in a {@link Message} mutable, and the option to suppress automatic generation * of {@link MessageHeaders#ID id} and {@link MessageHeaders#TIMESTAMP - * timesteamp} headers. Sub-classes such as {@link NativeMessageHeaderAccessor} + * timesteamp} headers. Subclasses such as {@link NativeMessageHeaderAccessor} * and others provide support for managing processing vs external source headers * as well as protocol specific headers. * *

Below is a workflow to initialize headers via {@code MessageHeaderAccessor}, - * or one of its sub-classes, then create a {@link Message}, and then re-obtain + * or one of its subclasses, then create a {@link Message}, and then re-obtain * the accessor possibly from a different component: *

  * // Create a message with headers
@@ -153,7 +153,7 @@ public class MessageHeaderAccessor {
 	// Configuration properties
 
 	/**
-	 * By default when {@link #getMessageHeaders()} is called, {@code "this"}
+	 * By default, when {@link #getMessageHeaders()} is called, {@code "this"}
 	 * {@code MessageHeaderAccessor} instance can no longer be used to modify the
 	 * underlying message headers and the returned {@code MessageHeaders} is immutable.
 	 * 

However when this is set to {@code true}, the returned (underlying) @@ -173,7 +173,7 @@ public class MessageHeaderAccessor { } /** - * By default when {@link #getMessageHeaders()} is called, {@code "this"} + * By default, when {@link #getMessageHeaders()} is called, {@code "this"} * {@code MessageHeaderAccessor} instance can no longer be used to modify the * underlying message headers. However if {@link #setLeaveMutable(boolean)} * is used, this method is necessary to indicate explicitly when the diff --git a/spring-messaging/src/main/java/org/springframework/messaging/support/NativeMessageHeaderAccessor.java b/spring-messaging/src/main/java/org/springframework/messaging/support/NativeMessageHeaderAccessor.java index 2a3607fde2..1089119c60 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/support/NativeMessageHeaderAccessor.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/support/NativeMessageHeaderAccessor.java @@ -36,9 +36,9 @@ import org.springframework.util.ObjectUtils; * key {@link #NATIVE_HEADERS}. This allows separating processing headers from * headers that need to be sent to or received from the external source. * - *

This class is likely to be used through indirectly through a protocol - * specific sub-class that also provide factory methods to translate - * message headers to an from an external messaging source. + *

This class is likely to be used indirectly through a protocol-specific + * subclass that also provide factory methods to translate + * message headers to and from an external messaging source. * * @author Rossen Stoyanchev * @since 4.0 diff --git a/spring-messaging/src/test/java/org/springframework/messaging/handler/invocation/TestExceptionResolver.java b/spring-messaging/src/test/java/org/springframework/messaging/handler/invocation/TestExceptionResolver.java index bf30e67416..bc13d1f27b 100644 --- a/spring-messaging/src/test/java/org/springframework/messaging/handler/invocation/TestExceptionResolver.java +++ b/spring-messaging/src/test/java/org/springframework/messaging/handler/invocation/TestExceptionResolver.java @@ -24,7 +24,7 @@ import org.springframework.core.MethodIntrospector; import org.springframework.util.ReflectionUtils; /** - * Sub-class for {@link AbstractExceptionHandlerMethodResolver} for testing. + * Subclass for {@link AbstractExceptionHandlerMethodResolver} for testing. * @author Rossen Stoyanchev */ public class TestExceptionResolver extends AbstractExceptionHandlerMethodResolver { From e76fbcb29089930715d0321910ab4f9a47c67472 Mon Sep 17 00:00:00 2001 From: Marc Wrobel Date: Tue, 12 Jul 2022 15:53:53 +0200 Subject: [PATCH 2/4] Fix and improve Javadoc in spring-jms See gh-28800 --- .../org/springframework/jms/config/JmsListenerEndpoint.java | 2 +- .../jms/config/JmsListenerEndpointRegistry.java | 4 ++-- .../connection/UserCredentialsConnectionFactoryAdapter.java | 2 +- .../jms/listener/AbstractMessageListenerContainer.java | 2 +- .../jms/listener/DefaultMessageListenerContainer.java | 4 ++-- .../jms/listener/MessageListenerContainer.java | 2 +- .../jms/listener/SubscriptionNameProvider.java | 4 ++-- .../jms/listener/adapter/MessageListenerAdapter.java | 2 +- .../jms/listener/endpoint/JmsActivationSpecConfig.java | 2 +- .../listener/endpoint/StandardJmsActivationSpecFactory.java | 4 ++-- .../java/org/springframework/jms/support/JmsAccessor.java | 6 +++--- .../jms/annotation/AbstractJmsAnnotationDrivenTests.java | 4 ++-- .../java/org/springframework/jms/core/JmsTemplateTests.java | 6 +++--- 13 files changed, 22 insertions(+), 22 deletions(-) diff --git a/spring-jms/src/main/java/org/springframework/jms/config/JmsListenerEndpoint.java b/spring-jms/src/main/java/org/springframework/jms/config/JmsListenerEndpoint.java index d1c3e10d29..c206018e20 100644 --- a/spring-jms/src/main/java/org/springframework/jms/config/JmsListenerEndpoint.java +++ b/spring-jms/src/main/java/org/springframework/jms/config/JmsListenerEndpoint.java @@ -34,7 +34,7 @@ public interface JmsListenerEndpoint { String getId(); /** - * Setup the specified message listener container with the model + * Set up the specified message listener container with the model * defined by this endpoint. *

This endpoint must provide the requested missing option(s) of * the specified container to make it usable. Usually, this is about diff --git a/spring-jms/src/main/java/org/springframework/jms/config/JmsListenerEndpointRegistry.java b/spring-jms/src/main/java/org/springframework/jms/config/JmsListenerEndpointRegistry.java index 4807958f51..68f6c21a22 100644 --- a/spring-jms/src/main/java/org/springframework/jms/config/JmsListenerEndpointRegistry.java +++ b/spring-jms/src/main/java/org/springframework/jms/config/JmsListenerEndpointRegistry.java @@ -121,7 +121,7 @@ public class JmsListenerEndpointRegistry implements DisposableBean, SmartLifecyc /** * Create a message listener container for the given {@link JmsListenerEndpoint}. *

This create the necessary infrastructure to honor that endpoint - * with regards to its configuration. + * with regard to its configuration. *

The {@code startImmediately} flag determines if the container should be * started immediately. * @param endpoint the endpoint to add @@ -153,7 +153,7 @@ public class JmsListenerEndpointRegistry implements DisposableBean, SmartLifecyc /** * Create a message listener container for the given {@link JmsListenerEndpoint}. *

This create the necessary infrastructure to honor that endpoint - * with regards to its configuration. + * with regard to its configuration. * @param endpoint the endpoint to add * @param factory the listener factory to use * @see #registerListenerContainer(JmsListenerEndpoint, JmsListenerContainerFactory, boolean) diff --git a/spring-jms/src/main/java/org/springframework/jms/connection/UserCredentialsConnectionFactoryAdapter.java b/spring-jms/src/main/java/org/springframework/jms/connection/UserCredentialsConnectionFactoryAdapter.java index 1943d753c4..adfe7cd962 100644 --- a/spring-jms/src/main/java/org/springframework/jms/connection/UserCredentialsConnectionFactoryAdapter.java +++ b/spring-jms/src/main/java/org/springframework/jms/connection/UserCredentialsConnectionFactoryAdapter.java @@ -123,7 +123,7 @@ public class UserCredentialsConnectionFactoryAdapter /** - * Set user credententials for this proxy and the current thread. + * Set user credentials for this proxy and the current thread. * The given username and password will be applied to all subsequent * {@code createConnection()} calls on this ConnectionFactory proxy. *

This will override any statically specified user credentials, diff --git a/spring-jms/src/main/java/org/springframework/jms/listener/AbstractMessageListenerContainer.java b/spring-jms/src/main/java/org/springframework/jms/listener/AbstractMessageListenerContainer.java index 534e12285f..e0a841aa21 100644 --- a/spring-jms/src/main/java/org/springframework/jms/listener/AbstractMessageListenerContainer.java +++ b/spring-jms/src/main/java/org/springframework/jms/listener/AbstractMessageListenerContainer.java @@ -465,7 +465,7 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen /** * Configure the reply destination type. By default, the configured {@code pubSubDomain} - * value is used (see {@link #isPubSubDomain()}. + * value is used (see {@link #isPubSubDomain()}). *

This setting primarily indicates what type of destination to resolve if dynamic * destinations are enabled. * @param replyPubSubDomain "true" for the Publish/Subscribe domain ({@link Topic Topics}), diff --git a/spring-jms/src/main/java/org/springframework/jms/listener/DefaultMessageListenerContainer.java b/spring-jms/src/main/java/org/springframework/jms/listener/DefaultMessageListenerContainer.java index 856be8c914..5c042ddc00 100644 --- a/spring-jms/src/main/java/org/springframework/jms/listener/DefaultMessageListenerContainer.java +++ b/spring-jms/src/main/java/org/springframework/jms/listener/DefaultMessageListenerContainer.java @@ -872,7 +872,7 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe } /** - * This implementations proceeds even after an exception thrown from + * This implementation proceeds even after an exception thrown from * {@code Connection.start()}, relying on listeners to perform * appropriate recovery. */ @@ -887,7 +887,7 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe } /** - * This implementations proceeds even after an exception thrown from + * This implementation proceeds even after an exception thrown from * {@code Connection.stop()}, relying on listeners to perform * appropriate recovery after a restart. */ diff --git a/spring-jms/src/main/java/org/springframework/jms/listener/MessageListenerContainer.java b/spring-jms/src/main/java/org/springframework/jms/listener/MessageListenerContainer.java index 89bfe78daa..26ed83890c 100644 --- a/spring-jms/src/main/java/org/springframework/jms/listener/MessageListenerContainer.java +++ b/spring-jms/src/main/java/org/springframework/jms/listener/MessageListenerContainer.java @@ -33,7 +33,7 @@ import org.springframework.lang.Nullable; public interface MessageListenerContainer extends SmartLifecycle { /** - * Setup the message listener to use. Throws an {@link IllegalArgumentException} + * Set up the message listener to use. Throws an {@link IllegalArgumentException} * if that message listener type is not supported. */ void setupMessageListener(Object messageListener); diff --git a/spring-jms/src/main/java/org/springframework/jms/listener/SubscriptionNameProvider.java b/spring-jms/src/main/java/org/springframework/jms/listener/SubscriptionNameProvider.java index c8622a78c0..f817aac1ee 100644 --- a/spring-jms/src/main/java/org/springframework/jms/listener/SubscriptionNameProvider.java +++ b/spring-jms/src/main/java/org/springframework/jms/listener/SubscriptionNameProvider.java @@ -18,12 +18,12 @@ package org.springframework.jms.listener; /** * Interface to be implemented by message listener objects that suggest a specific - * name for a durable subscription that they might be registered with. Otherwise + * name for a durable subscription that they might be registered with. Otherwise, * the listener class name will be used as a default subscription name. * *

Applies to {@link javax.jms.MessageListener} objects as well as to * {@link SessionAwareMessageListener} objects and plain listener methods - * (as supported by {@link org.springframework.jms.listener.adapter.MessageListenerAdapter}. + * (as supported by {@link org.springframework.jms.listener.adapter.MessageListenerAdapter}). * * @author Juergen Hoeller * @since 2.5.6 diff --git a/spring-jms/src/main/java/org/springframework/jms/listener/adapter/MessageListenerAdapter.java b/spring-jms/src/main/java/org/springframework/jms/listener/adapter/MessageListenerAdapter.java index 2743b70439..f354fd5a7a 100644 --- a/spring-jms/src/main/java/org/springframework/jms/listener/adapter/MessageListenerAdapter.java +++ b/spring-jms/src/main/java/org/springframework/jms/listener/adapter/MessageListenerAdapter.java @@ -36,7 +36,7 @@ import org.springframework.util.ObjectUtils; * Message listener adapter that delegates the handling of messages to target * listener methods via reflection, with flexible message type conversion. * Allows listener methods to operate on message content types, completely - * independent from the JMS API. + * independent of the JMS API. * *

By default, the content of incoming JMS messages gets extracted before * being passed into the target listener method, to let the target method diff --git a/spring-jms/src/main/java/org/springframework/jms/listener/endpoint/JmsActivationSpecConfig.java b/spring-jms/src/main/java/org/springframework/jms/listener/endpoint/JmsActivationSpecConfig.java index ba2f6da68a..d28208fb4e 100644 --- a/spring-jms/src/main/java/org/springframework/jms/listener/endpoint/JmsActivationSpecConfig.java +++ b/spring-jms/src/main/java/org/springframework/jms/listener/endpoint/JmsActivationSpecConfig.java @@ -182,7 +182,7 @@ public class JmsActivationSpecConfig { *

Note that JCA resource adapters generally only support auto and dups-ok * (see Spring's {@link StandardJmsActivationSpecFactory}). ActiveMQ also * supports "SESSION_TRANSACTED" in the form of RA-managed transactions - * (automatically translated by Spring's {@link DefaultJmsActivationSpecFactory}. + * (automatically translated by Spring's {@link DefaultJmsActivationSpecFactory}). * @param constantName the name of the {@link Session} acknowledge mode constant * @see javax.jms.Session#AUTO_ACKNOWLEDGE * @see javax.jms.Session#CLIENT_ACKNOWLEDGE diff --git a/spring-jms/src/main/java/org/springframework/jms/listener/endpoint/StandardJmsActivationSpecFactory.java b/spring-jms/src/main/java/org/springframework/jms/listener/endpoint/StandardJmsActivationSpecFactory.java index 632a125131..26f3efa129 100644 --- a/spring-jms/src/main/java/org/springframework/jms/listener/endpoint/StandardJmsActivationSpecFactory.java +++ b/spring-jms/src/main/java/org/springframework/jms/listener/endpoint/StandardJmsActivationSpecFactory.java @@ -192,8 +192,8 @@ public class StandardJmsActivationSpecFactory implements JmsActivationSpecFactor * case of {@code CLIENT_ACKNOWLEDGE} or {@code SESSION_TRANSACTED} * having been requested. * @param bw the BeanWrapper wrapping the ActivationSpec object - * @param ackMode the configured acknowledge mode - * (according to the constants in {@link javax.jms.Session} + * @param ackMode the configured acknowledgment mode + * (according to the constants in {@link javax.jms.Session}) * @see javax.jms.Session#AUTO_ACKNOWLEDGE * @see javax.jms.Session#DUPS_OK_ACKNOWLEDGE * @see javax.jms.Session#CLIENT_ACKNOWLEDGE diff --git a/spring-jms/src/main/java/org/springframework/jms/support/JmsAccessor.java b/spring-jms/src/main/java/org/springframework/jms/support/JmsAccessor.java index 305fc82498..03f89d28a7 100644 --- a/spring-jms/src/main/java/org/springframework/jms/support/JmsAccessor.java +++ b/spring-jms/src/main/java/org/springframework/jms/support/JmsAccessor.java @@ -100,7 +100,7 @@ public abstract class JmsAccessor implements InitializingBean { * parameters are not taken into account within a locally managed transaction * either, since the accessor operates on an existing JMS Session in this case. *

Setting this flag to "true" will use a short local JMS transaction - * when running outside of a managed transaction, and a synchronized local + * when running outside a managed transaction, and a synchronized local * JMS transaction in case of a managed transaction (other than an XA * transaction) being present. This has the effect of a local JMS * transaction being managed alongside the main transaction (which might @@ -124,7 +124,7 @@ public abstract class JmsAccessor implements InitializingBean { /** * Set the JMS acknowledgement mode by the name of the corresponding constant * in the JMS {@link Session} interface, e.g. "CLIENT_ACKNOWLEDGE". - *

If you want to use vendor-specific extensions to the acknowledgment mode, + *

If you want to use vendor-specific extensions to the acknowledgement mode, * use {@link #setSessionAcknowledgeMode(int)} instead. * @param constantName the name of the {@link Session} acknowledge mode constant * @see javax.jms.Session#AUTO_ACKNOWLEDGE @@ -140,7 +140,7 @@ public abstract class JmsAccessor implements InitializingBean { * Set the JMS acknowledgement mode that is used when creating a JMS * {@link Session} to send a message. *

Default is {@link Session#AUTO_ACKNOWLEDGE}. - *

Vendor-specific extensions to the acknowledgment mode can be set here as well. + *

Vendor-specific extensions to the acknowledgement mode can be set here as well. *

Note that inside an EJB, the parameters to the * {@code create(Queue/Topic)Session(boolean transacted, int acknowledgeMode)} method * are not taken into account. Depending on the transaction context in the EJB, diff --git a/spring-jms/src/test/java/org/springframework/jms/annotation/AbstractJmsAnnotationDrivenTests.java b/spring-jms/src/test/java/org/springframework/jms/annotation/AbstractJmsAnnotationDrivenTests.java index 0bd41eb7ee..eb96ae9325 100644 --- a/spring-jms/src/test/java/org/springframework/jms/annotation/AbstractJmsAnnotationDrivenTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/annotation/AbstractJmsAnnotationDrivenTests.java @@ -113,9 +113,9 @@ abstract class AbstractJmsAnnotationDrivenTests { } /** - * Test for {@link CustomBean} and an manually endpoint registered + * Test for {@link CustomBean} and an endpoint manually registered * with "myCustomEndpointId". The custom endpoint does not provide - * any factory so it's registered with the default one + * any factory, so it's registered with the default one */ protected void testCustomConfiguration(ApplicationContext context) { JmsListenerContainerTestFactory defaultFactory = diff --git a/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java b/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java index 34bf543bdd..14364dfb38 100644 --- a/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java @@ -270,7 +270,7 @@ class JmsTemplateTests { /** * Test sending to a destination using the method - * send(String d, MessageCreator messageCreator) + * {@code send(String d, MessageCreator messageCreator)} */ @Test void testSendDestinationName() throws Exception { @@ -279,7 +279,7 @@ class JmsTemplateTests { /** * Test sending to a destination using the method - * send(Destination d, MessageCreator messageCreator) using QOS parameters. + * {@code send(Destination d, MessageCreator messageCreator)} using QOS parameters. */ @Test void testSendDestinationWithQOS() throws Exception { @@ -288,7 +288,7 @@ class JmsTemplateTests { /** * Test sending to a destination using the method - * send(String d, MessageCreator messageCreator) using QOS parameters. + * {@code send(String d, MessageCreator messageCreator)} using QOS parameters. */ @Test void testSendDestinationNameWithQOS() throws Exception { From 91258271e41ed7e998d475fb1a807a61c48508f1 Mon Sep 17 00:00:00 2001 From: Marc Wrobel Date: Tue, 12 Jul 2022 15:57:04 +0200 Subject: [PATCH 3/4] Fix and improve Javadoc in spring-expression Closes gh-28800 --- .../springframework/expression/ConstructorResolver.java | 2 +- .../java/org/springframework/expression/ParserContext.java | 2 +- .../java/org/springframework/expression/spel/CodeFlow.java | 4 ++-- .../java/org/springframework/expression/spel/SpelNode.java | 2 +- .../expression/spel/ast/ConstructorReference.java | 6 +++--- .../org/springframework/expression/spel/ast/Elvis.java | 7 ++++--- .../expression/spel/ast/OperatorInstanceof.java | 4 ++-- .../expression/spel/ast/PropertyOrFieldReference.java | 2 +- .../org/springframework/expression/spel/ast/Ternary.java | 2 +- .../spel/standard/InternalSpelExpressionParser.java | 2 +- .../expression/spel/OperatorOverloaderTests.java | 2 +- .../spel/ScenariosForSpringSecurityExpressionTests.java | 2 +- .../org/springframework/expression/spel/SetValueTests.java | 6 +++--- .../expression/spel/SpelCompilationCoverageTests.java | 4 ++-- .../springframework/expression/spel/SpelReproTests.java | 2 +- 15 files changed, 25 insertions(+), 24 deletions(-) diff --git a/spring-expression/src/main/java/org/springframework/expression/ConstructorResolver.java b/spring-expression/src/main/java/org/springframework/expression/ConstructorResolver.java index b8e1a2093f..821a46c1bd 100644 --- a/spring-expression/src/main/java/org/springframework/expression/ConstructorResolver.java +++ b/spring-expression/src/main/java/org/springframework/expression/ConstructorResolver.java @@ -22,7 +22,7 @@ import org.springframework.core.convert.TypeDescriptor; import org.springframework.lang.Nullable; /** - * A constructor resolver attempts locate a constructor and returns a ConstructorExecutor + * A constructor resolver attempts to locate a constructor and returns a ConstructorExecutor * that can be used to invoke that constructor. The ConstructorExecutor will be cached but * if it 'goes stale' the resolvers will be called again. * diff --git a/spring-expression/src/main/java/org/springframework/expression/ParserContext.java b/spring-expression/src/main/java/org/springframework/expression/ParserContext.java index 873d428a4a..86f1b2ba6f 100644 --- a/spring-expression/src/main/java/org/springframework/expression/ParserContext.java +++ b/spring-expression/src/main/java/org/springframework/expression/ParserContext.java @@ -27,7 +27,7 @@ package org.springframework.expression; public interface ParserContext { /** - * Whether or not the expression being parsed is a template. A template expression + * Whether the expression being parsed is a template. A template expression * consists of literal text that can be mixed with evaluatable blocks. Some examples: *

 	 * 	   Some literal text
diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/CodeFlow.java b/spring-expression/src/main/java/org/springframework/expression/spel/CodeFlow.java
index 393946b216..8cde184626 100644
--- a/spring-expression/src/main/java/org/springframework/expression/spel/CodeFlow.java
+++ b/spring-expression/src/main/java/org/springframework/expression/spel/CodeFlow.java
@@ -171,7 +171,7 @@ public class CodeFlow implements Opcodes {
 
 	/**
 	 * Called after the main expression evaluation method has been generated, this
-	 * method will callback any registered FieldAdders or ClinitAdders to add any
+	 * method will call back any registered FieldAdders or ClinitAdders to add any
 	 * extra information to the class representing the compiled expression.
 	 */
 	public void finish() {
@@ -1008,7 +1008,7 @@ public class CodeFlow implements Opcodes {
 	/**
 	 * For use in mathematical operators, handles converting from a (possibly boxed)
 	 * number on the stack to a primitive numeric type.
-	 * 

For example, from a Integer to a double, just need to call 'Number.doubleValue()' + *

For example, from an Integer to a double, just need to call 'Number.doubleValue()' * but from an int to a double, need to use the bytecode 'i2d'. * @param mv the method visitor when instructions should be appended * @param stackDescriptor a descriptor of the operand on the stack diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/SpelNode.java b/spring-expression/src/main/java/org/springframework/expression/spel/SpelNode.java index 1889f2ef12..6964d312eb 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/SpelNode.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/SpelNode.java @@ -66,7 +66,7 @@ public interface SpelNode { void setValue(ExpressionState expressionState, @Nullable Object newValue) throws EvaluationException; /** - * Return the string form the this AST node. + * Return the string form of this AST node. * @return the string form */ String toStringAST(); diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/ConstructorReference.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/ConstructorReference.java index c425c84746..35a0b3efc3 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/ConstructorReference.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/ConstructorReference.java @@ -140,7 +140,7 @@ public class ConstructorReference extends SpelNodeImpl { // To determine which situation it is, the AccessException will contain a cause. // If the cause is an InvocationTargetException, a user exception was thrown inside the constructor. - // Otherwise the constructor could not be invoked. + // Otherwise, the constructor could not be invoked. if (ex.getCause() instanceof InvocationTargetException) { // User exception was the root cause - exit now Throwable rootCause = ex.getCause().getCause(); @@ -271,7 +271,7 @@ public class ConstructorReference extends SpelNodeImpl { newArray = Array.newInstance(componentType, arraySize); } else { - // Multi-dimensional - hold onto your hat! + // Multidimensional - hold onto your hat! int[] dims = new int[this.dimensions.length]; long numElements = 1; for (int d = 0; d < this.dimensions.length; d++) { @@ -288,7 +288,7 @@ public class ConstructorReference extends SpelNodeImpl { else { // There is an initializer if (this.dimensions == null || this.dimensions.length > 1) { - // There is an initializer but this is a multi-dimensional array (e.g. new int[][]{{1,2},{3,4}}) + // There is an initializer but this is a multidimensional array (e.g. new int[][]{{1,2},{3,4}}) // - this is not currently supported throw new SpelEvaluationException(getStartPosition(), SpelMessage.MULTIDIM_ARRAY_INITIALIZER_NOT_SUPPORTED); diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Elvis.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Elvis.java index 60b313e90a..818f43fca6 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Elvis.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Elvis.java @@ -26,8 +26,9 @@ import org.springframework.util.Assert; import org.springframework.util.ObjectUtils; /** - * Represents the elvis operator ?:. For an expression "a?:b" if a is not null, the value - * of the expression is "a", if a is null then the value of the expression is "b". + * Represents the elvis operator ?:. For an expression a?:b if a is not null, + * the value of the expression is a, if a is null then the value of the expression is + * b. * * @author Andy Clement * @author Juergen Hoeller @@ -117,7 +118,7 @@ public class Elvis extends SpelNodeImpl { this.exitTypeDescriptor = conditionDescriptor; } else { - // Use the easiest to compute common super type + // Use the easiest to compute common supertype this.exitTypeDescriptor = "Ljava/lang/Object"; } } diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/OperatorInstanceof.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/OperatorInstanceof.java index 0deb8b7da9..3cd663d873 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/OperatorInstanceof.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/OperatorInstanceof.java @@ -29,8 +29,8 @@ import org.springframework.lang.Nullable; import org.springframework.util.Assert; /** - * The operator 'instanceof' checks if an object is of the class specified in the right - * hand operand, in the same way that {@code instanceof} does in Java. + * The operator 'instanceof' checks if an object is of the class specified in the + * right-hand operand, in the same way that {@code instanceof} does in Java. * * @author Andy Clement * @since 3.0 diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/PropertyOrFieldReference.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/PropertyOrFieldReference.java index 476fb4c9b7..ec509199eb 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/PropertyOrFieldReference.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/PropertyOrFieldReference.java @@ -164,7 +164,7 @@ public class PropertyOrFieldReference extends SpelNodeImpl { /** * Attempt to read the named property from the current context object. * @return the value of the property - * @throws EvaluationException if any problem accessing the property or it cannot be found + * @throws EvaluationException if any problem accessing the property, or if it cannot be found */ private TypedValue readProperty(TypedValue contextObject, EvaluationContext evalContext, String name) throws EvaluationException { diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Ternary.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Ternary.java index efb9b36897..2889f57942 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Ternary.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Ternary.java @@ -74,7 +74,7 @@ public class Ternary extends SpelNodeImpl { this.exitTypeDescriptor = leftDescriptor; } else { - // Use the easiest to compute common super type + // Use the easiest to compute common supertype this.exitTypeDescriptor = "Ljava/lang/Object"; } } diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/standard/InternalSpelExpressionParser.java b/spring-expression/src/main/java/org/springframework/expression/spel/standard/InternalSpelExpressionParser.java index 5b3f69f781..33c4d9db4e 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/standard/InternalSpelExpressionParser.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/standard/InternalSpelExpressionParser.java @@ -78,7 +78,7 @@ import org.springframework.util.Assert; import org.springframework.util.StringUtils; /** - * Hand-written SpEL parser. Instances are reusable but are not thread-safe. + * Handwritten SpEL parser. Instances are reusable but are not thread-safe. * * @author Andy Clement * @author Juergen Hoeller diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/OperatorOverloaderTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/OperatorOverloaderTests.java index d949e0733b..88e7b1e4e1 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/OperatorOverloaderTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/OperatorOverloaderTests.java @@ -35,7 +35,7 @@ public class OperatorOverloaderTests extends AbstractExpressionTests { @Test public void testSimpleOperations() throws Exception { - // no built in support for this: + // no built-in support for this: evaluateAndCheckError("'abc'-true",SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES); StandardEvaluationContext eContext = TestScenarioCreator.getTestEvaluationContext(); diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/ScenariosForSpringSecurityExpressionTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/ScenariosForSpringSecurityExpressionTests.java index 5d9798fae4..010da3e8f6 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/ScenariosForSpringSecurityExpressionTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/ScenariosForSpringSecurityExpressionTests.java @@ -123,7 +123,7 @@ public class ScenariosForSpringSecurityExpressionTests extends AbstractExpressio SpelExpressionParser parser = new SpelExpressionParser(); StandardEvaluationContext ctx = new StandardEvaluationContext(); - ctx.setRootObject(new Supervisor("Ben")); // so non-qualified references 'hasRole()' 'hasIpAddress()' are invoked against it); + ctx.setRootObject(new Supervisor("Ben")); // so non-qualified references 'hasRole()' 'hasIpAddress()' are invoked against it; ctx.addMethodResolver(new MyMethodResolver()); // NEEDS TO OVERRIDE THE REFLECTION ONE - SHOW REORDERING MECHANISM // Might be better with a as a variable although it would work as a property too... diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/SetValueTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/SetValueTests.java index 6073d735b5..c79d286eea 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/SetValueTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/SetValueTests.java @@ -84,7 +84,7 @@ public class SetValueTests extends AbstractExpressionTests { StandardEvaluationContext lContext = TestScenarioCreator.getTestEvaluationContext(); // PROPERTYORFIELDREFERENCE - // Non existent field (or property): + // Non-existent field (or property): Expression e1 = parser.parseExpression("arrayContainer.wibble"); assertThat(e1.isWritable(lContext)).as("Should not be writable!").isFalse(); @@ -103,12 +103,12 @@ public class SetValueTests extends AbstractExpressionTests { assertThat(e4.isWritable(lContext)).as("Should not be writable!").isFalse(); // INDEXER - // non existent indexer (wibble made up) + // non-existent indexer (wibble made up) Expression e5 = parser.parseExpression("arrayContainer.wibble[99]"); assertThatExceptionOfType(SpelEvaluationException.class).isThrownBy(() -> e5.isWritable(lContext)); - // non existent indexer (index via a string) + // non-existent indexer (index via a string) Expression e6 = parser.parseExpression("arrayContainer.ints['abc']"); assertThatExceptionOfType(SpelEvaluationException.class).isThrownBy(() -> e6.isWritable(lContext)); diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/SpelCompilationCoverageTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/SpelCompilationCoverageTests.java index 98a726eff1..b55e9d1c61 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/SpelCompilationCoverageTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/SpelCompilationCoverageTests.java @@ -272,7 +272,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests { assertCanCompile(expression); assertThat(expression.getValue()).asInstanceOf(BOOLEAN).isTrue(); - // Only when the right hand operand is a direct type reference + // Only when the right-hand operand is a direct type reference // will it be compilable. StandardEvaluationContext ctx = new StandardEvaluationContext(); ctx.setVariable("foo", String.class); @@ -4155,7 +4155,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests { void propertyReference() { TestClass6 tc = new TestClass6(); - // non static field + // non-static field expression = parser.parseExpression("orange"); assertCantCompile(expression); assertThat(expression.getValue(tc)).isEqualTo("value1"); diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java index b4f0168f07..508358f445 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java @@ -602,7 +602,7 @@ class SpelReproTests extends AbstractExpressionTests { /** * Test whether {@link ReflectiveMethodResolver} follows Java Method Invocation * Conversion order. And more precisely that widening reference conversion is 'higher' - * than a unboxing conversion. + * than an unboxing conversion. */ @Test void conversionPriority_SPR8224() throws Exception { From 46db372951e6dd17c2c25d54c6ba06e444689025 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Wed, 13 Jul 2022 14:00:59 +0200 Subject: [PATCH 4/4] Polishing --- .../messaging/simp/SimpMessageHeaderAccessor.java | 14 ++++++++------ .../support/NativeMessageHeaderAccessor.java | 8 ++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/SimpMessageHeaderAccessor.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/SimpMessageHeaderAccessor.java index b32c3836ed..96b055a457 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/SimpMessageHeaderAccessor.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/SimpMessageHeaderAccessor.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. @@ -33,9 +33,9 @@ import org.springframework.util.CollectionUtils; * A base class for working with message headers in simple messaging protocols that * support basic messaging patterns. Provides uniform access to specific values common * across protocols such as a destination, message type (e.g. publish, subscribe, etc), - * session id, and others. + * session ID, and others. * - *

Use one of the static factory method in this class, then call getters and setters, + *

Use one of the static factory methods in this class, then call getters and setters, * and at the end if necessary call {@link #toMap()} to obtain the updated headers. * * @author Rossen Stoyanchev @@ -91,7 +91,8 @@ public class SimpMessageHeaderAccessor extends NativeMessageHeaderAccessor { /** * A constructor for creating new message headers. - * This constructor is protected. See factory methods in this and subclasses. + *

This constructor is protected. See factory methods in this class + * and subclasses. */ protected SimpMessageHeaderAccessor(SimpMessageType messageType, @Nullable Map> externalSourceHeaders) { @@ -103,8 +104,9 @@ public class SimpMessageHeaderAccessor extends NativeMessageHeaderAccessor { } /** - * A constructor for accessing and modifying existing message headers. This - * constructor is protected. See factory methods in this and subclasses. + * A constructor for accessing and modifying existing message headers. + *

This constructor is protected. See factory methods in this class + * and subclasses. */ protected SimpMessageHeaderAccessor(Message message) { super(message); diff --git a/spring-messaging/src/main/java/org/springframework/messaging/support/NativeMessageHeaderAccessor.java b/spring-messaging/src/main/java/org/springframework/messaging/support/NativeMessageHeaderAccessor.java index 1089119c60..aafc1dcca4 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/support/NativeMessageHeaderAccessor.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/support/NativeMessageHeaderAccessor.java @@ -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. @@ -30,15 +30,15 @@ import org.springframework.util.MultiValueMap; import org.springframework.util.ObjectUtils; /** - * {@link MessageHeaderAccessor} sub-class that supports storage and access of + * {@link MessageHeaderAccessor} subclass that supports storage and access of * headers from an external source such as a message broker. Headers from the * external source are kept separate from other headers, in a sub-map under the * key {@link #NATIVE_HEADERS}. This allows separating processing headers from * headers that need to be sent to or received from the external source. * *

This class is likely to be used indirectly through a protocol-specific - * subclass that also provide factory methods to translate - * message headers to and from an external messaging source. + * subclass that also provides factory methods to translate message headers + * to and from an external messaging source. * * @author Rossen Stoyanchev * @since 4.0