diff --git a/spring-core/src/main/java/org/springframework/core/GenericTypeResolver.java b/spring-core/src/main/java/org/springframework/core/GenericTypeResolver.java index 812f47b0d2..ee57397f1d 100644 --- a/spring-core/src/main/java/org/springframework/core/GenericTypeResolver.java +++ b/spring-core/src/main/java/org/springframework/core/GenericTypeResolver.java @@ -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. diff --git a/spring-core/src/main/java/org/springframework/core/MethodParameter.java b/spring-core/src/main/java/org/springframework/core/MethodParameter.java index 9e56c8aca4..268184eab8 100644 --- a/spring-core/src/main/java/org/springframework/core/MethodParameter.java +++ b/spring-core/src/main/java/org/springframework/core/MethodParameter.java @@ -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. diff --git a/spring-core/src/main/java/org/springframework/core/NestedCheckedException.java b/spring-core/src/main/java/org/springframework/core/NestedCheckedException.java index 0278c299bc..9df1a3f537 100644 --- a/spring-core/src/main/java/org/springframework/core/NestedCheckedException.java +++ b/spring-core/src/main/java/org/springframework/core/NestedCheckedException.java @@ -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. diff --git a/spring-core/src/main/java/org/springframework/core/NestedRuntimeException.java b/spring-core/src/main/java/org/springframework/core/NestedRuntimeException.java index feec671f9f..2162c8b871 100644 --- a/spring-core/src/main/java/org/springframework/core/NestedRuntimeException.java +++ b/spring-core/src/main/java/org/springframework/core/NestedRuntimeException.java @@ -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. diff --git a/spring-core/src/main/java/org/springframework/core/OrderComparator.java b/spring-core/src/main/java/org/springframework/core/OrderComparator.java index adae87a28d..341ae09cb5 100644 --- a/spring-core/src/main/java/org/springframework/core/OrderComparator.java +++ b/spring-core/src/main/java/org/springframework/core/OrderComparator.java @@ -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. diff --git a/spring-core/src/main/java/org/springframework/core/SerializableTypeWrapper.java b/spring-core/src/main/java/org/springframework/core/SerializableTypeWrapper.java index 48508bc92d..46b4c28083 100644 --- a/spring-core/src/main/java/org/springframework/core/SerializableTypeWrapper.java +++ b/spring-core/src/main/java/org/springframework/core/SerializableTypeWrapper.java @@ -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. diff --git a/spring-core/src/main/java/org/springframework/core/codec/NettyByteBufDecoder.java b/spring-core/src/main/java/org/springframework/core/codec/NettyByteBufDecoder.java index 0946b9d058..569a5cc832 100644 --- a/spring-core/src/main/java/org/springframework/core/codec/NettyByteBufDecoder.java +++ b/spring-core/src/main/java/org/springframework/core/codec/NettyByteBufDecoder.java @@ -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. diff --git a/spring-core/src/main/java/org/springframework/core/codec/NettyByteBufEncoder.java b/spring-core/src/main/java/org/springframework/core/codec/NettyByteBufEncoder.java index 63d13c6061..da07d638aa 100644 --- a/spring-core/src/main/java/org/springframework/core/codec/NettyByteBufEncoder.java +++ b/spring-core/src/main/java/org/springframework/core/codec/NettyByteBufEncoder.java @@ -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. diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/ConversionServiceFactory.java b/spring-core/src/main/java/org/springframework/core/convert/support/ConversionServiceFactory.java index 7b9b697479..7275d31241 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/ConversionServiceFactory.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/ConversionServiceFactory.java @@ -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 { diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java b/spring-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java index 3a9f154787..ebb25c3130 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java @@ -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 and target type 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 diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/ObjectToObjectConverter.java b/spring-core/src/main/java/org/springframework/core/convert/support/ObjectToObjectConverter.java index e6ac777305..c4b30c4ec7 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/ObjectToObjectConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/ObjectToObjectConverter.java @@ -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; diff --git a/spring-core/src/main/java/org/springframework/core/env/PropertySourcesPropertyResolver.java b/spring-core/src/main/java/org/springframework/core/env/PropertySourcesPropertyResolver.java index 2e6351cb8a..b97fad8748 100644 --- a/spring-core/src/main/java/org/springframework/core/env/PropertySourcesPropertyResolver.java +++ b/spring-core/src/main/java/org/springframework/core/env/PropertySourcesPropertyResolver.java @@ -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. diff --git a/spring-core/src/main/java/org/springframework/core/io/VfsUtils.java b/spring-core/src/main/java/org/springframework/core/io/VfsUtils.java index ce80ffc31d..781712a224 100644 --- a/spring-core/src/main/java/org/springframework/core/io/VfsUtils.java +++ b/spring-core/src/main/java/org/springframework/core/io/VfsUtils.java @@ -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); } diff --git a/spring-core/src/main/java/org/springframework/core/io/buffer/DataBufferUtils.java b/spring-core/src/main/java/org/springframework/core/io/buffer/DataBufferUtils.java index bb402fbbfc..355f9a7f32 100644 --- a/spring-core/src/main/java/org/springframework/core/io/buffer/DataBufferUtils.java +++ b/spring-core/src/main/java/org/springframework/core/io/buffer/DataBufferUtils.java @@ -480,8 +480,8 @@ public abstract class DataBufferUtils { */ @SuppressWarnings("unchecked") public static 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 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; diff --git a/spring-core/src/main/java/org/springframework/core/io/buffer/NettyDataBufferFactory.java b/spring-core/src/main/java/org/springframework/core/io/buffer/NettyDataBufferFactory.java index 30411d072c..2fb09959f8 100644 --- a/spring-core/src/main/java/org/springframework/core/io/buffer/NettyDataBufferFactory.java +++ b/spring-core/src/main/java/org/springframework/core/io/buffer/NettyDataBufferFactory.java @@ -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. diff --git a/spring-core/src/main/java/org/springframework/core/io/support/ResourcePatternUtils.java b/spring-core/src/main/java/org/springframework/core/io/support/ResourcePatternUtils.java index 42df0104dc..c6c778430b 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/ResourcePatternUtils.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/ResourcePatternUtils.java @@ -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. diff --git a/spring-core/src/main/java/org/springframework/core/style/DefaultValueStyler.java b/spring-core/src/main/java/org/springframework/core/style/DefaultValueStyler.java index 3fcf698108..6d5bdad45a 100644 --- a/spring-core/src/main/java/org/springframework/core/style/DefaultValueStyler.java +++ b/spring-core/src/main/java/org/springframework/core/style/DefaultValueStyler.java @@ -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. diff --git a/spring-core/src/main/java/org/springframework/core/task/support/TaskExecutorAdapter.java b/spring-core/src/main/java/org/springframework/core/task/support/TaskExecutorAdapter.java index 4cb53b0ec8..6d6454aec8 100644 --- a/spring-core/src/main/java/org/springframework/core/task/support/TaskExecutorAdapter.java +++ b/spring-core/src/main/java/org/springframework/core/task/support/TaskExecutorAdapter.java @@ -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 future = new FutureTask<>(task, null); @@ -126,8 +126,8 @@ public class TaskExecutorAdapter implements AsyncListenableTaskExecutor { public Future submit(Callable 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 future = new FutureTask<>(task); diff --git a/spring-core/src/main/java/org/springframework/core/type/classreading/CachingMetadataReaderFactory.java b/spring-core/src/main/java/org/springframework/core/type/classreading/CachingMetadataReaderFactory.java index 03f784153c..9d9956fcf2 100644 --- a/spring-core/src/main/java/org/springframework/core/type/classreading/CachingMetadataReaderFactory.java +++ b/spring-core/src/main/java/org/springframework/core/type/classreading/CachingMetadataReaderFactory.java @@ -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); diff --git a/spring-core/src/main/java/org/springframework/core/type/classreading/MergedAnnotationReadingVisitor.java b/spring-core/src/main/java/org/springframework/core/type/classreading/MergedAnnotationReadingVisitor.java index 643b8264b5..e3af278bd7 100644 --- a/spring-core/src/main/java/org/springframework/core/type/classreading/MergedAnnotationReadingVisitor.java +++ b/spring-core/src/main/java/org/springframework/core/type/classreading/MergedAnnotationReadingVisitor.java @@ -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 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 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 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(); } diff --git a/spring-core/src/main/java/org/springframework/util/DigestUtils.java b/spring-core/src/main/java/org/springframework/util/DigestUtils.java index 39a761602b..63554c65b2 100644 --- a/spring-core/src/main/java/org/springframework/util/DigestUtils.java +++ b/spring-core/src/main/java/org/springframework/util/DigestUtils.java @@ -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 { diff --git a/spring-core/src/main/java/org/springframework/util/LinkedCaseInsensitiveMap.java b/spring-core/src/main/java/org/springframework/util/LinkedCaseInsensitiveMap.java index f5ca1f50b9..12b26b904a 100644 --- a/spring-core/src/main/java/org/springframework/util/LinkedCaseInsensitiveMap.java +++ b/spring-core/src/main/java/org/springframework/util/LinkedCaseInsensitiveMap.java @@ -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. diff --git a/spring-core/src/main/java/org/springframework/util/NumberUtils.java b/spring-core/src/main/java/org/springframework/util/NumberUtils.java index 09ddb6d929..61df19ff7d 100644 --- a/spring-core/src/main/java/org/springframework/util/NumberUtils.java +++ b/spring-core/src/main/java/org/springframework/util/NumberUtils.java @@ -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. diff --git a/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java b/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java index 83e0bc9f3b..18dd5396df 100644 --- a/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java +++ b/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java @@ -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 { *

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); } diff --git a/spring-core/src/main/java/org/springframework/util/comparator/NullSafeComparator.java b/spring-core/src/main/java/org/springframework/util/comparator/NullSafeComparator.java index 0a831d7752..50e4745e06 100644 --- a/spring-core/src/main/java/org/springframework/util/comparator/NullSafeComparator.java +++ b/spring-core/src/main/java/org/springframework/util/comparator/NullSafeComparator.java @@ -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 implements Comparator { 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 diff --git a/spring-core/src/main/java/org/springframework/util/xml/DomContentHandler.java b/spring-core/src/main/java/org/springframework/util/xml/DomContentHandler.java index 7405e0b90e..5c7e458d29 100644 --- a/spring-core/src/main/java/org/springframework/util/xml/DomContentHandler.java +++ b/spring-core/src/main/java/org/springframework/util/xml/DomContentHandler.java @@ -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. diff --git a/spring-core/src/main/java/org/springframework/util/xml/StaxUtils.java b/spring-core/src/main/java/org/springframework/util/xml/StaxUtils.java index bb8807cd64..eeac7ec8a3 100644 --- a/spring-core/src/main/java/org/springframework/util/xml/StaxUtils.java +++ b/spring-core/src/main/java/org/springframework/util/xml/StaxUtils.java @@ -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. diff --git a/spring-core/src/test/java/org/springframework/core/io/buffer/DataBufferUtilsTests.java b/spring-core/src/test/java/org/springframework/core/io/buffer/DataBufferUtilsTests.java index fb1b9c8700..94bfb409a9 100644 --- a/spring-core/src/test/java/org/springframework/core/io/buffer/DataBufferUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/core/io/buffer/DataBufferUtilsTests.java @@ -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); } }