Skip to content

Commit 99378fe

Browse files
committed
Polishing
1 parent b0e29ac commit 99378fe

File tree

7 files changed

+28
-27
lines changed

7 files changed

+28
-27
lines changed

spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectJAdvisorBeanRegistrationAotProcessor.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@
3333
*/
3434
class AspectJAdvisorBeanRegistrationAotProcessor implements BeanRegistrationAotProcessor {
3535

36-
private static final boolean aspectJPresent = ClassUtils.isPresent("org.aspectj.lang.annotation.Pointcut",
36+
private static final boolean aspectjPresent = ClassUtils.isPresent("org.aspectj.lang.annotation.Pointcut",
3737
AspectJAdvisorBeanRegistrationAotProcessor.class.getClassLoader());
3838

39+
3940
@Override
4041
public BeanRegistrationAotContribution processAheadOfTime(RegisteredBean registeredBean) {
41-
if (aspectJPresent) {
42+
if (aspectjPresent) {
4243
Class<?> beanClass = registeredBean.getBeanClass();
4344
if (AbstractAspectJAdvisorFactory.compiledByAjc(beanClass)) {
4445
return new AspectJAdvisorContribution(beanClass);
@@ -47,6 +48,7 @@ public BeanRegistrationAotContribution processAheadOfTime(RegisteredBean registe
4748
return null;
4849
}
4950

51+
5052
private static class AspectJAdvisorContribution implements BeanRegistrationAotContribution {
5153

5254
private final Class<?> beanClass;

spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectJBeanFactoryInitializationAotProcessor.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,20 @@
4040
*/
4141
class AspectJBeanFactoryInitializationAotProcessor implements BeanFactoryInitializationAotProcessor {
4242

43-
private static final boolean aspectJPresent = ClassUtils.isPresent(
44-
"org.aspectj.lang.annotation.Pointcut", AspectJBeanFactoryInitializationAotProcessor.class.getClassLoader());
43+
private static final boolean aspectJPresent = ClassUtils.isPresent("org.aspectj.lang.annotation.Pointcut",
44+
AspectJBeanFactoryInitializationAotProcessor.class.getClassLoader());
45+
4546

46-
@Nullable
4747
@Override
48+
@Nullable
4849
public BeanFactoryInitializationAotContribution processAheadOfTime(ConfigurableListableBeanFactory beanFactory) {
4950
if (aspectJPresent) {
5051
return AspectDelegate.processAheadOfTime(beanFactory);
5152
}
5253
return null;
5354
}
5455

56+
5557
/**
5658
* Inner class to avoid a hard dependency on AspectJ at runtime.
5759
*/
@@ -63,7 +65,6 @@ private static AspectContribution processAheadOfTime(ConfigurableListableBeanFac
6365
List<Advisor> advisors = builder.buildAspectJAdvisors();
6466
return (advisors.isEmpty() ? null : new AspectContribution(advisors));
6567
}
66-
6768
}
6869

6970

@@ -84,7 +85,6 @@ public void applyTo(GenerationContext generationContext, BeanFactoryInitializati
8485
}
8586
}
8687
}
87-
8888
}
8989

9090
}

spring-core/src/main/java/org/springframework/core/codec/CharBufferDecoder.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@
4242
*/
4343
public final class CharBufferDecoder extends AbstractCharSequenceDecoder<CharBuffer> {
4444

45-
4645
public CharBufferDecoder(List<String> delimiters, boolean stripDelimiter, MimeType... mimeTypes) {
4746
super(delimiters, stripDelimiter, mimeTypes);
4847
}
4948

49+
5050
@Override
5151
public boolean canDecode(ResolvableType elementType, @Nullable MimeType mimeType) {
52-
return elementType.resolve() == CharBuffer.class && super.canDecode(elementType, mimeType);
52+
return (elementType.resolve() == CharBuffer.class) && super.canDecode(elementType, mimeType);
5353
}
5454

5555
@Override
@@ -69,9 +69,8 @@ public static CharBufferDecoder textPlainOnly() {
6969

7070
/**
7171
* Create a {@code CharBufferDecoder} for {@code "text/plain"}.
72-
* @param delimiters delimiter strings to use to split the input stream
73-
* @param stripDelimiter whether to remove delimiters from the resulting
74-
* input strings
72+
* @param delimiters delimiter strings to use to split the input stream
73+
* @param stripDelimiter whether to remove delimiters from the resulting input strings
7574
*/
7675
public static CharBufferDecoder textPlainOnly(List<String> delimiters, boolean stripDelimiter) {
7776
var textPlain = new MimeType("text", "plain", DEFAULT_CHARSET);
@@ -87,9 +86,8 @@ public static CharBufferDecoder allMimeTypes() {
8786

8887
/**
8988
* Create a {@code CharBufferDecoder} that supports all MIME types.
90-
* @param delimiters delimiter strings to use to split the input stream
91-
* @param stripDelimiter whether to remove delimiters from the resulting
92-
* input strings
89+
* @param delimiters delimiter strings to use to split the input stream
90+
* @param stripDelimiter whether to remove delimiters from the resulting input strings
9391
*/
9492
public static CharBufferDecoder allMimeTypes(List<String> delimiters, boolean stripDelimiter) {
9593
var textPlain = new MimeType("text", "plain", DEFAULT_CHARSET);

spring-core/src/main/java/org/springframework/core/codec/CharSequenceEncoder.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -51,8 +51,7 @@ public final class CharSequenceEncoder extends AbstractEncoder<CharSequence> {
5151
*/
5252
public static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
5353

54-
private final ConcurrentMap<Charset, Float> charsetToMaxBytesPerChar =
55-
new ConcurrentHashMap<>(3);
54+
private final ConcurrentMap<Charset, Float> charsetToMaxBytesPerChar = new ConcurrentHashMap<>(3);
5655

5756

5857
private CharSequenceEncoder(MimeType... mimeTypes) {
@@ -105,8 +104,8 @@ public DataBuffer encodeValue(CharSequence charSequence, DataBufferFactory buffe
105104
}
106105

107106
int calculateCapacity(CharSequence sequence, Charset charset) {
108-
float maxBytesPerChar = this.charsetToMaxBytesPerChar
109-
.computeIfAbsent(charset, cs -> cs.newEncoder().maxBytesPerChar());
107+
float maxBytesPerChar = this.charsetToMaxBytesPerChar.computeIfAbsent(charset,
108+
cs -> cs.newEncoder().maxBytesPerChar());
110109
float maxBytesForSequence = sequence.length() * maxBytesPerChar;
111110
return (int) Math.ceil(maxBytesForSequence);
112111
}

spring-core/src/main/java/org/springframework/core/io/buffer/OutputStreamPublisher.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ final class OutputStreamPublisher implements Publisher<DataBuffer> {
6868
public void subscribe(Subscriber<? super DataBuffer> subscriber) {
6969
Objects.requireNonNull(subscriber, "Subscriber must not be null");
7070

71-
OutputStreamSubscription subscription = new OutputStreamSubscription(subscriber, this.outputStreamConsumer,
72-
this.bufferFactory, this.chunkSize);
71+
OutputStreamSubscription subscription = new OutputStreamSubscription(
72+
subscriber, this.outputStreamConsumer, this.bufferFactory, this.chunkSize);
7373

7474
subscriber.onSubscribe(subscription);
7575
this.executor.execute(subscription::invokeHandler);
@@ -80,7 +80,6 @@ private static final class OutputStreamSubscription extends OutputStream impleme
8080

8181
private static final Object READY = new Object();
8282

83-
8483
private final Subscriber<? super DataBuffer> actual;
8584

8685
private final Consumer<OutputStream> outputStreamHandler;
@@ -98,7 +97,6 @@ private static final class OutputStreamSubscription extends OutputStream impleme
9897

9998
private long produced;
10099

101-
102100
OutputStreamSubscription(Subscriber<? super DataBuffer> actual,
103101
Consumer<OutputStream> outputStreamConsumer, DataBufferFactory bufferFactory, int chunkSize) {
104102

@@ -351,4 +349,5 @@ private static long addCap(long a, long b) {
351349
return res;
352350
}
353351
}
352+
354353
}

spring-core/src/main/java/org/springframework/core/task/support/ContextPropagatingTaskDecorator.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
import org.springframework.core.task.TaskDecorator;
2323

2424
/**
25-
* {@link TaskDecorator} that {@link ContextSnapshot#wrap(Runnable) wraps the execution} of
26-
* tasks, assisting with context propagation.
25+
* {@link TaskDecorator} that {@link ContextSnapshot#wrap(Runnable) wraps the execution}
26+
* of tasks, assisting with context propagation.
27+
*
2728
* <p>This operation is only useful when the task execution is scheduled on a different
2829
* thread than the original call stack; this depends on the choice of
2930
* {@link org.springframework.core.task.TaskExecutor}. This is particularly useful for
@@ -39,6 +40,7 @@ public class ContextPropagatingTaskDecorator implements TaskDecorator {
3940

4041
private final ContextSnapshotFactory factory;
4142

43+
4244
/**
4345
* Create a new decorator that uses a default instance of the {@link ContextSnapshotFactory}.
4446
*/
@@ -54,6 +56,7 @@ public ContextPropagatingTaskDecorator(ContextSnapshotFactory factory) {
5456
this.factory = factory;
5557
}
5658

59+
5760
@Override
5861
public Runnable decorate(Runnable runnable) {
5962
return this.factory.captureAll().wrap(runnable);

spring-web/src/main/java/org/springframework/http/StreamingHttpOutputMessage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ interface Body {
5454
/**
5555
* Indicates whether this body is capable of
5656
* {@linkplain #writeTo(OutputStream) writing its data} more than
57-
* once. Default implementation returns {@code false}.
57+
* once. The default implementation returns {@code false}.
5858
* @return {@code true} if this body can be written repeatedly,
5959
* {@code false} otherwise
6060
* @since 6.1

0 commit comments

Comments
 (0)