diff --git a/src/main/java/org/springframework/classify/BackToBackPatternClassifier.java b/src/main/java/org/springframework/classify/BackToBackPatternClassifier.java index 5929fb8..4c86be5 100644 --- a/src/main/java/org/springframework/classify/BackToBackPatternClassifier.java +++ b/src/main/java/org/springframework/classify/BackToBackPatternClassifier.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-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. @@ -56,7 +56,7 @@ public class BackToBackPatternClassifier implements Classifier { * @param map maps pattern keys with wildcards to output values */ public void setMatcherMap(Map map) { - this.matcher = new PatternMatchingClassifier(map); + this.matcher = new PatternMatchingClassifier<>(map); } /** @@ -67,7 +67,7 @@ public class BackToBackPatternClassifier implements Classifier { * @param delegate the delegate object used to create a router classifier */ public void setRouterDelegate(Object delegate) { - this.router = new ClassifierAdapter(delegate); + this.router = new ClassifierAdapter<>(delegate); } /** diff --git a/src/main/java/org/springframework/classify/BinaryExceptionClassifier.java b/src/main/java/org/springframework/classify/BinaryExceptionClassifier.java index 8e0dbf0..8e3ccd3 100644 --- a/src/main/java/org/springframework/classify/BinaryExceptionClassifier.java +++ b/src/main/java/org/springframework/classify/BinaryExceptionClassifier.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2019 the original author or authors. + * Copyright 2006-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. @@ -64,7 +64,7 @@ public class BinaryExceptionClassifier extends SubclassClassifier> exceptionClasses, boolean value) { this(!value); if (exceptionClasses != null) { - Map, Boolean> map = new HashMap, Boolean>(); + Map, Boolean> map = new HashMap<>(); for (Class type : exceptionClasses) { map.put(type, !getDefault()); } diff --git a/src/main/java/org/springframework/classify/BinaryExceptionClassifierBuilder.java b/src/main/java/org/springframework/classify/BinaryExceptionClassifierBuilder.java index 838209f..949c13a 100644 --- a/src/main/java/org/springframework/classify/BinaryExceptionClassifierBuilder.java +++ b/src/main/java/org/springframework/classify/BinaryExceptionClassifierBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 the original author or authors. + * Copyright 2006-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. @@ -52,7 +52,7 @@ public class BinaryExceptionClassifierBuilder { private boolean traverseCauses = false; - private List> exceptionClasses = new ArrayList>(); + private List> exceptionClasses = new ArrayList<>(); public BinaryExceptionClassifierBuilder retryOn(Class throwable) { Assert.isTrue(isWhiteList == null || isWhiteList, "Please use only retryOn() or only notRetryOn()"); diff --git a/src/main/java/org/springframework/classify/PatternMatcher.java b/src/main/java/org/springframework/classify/PatternMatcher.java index 8cf20c1..2c71c99 100644 --- a/src/main/java/org/springframework/classify/PatternMatcher.java +++ b/src/main/java/org/springframework/classify/PatternMatcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-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. @@ -31,9 +31,9 @@ import org.springframework.util.Assert; */ public class PatternMatcher { - private Map map = new HashMap(); + private Map map = new HashMap<>(); - private List sorted = new ArrayList(); + private List sorted = new ArrayList<>(); /** * Initialize a new {@link PatternMatcher} with a map of patterns to values @@ -43,7 +43,7 @@ public class PatternMatcher { super(); this.map = map; // Sort keys to start with the most specific - this.sorted = new ArrayList(map.keySet()); + this.sorted = new ArrayList<>(map.keySet()); Collections.sort(this.sorted, new Comparator() { @Override public int compare(String o1, String o2) { diff --git a/src/main/java/org/springframework/classify/PatternMatchingClassifier.java b/src/main/java/org/springframework/classify/PatternMatchingClassifier.java index 91b049a..db4ad16 100644 --- a/src/main/java/org/springframework/classify/PatternMatchingClassifier.java +++ b/src/main/java/org/springframework/classify/PatternMatchingClassifier.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-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. @@ -37,7 +37,7 @@ public class PatternMatchingClassifier implements Classifier { * classifier, otherwise all inputs will cause an exception. */ public PatternMatchingClassifier() { - this(new HashMap()); + this(new HashMap<>()); } /** @@ -47,7 +47,7 @@ public class PatternMatchingClassifier implements Classifier { */ public PatternMatchingClassifier(Map values) { super(); - this.values = new PatternMatcher(values); + this.values = new PatternMatcher<>(values); } /** @@ -55,7 +55,7 @@ public class PatternMatchingClassifier implements Classifier { * @param values the pattern map to set */ public void setPatternMap(Map values) { - this.values = new PatternMatcher(values); + this.values = new PatternMatcher<>(values); } /** diff --git a/src/main/java/org/springframework/classify/SubclassClassifier.java b/src/main/java/org/springframework/classify/SubclassClassifier.java index c4637ac..c8d9a73 100644 --- a/src/main/java/org/springframework/classify/SubclassClassifier.java +++ b/src/main/java/org/springframework/classify/SubclassClassifier.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2013 the original author or authors. + * Copyright 2006-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. @@ -35,7 +35,7 @@ import java.util.concurrent.ConcurrentMap; @SuppressWarnings("serial") public class SubclassClassifier implements Classifier { - private ConcurrentMap, C> classified = new ConcurrentHashMap, C>(); + private ConcurrentMap, C> classified = new ConcurrentHashMap<>(); private C defaultValue = null; @@ -52,7 +52,7 @@ public class SubclassClassifier implements Classifier { * @param defaultValue the default value */ public SubclassClassifier(C defaultValue) { - this(new HashMap, C>(), defaultValue); + this(new HashMap<>(), defaultValue); } /** @@ -62,7 +62,7 @@ public class SubclassClassifier implements Classifier { */ public SubclassClassifier(Map, C> typeMap, C defaultValue) { super(); - this.classified = new ConcurrentHashMap, C>(typeMap); + this.classified = new ConcurrentHashMap<>(typeMap); this.defaultValue = defaultValue; } @@ -82,7 +82,7 @@ public class SubclassClassifier implements Classifier { * @param map a map from type to class */ public void setTypeMap(Map, C> map) { - this.classified = new ConcurrentHashMap, C>(map); + this.classified = new ConcurrentHashMap<>(map); } /** diff --git a/src/main/java/org/springframework/classify/util/AnnotationMethodResolver.java b/src/main/java/org/springframework/classify/util/AnnotationMethodResolver.java index f682259..4e5b5ba 100644 --- a/src/main/java/org/springframework/classify/util/AnnotationMethodResolver.java +++ b/src/main/java/org/springframework/classify/util/AnnotationMethodResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2006-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. @@ -79,7 +79,7 @@ public class AnnotationMethodResolver implements MethodResolver { */ public Method findMethod(final Class clazz) { Assert.notNull(clazz, "class must not be null"); - final AtomicReference annotatedMethod = new AtomicReference(); + final AtomicReference annotatedMethod = new AtomicReference<>(); ReflectionUtils.doWithMethods(clazz, new ReflectionUtils.MethodCallback() { public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { Annotation annotation = AnnotationUtils.findAnnotation(method, annotationType); diff --git a/src/main/java/org/springframework/classify/util/MethodInvokerUtils.java b/src/main/java/org/springframework/classify/util/MethodInvokerUtils.java index b6637ff..ccdffca 100644 --- a/src/main/java/org/springframework/classify/util/MethodInvokerUtils.java +++ b/src/main/java/org/springframework/classify/util/MethodInvokerUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2006-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. @@ -159,7 +159,7 @@ public class MethodInvokerUtils { // Proxy with no target cannot have annotations return null; } - final AtomicReference annotatedMethod = new AtomicReference(); + final AtomicReference annotatedMethod = new AtomicReference<>(); ReflectionUtils.doWithMethods(targetClass, new ReflectionUtils.MethodCallback() { public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { Annotation annotation = AnnotationUtils.findAnnotation(method, annotationType); @@ -188,7 +188,7 @@ public class MethodInvokerUtils { * @param the C */ public static MethodInvoker getMethodInvokerForSingleArgument(Object target) { - final AtomicReference methodHolder = new AtomicReference(); + final AtomicReference methodHolder = new AtomicReference<>(); ReflectionUtils.doWithMethods(target.getClass(), new ReflectionUtils.MethodCallback() { public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { if ((method.getModifiers() & Modifier.PUBLIC) == 0 || method.isBridge()) { diff --git a/src/main/java/org/springframework/retry/annotation/AnnotationAwareRetryOperationsInterceptor.java b/src/main/java/org/springframework/retry/annotation/AnnotationAwareRetryOperationsInterceptor.java index a06b960..bc0dc47 100644 --- a/src/main/java/org/springframework/retry/annotation/AnnotationAwareRetryOperationsInterceptor.java +++ b/src/main/java/org/springframework/retry/annotation/AnnotationAwareRetryOperationsInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2006-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. @@ -89,7 +89,7 @@ public class AnnotationAwareRetryOperationsInterceptor implements IntroductionIn private final StandardEvaluationContext evaluationContext = new StandardEvaluationContext(); - private final ConcurrentReferenceHashMap> delegates = new ConcurrentReferenceHashMap>(); + private final ConcurrentReferenceHashMap> delegates = new ConcurrentReferenceHashMap<>(); private RetryContextCache retryContextCache = new MapRetryContextCache(); @@ -137,7 +137,7 @@ public class AnnotationAwareRetryOperationsInterceptor implements IntroductionIn * @param globalListeners the default listeners */ public void setListeners(Collection globalListeners) { - ArrayList retryListeners = new ArrayList(globalListeners); + ArrayList retryListeners = new ArrayList<>(globalListeners); AnnotationAwareOrderComparator.sort(retryListeners); this.globalListeners = retryListeners.toArray(new RetryListener[0]); } @@ -167,7 +167,7 @@ public class AnnotationAwareRetryOperationsInterceptor implements IntroductionIn private MethodInterceptor getDelegate(Object target, Method method) { ConcurrentMap cachedMethods = this.delegates.get(target); if (cachedMethods == null) { - cachedMethods = new ConcurrentHashMap(); + cachedMethods = new ConcurrentHashMap<>(); } MethodInterceptor delegate = cachedMethods.get(method); if (delegate == null) { @@ -310,7 +310,7 @@ public class AnnotationAwareRetryOperationsInterceptor implements IntroductionIn if (!foundRecoverable.get()) { return null; } - return new RecoverAnnotationRecoveryHandler(target, method); + return new RecoverAnnotationRecoveryHandler<>(target, method); } private RetryPolicy getRetryPolicy(Annotation retryable) { @@ -345,7 +345,7 @@ public class AnnotationAwareRetryOperationsInterceptor implements IntroductionIn simple.setMaxAttempts(maxAttempts); return simple; } - Map, Boolean> policyMap = new HashMap, Boolean>(); + Map, Boolean> policyMap = new HashMap<>(); for (Class type : includes) { policyMap.put(type, true); } diff --git a/src/main/java/org/springframework/retry/annotation/RecoverAnnotationRecoveryHandler.java b/src/main/java/org/springframework/retry/annotation/RecoverAnnotationRecoveryHandler.java index dcbc7be..0b1d866 100644 --- a/src/main/java/org/springframework/retry/annotation/RecoverAnnotationRecoveryHandler.java +++ b/src/main/java/org/springframework/retry/annotation/RecoverAnnotationRecoveryHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 the original author or authors. + * Copyright 2006-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. @@ -56,9 +56,9 @@ import org.springframework.util.StringUtils; */ public class RecoverAnnotationRecoveryHandler implements MethodInvocationRecoverer { - private final SubclassClassifier classifier = new SubclassClassifier(); + private final SubclassClassifier classifier = new SubclassClassifier<>(); - private final Map methods = new HashMap(); + private final Map methods = new HashMap<>(); private final Object target; @@ -197,7 +197,7 @@ public class RecoverAnnotationRecoveryHandler implements MethodInvocationReco } private void init(final Object target, Method method) { - final Map, Method> types = new HashMap, Method>(); + final Map, Method> types = new HashMap<>(); final Method failingMethod = method; Retryable retryable = AnnotationUtils.findAnnotation(method, Retryable.class); if (retryable != null) { @@ -284,7 +284,7 @@ public class RecoverAnnotationRecoveryHandler implements MethodInvocationReco } private void optionallyFilterMethodsBy(Class returnClass) { - Map filteredMethods = new HashMap(); + Map filteredMethods = new HashMap<>(); for (Method method : this.methods.keySet()) { if (method.getReturnType() == returnClass) { filteredMethods.put(method, this.methods.get(method)); diff --git a/src/main/java/org/springframework/retry/annotation/RetryConfiguration.java b/src/main/java/org/springframework/retry/annotation/RetryConfiguration.java index cae4c3b..ce23ae1 100644 --- a/src/main/java/org/springframework/retry/annotation/RetryConfiguration.java +++ b/src/main/java/org/springframework/retry/annotation/RetryConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2006-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. @@ -94,7 +94,7 @@ public class RetryConfiguration extends AbstractPointcutAdvisor this.newMethodArgumentsIdentifier = findBean(NewMethodArgumentsIdentifier.class); this.retryListeners = findBeans(RetryListener.class); this.sleeper = findBean(Sleeper.class); - Set> retryableAnnotationTypes = new LinkedHashSet>(1); + Set> retryableAnnotationTypes = new LinkedHashSet<>(1); retryableAnnotationTypes.add(Retryable.class); this.pointcut = buildPointcut(retryableAnnotationTypes); this.advice = buildAdvice(); @@ -107,7 +107,7 @@ public class RetryConfiguration extends AbstractPointcutAdvisor if (this.beanFactory instanceof ListableBeanFactory) { ListableBeanFactory listable = (ListableBeanFactory) this.beanFactory; if (listable.getBeanNamesForType(type).length > 0) { - ArrayList list = new ArrayList(listable.getBeansOfType(type, false, false).values()); + ArrayList list = new ArrayList<>(listable.getBeansOfType(type, false, false).values()); OrderComparator.sort(list); return list; } diff --git a/src/main/java/org/springframework/retry/policy/CompositeRetryPolicy.java b/src/main/java/org/springframework/retry/policy/CompositeRetryPolicy.java index 50eebae..6796178 100644 --- a/src/main/java/org/springframework/retry/policy/CompositeRetryPolicy.java +++ b/src/main/java/org/springframework/retry/policy/CompositeRetryPolicy.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-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. @@ -123,7 +123,7 @@ public class CompositeRetryPolicy implements RetryPolicy { */ @Override public RetryContext open(RetryContext parent) { - List list = new ArrayList(); + List list = new ArrayList<>(); for (RetryPolicy policy : this.policies) { list.add(policy.open(parent)); } diff --git a/src/main/java/org/springframework/retry/policy/ExceptionClassifierRetryPolicy.java b/src/main/java/org/springframework/retry/policy/ExceptionClassifierRetryPolicy.java index 8f599ee..6274175 100644 --- a/src/main/java/org/springframework/retry/policy/ExceptionClassifierRetryPolicy.java +++ b/src/main/java/org/springframework/retry/policy/ExceptionClassifierRetryPolicy.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-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. @@ -37,8 +37,7 @@ import org.springframework.util.Assert; @SuppressWarnings("serial") public class ExceptionClassifierRetryPolicy implements RetryPolicy { - private Classifier exceptionClassifier = new ClassifierSupport( - new NeverRetryPolicy()); + private Classifier exceptionClassifier = new ClassifierSupport<>(new NeverRetryPolicy()); /** * Setter for policy map used to create a classifier. Either this property or the @@ -47,7 +46,7 @@ public class ExceptionClassifierRetryPolicy implements RetryPolicy { * to create a {@link Classifier} to locate a policy. */ public void setPolicyMap(Map, RetryPolicy> policyMap) { - this.exceptionClassifier = new SubclassClassifier(policyMap, new NeverRetryPolicy()); + this.exceptionClassifier = new SubclassClassifier<>(policyMap, new NeverRetryPolicy()); } /** @@ -112,7 +111,7 @@ public class ExceptionClassifierRetryPolicy implements RetryPolicy { // Dynamic: depends on the policy: private RetryContext context; - final private Map contexts = new HashMap(); + final private Map contexts = new HashMap<>(); public ExceptionClassifierRetryContext(RetryContext parent, Classifier exceptionClassifier) { diff --git a/src/main/java/org/springframework/retry/policy/MapRetryContextCache.java b/src/main/java/org/springframework/retry/policy/MapRetryContextCache.java index aa9068a..f05ec8f 100644 --- a/src/main/java/org/springframework/retry/policy/MapRetryContextCache.java +++ b/src/main/java/org/springframework/retry/policy/MapRetryContextCache.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-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. @@ -36,7 +36,7 @@ public class MapRetryContextCache implements RetryContextCache { */ public static final int DEFAULT_CAPACITY = 4096; - private Map map = Collections.synchronizedMap(new HashMap()); + private Map map = Collections.synchronizedMap(new HashMap<>()); private int capacity; diff --git a/src/main/java/org/springframework/retry/policy/SoftReferenceMapRetryContextCache.java b/src/main/java/org/springframework/retry/policy/SoftReferenceMapRetryContextCache.java index 08f9626..7128490 100644 --- a/src/main/java/org/springframework/retry/policy/SoftReferenceMapRetryContextCache.java +++ b/src/main/java/org/springframework/retry/policy/SoftReferenceMapRetryContextCache.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-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. @@ -39,8 +39,7 @@ public class SoftReferenceMapRetryContextCache implements RetryContextCache { */ public static final int DEFAULT_CAPACITY = 4096; - private Map> map = Collections - .synchronizedMap(new HashMap>()); + private Map> map = Collections.synchronizedMap(new HashMap<>()); private int capacity; @@ -91,7 +90,7 @@ public class SoftReferenceMapRetryContextCache implements RetryContextCache { + "Do you need to re-consider the implementation of the key generator, " + "or the equals and hashCode of the items that failed?"); } - map.put(key, new SoftReference(context)); + map.put(key, new SoftReference<>(context)); } public void remove(Object key) { diff --git a/src/main/java/org/springframework/retry/stats/DefaultStatisticsRepository.java b/src/main/java/org/springframework/retry/stats/DefaultStatisticsRepository.java index d3c3466..0d52509 100644 --- a/src/main/java/org/springframework/retry/stats/DefaultStatisticsRepository.java +++ b/src/main/java/org/springframework/retry/stats/DefaultStatisticsRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2006-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. @@ -28,7 +28,7 @@ import org.springframework.retry.RetryStatistics; */ public class DefaultStatisticsRepository implements StatisticsRepository { - private ConcurrentMap map = new ConcurrentHashMap(); + private ConcurrentMap map = new ConcurrentHashMap<>(); private RetryStatisticsFactory factory = new DefaultRetryStatisticsFactory(); @@ -43,7 +43,7 @@ public class DefaultStatisticsRepository implements StatisticsRepository { @Override public Iterable findAll() { - return new ArrayList(map.values()); + return new ArrayList<>(map.values()); } @Override diff --git a/src/main/java/org/springframework/retry/support/RetrySimulation.java b/src/main/java/org/springframework/retry/support/RetrySimulation.java index ce8804d..10efe4b 100644 --- a/src/main/java/org/springframework/retry/support/RetrySimulation.java +++ b/src/main/java/org/springframework/retry/support/RetrySimulation.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-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. @@ -25,9 +25,9 @@ import java.util.List; */ public class RetrySimulation { - private final List sleepSequences = new ArrayList(); + private final List sleepSequences = new ArrayList<>(); - private final List sleepHistogram = new ArrayList(); + private final List sleepHistogram = new ArrayList<>(); public RetrySimulation() { } @@ -46,7 +46,7 @@ public class RetrySimulation { * all simulations. */ public List getPercentiles() { - List res = new ArrayList(); + List res = new ArrayList<>(); for (double percentile : new double[] { 10, 20, 30, 40, 50, 60, 70, 80, 90 }) { res.add(getPercentile(percentile / 100)); } diff --git a/src/main/java/org/springframework/retry/support/RetrySimulator.java b/src/main/java/org/springframework/retry/support/RetrySimulator.java index ba3f1a0..68058aa 100644 --- a/src/main/java/org/springframework/retry/support/RetrySimulator.java +++ b/src/main/java/org/springframework/retry/support/RetrySimulator.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-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,7 +112,7 @@ public class RetrySimulator { @SuppressWarnings("serial") static class StealingSleeper implements Sleeper { - private final List sleeps = new ArrayList(); + private final List sleeps = new ArrayList<>(); public void sleep(long backOffPeriod) throws InterruptedException { sleeps.add(backOffPeriod); diff --git a/src/main/java/org/springframework/retry/support/RetrySynchronizationManager.java b/src/main/java/org/springframework/retry/support/RetrySynchronizationManager.java index a82a4cd..37ea7c2 100644 --- a/src/main/java/org/springframework/retry/support/RetrySynchronizationManager.java +++ b/src/main/java/org/springframework/retry/support/RetrySynchronizationManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-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. @@ -37,7 +37,7 @@ public final class RetrySynchronizationManager { private RetrySynchronizationManager() { } - private static final ThreadLocal context = new ThreadLocal(); + private static final ThreadLocal context = new ThreadLocal<>(); /** * Public accessor for the locally enclosing {@link RetryContext}. diff --git a/src/main/java/org/springframework/retry/support/RetryTemplate.java b/src/main/java/org/springframework/retry/support/RetryTemplate.java index 8bf4bf4..cc7e6af 100644 --- a/src/main/java/org/springframework/retry/support/RetryTemplate.java +++ b/src/main/java/org/springframework/retry/support/RetryTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2020 the original author or authors. + * Copyright 2006-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. @@ -159,7 +159,7 @@ public class RetryTemplate implements RetryOperations { * @see #setListeners(RetryListener[]) */ public void registerListener(RetryListener listener, int index) { - List list = new ArrayList(Arrays.asList(this.listeners)); + List list = new ArrayList<>(Arrays.asList(this.listeners)); if (index >= list.size()) { list.add(listener); } diff --git a/src/main/java/org/springframework/retry/support/RetryTemplateBuilder.java b/src/main/java/org/springframework/retry/support/RetryTemplateBuilder.java index 87258f4..701b131 100644 --- a/src/main/java/org/springframework/retry/support/RetryTemplateBuilder.java +++ b/src/main/java/org/springframework/retry/support/RetryTemplateBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2019 the original author or authors. + * Copyright 2006-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. @@ -458,7 +458,7 @@ public class RetryTemplateBuilder { private List listenersList() { if (this.listeners == null) { - this.listeners = new ArrayList(); + this.listeners = new ArrayList<>(); } return this.listeners; } diff --git a/src/test/java/org/springframework/classify/BackToBackPatternClassifierTests.java b/src/test/java/org/springframework/classify/BackToBackPatternClassifierTests.java index 0be7684..9e34ae9 100644 --- a/src/test/java/org/springframework/classify/BackToBackPatternClassifierTests.java +++ b/src/test/java/org/springframework/classify/BackToBackPatternClassifierTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-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. @@ -31,13 +31,13 @@ import org.springframework.classify.annotation.Classifier; */ public class BackToBackPatternClassifierTests { - private BackToBackPatternClassifier classifier = new BackToBackPatternClassifier(); + private BackToBackPatternClassifier classifier = new BackToBackPatternClassifier<>(); private Map map; @Before public void createMap() { - map = new HashMap(); + map = new HashMap<>(); map.put("foo", "bar"); map.put("*", "spam"); } @@ -49,9 +49,9 @@ public class BackToBackPatternClassifierTests { @Test public void testCreateFromConstructor() { - classifier = new BackToBackPatternClassifier( - new PatternMatchingClassifier(Collections.singletonMap("oof", "bucket")), - new PatternMatchingClassifier(map)); + classifier = new BackToBackPatternClassifier<>( + new PatternMatchingClassifier<>(Collections.singletonMap("oof", "bucket")), + new PatternMatchingClassifier<>(map)); assertEquals("spam", classifier.classify("oof")); } @@ -69,7 +69,7 @@ public class BackToBackPatternClassifierTests { @Test public void testSingleMethodWithNoAnnotation() { - classifier = new BackToBackPatternClassifier(); + classifier = new BackToBackPatternClassifier<>(); classifier.setRouterDelegate(new RouterDelegate()); classifier.setMatcherMap(map); assertEquals("spam", classifier.classify("oof")); diff --git a/src/test/java/org/springframework/classify/BinaryExceptionClassifierTests.java b/src/test/java/org/springframework/classify/BinaryExceptionClassifierTests.java index 8c0baae..799370e 100644 --- a/src/test/java/org/springframework/classify/BinaryExceptionClassifierTests.java +++ b/src/test/java/org/springframework/classify/BinaryExceptionClassifierTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2013 the original author or authors. + * Copyright 2006-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. @@ -80,7 +80,7 @@ public class BinaryExceptionClassifierTests { @Test public void testClassifySubclassMatchInCauseFalse() { - Map, Boolean> map = new HashMap, Boolean>(); + Map, Boolean> map = new HashMap<>(); map.put(IllegalStateException.class, true); map.put(BarException.class, false); BinaryExceptionClassifier binaryExceptionClassifier = new BinaryExceptionClassifier(map, true); diff --git a/src/test/java/org/springframework/classify/ClassifierAdapterTests.java b/src/test/java/org/springframework/classify/ClassifierAdapterTests.java index de6c189..e07f2de 100644 --- a/src/test/java/org/springframework/classify/ClassifierAdapterTests.java +++ b/src/test/java/org/springframework/classify/ClassifierAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-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. @@ -27,11 +27,11 @@ import static org.junit.Assert.assertEquals; */ public class ClassifierAdapterTests { - private ClassifierAdapter adapter = new ClassifierAdapter(); + private ClassifierAdapter adapter = new ClassifierAdapter<>(); @Test public void testClassifierAdapterObject() { - adapter = new ClassifierAdapter(new Object() { + adapter = new ClassifierAdapter<>(new Object() { @Classifier public Integer getValue(String key) { return Integer.parseInt(key); @@ -47,7 +47,7 @@ public class ClassifierAdapterTests { @Test(expected = IllegalStateException.class) public void testClassifierAdapterObjectWithNoAnnotation() { - adapter = new ClassifierAdapter(new Object() { + adapter = new ClassifierAdapter<>(new Object() { @SuppressWarnings("unused") public Integer getValue(String key) { return Integer.parseInt(key); @@ -63,7 +63,7 @@ public class ClassifierAdapterTests { @Test public void testClassifierAdapterObjectSingleMethodWithNoAnnotation() { - adapter = new ClassifierAdapter(new Object() { + adapter = new ClassifierAdapter<>(new Object() { @SuppressWarnings("unused") public Integer getValue(String key) { return Integer.parseInt(key); @@ -84,12 +84,11 @@ public class ClassifierAdapterTests { @SuppressWarnings({ "serial" }) @Test public void testClassifierAdapterClassifier() { - adapter = new ClassifierAdapter( - new org.springframework.classify.Classifier() { - public Integer classify(String classifiable) { - return Integer.valueOf(classifiable); - } - }); + adapter = new ClassifierAdapter<>(new org.springframework.classify.Classifier() { + public Integer classify(String classifiable) { + return Integer.valueOf(classifiable); + } + }); assertEquals(23, adapter.classify("23").intValue()); } diff --git a/src/test/java/org/springframework/classify/ClassifierSupportTests.java b/src/test/java/org/springframework/classify/ClassifierSupportTests.java index ebd8003..9a5fbff 100644 --- a/src/test/java/org/springframework/classify/ClassifierSupportTests.java +++ b/src/test/java/org/springframework/classify/ClassifierSupportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-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. @@ -24,13 +24,13 @@ public class ClassifierSupportTests { @Test public void testClassifyNullIsDefault() { - ClassifierSupport classifier = new ClassifierSupport("foo"); + ClassifierSupport classifier = new ClassifierSupport<>("foo"); assertEquals(classifier.classify(null), "foo"); } @Test public void testClassifyRandomException() { - ClassifierSupport classifier = new ClassifierSupport("foo"); + ClassifierSupport classifier = new ClassifierSupport<>("foo"); assertEquals(classifier.classify(new IllegalStateException("Foo")), classifier.classify(null)); } diff --git a/src/test/java/org/springframework/classify/PatternMatchingClassifierTests.java b/src/test/java/org/springframework/classify/PatternMatchingClassifierTests.java index 89713cb..83b44e0 100644 --- a/src/test/java/org/springframework/classify/PatternMatchingClassifierTests.java +++ b/src/test/java/org/springframework/classify/PatternMatchingClassifierTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-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. @@ -30,13 +30,13 @@ import org.springframework.classify.PatternMatchingClassifier; */ public class PatternMatchingClassifierTests { - private PatternMatchingClassifier classifier = new PatternMatchingClassifier(); + private PatternMatchingClassifier classifier = new PatternMatchingClassifier<>(); private Map map; @Before public void createMap() { - map = new HashMap(); + map = new HashMap<>(); map.put("foo", "bar"); map.put("*", "spam"); } @@ -50,7 +50,7 @@ public class PatternMatchingClassifierTests { @Test public void testCreateFromMap() { - classifier = new PatternMatchingClassifier(map); + classifier = new PatternMatchingClassifier<>(map); assertEquals("bar", classifier.classify("foo")); assertEquals("spam", classifier.classify("bucket")); } diff --git a/src/test/java/org/springframework/classify/SubclassClassifierTests.java b/src/test/java/org/springframework/classify/SubclassClassifierTests.java index 7ab1948..ca1da63 100644 --- a/src/test/java/org/springframework/classify/SubclassClassifierTests.java +++ b/src/test/java/org/springframework/classify/SubclassClassifierTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-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. @@ -27,14 +27,14 @@ public class SubclassClassifierTests { @Test public void testClassifyInterface() { - SubclassClassifier classifier = new SubclassClassifier(); + SubclassClassifier classifier = new SubclassClassifier<>(); classifier.setTypeMap(Collections., String>singletonMap(Supplier.class, "foo")); assertEquals("foo", classifier.classify(new Foo())); } @Test public void testClassifyInterfaceOfParent() { - SubclassClassifier classifier = new SubclassClassifier(); + SubclassClassifier classifier = new SubclassClassifier<>(); classifier.setTypeMap(Collections., String>singletonMap(Supplier.class, "foo")); assertEquals("foo", classifier.classify(new Bar())); } diff --git a/src/test/java/org/springframework/classify/SubclassExceptionClassifierTests.java b/src/test/java/org/springframework/classify/SubclassExceptionClassifierTests.java index 889987f..4c3ae27 100644 --- a/src/test/java/org/springframework/classify/SubclassExceptionClassifierTests.java +++ b/src/test/java/org/springframework/classify/SubclassExceptionClassifierTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-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. @@ -30,7 +30,7 @@ import static org.junit.Assert.assertNull; public class SubclassExceptionClassifierTests { - SubclassClassifier classifier = new SubclassClassifier(); + SubclassClassifier classifier = new SubclassClassifier<>(); @Test public void testClassifyNullIsDefault() { @@ -44,7 +44,7 @@ public class SubclassExceptionClassifierTests { @Test public void testClassifyNullNonDefault() { - this.classifier = new SubclassClassifier("foo"); + this.classifier = new SubclassClassifier<>("foo"); assertEquals("foo", this.classifier.classify(null)); } @@ -90,7 +90,7 @@ public class SubclassExceptionClassifierTests { @SuppressWarnings("serial") @Test public void testClassifyAncestorMatch2() { - this.classifier = new SubclassClassifier(); + this.classifier = new SubclassClassifier<>(); this.classifier.setTypeMap(new HashMap, String>() { { put(SocketException.class, "1"); diff --git a/src/test/java/org/springframework/retry/ResourcelessTransactionManager.java b/src/test/java/org/springframework/retry/ResourcelessTransactionManager.java index 88949c3..e415714 100644 --- a/src/test/java/org/springframework/retry/ResourcelessTransactionManager.java +++ b/src/test/java/org/springframework/retry/ResourcelessTransactionManager.java @@ -1,3 +1,19 @@ +/* + * Copyright 2006-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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.springframework.retry; import java.util.Stack; @@ -23,7 +39,7 @@ public class ResourcelessTransactionManager extends AbstractPlatformTransactionM Object transaction = new ResourcelessTransaction(); Stack resources; if (!TransactionSynchronizationManager.hasResource(this)) { - resources = new Stack(); + resources = new Stack<>(); TransactionSynchronizationManager.bindResource(this, resources); } else { diff --git a/src/test/java/org/springframework/retry/annotation/EnableRetryWithBackoffTests.java b/src/test/java/org/springframework/retry/annotation/EnableRetryWithBackoffTests.java index ef91502..b2ba832 100644 --- a/src/test/java/org/springframework/retry/annotation/EnableRetryWithBackoffTests.java +++ b/src/test/java/org/springframework/retry/annotation/EnableRetryWithBackoffTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2006-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. @@ -133,7 +133,7 @@ public class EnableRetryWithBackoffTests { @SuppressWarnings("serial") protected static class PeriodSleeper implements Sleeper { - private List periods = new ArrayList(); + private List periods = new ArrayList<>(); @Override public void sleep(long period) throws InterruptedException { diff --git a/src/test/java/org/springframework/retry/annotation/ProxyApplicationTests.java b/src/test/java/org/springframework/retry/annotation/ProxyApplicationTests.java index a6f80f0..bdb9d99 100644 --- a/src/test/java/org/springframework/retry/annotation/ProxyApplicationTests.java +++ b/src/test/java/org/springframework/retry/annotation/ProxyApplicationTests.java @@ -74,7 +74,7 @@ public class ProxyApplicationTests { private static class CountClassesClassLoader extends URLClassLoader { - private final Set> classes = new HashSet>(); + private final Set> classes = new HashSet<>(); public CountClassesClassLoader() { super(new URL[0], ProxyApplicationTests.class.getClassLoader()); diff --git a/src/test/java/org/springframework/retry/backoff/BackOffPolicySerializationTests.java b/src/test/java/org/springframework/retry/backoff/BackOffPolicySerializationTests.java index 1fd04af..be88e74 100644 --- a/src/test/java/org/springframework/retry/backoff/BackOffPolicySerializationTests.java +++ b/src/test/java/org/springframework/retry/backoff/BackOffPolicySerializationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2006-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. @@ -52,7 +52,7 @@ public class BackOffPolicySerializationTests { @Parameters(name = "{index}: {0}") public static List policies() { - List result = new ArrayList(); + List result = new ArrayList<>(); ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(true); scanner.addIncludeFilter(new AssignableTypeFilter(BackOffPolicy.class)); scanner.addExcludeFilter(new RegexPatternTypeFilter(Pattern.compile(".*Test.*"))); diff --git a/src/test/java/org/springframework/retry/backoff/DummySleeper.java b/src/test/java/org/springframework/retry/backoff/DummySleeper.java index 1ee4241..c4bdcd7 100644 --- a/src/test/java/org/springframework/retry/backoff/DummySleeper.java +++ b/src/test/java/org/springframework/retry/backoff/DummySleeper.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-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. @@ -28,7 +28,7 @@ import java.util.List; @SuppressWarnings("serial") public class DummySleeper implements Sleeper { - private List backOffs = new ArrayList(); + private List backOffs = new ArrayList<>(); /** * Public getter for the long. diff --git a/src/test/java/org/springframework/retry/interceptor/RetryOperationsInterceptorTests.java b/src/test/java/org/springframework/retry/interceptor/RetryOperationsInterceptorTests.java index 8cf0711..a04f68a 100644 --- a/src/test/java/org/springframework/retry/interceptor/RetryOperationsInterceptorTests.java +++ b/src/test/java/org/springframework/retry/interceptor/RetryOperationsInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2020 the original author or authors. + * Copyright 2006-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. @@ -128,7 +128,7 @@ public class RetryOperationsInterceptorTests { final String classTagName = "class"; final String methodTagName = "method"; final String labelTagName = "label"; - final Map monitoringTags = new HashMap(); + final Map monitoringTags = new HashMap<>(); RetryTemplate template = new RetryTemplate(); template.setRetryPolicy(new SimpleRetryPolicy(2)); template.registerListener(new MethodInvocationRetryListenerSupport() { @@ -174,7 +174,7 @@ public class RetryOperationsInterceptorTests { @Test public void testInterceptorChainWithRetry() throws Exception { ((Advised) this.service).addAdvice(this.interceptor); - final List list = new ArrayList(); + final List list = new ArrayList<>(); ((Advised) this.service).addAdvice(new MethodInterceptor() { @Override public Object invoke(MethodInvocation invocation) throws Throwable { diff --git a/src/test/java/org/springframework/retry/interceptor/StatefulRetryOperationsInterceptorTests.java b/src/test/java/org/springframework/retry/interceptor/StatefulRetryOperationsInterceptorTests.java index aa637ad..887e613 100644 --- a/src/test/java/org/springframework/retry/interceptor/StatefulRetryOperationsInterceptorTests.java +++ b/src/test/java/org/springframework/retry/interceptor/StatefulRetryOperationsInterceptorTests.java @@ -149,7 +149,7 @@ public class StatefulRetryOperationsInterceptorTests { @Test public void testInterceptorChainWithRetry() throws Exception { ((Advised) service).addAdvice(interceptor); - final List list = new ArrayList(); + final List list = new ArrayList<>(); ((Advised) service).addAdvice(new MethodInterceptor() { @Override public Object invoke(MethodInvocation invocation) throws Throwable { diff --git a/src/test/java/org/springframework/retry/listener/RetryListenerTests.java b/src/test/java/org/springframework/retry/listener/RetryListenerTests.java index 2bb130c..9b4718d 100644 --- a/src/test/java/org/springframework/retry/listener/RetryListenerTests.java +++ b/src/test/java/org/springframework/retry/listener/RetryListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-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. @@ -37,7 +37,7 @@ public class RetryListenerTests { int count = 0; - List list = new ArrayList(); + List list = new ArrayList<>(); @Test public void testOpenInterceptors() throws Throwable { diff --git a/src/test/java/org/springframework/retry/policy/CompositeRetryPolicyTests.java b/src/test/java/org/springframework/retry/policy/CompositeRetryPolicyTests.java index 95968b5..99d73dd 100644 --- a/src/test/java/org/springframework/retry/policy/CompositeRetryPolicyTests.java +++ b/src/test/java/org/springframework/retry/policy/CompositeRetryPolicyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-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. @@ -89,7 +89,7 @@ public class CompositeRetryPolicyTests { @SuppressWarnings("serial") @Test public void testNonTrivialPoliciesClose() throws Exception { - final List list = new ArrayList(); + final List list = new ArrayList<>(); CompositeRetryPolicy policy = new CompositeRetryPolicy(); policy.setPolicies(new RetryPolicy[] { new MockRetryPolicySupport() { public void close(RetryContext context) { @@ -109,7 +109,7 @@ public class CompositeRetryPolicyTests { @SuppressWarnings("serial") @Test public void testExceptionOnPoliciesClose() throws Exception { - final List list = new ArrayList(); + final List list = new ArrayList<>(); CompositeRetryPolicy policy = new CompositeRetryPolicy(); policy.setPolicies(new RetryPolicy[] { new MockRetryPolicySupport() { public void close(RetryContext context) { diff --git a/src/test/java/org/springframework/retry/policy/ExceptionClassifierRetryPolicyTests.java b/src/test/java/org/springframework/retry/policy/ExceptionClassifierRetryPolicyTests.java index d6740f7..8f49f5a 100644 --- a/src/test/java/org/springframework/retry/policy/ExceptionClassifierRetryPolicyTests.java +++ b/src/test/java/org/springframework/retry/policy/ExceptionClassifierRetryPolicyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-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. @@ -52,7 +52,7 @@ public class ExceptionClassifierRetryPolicyTests { @Test public void testNullPolicies() throws Exception { - policy.setPolicyMap(new HashMap, RetryPolicy>()); + policy.setPolicyMap(new HashMap<>()); RetryContext context = policy.open(null); assertNotNull(context); } diff --git a/src/test/java/org/springframework/retry/policy/FatalExceptionRetryPolicyTests.java b/src/test/java/org/springframework/retry/policy/FatalExceptionRetryPolicyTests.java index b2dfb75..308a694 100644 --- a/src/test/java/org/springframework/retry/policy/FatalExceptionRetryPolicyTests.java +++ b/src/test/java/org/springframework/retry/policy/FatalExceptionRetryPolicyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-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. @@ -39,7 +39,7 @@ public class FatalExceptionRetryPolicyTests { RetryTemplate retryTemplate = new RetryTemplate(); // Make sure certain exceptions are fatal... - Map, Boolean> map = new HashMap, Boolean>(); + Map, Boolean> map = new HashMap<>(); map.put(IllegalArgumentException.class, false); map.put(IllegalStateException.class, false); @@ -72,7 +72,7 @@ public class FatalExceptionRetryPolicyTests { RetryTemplate retryTemplate = new RetryTemplate(); - Map, Boolean> map = new HashMap, Boolean>(); + Map, Boolean> map = new HashMap<>(); map.put(IllegalArgumentException.class, false); map.put(IllegalStateException.class, false); diff --git a/src/test/java/org/springframework/retry/policy/RetryContextSerializationTests.java b/src/test/java/org/springframework/retry/policy/RetryContextSerializationTests.java index 32879a1..02a694c 100644 --- a/src/test/java/org/springframework/retry/policy/RetryContextSerializationTests.java +++ b/src/test/java/org/springframework/retry/policy/RetryContextSerializationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2006-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. @@ -55,7 +55,7 @@ public class RetryContextSerializationTests { @Parameters(name = "{index}: {0}") public static List policies() { - List result = new ArrayList(); + List result = new ArrayList<>(); ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(true); scanner.addIncludeFilter(new AssignableTypeFilter(RetryPolicy.class)); scanner.addExcludeFilter(new RegexPatternTypeFilter(Pattern.compile(".*Test.*"))); @@ -71,7 +71,7 @@ public class RetryContextSerializationTests { } } ExceptionClassifierRetryPolicy extra = new ExceptionClassifierRetryPolicy(); - extra.setExceptionClassifier(new SubclassClassifier(new AlwaysRetryPolicy())); + extra.setExceptionClassifier(new SubclassClassifier<>(new AlwaysRetryPolicy())); result.add(new Object[] { extra }); return result; } diff --git a/src/test/java/org/springframework/retry/policy/SerializedMapRetryContextCache.java b/src/test/java/org/springframework/retry/policy/SerializedMapRetryContextCache.java index ee31852..e516ed8 100644 --- a/src/test/java/org/springframework/retry/policy/SerializedMapRetryContextCache.java +++ b/src/test/java/org/springframework/retry/policy/SerializedMapRetryContextCache.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2006-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. @@ -26,7 +26,7 @@ public class SerializedMapRetryContextCache implements RetryContextCache { private static final int DEFAULT_CAPACITY = 4096; - private Map map = Collections.synchronizedMap(new HashMap()); + private Map map = Collections.synchronizedMap(new HashMap<>()); @Override public boolean containsKey(Object key) { diff --git a/src/test/java/org/springframework/retry/policy/SimpleRetryPolicyTests.java b/src/test/java/org/springframework/retry/policy/SimpleRetryPolicyTests.java index d56697d..ee03fdc 100644 --- a/src/test/java/org/springframework/retry/policy/SimpleRetryPolicyTests.java +++ b/src/test/java/org/springframework/retry/policy/SimpleRetryPolicyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2013 the original author or authors. + * Copyright 2006-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,7 +107,7 @@ public class SimpleRetryPolicyTests { @Test public void testFatalOverridesRetryable() throws Exception { - Map, Boolean> map = new HashMap, Boolean>(); + Map, Boolean> map = new HashMap<>(); map.put(Exception.class, false); map.put(RuntimeException.class, true); SimpleRetryPolicy policy = new SimpleRetryPolicy(3, map); @@ -119,7 +119,7 @@ public class SimpleRetryPolicyTests { @Test public void testRetryableWithCause() throws Exception { - Map, Boolean> map = new HashMap, Boolean>(); + Map, Boolean> map = new HashMap<>(); map.put(RuntimeException.class, true); SimpleRetryPolicy policy = new SimpleRetryPolicy(3, map, true); RetryContext context = policy.open(null); diff --git a/src/test/java/org/springframework/retry/policy/StatefulRetryIntegrationTests.java b/src/test/java/org/springframework/retry/policy/StatefulRetryIntegrationTests.java index 41e19eb..83faf40 100644 --- a/src/test/java/org/springframework/retry/policy/StatefulRetryIntegrationTests.java +++ b/src/test/java/org/springframework/retry/policy/StatefulRetryIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2012 the original author or authors. + * Copyright 2006-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. @@ -158,7 +158,7 @@ public class StatefulRetryIntegrationTests { policy.setMultiplier(1.5); RetryTemplate template = new RetryTemplate(); template.setBackOffPolicy(policy); - final List times = new ArrayList(); + final List times = new ArrayList<>(); RetryState retryState = new DefaultRetryState("bar"); for (int i = 0; i < 3; i++) { try { diff --git a/src/test/java/org/springframework/retry/support/StatefulRecoveryRetryTests.java b/src/test/java/org/springframework/retry/support/StatefulRecoveryRetryTests.java index 77f7e57..7e52922 100644 --- a/src/test/java/org/springframework/retry/support/StatefulRecoveryRetryTests.java +++ b/src/test/java/org/springframework/retry/support/StatefulRecoveryRetryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-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,7 +47,7 @@ public class StatefulRecoveryRetryTests { private int count = 0; - private List list = new ArrayList(); + private List list = new ArrayList<>(); @Test public void testOpenSunnyDay() throws Exception {