Polish
This commit is contained in:
parent
b05b5902c0
commit
9c5dcad0e5
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -402,7 +402,7 @@ public class AntPathMatcher implements PathMatcher {
|
|||
protected String[] tokenizePattern(String pattern) {
|
||||
String[] tokenized = null;
|
||||
Boolean cachePatterns = this.cachePatterns;
|
||||
if (cachePatterns == null || cachePatterns.booleanValue()) {
|
||||
if (cachePatterns == null || cachePatterns) {
|
||||
tokenized = this.tokenizedPatternCache.get(pattern);
|
||||
}
|
||||
if (tokenized == null) {
|
||||
|
|
@ -414,7 +414,7 @@ public class AntPathMatcher implements PathMatcher {
|
|||
deactivatePatternCache();
|
||||
return tokenized;
|
||||
}
|
||||
if (cachePatterns == null || cachePatterns.booleanValue()) {
|
||||
if (cachePatterns == null || cachePatterns) {
|
||||
this.tokenizedPatternCache.put(pattern, tokenized);
|
||||
}
|
||||
}
|
||||
|
|
@ -458,7 +458,7 @@ public class AntPathMatcher implements PathMatcher {
|
|||
protected AntPathStringMatcher getStringMatcher(String pattern) {
|
||||
AntPathStringMatcher matcher = null;
|
||||
Boolean cachePatterns = this.cachePatterns;
|
||||
if (cachePatterns == null || cachePatterns.booleanValue()) {
|
||||
if (cachePatterns == null || cachePatterns) {
|
||||
matcher = this.stringMatcherCache.get(pattern);
|
||||
}
|
||||
if (matcher == null) {
|
||||
|
|
@ -470,7 +470,7 @@ public class AntPathMatcher implements PathMatcher {
|
|||
deactivatePatternCache();
|
||||
return matcher;
|
||||
}
|
||||
if (cachePatterns == null || cachePatterns.booleanValue()) {
|
||||
if (cachePatterns == null || cachePatterns) {
|
||||
this.stringMatcherCache.put(pattern, matcher);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -138,7 +138,7 @@ public class AutoPopulatingList<E> implements List<E>, Serializable {
|
|||
@Override
|
||||
public E get(int index) {
|
||||
int backingListSize = this.backingList.size();
|
||||
E element = null;
|
||||
E element;
|
||||
if (index < backingListSize) {
|
||||
element = this.backingList.get(index);
|
||||
if (element == null) {
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public abstract class Base64Utils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Base64-decode the given byte array from an UTF-8 String.
|
||||
* Base64-decode the given byte array from a UTF-8 String.
|
||||
* @param src the encoded UTF-8 String
|
||||
* @return the original byte array
|
||||
*/
|
||||
|
|
@ -120,7 +120,7 @@ public abstract class Base64Utils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Base64-decode the given byte array from an UTF-8 String using the RFC 4648
|
||||
* Base64-decode the given byte array from a UTF-8 String using the RFC 4648
|
||||
* "URL and Filename Safe Alphabet".
|
||||
* @param src the encoded UTF-8 String
|
||||
* @return the original byte array
|
||||
|
|
|
|||
|
|
@ -106,19 +106,19 @@ public abstract class ClassUtils {
|
|||
|
||||
/**
|
||||
* Map with primitive wrapper type as key and corresponding primitive
|
||||
* type as value, for example: Integer.class -> int.class.
|
||||
* type as value, for example: {@code Integer.class -> int.class}.
|
||||
*/
|
||||
private static final Map<Class<?>, Class<?>> primitiveWrapperTypeMap = new IdentityHashMap<>(9);
|
||||
|
||||
/**
|
||||
* Map with primitive type as key and corresponding wrapper
|
||||
* type as value, for example: int.class -> Integer.class.
|
||||
* type as value, for example: {@code int.class -> Integer.class}.
|
||||
*/
|
||||
private static final Map<Class<?>, Class<?>> primitiveTypeToWrapperMap = new IdentityHashMap<>(9);
|
||||
|
||||
/**
|
||||
* Map with primitive type name as key and corresponding primitive
|
||||
* type as value, for example: "int" -> "int.class".
|
||||
* type as value, for example: {@code "int" -> int.class}.
|
||||
*/
|
||||
private static final Map<String, Class<?>> primitiveTypeNameMap = new HashMap<>(32);
|
||||
|
||||
|
|
|
|||
|
|
@ -396,7 +396,6 @@ public final class ConcurrentLruCache<K, V> {
|
|||
|
||||
private final EvictionQueue<K, V> evictionQueue;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
ReadOperations(EvictionQueue<K, V> evictionQueue) {
|
||||
this.evictionQueue = evictionQueue;
|
||||
for (int i = 0; i < BUFFER_COUNT; i++) {
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(@Nullable Object key, final @Nullable Object value) {
|
||||
public boolean remove(@Nullable Object key, @Nullable final Object value) {
|
||||
Boolean result = doTask(key, new Task<Boolean>(TaskOption.RESTRUCTURE_AFTER, TaskOption.SKIP_IF_EMPTY) {
|
||||
@Override
|
||||
protected Boolean execute(@Nullable Reference<K, V> ref, @Nullable Entry<K, V> entry) {
|
||||
|
|
@ -334,7 +334,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean replace(@Nullable K key, final @Nullable V oldValue, final @Nullable V newValue) {
|
||||
public boolean replace(@Nullable K key, @Nullable final V oldValue, @Nullable final V newValue) {
|
||||
Boolean result = doTask(key, new Task<Boolean>(TaskOption.RESTRUCTURE_BEFORE, TaskOption.SKIP_IF_EMPTY) {
|
||||
@Override
|
||||
protected Boolean execute(@Nullable Reference<K, V> ref, @Nullable Entry<K, V> entry) {
|
||||
|
|
@ -350,7 +350,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
|||
|
||||
@Override
|
||||
@Nullable
|
||||
public V replace(@Nullable K key, final @Nullable V value) {
|
||||
public V replace(@Nullable K key, @Nullable final V value) {
|
||||
return doTask(key, new Task<V>(TaskOption.RESTRUCTURE_BEFORE, TaskOption.SKIP_IF_EMPTY) {
|
||||
@Override
|
||||
@Nullable
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -125,13 +125,13 @@ public abstract class DigestUtils {
|
|||
|
||||
private static byte[] digest(String algorithm, InputStream inputStream) throws IOException {
|
||||
MessageDigest messageDigest = getDigest(algorithm);
|
||||
if (inputStream instanceof UpdateMessageDigestInputStream digestIntputStream){
|
||||
digestIntputStream.updateMessageDigest(messageDigest);
|
||||
if (inputStream instanceof UpdateMessageDigestInputStream digestInputStream){
|
||||
digestInputStream.updateMessageDigest(messageDigest);
|
||||
return messageDigest.digest();
|
||||
}
|
||||
else {
|
||||
final byte[] buffer = new byte[StreamUtils.BUFFER_SIZE];
|
||||
int bytesRead = -1;
|
||||
int bytesRead;
|
||||
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||
messageDigest.update(buffer, 0, bytesRead);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,12 +84,13 @@ public abstract class FileSystemUtils {
|
|||
return false;
|
||||
}
|
||||
|
||||
Files.walkFileTree(root, new SimpleFileVisitor<Path>() {
|
||||
Files.walkFileTree(root, new SimpleFileVisitor<>() {
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
||||
Files.delete(file);
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
|
||||
Files.delete(dir);
|
||||
|
|
@ -126,12 +127,13 @@ public abstract class FileSystemUtils {
|
|||
BasicFileAttributes srcAttr = Files.readAttributes(src, BasicFileAttributes.class);
|
||||
|
||||
if (srcAttr.isDirectory()) {
|
||||
Files.walkFileTree(src, EnumSet.of(FOLLOW_LINKS), Integer.MAX_VALUE, new SimpleFileVisitor<Path>() {
|
||||
Files.walkFileTree(src, EnumSet.of(FOLLOW_LINKS), Integer.MAX_VALUE, new SimpleFileVisitor<>() {
|
||||
@Override
|
||||
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
|
||||
Files.createDirectories(dest.resolve(src.relativize(dir)));
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
||||
Files.copy(file, dest.resolve(src.relativize(file)), StandardCopyOption.REPLACE_EXISTING);
|
||||
|
|
|
|||
|
|
@ -102,7 +102,6 @@ public class MimeType implements Comparable<MimeType>, Serializable {
|
|||
|
||||
private final String subtype;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private final Map<String, String> parameters;
|
||||
|
||||
@Nullable
|
||||
|
|
@ -642,7 +641,7 @@ public class MimeType implements Comparable<MimeType>, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this {@code MimeType} is more less than the given type.
|
||||
* Indicates whether this {@code MimeType} is less specific than the given type.
|
||||
* <ol>
|
||||
* <li>if this mime type has a {@linkplain #isWildcardType() wildcard type},
|
||||
* and the other does not, then this method returns {@code true}.</li>
|
||||
|
|
@ -684,7 +683,7 @@ public class MimeType implements Comparable<MimeType>, Serializable {
|
|||
/**
|
||||
* Parse the given String value into a {@code MimeType} object,
|
||||
* with this method name following the 'valueOf' naming convention
|
||||
* (as supported by {@link org.springframework.core.convert.ConversionService}.
|
||||
* (as supported by {@link org.springframework.core.convert.ConversionService}).
|
||||
* @see MimeTypeUtils#parseMimeType(String)
|
||||
*/
|
||||
public static MimeType valueOf(String value) {
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ public abstract class ObjectUtils {
|
|||
return optional.isEmpty();
|
||||
}
|
||||
if (obj instanceof CharSequence charSequence) {
|
||||
return charSequence.length() == 0;
|
||||
return charSequence.isEmpty();
|
||||
}
|
||||
if (obj.getClass().isArray()) {
|
||||
return Array.getLength(obj) == 0;
|
||||
|
|
|
|||
|
|
@ -839,7 +839,7 @@ public abstract class StringUtils {
|
|||
* the {@link Locale#toString} format as well as BCP 47 language tags as
|
||||
* specified by {@link Locale#forLanguageTag}.
|
||||
* @param localeValue the locale value: following either {@code Locale's}
|
||||
* {@code toString()} format ("en", "en_UK", etc), also accepting spaces as
|
||||
* {@code toString()} format ("en", "en_UK", etc.), also accepting spaces as
|
||||
* separators (as an alternative to underscores), or BCP 47 (e.g. "en-UK")
|
||||
* @return a corresponding {@code Locale} instance, or {@code null} if none
|
||||
* @throws IllegalArgumentException in case of an invalid locale specification
|
||||
|
|
@ -868,7 +868,7 @@ public abstract class StringUtils {
|
|||
* <p><b>Note: This delegate does not accept the BCP 47 language tag format.
|
||||
* Please use {@link #parseLocale} for lenient parsing of both formats.</b>
|
||||
* @param localeString the locale {@code String}: following {@code Locale's}
|
||||
* {@code toString()} format ("en", "en_UK", etc), also accepting spaces as
|
||||
* {@code toString()} format ("en", "en_UK", etc.), also accepting spaces as
|
||||
* separators (as an alternative to underscores)
|
||||
* @return a corresponding {@code Locale} instance, or {@code null} if none
|
||||
* @throws IllegalArgumentException in case of an invalid locale specification
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -26,7 +26,6 @@ import org.springframework.lang.Nullable;
|
|||
* @since 2.5
|
||||
* @see org.springframework.beans.factory.config.ConfigurableBeanFactory#resolveAliases
|
||||
* @see org.springframework.beans.factory.config.BeanDefinitionVisitor#BeanDefinitionVisitor(StringValueResolver)
|
||||
* @see org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface StringValueResolver {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -35,13 +35,13 @@ import org.springframework.lang.Nullable;
|
|||
*/
|
||||
public abstract class SystemPropertyUtils {
|
||||
|
||||
/** Prefix for system property placeholders: "${". */
|
||||
/** Prefix for system property placeholders: {@value}. */
|
||||
public static final String PLACEHOLDER_PREFIX = "${";
|
||||
|
||||
/** Suffix for system property placeholders: "}". */
|
||||
/** Suffix for system property placeholders: {@value}. */
|
||||
public static final String PLACEHOLDER_SUFFIX = "}";
|
||||
|
||||
/** Value separator for system property placeholders: ":". */
|
||||
/** Value separator for system property placeholders: {@value}. */
|
||||
public static final String VALUE_SEPARATOR = ":";
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ final class UnmodifiableMultiValueMap<K,V> implements MultiValueMap<K,V>, Serial
|
|||
|
||||
private static final long serialVersionUID = -8697084563854098920L;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private final MultiValueMap<K, V> delegate;
|
||||
|
||||
@Nullable
|
||||
|
|
@ -266,7 +265,6 @@ final class UnmodifiableMultiValueMap<K,V> implements MultiValueMap<K,V>, Serial
|
|||
|
||||
private static final long serialVersionUID = 2407578793783925203L;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private final Set<Entry<K, List<V>>> delegate;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
@ -516,7 +514,6 @@ final class UnmodifiableMultiValueMap<K,V> implements MultiValueMap<K,V>, Serial
|
|||
|
||||
private static final long serialVersionUID = 5518377583904339588L;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private final Collection<List<V>> delegate;
|
||||
|
||||
public UnmodifiableValueCollection(Collection<List<V>> delegate) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -54,7 +54,7 @@ public abstract class ListenableFutureAdapter<T, S> extends FutureAdapter<T, S>
|
|||
@Override
|
||||
public void addCallback(final SuccessCallback<? super T> successCallback, final FailureCallback failureCallback) {
|
||||
ListenableFuture<S> listenableAdaptee = (ListenableFuture<S>) getAdaptee();
|
||||
listenableAdaptee.addCallback(new ListenableFutureCallback<S>() {
|
||||
listenableAdaptee.addCallback(new ListenableFutureCallback<>() {
|
||||
@Override
|
||||
public void onSuccess(@Nullable S result) {
|
||||
T adapted = null;
|
||||
|
|
@ -74,6 +74,7 @@ public abstract class ListenableFutureAdapter<T, S> extends FutureAdapter<T, S>
|
|||
}
|
||||
successCallback.onSuccess(adapted);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable ex) {
|
||||
failureCallback.onFailure(ex);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -55,7 +55,7 @@ public abstract class TransformerUtils {
|
|||
* <p>If the underlying XSLT engine is Xalan, then the special output key {@code indent-amount}
|
||||
* will be also be set to a value of {@link #DEFAULT_INDENT_AMOUNT} characters.
|
||||
* @param transformer the target transformer
|
||||
* @param indentAmount the size of the indent (2 characters, 3 characters, etc)
|
||||
* @param indentAmount the size of the indent (2 characters, 3 characters, etc.)
|
||||
* @see javax.xml.transform.Transformer#setOutputProperty(String, String)
|
||||
* @see javax.xml.transform.OutputKeys#INDENT
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue