Merge branch '5.3.x'

This commit is contained in:
Sam Brannen
2021-10-06 12:13:21 +02:00
35 changed files with 81 additions and 79 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 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.
@@ -65,9 +65,9 @@ public interface AttributeAccessor {
* @param computeFunction a function that computes a new value for the attribute
* name; the function must not return a {@code null} value
* @return the existing value or newly computed value for the named attribute
* @since 5.3.3
* @see #getAttribute(String)
* @see #setAttribute(String, Object)
* @since 5.3.3
*/
@SuppressWarnings("unchecked")
default <T> T computeAttribute(String name, Function<String, T> computeFunction) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2021 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.
@@ -169,14 +169,14 @@ public final class CollectionFactory {
* (note: only relevant for {@link EnumSet} creation)
* @param capacity the initial capacity
* @return a new collection instance
* @throws IllegalArgumentException if the supplied {@code collectionType} is
* {@code null}; or if the desired {@code collectionType} is {@link EnumSet} and
* the supplied {@code elementType} is not a subtype of {@link Enum}
* @since 4.1.3
* @see java.util.LinkedHashSet
* @see java.util.ArrayList
* @see java.util.TreeSet
* @see java.util.EnumSet
* @throws IllegalArgumentException if the supplied {@code collectionType} is
* {@code null}; or if the desired {@code collectionType} is {@link EnumSet} and
* the supplied {@code elementType} is not a subtype of {@link Enum}
*/
@SuppressWarnings({"unchecked", "cast"})
public static <E> Collection<E> createCollection(Class<?> collectionType, @Nullable Class<?> elementType, int capacity) {
@@ -285,14 +285,14 @@ public final class CollectionFactory {
* (note: only relevant for {@link EnumMap} creation)
* @param capacity the initial capacity
* @return a new map instance
* @throws IllegalArgumentException if the supplied {@code mapType} is
* {@code null}; or if the desired {@code mapType} is {@link EnumMap} and
* the supplied {@code keyType} is not a subtype of {@link Enum}
* @since 4.1.3
* @see java.util.LinkedHashMap
* @see java.util.TreeMap
* @see org.springframework.util.LinkedMultiValueMap
* @see java.util.EnumMap
* @throws IllegalArgumentException if the supplied {@code mapType} is
* {@code null}; or if the desired {@code mapType} is {@link EnumMap} and
* the supplied {@code keyType} is not a subtype of {@link Enum}
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public static <K, V> Map<K, V> createMap(Class<?> mapType, @Nullable Class<?> keyType, int capacity) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 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.
@@ -74,10 +74,10 @@ public interface AnnotationFilter {
/**
* {@link AnnotationFilter} that never matches and can be used when no
* filtering is needed (allowing for any annotation types to be present).
* @see #PLAIN
* @deprecated as of 5.2.6 since the {@link MergedAnnotations} model
* always ignores lang annotations according to the {@link #PLAIN} filter
* (for efficiency reasons)
* @see #PLAIN
*/
@Deprecated
AnnotationFilter NONE = new AnnotationFilter() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2021 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.
@@ -23,10 +23,10 @@ import org.springframework.lang.Nullable;
/**
* Callback interface used to process annotations.
*
* @param <C> the context type
* @param <R> the result type
* @author Phillip Webb
* @since 5.2
* @param <C> the context type
* @param <R> the result type
* @see AnnotationsScanner
* @see TypeMappedAnnotations
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 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.
@@ -27,8 +27,8 @@ import org.springframework.lang.Nullable;
* source object which is typically an {@link Annotation}, {@link Map}, or
* {@link TypeMappedAnnotation}.
*
* @since 5.2.4
* @author Sam Brannen
* @since 5.2.4
*/
@FunctionalInterface
interface ValueExtractor {

View File

@@ -207,10 +207,13 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
* </pre>
*
* <p>The search order is now C, D, A, B as desired.
*
* <p>Beyond these recommendations, subclasses may use any of the {@code add*},
* {@code remove}, or {@code replace} methods exposed by {@link MutablePropertySources}
* in order to create the exact arrangement of property sources desired.
*
* <p>The base implementation registers no property sources.
*
* <p>Note that clients of any {@link ConfigurableEnvironment} may further customize
* property sources via the {@link #getPropertySources()} accessor, typically within
* an {@link org.springframework.context.ApplicationContextInitializer

View File

@@ -154,7 +154,7 @@ class ClassUtilsTests {
assertThat(ClassUtils.isCacheSafe(composite, childLoader3)).isTrue();
}
@ParameterizedTest
@ParameterizedTest(name = "''{0}'' -> {1}")
@CsvSource(textBlock = """
boolean, boolean
byte, byte
@@ -172,7 +172,7 @@ class ClassUtilsTests {
[J, long[]
[F, float[]
[D, double[]
""")
""")
void resolvePrimitiveClassName(String input, Class<?> output) {
assertThat(ClassUtils.resolvePrimitiveClassName(input)).isEqualTo(output);
}