Browse Source

Polishing

Closes gh-29284
pull/29292/head
Johnny Lim 2 years ago committed by Sam Brannen
parent
commit
ced37d53b4
  1. 1
      spring-aop/src/test/java/org/springframework/aop/framework/AopProxyUtilsTests.java
  2. 4
      spring-beans/src/jmh/java/org/springframework/beans/BeanUtilsBenchmark.java
  3. 10
      spring-context/src/main/java/org/springframework/cache/annotation/SpringCacheAnnotationParser.java
  4. 13
      spring-core/src/main/java/org/springframework/aot/hint/annotation/ReflectiveRuntimeHintsRegistrar.java
  5. 3
      spring-web/src/main/java/org/springframework/http/codec/json/AbstractJackson2Encoder.java

1
spring-aop/src/test/java/org/springframework/aop/framework/AopProxyUtilsTests.java

@ -148,6 +148,7 @@ class AopProxyUtilsTests { @@ -148,6 +148,7 @@ class AopProxyUtilsTests {
sealed interface SealedInterface {
}
@SuppressWarnings("unused")
static final class SealedClass implements SealedInterface {
}

4
spring-beans/src/jmh/java/org/springframework/beans/BeanUtilsBenchmark.java

@ -51,8 +51,8 @@ public class BeanUtilsBenchmark { @@ -51,8 +51,8 @@ public class BeanUtilsBenchmark {
return BeanUtils.instantiateClass(this.constructor, 1, "str");
}
static class TestClass1{
};
static class TestClass1 {
}
@SuppressWarnings("unused")
static class TestClass2 {

10
spring-context/src/main/java/org/springframework/cache/annotation/SpringCacheAnnotationParser.java vendored

@ -22,7 +22,6 @@ import java.lang.reflect.AnnotatedElement; @@ -22,7 +22,6 @@ import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;
import org.springframework.cache.interceptor.CacheEvictOperation;
@ -49,14 +48,7 @@ import org.springframework.util.StringUtils; @@ -49,14 +48,7 @@ import org.springframework.util.StringUtils;
@SuppressWarnings("serial")
public class SpringCacheAnnotationParser implements CacheAnnotationParser, Serializable {
private static final Set<Class<? extends Annotation>> CACHE_OPERATION_ANNOTATIONS = new LinkedHashSet<>(8);
static {
CACHE_OPERATION_ANNOTATIONS.add(Cacheable.class);
CACHE_OPERATION_ANNOTATIONS.add(CacheEvict.class);
CACHE_OPERATION_ANNOTATIONS.add(CachePut.class);
CACHE_OPERATION_ANNOTATIONS.add(Caching.class);
}
private static final Set<Class<? extends Annotation>> CACHE_OPERATION_ANNOTATIONS = Set.of(Cacheable.class, CacheEvict.class, CachePut.class, Caching.class);
@Override

13
spring-core/src/main/java/org/springframework/aot/hint/annotation/ReflectiveRuntimeHintsRegistrar.java

@ -25,7 +25,6 @@ import java.util.List; @@ -25,7 +25,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.springframework.aot.hint.ReflectionHints;
@ -39,7 +38,7 @@ import org.springframework.util.ReflectionUtils; @@ -39,7 +38,7 @@ import org.springframework.util.ReflectionUtils;
*
* @author Stephane Nicoll
* @author Andy Wilkinson
* since 6.0
* @since 6.0
*/
public class ReflectiveRuntimeHintsRegistrar {
@ -92,13 +91,13 @@ public class ReflectiveRuntimeHintsRegistrar { @@ -92,13 +91,13 @@ public class ReflectiveRuntimeHintsRegistrar {
@SuppressWarnings("unchecked")
private Entry createEntry(AnnotatedElement element) {
List<Class<? extends ReflectiveProcessor>> processorClasses =
List<ReflectiveProcessor> processors =
MergedAnnotations.from(element, MergedAnnotations.SearchStrategy.TYPE_HIERARCHY)
.stream(Reflective.class).flatMap(annotation -> Stream.of(annotation.getClassArray("value")))
.map(type -> (Class<? extends ReflectiveProcessor>) type).collect(Collectors.toList());
List<ReflectiveProcessor> processors = processorClasses.stream().distinct()
.map(processorClass -> this.processors.computeIfAbsent(processorClass, this::instantiateClass))
.toList();
.map(type -> (Class<? extends ReflectiveProcessor>) type)
.distinct()
.map(processorClass -> this.processors.computeIfAbsent(processorClass, this::instantiateClass))
.toList();
ReflectiveProcessor processorToUse = (processors.size() == 1 ? processors.get(0)
: new DelegateReflectiveProcessor(processors));
return new Entry(element, processorToUse);

3
spring-web/src/main/java/org/springframework/http/codec/json/AbstractJackson2Encoder.java

@ -20,7 +20,6 @@ import java.io.IOException; @@ -20,7 +20,6 @@ import java.io.IOException;
import java.lang.annotation.Annotation;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@ -195,7 +194,7 @@ public abstract class AbstractJackson2Encoder extends Jackson2CodecSupport imple @@ -195,7 +194,7 @@ public abstract class AbstractJackson2Encoder extends Jackson2CodecSupport imple
delimiter, EMPTY_BYTES);
return (prefix.length > 0 ?
bufferFactory.join(Arrays.asList(bufferFactory.wrap(prefix), dataBuffer)) :
bufferFactory.join(List.of(bufferFactory.wrap(prefix), dataBuffer)) :
dataBuffer);
})
.switchIfEmpty(Mono.fromCallable(() -> bufferFactory.wrap(helper.getPrefix())))

Loading…
Cancel
Save