Polish contribution
See gh-28188
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -47,14 +47,14 @@ public final class ConversionServiceFactory {
|
||||
*/
|
||||
public static void registerConverters(@Nullable Set<?> converters, ConverterRegistry registry) {
|
||||
if (converters != null) {
|
||||
for (Object converter : converters) {
|
||||
if (converter instanceof GenericConverter genericConverter) {
|
||||
for (Object candidate : converters) {
|
||||
if (candidate instanceof GenericConverter genericConverter) {
|
||||
registry.addConverter(genericConverter);
|
||||
}
|
||||
else if (converter instanceof Converter<?, ?> iConverter) {
|
||||
registry.addConverter(iConverter);
|
||||
else if (candidate instanceof Converter<?, ?> converter) {
|
||||
registry.addConverter(converter);
|
||||
}
|
||||
else if (converter instanceof ConverterFactory<?, ?> converterFactory) {
|
||||
else if (candidate instanceof ConverterFactory<?, ?> converterFactory) {
|
||||
registry.addConverterFactory(converterFactory);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -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.
|
||||
@@ -110,8 +110,8 @@ public class GenericConversionService implements ConfigurableConversionService {
|
||||
@Override
|
||||
public void addConverterFactory(ConverterFactory<?, ?> factory) {
|
||||
ResolvableType[] typeInfo = getRequiredTypeInfo(factory.getClass(), ConverterFactory.class);
|
||||
if (typeInfo == null && factory instanceof DecoratingProxy proxy) {
|
||||
typeInfo = getRequiredTypeInfo(proxy.getDecoratedClass(), ConverterFactory.class);
|
||||
if (typeInfo == null && factory instanceof DecoratingProxy decoratingProxy) {
|
||||
typeInfo = getRequiredTypeInfo(decoratingProxy.getDecoratedClass(), ConverterFactory.class);
|
||||
}
|
||||
if (typeInfo == null) {
|
||||
throw new IllegalArgumentException("Unable to determine source type <S> and target type <T> for your " +
|
||||
@@ -373,8 +373,8 @@ public class GenericConversionService implements ConfigurableConversionService {
|
||||
!this.targetType.hasUnresolvableGenerics()) {
|
||||
return false;
|
||||
}
|
||||
return !(this.converter instanceof ConditionalConverter converter) ||
|
||||
converter.matches(sourceType, targetType);
|
||||
return !(this.converter instanceof ConditionalConverter conditionalConverter) ||
|
||||
conditionalConverter.matches(sourceType, targetType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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.
|
||||
@@ -101,9 +101,9 @@ final class ObjectToObjectConverter implements ConditionalGenericConverter {
|
||||
return method.invoke(null, source);
|
||||
}
|
||||
}
|
||||
else if (member instanceof Constructor<?> ctor) {
|
||||
ReflectionUtils.makeAccessible(ctor);
|
||||
return ctor.newInstance(source);
|
||||
else if (member instanceof Constructor<?> constructor) {
|
||||
ReflectionUtils.makeAccessible(constructor);
|
||||
return constructor.newInstance(source);
|
||||
}
|
||||
}
|
||||
catch (InvocationTargetException ex) {
|
||||
@@ -155,8 +155,8 @@ final class ObjectToObjectConverter implements ConditionalGenericConverter {
|
||||
ClassUtils.isAssignable(method.getDeclaringClass(), sourceClass) :
|
||||
method.getParameterTypes()[0] == sourceClass);
|
||||
}
|
||||
else if (member instanceof Constructor<?> ctor) {
|
||||
return (ctor.getParameterTypes()[0] == sourceClass);
|
||||
else if (member instanceof Constructor<?> constructor) {
|
||||
return (constructor.getParameterTypes()[0] == sourceClass);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
|
||||
@@ -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.
|
||||
@@ -103,8 +103,8 @@ public abstract class VfsUtils {
|
||||
}
|
||||
catch (InvocationTargetException ex) {
|
||||
Throwable targetEx = ex.getTargetException();
|
||||
if (targetEx instanceof IOException exception) {
|
||||
throw exception;
|
||||
if (targetEx instanceof IOException ioException) {
|
||||
throw ioException;
|
||||
}
|
||||
ReflectionUtils.handleInvocationTargetException(ex);
|
||||
}
|
||||
|
||||
@@ -480,8 +480,8 @@ public abstract class DataBufferUtils {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T extends DataBuffer> T retain(T dataBuffer) {
|
||||
if (dataBuffer instanceof PooledDataBuffer buffer) {
|
||||
return (T) buffer.retain();
|
||||
if (dataBuffer instanceof PooledDataBuffer pooledDataBuffer) {
|
||||
return (T) pooledDataBuffer.retain();
|
||||
}
|
||||
else {
|
||||
return dataBuffer;
|
||||
@@ -498,8 +498,8 @@ public abstract class DataBufferUtils {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T extends DataBuffer> T touch(T dataBuffer, Object hint) {
|
||||
if (dataBuffer instanceof PooledDataBuffer buffer) {
|
||||
return (T) buffer.touch(hint);
|
||||
if (dataBuffer instanceof PooledDataBuffer pooledDataBuffer) {
|
||||
return (T) pooledDataBuffer.touch(hint);
|
||||
}
|
||||
else {
|
||||
return dataBuffer;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -107,8 +107,8 @@ public class TaskExecutorAdapter implements AsyncListenableTaskExecutor {
|
||||
public Future<?> submit(Runnable task) {
|
||||
try {
|
||||
if (this.taskDecorator == null &&
|
||||
this.concurrentExecutor instanceof ExecutorService executor) {
|
||||
return executor.submit(task);
|
||||
this.concurrentExecutor instanceof ExecutorService executorService) {
|
||||
return executorService.submit(task);
|
||||
}
|
||||
else {
|
||||
FutureTask<Object> future = new FutureTask<>(task, null);
|
||||
@@ -126,8 +126,8 @@ public class TaskExecutorAdapter implements AsyncListenableTaskExecutor {
|
||||
public <T> Future<T> submit(Callable<T> task) {
|
||||
try {
|
||||
if (this.taskDecorator == null &&
|
||||
this.concurrentExecutor instanceof ExecutorService executor) {
|
||||
return executor.submit(task);
|
||||
this.concurrentExecutor instanceof ExecutorService executorService) {
|
||||
return executorService.submit(task);
|
||||
}
|
||||
else {
|
||||
FutureTask<T> future = new FutureTask<>(task);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -73,8 +73,8 @@ public class CachingMetadataReaderFactory extends SimpleMetadataReaderFactory {
|
||||
*/
|
||||
public CachingMetadataReaderFactory(@Nullable ResourceLoader resourceLoader) {
|
||||
super(resourceLoader);
|
||||
if (resourceLoader instanceof DefaultResourceLoader loader) {
|
||||
this.metadataReaderCache = loader.getResourceCache(MetadataReader.class);
|
||||
if (resourceLoader instanceof DefaultResourceLoader defaultResourceLoader) {
|
||||
this.metadataReaderCache = defaultResourceLoader.getResourceCache(MetadataReader.class);
|
||||
}
|
||||
else {
|
||||
setCacheLimit(DEFAULT_CACHE_LIMIT);
|
||||
@@ -92,8 +92,8 @@ public class CachingMetadataReaderFactory extends SimpleMetadataReaderFactory {
|
||||
if (cacheLimit <= 0) {
|
||||
this.metadataReaderCache = null;
|
||||
}
|
||||
else if (this.metadataReaderCache instanceof LocalResourceCache cache) {
|
||||
cache.setCacheLimit(cacheLimit);
|
||||
else if (this.metadataReaderCache instanceof LocalResourceCache localResourceCache) {
|
||||
localResourceCache.setCacheLimit(cacheLimit);
|
||||
}
|
||||
else {
|
||||
this.metadataReaderCache = new LocalResourceCache(cacheLimit);
|
||||
@@ -104,8 +104,8 @@ public class CachingMetadataReaderFactory extends SimpleMetadataReaderFactory {
|
||||
* Return the maximum number of entries for the MetadataReader cache.
|
||||
*/
|
||||
public int getCacheLimit() {
|
||||
if (this.metadataReaderCache instanceof LocalResourceCache cache) {
|
||||
return cache.getCacheLimit();
|
||||
if (this.metadataReaderCache instanceof LocalResourceCache localResourceCache) {
|
||||
return localResourceCache.getCacheLimit();
|
||||
}
|
||||
else {
|
||||
return (this.metadataReaderCache != null ? Integer.MAX_VALUE : 0);
|
||||
|
||||
@@ -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.
|
||||
@@ -68,8 +68,8 @@ class MergedAnnotationReadingVisitor<A extends Annotation> extends AnnotationVis
|
||||
|
||||
@Override
|
||||
public void visit(String name, Object value) {
|
||||
if (value instanceof Type typeObject) {
|
||||
value = typeObject.getClassName();
|
||||
if (value instanceof Type type) {
|
||||
value = type.getClassName();
|
||||
}
|
||||
this.attributes.put(name, value);
|
||||
}
|
||||
@@ -158,8 +158,8 @@ class MergedAnnotationReadingVisitor<A extends Annotation> extends AnnotationVis
|
||||
|
||||
@Override
|
||||
public void visit(String name, Object value) {
|
||||
if (value instanceof Type typeObject) {
|
||||
value = typeObject.getClassName();
|
||||
if (value instanceof Type type) {
|
||||
value = type.getClassName();
|
||||
}
|
||||
this.elements.add(value);
|
||||
}
|
||||
@@ -187,8 +187,8 @@ class MergedAnnotationReadingVisitor<A extends Annotation> extends AnnotationVis
|
||||
return Object.class;
|
||||
}
|
||||
Object firstElement = this.elements.get(0);
|
||||
if (firstElement instanceof Enum<?> enumObject) {
|
||||
return enumObject.getDeclaringClass();
|
||||
if (firstElement instanceof Enum<?> enumeration) {
|
||||
return enumeration.getDeclaringClass();
|
||||
}
|
||||
return firstElement.getClass();
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -125,8 +125,8 @@ public abstract class DigestUtils {
|
||||
|
||||
private static byte[] digest(String algorithm, InputStream inputStream) throws IOException {
|
||||
MessageDigest messageDigest = getDigest(algorithm);
|
||||
if (inputStream instanceof UpdateMessageDigestInputStream stream){
|
||||
stream.updateMessageDigest(messageDigest);
|
||||
if (inputStream instanceof UpdateMessageDigestInputStream digestIntputStream){
|
||||
digestIntputStream.updateMessageDigest(messageDigest);
|
||||
return messageDigest.digest();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
@@ -106,11 +106,11 @@ public abstract class ReflectionUtils {
|
||||
if (ex instanceof IllegalAccessException) {
|
||||
throw new IllegalStateException("Could not access method or field: " + ex.getMessage());
|
||||
}
|
||||
if (ex instanceof InvocationTargetException exception) {
|
||||
handleInvocationTargetException(exception);
|
||||
if (ex instanceof InvocationTargetException invocationTargetException) {
|
||||
handleInvocationTargetException(invocationTargetException);
|
||||
}
|
||||
if (ex instanceof RuntimeException rex) {
|
||||
throw rex;
|
||||
if (ex instanceof RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
throw new UndeclaredThrowableException(ex);
|
||||
}
|
||||
@@ -138,8 +138,8 @@ public abstract class ReflectionUtils {
|
||||
* @throws RuntimeException the rethrown exception
|
||||
*/
|
||||
public static void rethrowRuntimeException(Throwable ex) {
|
||||
if (ex instanceof RuntimeException rex) {
|
||||
throw rex;
|
||||
if (ex instanceof RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
if (ex instanceof Error error) {
|
||||
throw error;
|
||||
@@ -155,17 +155,17 @@ public abstract class ReflectionUtils {
|
||||
* <p>Rethrows the underlying exception cast to an {@link Exception} or
|
||||
* {@link Error} if appropriate; otherwise, throws an
|
||||
* {@link UndeclaredThrowableException}.
|
||||
* @param ex the exception to rethrow
|
||||
* @param throwable the exception to rethrow
|
||||
* @throws Exception the rethrown exception (in case of a checked exception)
|
||||
*/
|
||||
public static void rethrowException(Throwable ex) throws Exception {
|
||||
if (ex instanceof Exception e) {
|
||||
throw e;
|
||||
public static void rethrowException(Throwable throwable) throws Exception {
|
||||
if (throwable instanceof Exception exception) {
|
||||
throw exception;
|
||||
}
|
||||
if (ex instanceof Error error) {
|
||||
if (throwable instanceof Error error) {
|
||||
throw error;
|
||||
}
|
||||
throw new UndeclaredThrowableException(ex);
|
||||
throw new UndeclaredThrowableException(throwable);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -112,11 +112,11 @@ public class NullSafeComparator<T> implements Comparator<T> {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof NullSafeComparator<?> nullSafeComparator)) {
|
||||
if (!(other instanceof NullSafeComparator<?> otherComparator)) {
|
||||
return false;
|
||||
}
|
||||
return this.nonNullComparator.equals(nullSafeComparator.nonNullComparator)
|
||||
&& this.nullsLow == nullSafeComparator.nullsLow;
|
||||
return (this.nonNullComparator.equals(otherComparator.nonNullComparator)
|
||||
&& this.nullsLow == otherComparator.nullsLow);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 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.
|
||||
|
||||
@@ -769,8 +769,8 @@ class DataBufferUtilsTests extends AbstractDataBufferAllocatingTests {
|
||||
}
|
||||
|
||||
private static void assertReleased(DataBuffer dataBuffer) {
|
||||
if (dataBuffer instanceof NettyDataBuffer) {
|
||||
ByteBuf byteBuf = ((NettyDataBuffer) dataBuffer).getNativeBuffer();
|
||||
if (dataBuffer instanceof NettyDataBuffer nettyDataBuffer) {
|
||||
ByteBuf byteBuf = nettyDataBuffer.getNativeBuffer();
|
||||
assertThat(byteBuf.refCnt()).isEqualTo(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user