Browse Source

Use consistent class design

Update all classes so that inner classes are always last. Also
ensure that utility classes are always final and have a private
constructor and make exceptions final whenever possible.

Issue: SPR-16968
pull/1868/head
Phillip Webb 8 years ago committed by Juergen Hoeller
parent
commit
eeebd51f57
  1. 4
      spring-aop/src/main/java/org/springframework/aop/TrueClassFilter.java
  2. 4
      spring-aop/src/main/java/org/springframework/aop/TrueMethodMatcher.java
  3. 4
      spring-aop/src/main/java/org/springframework/aop/TruePointcut.java
  4. 27
      spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java
  5. 6
      spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/InstantiationModelAwarePointcutAdvisorImpl.java
  6. 4
      spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/NotAnAtAspectException.java
  7. 6
      spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/ProxyCreationContext.java
  8. 2
      spring-aop/src/main/java/org/springframework/aop/interceptor/ExposeInvocationInterceptor.java
  9. 2
      spring-aop/src/main/java/org/springframework/aop/target/EmptyTargetSource.java
  10. 8
      spring-aspects/src/main/java/org/springframework/cache/aspectj/AnyThrow.java
  11. 12
      spring-beans/src/main/java/org/springframework/beans/BeanInstantiationException.java
  12. 2
      spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java
  13. 6
      spring-beans/src/main/java/org/springframework/beans/InvalidPropertyException.java
  14. 7
      spring-beans/src/main/java/org/springframework/beans/NotWritablePropertyException.java
  15. 5
      spring-beans/src/main/java/org/springframework/beans/PropertyAccessException.java
  16. 2
      spring-beans/src/main/java/org/springframework/beans/PropertyBatchUpdateException.java
  17. 9
      spring-beans/src/main/java/org/springframework/beans/PropertyDescriptorUtils.java
  18. 2
      spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrySupport.java
  19. 10
      spring-beans/src/main/java/org/springframework/beans/factory/BeanCreationException.java
  20. 12
      spring-beans/src/main/java/org/springframework/beans/factory/BeanDefinitionStoreException.java
  21. 6
      spring-beans/src/main/java/org/springframework/beans/factory/BeanNotOfRequiredTypeException.java
  22. 8
      spring-beans/src/main/java/org/springframework/beans/factory/CannotLoadBeanClassException.java
  23. 10
      spring-beans/src/main/java/org/springframework/beans/factory/NoSuchBeanDefinitionException.java
  24. 10
      spring-beans/src/main/java/org/springframework/beans/factory/NoUniqueBeanDefinitionException.java
  25. 5
      spring-beans/src/main/java/org/springframework/beans/factory/UnsatisfiedDependencyException.java
  26. 4
      spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.java
  27. 4
      spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionBuilder.java
  28. 8
      spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionReaderUtils.java
  29. 3
      spring-context-support/src/main/java/org/springframework/mail/MailSendException.java
  30. 6
      spring-context/src/main/java/org/springframework/cache/config/CacheManagementConfigUtils.java
  31. 6
      spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java
  32. 9
      spring-context/src/main/java/org/springframework/context/annotation/BeanAnnotationHelper.java
  33. 9
      spring-context/src/main/java/org/springframework/context/annotation/ScopedProxyCreator.java
  34. 8
      spring-context/src/main/java/org/springframework/context/index/CandidateComponentsIndexLoader.java
  35. 7
      spring-context/src/main/java/org/springframework/context/support/PostProcessorRegistrationDelegate.java
  36. 6
      spring-context/src/main/java/org/springframework/format/datetime/joda/JodaTimeContextHolder.java
  37. 7
      spring-context/src/main/java/org/springframework/format/datetime/joda/JodaTimeConverters.java
  38. 6
      spring-context/src/main/java/org/springframework/format/datetime/standard/DateTimeContextHolder.java
  39. 7
      spring-context/src/main/java/org/springframework/format/datetime/standard/DateTimeConverters.java
  40. 9
      spring-context/src/main/java/org/springframework/jmx/support/ObjectNameManager.java
  41. 9
      spring-context/src/main/java/org/springframework/scheduling/config/TaskManagementConfigUtils.java
  42. 6
      spring-context/src/main/java/org/springframework/scripting/ScriptCompilationException.java
  43. 4
      spring-context/src/main/java/org/springframework/scripting/bsh/BshScriptUtils.java
  44. 2
      spring-core/src/main/java/org/springframework/core/ReactiveTypeDescriptor.java
  45. 9
      spring-core/src/main/java/org/springframework/core/SpringVersion.java
  46. 2
      spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java
  47. 2
      spring-core/src/main/java/org/springframework/core/codec/CharSequenceEncoder.java
  48. 2
      spring-core/src/main/java/org/springframework/core/codec/StringDecoder.java
  49. 5
      spring-core/src/main/java/org/springframework/core/env/ProfilesParser.java
  50. 42
      spring-core/src/main/java/org/springframework/util/ReflectionUtils.java
  51. 8
      spring-expression/src/main/java/org/springframework/expression/ExpressionException.java
  52. 29
      spring-expression/src/main/java/org/springframework/expression/spel/CodeFlow.java
  53. 28
      spring-expression/src/main/java/org/springframework/expression/spel/ast/Operator.java
  54. 4
      spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelCompiler.java
  55. 2
      spring-expression/src/main/java/org/springframework/expression/spel/support/BooleanTypedValue.java
  56. 2
      spring-expression/src/main/java/org/springframework/expression/spel/support/DataBindingMethodResolver.java
  57. 2
      spring-expression/src/main/java/org/springframework/expression/spel/support/DataBindingPropertyAccessor.java
  58. 2
      spring-expression/src/main/java/org/springframework/expression/spel/support/SimpleEvaluationContext.java
  59. 8
      spring-instrument/src/main/java/org/springframework/instrument/InstrumentationSavingAgent.java
  60. 4
      spring-jdbc/src/main/java/org/springframework/jdbc/BadSqlGrammarException.java
  61. 6
      spring-jdbc/src/main/java/org/springframework/jdbc/IncorrectResultSetColumnCountException.java
  62. 5
      spring-jdbc/src/main/java/org/springframework/jdbc/InvalidResultSetAccessException.java
  63. 4
      spring-jdbc/src/main/java/org/springframework/jdbc/JdbcUpdateAffectedIncorrectNumberOfRowsException.java
  64. 7
      spring-jdbc/src/main/java/org/springframework/jdbc/config/DatabasePopulatorConfigUtils.java
  65. 6
      spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataProviderFactory.java
  66. 6
      spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataProviderFactory.java
  67. 4
      spring-jdbc/src/main/java/org/springframework/jdbc/datasource/UserCredentialsDataSourceAdapter.java
  68. 5
      spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseConfigurerFactory.java
  69. 9
      spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/OutputStreamFactory.java
  70. 4
      spring-jdbc/src/main/java/org/springframework/jdbc/support/CustomSQLExceptionTranslatorRegistry.java
  71. 6
      spring-jms/src/main/java/org/springframework/jms/connection/UserCredentialsConnectionFactoryAdapter.java
  72. 2
      spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/DestinationVariableMethodArgumentResolver.java
  73. 4
      spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/HeaderMethodArgumentResolver.java
  74. 5
      spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/MethodArgumentNotValidException.java
  75. 2
      spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandler.java
  76. 8
      spring-orm/src/main/java/org/springframework/orm/ObjectOptimisticLockingFailureException.java
  77. 8
      spring-orm/src/main/java/org/springframework/orm/ObjectRetrievalFailureException.java
  78. 2
      spring-orm/src/main/java/org/springframework/orm/hibernate5/HibernateTransactionManager.java
  79. 2
      spring-orm/src/main/java/org/springframework/orm/jpa/ExtendedEntityManagerCreator.java
  80. 2
      spring-orm/src/main/java/org/springframework/orm/jpa/JpaTransactionManager.java
  81. 7
      spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java
  82. 4
      spring-oxm/src/main/java/org/springframework/oxm/support/MarshallingSource.java
  83. 2
      spring-test/src/main/java/org/springframework/mock/http/server/reactive/MockServerHttpRequest.java
  84. 4
      spring-test/src/main/java/org/springframework/mock/jndi/SimpleNamingContext.java
  85. 2
      spring-test/src/main/java/org/springframework/mock/web/MockFilterChain.java
  86. 2
      spring-test/src/main/java/org/springframework/mock/web/reactive/function/server/MockServerRequest.java
  87. 4
      spring-test/src/main/java/org/springframework/test/annotation/SystemProfileValueSource.java
  88. 9
      spring-test/src/main/java/org/springframework/test/annotation/TestAnnotationUtils.java
  89. 7
      spring-test/src/main/java/org/springframework/test/context/transaction/TestTransaction.java
  90. 6
      spring-test/src/main/java/org/springframework/test/context/transaction/TransactionContextHolder.java
  91. 8
      spring-test/src/main/java/org/springframework/test/jdbc/JdbcTestUtils.java
  92. 4
      spring-test/src/main/java/org/springframework/test/web/client/ExpectedCount.java
  93. 2
      spring-test/src/main/java/org/springframework/test/web/client/MockRestServiceServer.java
  94. 7
      spring-test/src/main/java/org/springframework/test/web/servlet/setup/MockMvcBuilders.java
  95. 6
      spring-tx/src/main/java/org/springframework/dao/IncorrectResultSizeDataAccessException.java
  96. 2
      spring-tx/src/main/java/org/springframework/jca/cci/connection/SingleConnectionFactory.java
  97. 2
      spring-tx/src/main/java/org/springframework/transaction/HeuristicCompletionException.java
  98. 4
      spring-tx/src/main/java/org/springframework/transaction/InvalidTimeoutException.java
  99. 2
      spring-tx/src/main/java/org/springframework/transaction/support/AbstractPlatformTransactionManager.java
  100. 2
      spring-web/src/main/java/org/springframework/http/ContentDisposition.java
  101. Some files were not shown because too many files have changed in this diff Show More

4
spring-aop/src/main/java/org/springframework/aop/TrueClassFilter.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -24,7 +24,7 @@ import java.io.Serializable;
* @author Rod Johnson * @author Rod Johnson
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
class TrueClassFilter implements ClassFilter, Serializable { final class TrueClassFilter implements ClassFilter, Serializable {
public static final TrueClassFilter INSTANCE = new TrueClassFilter(); public static final TrueClassFilter INSTANCE = new TrueClassFilter();

4
spring-aop/src/main/java/org/springframework/aop/TrueMethodMatcher.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2015 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,7 +27,7 @@ import org.springframework.lang.Nullable;
* @author Rod Johnson * @author Rod Johnson
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
class TrueMethodMatcher implements MethodMatcher, Serializable { final class TrueMethodMatcher implements MethodMatcher, Serializable {
public static final TrueMethodMatcher INSTANCE = new TrueMethodMatcher(); public static final TrueMethodMatcher INSTANCE = new TrueMethodMatcher();

4
spring-aop/src/main/java/org/springframework/aop/TruePointcut.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -24,7 +24,7 @@ import java.io.Serializable;
* @author Rod Johnson * @author Rod Johnson
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
class TruePointcut implements Pointcut, Serializable { final class TruePointcut implements Pointcut, Serializable {
public static final TruePointcut INSTANCE = new TruePointcut(); public static final TruePointcut INSTANCE = new TruePointcut();

27
spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java

@ -561,6 +561,19 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
return sb.toString(); return sb.toString();
} }
//---------------------------------------------------------------------
// Serialization support
//---------------------------------------------------------------------
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
// Rely on default serialization, just initialize state after deserialization.
ois.defaultReadObject();
// Initialize transient fields.
// pointcutExpression will be initialized lazily by checkReadyToMatch()
this.shadowMatchCache = new ConcurrentHashMap<>(32);
}
/** /**
* Handler for the Spring-specific {@code bean()} pointcut designator * Handler for the Spring-specific {@code bean()} pointcut designator
@ -657,20 +670,6 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
} }
//---------------------------------------------------------------------
// Serialization support
//---------------------------------------------------------------------
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
// Rely on default serialization, just initialize state after deserialization.
ois.defaultReadObject();
// Initialize transient fields.
// pointcutExpression will be initialized lazily by checkReadyToMatch()
this.shadowMatchCache = new ConcurrentHashMap<>(32);
}
private static class DefensiveShadowMatch implements ShadowMatch { private static class DefensiveShadowMatch implements ShadowMatch {
private final ShadowMatch primary; private final ShadowMatch primary;

6
spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/InstantiationModelAwarePointcutAdvisorImpl.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -42,7 +42,7 @@ import org.springframework.lang.Nullable;
* @since 2.0 * @since 2.0
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
class InstantiationModelAwarePointcutAdvisorImpl final class InstantiationModelAwarePointcutAdvisorImpl
implements InstantiationModelAwarePointcutAdvisor, AspectJPrecedenceInformation, Serializable { implements InstantiationModelAwarePointcutAdvisor, AspectJPrecedenceInformation, Serializable {
private static final Advice EMPTY_ADVICE = new Advice() {}; private static final Advice EMPTY_ADVICE = new Advice() {};
@ -264,7 +264,7 @@ class InstantiationModelAwarePointcutAdvisorImpl
* Note that this is a <i>dynamic</i> pointcut. Otherwise it might * Note that this is a <i>dynamic</i> pointcut. Otherwise it might
* be optimized out if it does not at first match statically. * be optimized out if it does not at first match statically.
*/ */
private class PerTargetInstantiationModelPointcut extends DynamicMethodMatcherPointcut { private final class PerTargetInstantiationModelPointcut extends DynamicMethodMatcherPointcut {
private final AspectJExpressionPointcut declaredPointcut; private final AspectJExpressionPointcut declaredPointcut;

4
spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/NotAnAtAspectException.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -29,7 +29,7 @@ import org.springframework.aop.framework.AopConfigException;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class NotAnAtAspectException extends AopConfigException { public class NotAnAtAspectException extends AopConfigException {
private Class<?> nonAspectClass; private final Class<?> nonAspectClass;
/** /**

6
spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/ProxyCreationContext.java

@ -27,13 +27,17 @@ import org.springframework.lang.Nullable;
* @author Ramnivas Laddad * @author Ramnivas Laddad
* @since 2.5 * @since 2.5
*/ */
public class ProxyCreationContext { public final class ProxyCreationContext {
/** ThreadLocal holding the current proxied bean name during Advisor matching. */ /** ThreadLocal holding the current proxied bean name during Advisor matching. */
private static final ThreadLocal<String> currentProxiedBeanName = private static final ThreadLocal<String> currentProxiedBeanName =
new NamedThreadLocal<>("Name of currently proxied bean"); new NamedThreadLocal<>("Name of currently proxied bean");
private ProxyCreationContext() {
}
/** /**
* Return the name of the currently proxied bean instance. * Return the name of the currently proxied bean instance.
* @return the name of the bean, or {@code null} if none available * @return the name of the bean, or {@code null} if none available

2
spring-aop/src/main/java/org/springframework/aop/interceptor/ExposeInvocationInterceptor.java

@ -41,7 +41,7 @@ import org.springframework.core.PriorityOrdered;
* @author Juergen Hoeller * @author Juergen Hoeller
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ExposeInvocationInterceptor implements MethodInterceptor, PriorityOrdered, Serializable { public final class ExposeInvocationInterceptor implements MethodInterceptor, PriorityOrdered, Serializable {
/** Singleton instance of this class. */ /** Singleton instance of this class. */
public static final ExposeInvocationInterceptor INSTANCE = new ExposeInvocationInterceptor(); public static final ExposeInvocationInterceptor INSTANCE = new ExposeInvocationInterceptor();

2
spring-aop/src/main/java/org/springframework/aop/target/EmptyTargetSource.java

@ -30,7 +30,7 @@ import org.springframework.util.ObjectUtils;
* @author Rod Johnson * @author Rod Johnson
* @author Juergen Hoeller * @author Juergen Hoeller
*/ */
public class EmptyTargetSource implements TargetSource, Serializable { public final class EmptyTargetSource implements TargetSource, Serializable {
/** use serialVersionUID from Spring 1.2 for interoperability. */ /** use serialVersionUID from Spring 1.2 for interoperability. */
private static final long serialVersionUID = 3680494563553489691L; private static final long serialVersionUID = 3680494563553489691L;

8
spring-aspects/src/main/java/org/springframework/cache/aspectj/AnyThrow.java vendored

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2015 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,7 +22,11 @@ package org.springframework.cache.aspectj;
* *
* @author Stephane Nicoll * @author Stephane Nicoll
*/ */
class AnyThrow { final class AnyThrow {
private AnyThrow() {
}
static void throwUnchecked(Throwable e) { static void throwUnchecked(Throwable e) {
AnyThrow.<RuntimeException>throwAny(e); AnyThrow.<RuntimeException>throwAny(e);

12
spring-beans/src/main/java/org/springframework/beans/BeanInstantiationException.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -31,13 +31,13 @@ import org.springframework.lang.Nullable;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BeanInstantiationException extends FatalBeanException { public class BeanInstantiationException extends FatalBeanException {
private Class<?> beanClass; private final Class<?> beanClass;
@Nullable @Nullable
private Constructor<?> constructor; private final Constructor<?> constructor;
@Nullable @Nullable
private Method constructingMethod; private final Method constructingMethod;
/** /**
@ -58,6 +58,8 @@ public class BeanInstantiationException extends FatalBeanException {
public BeanInstantiationException(Class<?> beanClass, String msg, @Nullable Throwable cause) { public BeanInstantiationException(Class<?> beanClass, String msg, @Nullable Throwable cause) {
super("Failed to instantiate [" + beanClass.getName() + "]: " + msg, cause); super("Failed to instantiate [" + beanClass.getName() + "]: " + msg, cause);
this.beanClass = beanClass; this.beanClass = beanClass;
this.constructor = null;
this.constructingMethod = null;
} }
/** /**
@ -71,6 +73,7 @@ public class BeanInstantiationException extends FatalBeanException {
super("Failed to instantiate [" + constructor.getDeclaringClass().getName() + "]: " + msg, cause); super("Failed to instantiate [" + constructor.getDeclaringClass().getName() + "]: " + msg, cause);
this.beanClass = constructor.getDeclaringClass(); this.beanClass = constructor.getDeclaringClass();
this.constructor = constructor; this.constructor = constructor;
this.constructingMethod = null;
} }
/** /**
@ -84,6 +87,7 @@ public class BeanInstantiationException extends FatalBeanException {
public BeanInstantiationException(Method constructingMethod, String msg, @Nullable Throwable cause) { public BeanInstantiationException(Method constructingMethod, String msg, @Nullable Throwable cause) {
super("Failed to instantiate [" + constructingMethod.getReturnType().getName() + "]: " + msg, cause); super("Failed to instantiate [" + constructingMethod.getReturnType().getName() + "]: " + msg, cause);
this.beanClass = constructingMethod.getReturnType(); this.beanClass = constructingMethod.getReturnType();
this.constructor = null;
this.constructingMethod = constructingMethod; this.constructingMethod = constructingMethod;
} }

2
spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java

@ -71,7 +71,7 @@ import org.springframework.util.StringUtils;
* @see #clearClassLoader(ClassLoader) * @see #clearClassLoader(ClassLoader)
* @see #forClass(Class) * @see #forClass(Class)
*/ */
public class CachedIntrospectionResults { public final class CachedIntrospectionResults {
/** /**
* System property that instructs Spring to use the {@link Introspector#IGNORE_ALL_BEANINFO} * System property that instructs Spring to use the {@link Introspector#IGNORE_ALL_BEANINFO}

6
spring-beans/src/main/java/org/springframework/beans/InvalidPropertyException.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -28,9 +28,9 @@ import org.springframework.lang.Nullable;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class InvalidPropertyException extends FatalBeanException { public class InvalidPropertyException extends FatalBeanException {
private Class<?> beanClass; private final Class<?> beanClass;
private String propertyName; private final String propertyName;
/** /**

7
spring-beans/src/main/java/org/springframework/beans/NotWritablePropertyException.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -30,7 +30,7 @@ import org.springframework.lang.Nullable;
public class NotWritablePropertyException extends InvalidPropertyException { public class NotWritablePropertyException extends InvalidPropertyException {
@Nullable @Nullable
private String[] possibleMatches; private final String[] possibleMatches;
/** /**
@ -42,6 +42,7 @@ public class NotWritablePropertyException extends InvalidPropertyException {
super(beanClass, propertyName, super(beanClass, propertyName,
"Bean property '" + propertyName + "' is not writable or has an invalid setter method: " + "Bean property '" + propertyName + "' is not writable or has an invalid setter method: " +
"Does the return type of the getter match the parameter type of the setter?"); "Does the return type of the getter match the parameter type of the setter?");
this.possibleMatches = null;
} }
/** /**
@ -52,6 +53,7 @@ public class NotWritablePropertyException extends InvalidPropertyException {
*/ */
public NotWritablePropertyException(Class<?> beanClass, String propertyName, String msg) { public NotWritablePropertyException(Class<?> beanClass, String propertyName, String msg) {
super(beanClass, propertyName, msg); super(beanClass, propertyName, msg);
this.possibleMatches = null;
} }
/** /**
@ -63,6 +65,7 @@ public class NotWritablePropertyException extends InvalidPropertyException {
*/ */
public NotWritablePropertyException(Class<?> beanClass, String propertyName, String msg, Throwable cause) { public NotWritablePropertyException(Class<?> beanClass, String propertyName, String msg, Throwable cause) {
super(beanClass, propertyName, msg, cause); super(beanClass, propertyName, msg, cause);
this.possibleMatches = null;
} }
/** /**

5
spring-beans/src/main/java/org/springframework/beans/PropertyAccessException.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -31,7 +31,7 @@ import org.springframework.lang.Nullable;
public abstract class PropertyAccessException extends BeansException { public abstract class PropertyAccessException extends BeansException {
@Nullable @Nullable
private transient PropertyChangeEvent propertyChangeEvent; private final PropertyChangeEvent propertyChangeEvent;
/** /**
@ -52,6 +52,7 @@ public abstract class PropertyAccessException extends BeansException {
*/ */
public PropertyAccessException(String msg, @Nullable Throwable cause) { public PropertyAccessException(String msg, @Nullable Throwable cause) {
super(msg, cause); super(msg, cause);
this.propertyChangeEvent = null;
} }

2
spring-beans/src/main/java/org/springframework/beans/PropertyBatchUpdateException.java

@ -40,7 +40,7 @@ import org.springframework.util.ObjectUtils;
public class PropertyBatchUpdateException extends BeansException { public class PropertyBatchUpdateException extends BeansException {
/** List of PropertyAccessException objects. */ /** List of PropertyAccessException objects. */
private PropertyAccessException[] propertyAccessExceptions; private final PropertyAccessException[] propertyAccessExceptions;
/** /**

9
spring-beans/src/main/java/org/springframework/beans/PropertyDescriptorUtils.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -30,7 +30,12 @@ import org.springframework.util.ObjectUtils;
* @author Chris Beams * @author Chris Beams
* @author Juergen Hoeller * @author Juergen Hoeller
*/ */
class PropertyDescriptorUtils { final class PropertyDescriptorUtils {
private PropertyDescriptorUtils() {
}
/** /**
* See {@link java.beans.FeatureDescriptor}. * See {@link java.beans.FeatureDescriptor}.

2
spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrySupport.java

@ -517,7 +517,7 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
* Holder for a registered custom editor with property name. * Holder for a registered custom editor with property name.
* Keeps the PropertyEditor itself plus the type it was registered for. * Keeps the PropertyEditor itself plus the type it was registered for.
*/ */
private static class CustomEditorHolder { private static final class CustomEditorHolder {
private final PropertyEditor propertyEditor; private final PropertyEditor propertyEditor;

10
spring-beans/src/main/java/org/springframework/beans/factory/BeanCreationException.java

@ -35,10 +35,10 @@ import org.springframework.lang.Nullable;
public class BeanCreationException extends FatalBeanException { public class BeanCreationException extends FatalBeanException {
@Nullable @Nullable
private String beanName; private final String beanName;
@Nullable @Nullable
private String resourceDescription; private final String resourceDescription;
@Nullable @Nullable
private List<Throwable> relatedCauses; private List<Throwable> relatedCauses;
@ -50,6 +50,8 @@ public class BeanCreationException extends FatalBeanException {
*/ */
public BeanCreationException(String msg) { public BeanCreationException(String msg) {
super(msg); super(msg);
this.beanName = null;
this.resourceDescription = null;
} }
/** /**
@ -59,6 +61,8 @@ public class BeanCreationException extends FatalBeanException {
*/ */
public BeanCreationException(String msg, Throwable cause) { public BeanCreationException(String msg, Throwable cause) {
super(msg, cause); super(msg, cause);
this.beanName = null;
this.resourceDescription = null;
} }
/** /**
@ -69,6 +73,7 @@ public class BeanCreationException extends FatalBeanException {
public BeanCreationException(String beanName, String msg) { public BeanCreationException(String beanName, String msg) {
super("Error creating bean with name '" + beanName + "': " + msg); super("Error creating bean with name '" + beanName + "': " + msg);
this.beanName = beanName; this.beanName = beanName;
this.resourceDescription = null;
} }
/** /**
@ -94,6 +99,7 @@ public class BeanCreationException extends FatalBeanException {
(resourceDescription != null ? " defined in " + resourceDescription : "") + ": " + msg); (resourceDescription != null ? " defined in " + resourceDescription : "") + ": " + msg);
this.resourceDescription = resourceDescription; this.resourceDescription = resourceDescription;
this.beanName = beanName; this.beanName = beanName;
this.relatedCauses = null;
} }
/** /**

12
spring-beans/src/main/java/org/springframework/beans/factory/BeanDefinitionStoreException.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -31,10 +31,10 @@ import org.springframework.lang.Nullable;
public class BeanDefinitionStoreException extends FatalBeanException { public class BeanDefinitionStoreException extends FatalBeanException {
@Nullable @Nullable
private String resourceDescription; private final String resourceDescription;
@Nullable @Nullable
private String beanName; private final String beanName;
/** /**
@ -43,6 +43,8 @@ public class BeanDefinitionStoreException extends FatalBeanException {
*/ */
public BeanDefinitionStoreException(String msg) { public BeanDefinitionStoreException(String msg) {
super(msg); super(msg);
this.resourceDescription = null;
this.beanName = null;
} }
/** /**
@ -52,6 +54,8 @@ public class BeanDefinitionStoreException extends FatalBeanException {
*/ */
public BeanDefinitionStoreException(String msg, @Nullable Throwable cause) { public BeanDefinitionStoreException(String msg, @Nullable Throwable cause) {
super(msg, cause); super(msg, cause);
this.resourceDescription = null;
this.beanName = null;
} }
/** /**
@ -62,6 +66,7 @@ public class BeanDefinitionStoreException extends FatalBeanException {
public BeanDefinitionStoreException(@Nullable String resourceDescription, String msg) { public BeanDefinitionStoreException(@Nullable String resourceDescription, String msg) {
super(msg); super(msg);
this.resourceDescription = resourceDescription; this.resourceDescription = resourceDescription;
this.beanName = null;
} }
/** /**
@ -73,6 +78,7 @@ public class BeanDefinitionStoreException extends FatalBeanException {
public BeanDefinitionStoreException(@Nullable String resourceDescription, String msg, @Nullable Throwable cause) { public BeanDefinitionStoreException(@Nullable String resourceDescription, String msg, @Nullable Throwable cause) {
super(msg, cause); super(msg, cause);
this.resourceDescription = resourceDescription; this.resourceDescription = resourceDescription;
this.beanName = null;
} }
/** /**

6
spring-beans/src/main/java/org/springframework/beans/factory/BeanNotOfRequiredTypeException.java

@ -29,13 +29,13 @@ import org.springframework.util.ClassUtils;
public class BeanNotOfRequiredTypeException extends BeansException { public class BeanNotOfRequiredTypeException extends BeansException {
/** The name of the instance that was of the wrong type. */ /** The name of the instance that was of the wrong type. */
private String beanName; private final String beanName;
/** The required type. */ /** The required type. */
private Class<?> requiredType; private final Class<?> requiredType;
/** The offending type. */ /** The offending type. */
private Class<?> actualType; private final Class<?> actualType;
/** /**

8
spring-beans/src/main/java/org/springframework/beans/factory/CannotLoadBeanClassException.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -30,13 +30,13 @@ import org.springframework.lang.Nullable;
public class CannotLoadBeanClassException extends FatalBeanException { public class CannotLoadBeanClassException extends FatalBeanException {
@Nullable @Nullable
private String resourceDescription; private final String resourceDescription;
@Nullable @Nullable
private String beanName; private final String beanName;
@Nullable @Nullable
private String beanClassName; private final String beanClassName;
/** /**

10
spring-beans/src/main/java/org/springframework/beans/factory/NoSuchBeanDefinitionException.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -36,10 +36,10 @@ import org.springframework.lang.Nullable;
public class NoSuchBeanDefinitionException extends BeansException { public class NoSuchBeanDefinitionException extends BeansException {
@Nullable @Nullable
private String beanName; private final String beanName;
@Nullable @Nullable
private ResolvableType resolvableType; private final ResolvableType resolvableType;
/** /**
@ -49,6 +49,7 @@ public class NoSuchBeanDefinitionException extends BeansException {
public NoSuchBeanDefinitionException(String name) { public NoSuchBeanDefinitionException(String name) {
super("No bean named '" + name + "' available"); super("No bean named '" + name + "' available");
this.beanName = name; this.beanName = name;
this.resolvableType = null;
} }
/** /**
@ -59,6 +60,7 @@ public class NoSuchBeanDefinitionException extends BeansException {
public NoSuchBeanDefinitionException(String name, String message) { public NoSuchBeanDefinitionException(String name, String message) {
super("No bean named '" + name + "' available: " + message); super("No bean named '" + name + "' available: " + message);
this.beanName = name; this.beanName = name;
this.resolvableType = null;
} }
/** /**
@ -85,6 +87,7 @@ public class NoSuchBeanDefinitionException extends BeansException {
*/ */
public NoSuchBeanDefinitionException(ResolvableType type) { public NoSuchBeanDefinitionException(ResolvableType type) {
super("No qualifying bean of type '" + type + "' available"); super("No qualifying bean of type '" + type + "' available");
this.beanName = null;
this.resolvableType = type; this.resolvableType = type;
} }
@ -96,6 +99,7 @@ public class NoSuchBeanDefinitionException extends BeansException {
*/ */
public NoSuchBeanDefinitionException(ResolvableType type, String message) { public NoSuchBeanDefinitionException(ResolvableType type, String message) {
super("No qualifying bean of type '" + type + "' available: " + message); super("No qualifying bean of type '" + type + "' available: " + message);
this.beanName = null;
this.resolvableType = type; this.resolvableType = type;
} }

10
spring-beans/src/main/java/org/springframework/beans/factory/NoUniqueBeanDefinitionException.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -33,10 +33,10 @@ import org.springframework.util.StringUtils;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class NoUniqueBeanDefinitionException extends NoSuchBeanDefinitionException { public class NoUniqueBeanDefinitionException extends NoSuchBeanDefinitionException {
private int numberOfBeansFound; private final int numberOfBeansFound;
@Nullable @Nullable
private Collection<String> beanNamesFound; private final Collection<String> beanNamesFound;
/** /**
@ -48,6 +48,7 @@ public class NoUniqueBeanDefinitionException extends NoSuchBeanDefinitionExcepti
public NoUniqueBeanDefinitionException(Class<?> type, int numberOfBeansFound, String message) { public NoUniqueBeanDefinitionException(Class<?> type, int numberOfBeansFound, String message) {
super(type, message); super(type, message);
this.numberOfBeansFound = numberOfBeansFound; this.numberOfBeansFound = numberOfBeansFound;
this.beanNamesFound = null;
} }
/** /**
@ -56,8 +57,9 @@ public class NoUniqueBeanDefinitionException extends NoSuchBeanDefinitionExcepti
* @param beanNamesFound the names of all matching beans (as a Collection) * @param beanNamesFound the names of all matching beans (as a Collection)
*/ */
public NoUniqueBeanDefinitionException(Class<?> type, Collection<String> beanNamesFound) { public NoUniqueBeanDefinitionException(Class<?> type, Collection<String> beanNamesFound) {
this(type, beanNamesFound.size(), "expected single matching bean but found " + beanNamesFound.size() + ": " + super(type, "expected single matching bean but found " + beanNamesFound.size() + ": " +
StringUtils.collectionToCommaDelimitedString(beanNamesFound)); StringUtils.collectionToCommaDelimitedString(beanNamesFound));
this.numberOfBeansFound = beanNamesFound.size();
this.beanNamesFound = beanNamesFound; this.beanNamesFound = beanNamesFound;
} }

5
spring-beans/src/main/java/org/springframework/beans/factory/UnsatisfiedDependencyException.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -33,7 +33,7 @@ import org.springframework.util.StringUtils;
public class UnsatisfiedDependencyException extends BeanCreationException { public class UnsatisfiedDependencyException extends BeanCreationException {
@Nullable @Nullable
private InjectionPoint injectionPoint; private final InjectionPoint injectionPoint;
/** /**
@ -49,6 +49,7 @@ public class UnsatisfiedDependencyException extends BeanCreationException {
super(resourceDescription, beanName, super(resourceDescription, beanName,
"Unsatisfied dependency expressed through bean property '" + propertyName + "'" + "Unsatisfied dependency expressed through bean property '" + propertyName + "'" +
(StringUtils.hasLength(msg) ? ": " + msg : "")); (StringUtils.hasLength(msg) ? ": " + msg : ""));
this.injectionPoint = null;
} }
/** /**

4
spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -250,7 +250,7 @@ public class PropertyPlaceholderConfigurer extends PlaceholderConfigurerSupport
} }
private class PropertyPlaceholderConfigurerResolver implements PlaceholderResolver { private final class PropertyPlaceholderConfigurerResolver implements PlaceholderResolver {
private final Properties props; private final Properties props;

4
spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionBuilder.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -34,7 +34,7 @@ import org.springframework.util.ObjectUtils;
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 2.0 * @since 2.0
*/ */
public class BeanDefinitionBuilder { public final class BeanDefinitionBuilder {
/** /**
* Create a new {@code BeanDefinitionBuilder} used to construct a {@link GenericBeanDefinition}. * Create a new {@code BeanDefinitionBuilder} used to construct a {@link GenericBeanDefinition}.

8
spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionReaderUtils.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -35,7 +35,7 @@ import org.springframework.util.StringUtils;
* @see PropertiesBeanDefinitionReader * @see PropertiesBeanDefinitionReader
* @see org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader * @see org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader
*/ */
public class BeanDefinitionReaderUtils { public final class BeanDefinitionReaderUtils {
/** /**
* Separator for generated bean names. If a class name or parent name is not * Separator for generated bean names. If a class name or parent name is not
@ -44,6 +44,10 @@ public class BeanDefinitionReaderUtils {
public static final String GENERATED_BEAN_NAME_SEPARATOR = BeanFactoryUtils.GENERATED_BEAN_NAME_SEPARATOR; public static final String GENERATED_BEAN_NAME_SEPARATOR = BeanFactoryUtils.GENERATED_BEAN_NAME_SEPARATOR;
private BeanDefinitionReaderUtils() {
}
/** /**
* Create a new GenericBeanDefinition for the given parent name and class name, * Create a new GenericBeanDefinition for the given parent name and class name,
* eagerly loading the bean class if a ClassLoader has been specified. * eagerly loading the bean class if a ClassLoader has been specified.

3
spring-context-support/src/main/java/org/springframework/mail/MailSendException.java

@ -37,7 +37,7 @@ public class MailSendException extends MailException {
private final transient Map<Object, Exception> failedMessages; private final transient Map<Object, Exception> failedMessages;
@Nullable @Nullable
private Exception[] messageExceptions; private final Exception[] messageExceptions;
/** /**
@ -56,6 +56,7 @@ public class MailSendException extends MailException {
public MailSendException(String msg, @Nullable Throwable cause) { public MailSendException(String msg, @Nullable Throwable cause) {
super(msg, cause); super(msg, cause);
this.failedMessages = new LinkedHashMap<>(); this.failedMessages = new LinkedHashMap<>();
this.messageExceptions = null;
} }
/** /**

6
spring-context/src/main/java/org/springframework/cache/config/CacheManagementConfigUtils.java vendored

@ -22,7 +22,7 @@ package org.springframework.cache.config;
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 4.1 * @since 4.1
*/ */
public class CacheManagementConfigUtils { public final class CacheManagementConfigUtils {
/** /**
* The name of the cache advisor bean. * The name of the cache advisor bean.
@ -48,4 +48,8 @@ public class CacheManagementConfigUtils {
public static final String JCACHE_ASPECT_BEAN_NAME = public static final String JCACHE_ASPECT_BEAN_NAME =
"org.springframework.cache.config.internalJCacheAspect"; "org.springframework.cache.config.internalJCacheAspect";
private CacheManagementConfigUtils() {
}
} }

6
spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java

@ -60,7 +60,7 @@ import org.springframework.util.ClassUtils;
* @see org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor * @see org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor
* @see org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor * @see org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor
*/ */
public class AnnotationConfigUtils { public final class AnnotationConfigUtils {
/** /**
* The bean name of the internally managed Configuration annotation processor. * The bean name of the internally managed Configuration annotation processor.
@ -127,6 +127,10 @@ public class AnnotationConfigUtils {
ClassUtils.isPresent(PERSISTENCE_ANNOTATION_PROCESSOR_CLASS_NAME, AnnotationConfigUtils.class.getClassLoader()); ClassUtils.isPresent(PERSISTENCE_ANNOTATION_PROCESSOR_CLASS_NAME, AnnotationConfigUtils.class.getClassLoader());
private AnnotationConfigUtils() {
}
/** /**
* Register all relevant annotation post processors in the given registry. * Register all relevant annotation post processors in the given registry.
* @param registry the registry to operate on * @param registry the registry to operate on

9
spring-context/src/main/java/org/springframework/context/annotation/BeanAnnotationHelper.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,7 +27,12 @@ import org.springframework.core.annotation.AnnotatedElementUtils;
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 3.1 * @since 3.1
*/ */
class BeanAnnotationHelper { final class BeanAnnotationHelper {
private BeanAnnotationHelper() {
}
public static boolean isBeanAnnotated(Method method) { public static boolean isBeanAnnotated(Method method) {
return AnnotatedElementUtils.hasAnnotation(method, Bean.class); return AnnotatedElementUtils.hasAnnotation(method, Bean.class);

9
spring-context/src/main/java/org/springframework/context/annotation/ScopedProxyCreator.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2009 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -28,7 +28,12 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry;
* @since 3.0 * @since 3.0
* @see org.springframework.aop.scope.ScopedProxyUtils#createScopedProxy * @see org.springframework.aop.scope.ScopedProxyUtils#createScopedProxy
*/ */
class ScopedProxyCreator { final class ScopedProxyCreator {
private ScopedProxyCreator() {
}
public static BeanDefinitionHolder createScopedProxy( public static BeanDefinitionHolder createScopedProxy(
BeanDefinitionHolder definitionHolder, BeanDefinitionRegistry registry, boolean proxyTargetClass) { BeanDefinitionHolder definitionHolder, BeanDefinitionRegistry registry, boolean proxyTargetClass) {

8
spring-context/src/main/java/org/springframework/context/index/CandidateComponentsIndexLoader.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -39,7 +39,7 @@ import org.springframework.util.ConcurrentReferenceHashMap;
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 5.0 * @since 5.0
*/ */
public class CandidateComponentsIndexLoader { public final class CandidateComponentsIndexLoader {
/** /**
* The location to look for components. * The location to look for components.
@ -67,6 +67,10 @@ public class CandidateComponentsIndexLoader {
new ConcurrentReferenceHashMap<>(); new ConcurrentReferenceHashMap<>();
private CandidateComponentsIndexLoader() {
}
/** /**
* Load and instantiate the {@link CandidateComponentsIndex} from * Load and instantiate the {@link CandidateComponentsIndex} from
* {@value #COMPONENTS_RESOURCE_LOCATION}, using the given class loader. If no * {@value #COMPONENTS_RESOURCE_LOCATION}, using the given class loader. If no

7
spring-context/src/main/java/org/springframework/context/support/PostProcessorRegistrationDelegate.java

@ -48,7 +48,12 @@ import org.springframework.lang.Nullable;
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 4.0 * @since 4.0
*/ */
class PostProcessorRegistrationDelegate { final class PostProcessorRegistrationDelegate {
private PostProcessorRegistrationDelegate() {
}
public static void invokeBeanFactoryPostProcessors( public static void invokeBeanFactoryPostProcessors(
ConfigurableListableBeanFactory beanFactory, List<BeanFactoryPostProcessor> beanFactoryPostProcessors) { ConfigurableListableBeanFactory beanFactory, List<BeanFactoryPostProcessor> beanFactoryPostProcessors) {

6
spring-context/src/main/java/org/springframework/format/datetime/joda/JodaTimeContextHolder.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -38,6 +38,10 @@ public final class JodaTimeContextHolder {
new NamedThreadLocal<>("JodaTimeContext"); new NamedThreadLocal<>("JodaTimeContext");
private JodaTimeContextHolder() {
}
/** /**
* Reset the JodaTimeContext for the current thread. * Reset the JodaTimeContext for the current thread.
*/ */

7
spring-context/src/main/java/org/springframework/format/datetime/joda/JodaTimeConverters.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -46,6 +46,11 @@ import org.springframework.format.datetime.DateFormatterRegistrar;
*/ */
final class JodaTimeConverters { final class JodaTimeConverters {
private JodaTimeConverters() {
}
/** /**
* Install the converters into the converter registry. * Install the converters into the converter registry.
* @param registry the converter registry * @param registry the converter registry

6
spring-context/src/main/java/org/springframework/format/datetime/standard/DateTimeContextHolder.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -35,6 +35,10 @@ public final class DateTimeContextHolder {
new NamedThreadLocal<>("DateTimeContext"); new NamedThreadLocal<>("DateTimeContext");
private DateTimeContextHolder() {
}
/** /**
* Reset the DateTimeContext for the current thread. * Reset the DateTimeContext for the current thread.
*/ */

7
spring-context/src/main/java/org/springframework/format/datetime/standard/DateTimeConverters.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -43,6 +43,11 @@ import org.springframework.format.datetime.DateFormatterRegistrar;
*/ */
final class DateTimeConverters { final class DateTimeConverters {
private DateTimeConverters() {
}
/** /**
* Install the converters into the converter registry. * Install the converters into the converter registry.
* @param registry the converter registry * @param registry the converter registry

9
spring-context/src/main/java/org/springframework/jmx/support/ObjectNameManager.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -28,7 +28,12 @@ import javax.management.ObjectName;
* @since 1.2 * @since 1.2
* @see javax.management.ObjectName#getInstance(String) * @see javax.management.ObjectName#getInstance(String)
*/ */
public class ObjectNameManager { public final class ObjectNameManager {
private ObjectNameManager() {
}
/** /**
* Retrieve the {@code ObjectName} instance corresponding to the supplied name. * Retrieve the {@code ObjectName} instance corresponding to the supplied name.

9
spring-context/src/main/java/org/springframework/scheduling/config/TaskManagementConfigUtils.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,7 +22,7 @@ package org.springframework.scheduling.config;
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 4.1 * @since 4.1
*/ */
public class TaskManagementConfigUtils { public final class TaskManagementConfigUtils {
/** /**
* The bean name of the internally managed Scheduled annotation processor. * The bean name of the internally managed Scheduled annotation processor.
@ -42,4 +42,9 @@ public class TaskManagementConfigUtils {
public static final String ASYNC_EXECUTION_ASPECT_BEAN_NAME = public static final String ASYNC_EXECUTION_ASPECT_BEAN_NAME =
"org.springframework.scheduling.config.internalAsyncExecutionAspect"; "org.springframework.scheduling.config.internalAsyncExecutionAspect";
private TaskManagementConfigUtils() {
}
} }

6
spring-context/src/main/java/org/springframework/scripting/ScriptCompilationException.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -29,7 +29,7 @@ import org.springframework.lang.Nullable;
public class ScriptCompilationException extends NestedRuntimeException { public class ScriptCompilationException extends NestedRuntimeException {
@Nullable @Nullable
private ScriptSource scriptSource; private final ScriptSource scriptSource;
/** /**
@ -38,6 +38,7 @@ public class ScriptCompilationException extends NestedRuntimeException {
*/ */
public ScriptCompilationException(String msg) { public ScriptCompilationException(String msg) {
super(msg); super(msg);
this.scriptSource = null;
} }
/** /**
@ -47,6 +48,7 @@ public class ScriptCompilationException extends NestedRuntimeException {
*/ */
public ScriptCompilationException(String msg, Throwable cause) { public ScriptCompilationException(String msg, Throwable cause) {
super(msg, cause); super(msg, cause);
this.scriptSource = null;
} }
/** /**

4
spring-context/src/main/java/org/springframework/scripting/bsh/BshScriptUtils.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -225,7 +225,7 @@ public abstract class BshScriptUtils {
* Exception to be thrown on script execution failure. * Exception to be thrown on script execution failure.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public static class BshExecutionException extends NestedRuntimeException { public static final class BshExecutionException extends NestedRuntimeException {
private BshExecutionException(EvalError ex) { private BshExecutionException(EvalError ex) {
super("BeanShell script execution failed", ex); super("BeanShell script execution failed", ex);

2
spring-core/src/main/java/org/springframework/core/ReactiveTypeDescriptor.java

@ -28,7 +28,7 @@ import org.springframework.util.Assert;
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
* @since 5.0 * @since 5.0
*/ */
public class ReactiveTypeDescriptor { public final class ReactiveTypeDescriptor {
private final Class<?> reactiveType; private final Class<?> reactiveType;

9
spring-core/src/main/java/org/springframework/core/SpringVersion.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -31,7 +31,12 @@ import org.springframework.lang.Nullable;
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 1.1 * @since 1.1
*/ */
public class SpringVersion { public final class SpringVersion {
private SpringVersion() {
}
/** /**
* Return the full version string of the present Spring codebase, * Return the full version string of the present Spring codebase,

2
spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java

@ -2047,7 +2047,7 @@ public abstract class AnnotationUtils {
* @see #getAttributeAliasNames * @see #getAttributeAliasNames
* @see #getAttributeOverrideName * @see #getAttributeOverrideName
*/ */
private static class AliasDescriptor { private static final class AliasDescriptor {
private final Method sourceAttribute; private final Method sourceAttribute;

2
spring-core/src/main/java/org/springframework/core/codec/CharSequenceEncoder.java

@ -42,7 +42,7 @@ import org.springframework.util.MimeTypeUtils;
* @since 5.0 * @since 5.0
* @see StringDecoder * @see StringDecoder
*/ */
public class CharSequenceEncoder extends AbstractEncoder<CharSequence> { public final class CharSequenceEncoder extends AbstractEncoder<CharSequence> {
/** /**
* The default charset used by the encoder. * The default charset used by the encoder.

2
spring-core/src/main/java/org/springframework/core/codec/StringDecoder.java

@ -53,7 +53,7 @@ import org.springframework.util.MimeTypeUtils;
* @since 5.0 * @since 5.0
* @see CharSequenceEncoder * @see CharSequenceEncoder
*/ */
public class StringDecoder extends AbstractDataBufferDecoder<String> { public final class StringDecoder extends AbstractDataBufferDecoder<String> {
private static final DataBuffer END_FRAME = new DefaultDataBufferFactory().wrap(new byte[0]); private static final DataBuffer END_FRAME = new DefaultDataBufferFactory().wrap(new byte[0]);

5
spring-core/src/main/java/org/springframework/core/env/ProfilesParser.java vendored

@ -31,7 +31,10 @@ import org.springframework.util.StringUtils;
* @author Phillip Webb * @author Phillip Webb
* @since 5.1 * @since 5.1
*/ */
class ProfilesParser { final class ProfilesParser {
private ProfilesParser() {
}
static Profiles parse(String... expressions) { static Profiles parse(String... expressions) {
Assert.notEmpty(expressions, "Must specify at least one profile"); Assert.notEmpty(expressions, "Must specify at least one profile");

42
spring-core/src/main/java/org/springframework/util/ReflectionUtils.java

@ -57,6 +57,27 @@ public abstract class ReflectionUtils {
private static final Field[] NO_FIELDS = {}; private static final Field[] NO_FIELDS = {};
/**
* Pre-built FieldFilter that matches all non-static, non-final fields.
*/
public static final FieldFilter COPYABLE_FIELDS =
field -> !(Modifier.isStatic(field.getModifiers()) || Modifier.isFinal(field.getModifiers()));
/**
* Pre-built MethodFilter that matches all non-bridge methods.
*/
public static final MethodFilter NON_BRIDGED_METHODS =
(method -> !method.isBridge());
/**
* Pre-built MethodFilter that matches all non-bridge non-synthetic methods
* which are not declared on {@code java.lang.Object}.
*/
public static final MethodFilter USER_DECLARED_METHODS =
(method -> (!method.isBridge() && !method.isSynthetic() && method.getDeclaringClass() != Object.class));
/** /**
* Cache for {@link Class#getDeclaredMethods()} plus equivalent default methods * Cache for {@link Class#getDeclaredMethods()} plus equivalent default methods
@ -847,25 +868,4 @@ public abstract class ReflectionUtils {
} }
/**
* Pre-built FieldFilter that matches all non-static, non-final fields.
*/
public static final FieldFilter COPYABLE_FIELDS =
field -> !(Modifier.isStatic(field.getModifiers()) || Modifier.isFinal(field.getModifiers()));
/**
* Pre-built MethodFilter that matches all non-bridge methods.
*/
public static final MethodFilter NON_BRIDGED_METHODS =
(method -> !method.isBridge());
/**
* Pre-built MethodFilter that matches all non-bridge non-synthetic methods
* which are not declared on {@code java.lang.Object}.
*/
public static final MethodFilter USER_DECLARED_METHODS =
(method -> (!method.isBridge() && !method.isSynthetic() && method.getDeclaringClass() != Object.class));
} }

8
spring-expression/src/main/java/org/springframework/expression/ExpressionException.java

@ -29,7 +29,7 @@ import org.springframework.lang.Nullable;
public class ExpressionException extends RuntimeException { public class ExpressionException extends RuntimeException {
@Nullable @Nullable
protected String expressionString; protected final String expressionString;
protected int position; // -1 if not known; should be known in all reasonable cases protected int position; // -1 if not known; should be known in all reasonable cases
@ -40,6 +40,8 @@ public class ExpressionException extends RuntimeException {
*/ */
public ExpressionException(String message) { public ExpressionException(String message) {
super(message); super(message);
this.expressionString = null;
this.position = 0;
} }
/** /**
@ -49,6 +51,8 @@ public class ExpressionException extends RuntimeException {
*/ */
public ExpressionException(String message, Throwable cause) { public ExpressionException(String message, Throwable cause) {
super(message, cause); super(message, cause);
this.expressionString = null;
this.position = 0;
} }
/** /**
@ -81,6 +85,7 @@ public class ExpressionException extends RuntimeException {
*/ */
public ExpressionException(int position, String message) { public ExpressionException(int position, String message) {
super(message); super(message);
this.expressionString = null;
this.position = position; this.position = position;
} }
@ -92,6 +97,7 @@ public class ExpressionException extends RuntimeException {
*/ */
public ExpressionException(int position, String message, Throwable cause) { public ExpressionException(int position, String message, Throwable cause) {
super(message, cause); super(message, cause);
this.expressionString = null;
this.position = position; this.position = position;
} }

29
spring-expression/src/main/java/org/springframework/expression/spel/CodeFlow.java

@ -1009,6 +1009,21 @@ public class CodeFlow implements Opcodes {
} }
} }
public static final String toBoxedDescriptor(String primitiveDescriptor) {
switch (primitiveDescriptor.charAt(0)) {
case 'I': return "Ljava/lang/Integer";
case 'J': return "Ljava/lang/Long";
case 'F': return "Ljava/lang/Float";
case 'D': return "Ljava/lang/Double";
case 'B': return "Ljava/lang/Byte";
case 'C': return "Ljava/lang/Character";
case 'S': return "Ljava/lang/Short";
case 'Z': return "Ljava/lang/Boolean";
default:
throw new IllegalArgumentException("Unexpected non primitive descriptor "+primitiveDescriptor);
}
}
/** /**
* Interface used to generate fields. * Interface used to generate fields.
@ -1029,19 +1044,5 @@ public class CodeFlow implements Opcodes {
void generateCode(MethodVisitor mv, CodeFlow codeflow); void generateCode(MethodVisitor mv, CodeFlow codeflow);
} }
public static String toBoxedDescriptor(String primitiveDescriptor) {
switch (primitiveDescriptor.charAt(0)) {
case 'I': return "Ljava/lang/Integer";
case 'J': return "Ljava/lang/Long";
case 'F': return "Ljava/lang/Float";
case 'D': return "Ljava/lang/Double";
case 'B': return "Ljava/lang/Byte";
case 'C': return "Ljava/lang/Character";
case 'S': return "Ljava/lang/Short";
case 'Z': return "Ljava/lang/Boolean";
default:
throw new IllegalArgumentException("Unexpected non primitive descriptor "+primitiveDescriptor);
}
}
} }

28
spring-expression/src/main/java/org/springframework/expression/spel/ast/Operator.java

@ -41,7 +41,7 @@ import org.springframework.util.ObjectUtils;
public abstract class Operator extends SpelNodeImpl { public abstract class Operator extends SpelNodeImpl {
private final String operatorName; private final String operatorName;
// The descriptors of the runtime operand values are used if the discovered declared // The descriptors of the runtime operand values are used if the discovered declared
// descriptors are not providing enough information (for example a generic type // descriptors are not providing enough information (for example a generic type
// whose accessors seem to only be returning 'Object' - the actual descriptors may // whose accessors seem to only be returning 'Object' - the actual descriptors may
@ -104,8 +104,8 @@ public abstract class Operator extends SpelNodeImpl {
return (dc.areNumbers && dc.areCompatible); return (dc.areNumbers && dc.areCompatible);
} }
/** /**
* Numeric comparison operators share very similar generated code, only differing in * Numeric comparison operators share very similar generated code, only differing in
* two comparison instructions. * two comparison instructions.
*/ */
protected void generateComparisonCode(MethodVisitor mv, CodeFlow cf, int compInstruction1, int compInstruction2) { protected void generateComparisonCode(MethodVisitor mv, CodeFlow cf, int compInstruction1, int compInstruction2) {
@ -113,20 +113,20 @@ public abstract class Operator extends SpelNodeImpl {
SpelNodeImpl right = getRightOperand(); SpelNodeImpl right = getRightOperand();
String leftDesc = left.exitTypeDescriptor; String leftDesc = left.exitTypeDescriptor;
String rightDesc = right.exitTypeDescriptor; String rightDesc = right.exitTypeDescriptor;
boolean unboxLeft = !CodeFlow.isPrimitive(leftDesc); boolean unboxLeft = !CodeFlow.isPrimitive(leftDesc);
boolean unboxRight = !CodeFlow.isPrimitive(rightDesc); boolean unboxRight = !CodeFlow.isPrimitive(rightDesc);
DescriptorComparison dc = DescriptorComparison.checkNumericCompatibility( DescriptorComparison dc = DescriptorComparison.checkNumericCompatibility(
leftDesc, rightDesc, this.leftActualDescriptor, this.rightActualDescriptor); leftDesc, rightDesc, this.leftActualDescriptor, this.rightActualDescriptor);
char targetType = dc.compatibleType; // CodeFlow.toPrimitiveTargetDesc(leftDesc); char targetType = dc.compatibleType; // CodeFlow.toPrimitiveTargetDesc(leftDesc);
cf.enterCompilationScope(); cf.enterCompilationScope();
left.generateCode(mv, cf); left.generateCode(mv, cf);
cf.exitCompilationScope(); cf.exitCompilationScope();
if (unboxLeft) { if (unboxLeft) {
CodeFlow.insertUnboxInsns(mv, targetType, leftDesc); CodeFlow.insertUnboxInsns(mv, targetType, leftDesc);
} }
cf.enterCompilationScope(); cf.enterCompilationScope();
right.generateCode(mv, cf); right.generateCode(mv, cf);
cf.exitCompilationScope(); cf.exitCompilationScope();
@ -142,11 +142,11 @@ public abstract class Operator extends SpelNodeImpl {
mv.visitJumpInsn(compInstruction1, elseTarget); mv.visitJumpInsn(compInstruction1, elseTarget);
} }
else if (targetType == 'F') { else if (targetType == 'F') {
mv.visitInsn(FCMPG); mv.visitInsn(FCMPG);
mv.visitJumpInsn(compInstruction1, elseTarget); mv.visitJumpInsn(compInstruction1, elseTarget);
} }
else if (targetType == 'J') { else if (targetType == 'J') {
mv.visitInsn(LCMP); mv.visitInsn(LCMP);
mv.visitJumpInsn(compInstruction1, elseTarget); mv.visitJumpInsn(compInstruction1, elseTarget);
} }
else if (targetType == 'I') { else if (targetType == 'I') {
@ -231,13 +231,13 @@ public abstract class Operator extends SpelNodeImpl {
return false; return false;
} }
/** /**
* A descriptor comparison encapsulates the result of comparing descriptor * A descriptor comparison encapsulates the result of comparing descriptor
* for two operands and describes at what level they are compatible. * for two operands and describes at what level they are compatible.
*/ */
protected static class DescriptorComparison { protected static final class DescriptorComparison {
static final DescriptorComparison NOT_NUMBERS = new DescriptorComparison(false, false, ' '); static final DescriptorComparison NOT_NUMBERS = new DescriptorComparison(false, false, ' ');
@ -254,7 +254,7 @@ public abstract class Operator extends SpelNodeImpl {
this.areCompatible = areCompatible; this.areCompatible = areCompatible;
this.compatibleType = compatibleType; this.compatibleType = compatibleType;
} }
/** /**
* Return an object that indicates whether the input descriptors are compatible. * Return an object that indicates whether the input descriptors are compatible.
* <p>A declared descriptor is what could statically be determined (e.g. from looking * <p>A declared descriptor is what could statically be determined (e.g. from looking
@ -278,7 +278,7 @@ public abstract class Operator extends SpelNodeImpl {
boolean leftNumeric = CodeFlow.isPrimitiveOrUnboxableSupportedNumberOrBoolean(ld); boolean leftNumeric = CodeFlow.isPrimitiveOrUnboxableSupportedNumberOrBoolean(ld);
boolean rightNumeric = CodeFlow.isPrimitiveOrUnboxableSupportedNumberOrBoolean(rd); boolean rightNumeric = CodeFlow.isPrimitiveOrUnboxableSupportedNumberOrBoolean(rd);
// If the declared descriptors aren't providing the information, try the actual descriptors // If the declared descriptors aren't providing the information, try the actual descriptors
if (!leftNumeric && !ObjectUtils.nullSafeEquals(ld, leftActualDescriptor)) { if (!leftNumeric && !ObjectUtils.nullSafeEquals(ld, leftActualDescriptor)) {
ld = leftActualDescriptor; ld = leftActualDescriptor;
@ -288,7 +288,7 @@ public abstract class Operator extends SpelNodeImpl {
rd = rightActualDescriptor; rd = rightActualDescriptor;
rightNumeric = CodeFlow.isPrimitiveOrUnboxableSupportedNumberOrBoolean(rd); rightNumeric = CodeFlow.isPrimitiveOrUnboxableSupportedNumberOrBoolean(rd);
} }
if (leftNumeric && rightNumeric) { if (leftNumeric && rightNumeric) {
if (CodeFlow.areBoxingCompatible(ld, rd)) { if (CodeFlow.areBoxingCompatible(ld, rd)) {
return new DescriptorComparison(true, true, CodeFlow.toPrimitiveTargetDesc(ld)); return new DescriptorComparison(true, true, CodeFlow.toPrimitiveTargetDesc(ld));
@ -299,7 +299,7 @@ public abstract class Operator extends SpelNodeImpl {
} }
else { else {
return DescriptorComparison.NOT_NUMBERS; return DescriptorComparison.NOT_NUMBERS;
} }
} }
} }

4
spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelCompiler.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -64,7 +64,7 @@ import org.springframework.util.ReflectionUtils;
* @author Andy Clement * @author Andy Clement
* @since 4.1 * @since 4.1
*/ */
public class SpelCompiler implements Opcodes { public final class SpelCompiler implements Opcodes {
private static final Log logger = LogFactory.getLog(SpelCompiler.class); private static final Log logger = LogFactory.getLog(SpelCompiler.class);

2
spring-expression/src/main/java/org/springframework/expression/spel/support/BooleanTypedValue.java

@ -24,7 +24,7 @@ import org.springframework.expression.TypedValue;
* @author Andy Clement * @author Andy Clement
* @since 3.0 * @since 3.0
*/ */
public class BooleanTypedValue extends TypedValue { public final class BooleanTypedValue extends TypedValue {
/** /**
* True. * True.

2
spring-expression/src/main/java/org/springframework/expression/spel/support/DataBindingMethodResolver.java

@ -39,7 +39,7 @@ import org.springframework.lang.Nullable;
* @see #forInstanceMethodInvocation() * @see #forInstanceMethodInvocation()
* @see DataBindingPropertyAccessor * @see DataBindingPropertyAccessor
*/ */
public class DataBindingMethodResolver extends ReflectiveMethodResolver { public final class DataBindingMethodResolver extends ReflectiveMethodResolver {
private DataBindingMethodResolver() { private DataBindingMethodResolver() {
super(); super();

2
spring-expression/src/main/java/org/springframework/expression/spel/support/DataBindingPropertyAccessor.java

@ -37,7 +37,7 @@ import java.lang.reflect.Method;
* @see StandardEvaluationContext * @see StandardEvaluationContext
* @see ReflectivePropertyAccessor * @see ReflectivePropertyAccessor
*/ */
public class DataBindingPropertyAccessor extends ReflectivePropertyAccessor { public final class DataBindingPropertyAccessor extends ReflectivePropertyAccessor {
/** /**
* Create a new property accessor for reading and possibly also writing. * Create a new property accessor for reading and possibly also writing.

2
spring-expression/src/main/java/org/springframework/expression/spel/support/SimpleEvaluationContext.java

@ -86,7 +86,7 @@ import org.springframework.lang.Nullable;
* @see StandardTypeConverter * @see StandardTypeConverter
* @see DataBindingPropertyAccessor * @see DataBindingPropertyAccessor
*/ */
public class SimpleEvaluationContext implements EvaluationContext { public final class SimpleEvaluationContext implements EvaluationContext {
private static final TypeLocator typeNotFoundTypeLocator = typeName -> { private static final TypeLocator typeNotFoundTypeLocator = typeName -> {
throw new SpelEvaluationException(SpelMessage.TYPE_NOT_FOUND, typeName); throw new SpelEvaluationException(SpelMessage.TYPE_NOT_FOUND, typeName);

8
spring-instrument/src/main/java/org/springframework/instrument/InstrumentationSavingAgent.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,11 +27,15 @@ import java.lang.instrument.Instrumentation;
* @since 2.0 * @since 2.0
* @see org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver * @see org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver
*/ */
public class InstrumentationSavingAgent { public final class InstrumentationSavingAgent {
private static volatile Instrumentation instrumentation; private static volatile Instrumentation instrumentation;
private InstrumentationSavingAgent() {
}
/** /**
* Save the {@link Instrumentation} interface exposed by the JVM. * Save the {@link Instrumentation} interface exposed by the JVM.
*/ */

4
spring-jdbc/src/main/java/org/springframework/jdbc/BadSqlGrammarException.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -34,7 +34,7 @@ import org.springframework.dao.InvalidDataAccessResourceUsageException;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BadSqlGrammarException extends InvalidDataAccessResourceUsageException { public class BadSqlGrammarException extends InvalidDataAccessResourceUsageException {
private String sql; private final String sql;
/** /**

6
spring-jdbc/src/main/java/org/springframework/jdbc/IncorrectResultSetColumnCountException.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -29,9 +29,9 @@ import org.springframework.dao.DataRetrievalFailureException;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class IncorrectResultSetColumnCountException extends DataRetrievalFailureException { public class IncorrectResultSetColumnCountException extends DataRetrievalFailureException {
private int expectedCount; private final int expectedCount;
private int actualCount; private final int actualCount;
/** /**

5
spring-jdbc/src/main/java/org/springframework/jdbc/InvalidResultSetAccessException.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -37,7 +37,7 @@ import org.springframework.lang.Nullable;
public class InvalidResultSetAccessException extends InvalidDataAccessResourceUsageException { public class InvalidResultSetAccessException extends InvalidDataAccessResourceUsageException {
@Nullable @Nullable
private String sql; private final String sql;
/** /**
@ -57,6 +57,7 @@ public class InvalidResultSetAccessException extends InvalidDataAccessResourceUs
*/ */
public InvalidResultSetAccessException(SQLException ex) { public InvalidResultSetAccessException(SQLException ex) {
super(ex.getMessage(), ex); super(ex.getMessage(), ex);
this.sql = null;
} }

4
spring-jdbc/src/main/java/org/springframework/jdbc/JdbcUpdateAffectedIncorrectNumberOfRowsException.java

@ -30,10 +30,10 @@ import org.springframework.dao.IncorrectUpdateSemanticsDataAccessException;
public class JdbcUpdateAffectedIncorrectNumberOfRowsException extends IncorrectUpdateSemanticsDataAccessException { public class JdbcUpdateAffectedIncorrectNumberOfRowsException extends IncorrectUpdateSemanticsDataAccessException {
/** Number of rows that should have been affected. */ /** Number of rows that should have been affected. */
private int expected; private final int expected;
/** Number of rows that actually were affected. */ /** Number of rows that actually were affected. */
private int actual; private final int actual;
/** /**

7
spring-jdbc/src/main/java/org/springframework/jdbc/config/DatabasePopulatorConfigUtils.java

@ -38,7 +38,12 @@ import org.springframework.util.xml.DomUtils;
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 3.1 * @since 3.1
*/ */
class DatabasePopulatorConfigUtils { final class DatabasePopulatorConfigUtils {
private DatabasePopulatorConfigUtils() {
}
public static void setDatabasePopulator(Element element, BeanDefinitionBuilder builder) { public static void setDatabasePopulator(Element element, BeanDefinitionBuilder builder) {
List<Element> scripts = DomUtils.getChildElementsByTagName(element, "script"); List<Element> scripts = DomUtils.getChildElementsByTagName(element, "script");

6
spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataProviderFactory.java

@ -35,7 +35,7 @@ import org.springframework.jdbc.support.MetaDataAccessException;
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 2.5 * @since 2.5
*/ */
public class CallMetaDataProviderFactory { public final class CallMetaDataProviderFactory {
/** List of supported database products for procedure calls. */ /** List of supported database products for procedure calls. */
public static final List<String> supportedDatabaseProductsForProcedures = Arrays.asList( public static final List<String> supportedDatabaseProductsForProcedures = Arrays.asList(
@ -59,6 +59,10 @@ public class CallMetaDataProviderFactory {
private static final Log logger = LogFactory.getLog(CallMetaDataProviderFactory.class); private static final Log logger = LogFactory.getLog(CallMetaDataProviderFactory.class);
private CallMetaDataProviderFactory() {
}
/** /**
* Create a {@link CallMetaDataProvider} based on the database meta-data. * Create a {@link CallMetaDataProvider} based on the database meta-data.
* @param dataSource the JDBC DataSource to use for retrieving meta-data * @param dataSource the JDBC DataSource to use for retrieving meta-data

6
spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataProviderFactory.java

@ -32,11 +32,15 @@ import org.springframework.jdbc.support.MetaDataAccessException;
* @author Thomas Risberg * @author Thomas Risberg
* @since 2.5 * @since 2.5
*/ */
public class TableMetaDataProviderFactory { public final class TableMetaDataProviderFactory {
private static final Log logger = LogFactory.getLog(TableMetaDataProviderFactory.class); private static final Log logger = LogFactory.getLog(TableMetaDataProviderFactory.class);
private TableMetaDataProviderFactory() {
}
/** /**
* Create a {@link TableMetaDataProvider} based on the database meta-data. * Create a {@link TableMetaDataProvider} based on the database meta-data.
* @param dataSource used to retrieve meta-data * @param dataSource used to retrieve meta-data

4
spring-jdbc/src/main/java/org/springframework/jdbc/datasource/UserCredentialsDataSourceAdapter.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -202,7 +202,7 @@ public class UserCredentialsDataSourceAdapter extends DelegatingDataSource {
/** /**
* Inner class used as ThreadLocal value. * Inner class used as ThreadLocal value.
*/ */
private static class JdbcUserCredentials { private static final class JdbcUserCredentials {
public final String username; public final String username;

5
spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseConfigurerFactory.java

@ -29,6 +29,11 @@ import org.springframework.util.Assert;
*/ */
final class EmbeddedDatabaseConfigurerFactory { final class EmbeddedDatabaseConfigurerFactory {
private EmbeddedDatabaseConfigurerFactory() {
}
/** /**
* Return a configurer instance for the given embedded database type. * Return a configurer instance for the given embedded database type.
* @param type the embedded database type (HSQL, H2 or Derby) * @param type the embedded database type (HSQL, H2 or Derby)

9
spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/OutputStreamFactory.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -26,7 +26,12 @@ import java.io.OutputStream;
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 3.0 * @since 3.0
*/ */
public class OutputStreamFactory { public final class OutputStreamFactory {
private OutputStreamFactory() {
}
/** /**
* Returns an {@link java.io.OutputStream} that ignores all data given to it. * Returns an {@link java.io.OutputStream} that ignores all data given to it.

4
spring-jdbc/src/main/java/org/springframework/jdbc/support/CustomSQLExceptionTranslatorRegistry.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -33,7 +33,7 @@ import org.springframework.lang.Nullable;
* @since 3.1.1 * @since 3.1.1
* @see SQLErrorCodesFactory * @see SQLErrorCodesFactory
*/ */
public class CustomSQLExceptionTranslatorRegistry { public final class CustomSQLExceptionTranslatorRegistry {
private static final Log logger = LogFactory.getLog(CustomSQLExceptionTranslatorRegistry.class); private static final Log logger = LogFactory.getLog(CustomSQLExceptionTranslatorRegistry.class);

6
spring-jms/src/main/java/org/springframework/jms/connection/UserCredentialsConnectionFactoryAdapter.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -320,17 +320,19 @@ public class UserCredentialsConnectionFactoryAdapter
/** /**
* Inner class used as ThreadLocal value. * Inner class used as ThreadLocal value.
*/ */
private static class JmsUserCredentials { private static final class JmsUserCredentials {
public final String username; public final String username;
public final String password; public final String password;
private JmsUserCredentials(String username, String password) { private JmsUserCredentials(String username, String password) {
this.username = username; this.username = username;
this.password = password; this.password = password;
} }
@Override @Override
public String toString() { public String toString() {
return "JmsUserCredentials[username='" + this.username + "',password='" + this.password + "']"; return "JmsUserCredentials[username='" + this.username + "',password='" + this.password + "']";

2
spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/DestinationVariableMethodArgumentResolver.java

@ -78,7 +78,7 @@ public class DestinationVariableMethodArgumentResolver extends AbstractNamedValu
} }
private static class DestinationVariableNamedValueInfo extends NamedValueInfo { private static final class DestinationVariableNamedValueInfo extends NamedValueInfo {
private DestinationVariableNamedValueInfo(DestinationVariable annotation) { private DestinationVariableNamedValueInfo(DestinationVariable annotation) {
super(annotation.value(), true, ValueConstants.DEFAULT_NONE); super(annotation.value(), true, ValueConstants.DEFAULT_NONE);

4
spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/HeaderMethodArgumentResolver.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -106,7 +106,7 @@ public class HeaderMethodArgumentResolver extends AbstractNamedValueMethodArgume
} }
private static class HeaderNamedValueInfo extends NamedValueInfo { private static final class HeaderNamedValueInfo extends NamedValueInfo {
private HeaderNamedValueInfo(Header annotation) { private HeaderNamedValueInfo(Header annotation) {
super(annotation.name(), annotation.required(), annotation.defaultValue()); super(annotation.name(), annotation.required(), annotation.defaultValue());

5
spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/MethodArgumentNotValidException.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -34,7 +34,7 @@ import org.springframework.validation.ObjectError;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class MethodArgumentNotValidException extends MethodArgumentResolutionException { public class MethodArgumentNotValidException extends MethodArgumentResolutionException {
private BindingResult bindingResult; private final BindingResult bindingResult;
/** /**
@ -42,6 +42,7 @@ public class MethodArgumentNotValidException extends MethodArgumentResolutionExc
*/ */
public MethodArgumentNotValidException(Message<?> message, MethodParameter parameter) { public MethodArgumentNotValidException(Message<?> message, MethodParameter parameter) {
super(message, parameter); super(message, parameter);
this.bindingResult = null;
} }
/** /**

2
spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandler.java

@ -577,7 +577,7 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
private volatile boolean isStompConnected; private volatile boolean isStompConnected;
private StompConnectionHandler(String sessionId, StompHeaderAccessor connectHeaders) { protected StompConnectionHandler(String sessionId, StompHeaderAccessor connectHeaders) {
this(sessionId, connectHeaders, true); this(sessionId, connectHeaders, true);
} }

8
spring-orm/src/main/java/org/springframework/orm/ObjectOptimisticLockingFailureException.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -30,10 +30,10 @@ import org.springframework.lang.Nullable;
public class ObjectOptimisticLockingFailureException extends OptimisticLockingFailureException { public class ObjectOptimisticLockingFailureException extends OptimisticLockingFailureException {
@Nullable @Nullable
private Object persistentClass; private final Object persistentClass;
@Nullable @Nullable
private Object identifier; private final Object identifier;
/** /**
@ -44,6 +44,8 @@ public class ObjectOptimisticLockingFailureException extends OptimisticLockingFa
*/ */
public ObjectOptimisticLockingFailureException(String msg, Throwable cause) { public ObjectOptimisticLockingFailureException(String msg, Throwable cause) {
super(msg, cause); super(msg, cause);
this.persistentClass = null;
this.identifier = null;
} }
/** /**

8
spring-orm/src/main/java/org/springframework/orm/ObjectRetrievalFailureException.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -30,10 +30,10 @@ import org.springframework.lang.Nullable;
public class ObjectRetrievalFailureException extends DataRetrievalFailureException { public class ObjectRetrievalFailureException extends DataRetrievalFailureException {
@Nullable @Nullable
private Object persistentClass; private final Object persistentClass;
@Nullable @Nullable
private Object identifier; private final Object identifier;
/** /**
@ -44,6 +44,8 @@ public class ObjectRetrievalFailureException extends DataRetrievalFailureExcepti
*/ */
public ObjectRetrievalFailureException(String msg, Throwable cause) { public ObjectRetrievalFailureException(String msg, Throwable cause) {
super(msg, cause); super(msg, cause);
this.persistentClass = null;
this.identifier = null;
} }
/** /**

2
spring-orm/src/main/java/org/springframework/orm/hibernate5/HibernateTransactionManager.java

@ -890,7 +890,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
* Holder for suspended resources. * Holder for suspended resources.
* Used internally by {@code doSuspend} and {@code doResume}. * Used internally by {@code doSuspend} and {@code doResume}.
*/ */
private static class SuspendedResourcesHolder { private static final class SuspendedResourcesHolder {
private final SessionHolder sessionHolder; private final SessionHolder sessionHolder;

2
spring-orm/src/main/java/org/springframework/orm/jpa/ExtendedEntityManagerCreator.java

@ -242,7 +242,7 @@ public abstract class ExtendedEntityManagerCreator {
* InvocationHandler for extended EntityManagers as defined in the JPA spec. * InvocationHandler for extended EntityManagers as defined in the JPA spec.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
private static class ExtendedEntityManagerInvocationHandler implements InvocationHandler, Serializable { private static final class ExtendedEntityManagerInvocationHandler implements InvocationHandler, Serializable {
private static final Log logger = LogFactory.getLog(ExtendedEntityManagerInvocationHandler.class); private static final Log logger = LogFactory.getLog(ExtendedEntityManagerInvocationHandler.class);

2
spring-orm/src/main/java/org/springframework/orm/jpa/JpaTransactionManager.java

@ -745,7 +745,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
* Holder for suspended resources. * Holder for suspended resources.
* Used internally by {@code doSuspend} and {@code doResume}. * Used internally by {@code doSuspend} and {@code doResume}.
*/ */
private static class SuspendedResourcesHolder { private static final class SuspendedResourcesHolder {
private final EntityManagerHolder entityManagerHolder; private final EntityManagerHolder entityManagerHolder;

7
spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java

@ -127,6 +127,9 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
private static final String CID = "cid:"; private static final String CID = "cid:";
private static final EntityResolver NO_OP_ENTITY_RESOLVER =
(publicId, systemId) -> new InputSource(new StringReader(""));
/** Logger available to subclasses. */ /** Logger available to subclasses. */
protected final Log logger = LogFactory.getLog(getClass()); protected final Log logger = LogFactory.getLog(getClass());
@ -1079,8 +1082,4 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
} }
} }
private static final EntityResolver NO_OP_ENTITY_RESOLVER =
(publicId, systemId) -> new InputSource(new StringReader(""));
} }

4
spring-oxm/src/main/java/org/springframework/oxm/support/MarshallingSource.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -102,7 +102,7 @@ public class MarshallingSource extends SAXSource {
} }
private static class MarshallingXMLReader implements XMLReader { private static final class MarshallingXMLReader implements XMLReader {
private final Marshaller marshaller; private final Marshaller marshaller;

2
spring-test/src/main/java/org/springframework/mock/http/server/reactive/MockServerHttpRequest.java

@ -52,7 +52,7 @@ import org.springframework.web.util.UriComponentsBuilder;
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
* @since 5.0 * @since 5.0
*/ */
public class MockServerHttpRequest extends AbstractServerHttpRequest { public final class MockServerHttpRequest extends AbstractServerHttpRequest {
private final HttpMethod httpMethod; private final HttpMethod httpMethod;

4
spring-test/src/main/java/org/springframework/mock/jndi/SimpleNamingContext.java

@ -357,7 +357,7 @@ public class SimpleNamingContext implements Context {
} }
private static class NameClassPairEnumeration extends AbstractNamingEnumeration<NameClassPair> { private static final class NameClassPairEnumeration extends AbstractNamingEnumeration<NameClassPair> {
private NameClassPairEnumeration(SimpleNamingContext context, String root) throws NamingException { private NameClassPairEnumeration(SimpleNamingContext context, String root) throws NamingException {
super(context, root); super(context, root);
@ -370,7 +370,7 @@ public class SimpleNamingContext implements Context {
} }
private static class BindingEnumeration extends AbstractNamingEnumeration<Binding> { private static final class BindingEnumeration extends AbstractNamingEnumeration<Binding> {
private BindingEnumeration(SimpleNamingContext context, String root) throws NamingException { private BindingEnumeration(SimpleNamingContext context, String root) throws NamingException {
super(context, root); super(context, root);

2
spring-test/src/main/java/org/springframework/mock/web/MockFilterChain.java

@ -150,7 +150,7 @@ public class MockFilterChain implements FilterChain {
/** /**
* A filter that simply delegates to a Servlet. * A filter that simply delegates to a Servlet.
*/ */
private static class ServletFilterProxy implements Filter { private static final class ServletFilterProxy implements Filter {
private final Servlet delegateServlet; private final Servlet delegateServlet;

2
spring-test/src/main/java/org/springframework/mock/web/reactive/function/server/MockServerRequest.java

@ -63,7 +63,7 @@ import org.springframework.web.util.UriComponentsBuilder;
* @author Arjen Poutsma * @author Arjen Poutsma
* @since 5.0 * @since 5.0
*/ */
public class MockServerRequest implements ServerRequest { public final class MockServerRequest implements ServerRequest {
private final HttpMethod method; private final HttpMethod method;

4
spring-test/src/main/java/org/springframework/test/annotation/SystemProfileValueSource.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -26,7 +26,7 @@ import org.springframework.util.Assert;
* @author Sam Brannen * @author Sam Brannen
* @since 2.0 * @since 2.0
*/ */
public class SystemProfileValueSource implements ProfileValueSource { public final class SystemProfileValueSource implements ProfileValueSource {
private static final SystemProfileValueSource INSTANCE = new SystemProfileValueSource(); private static final SystemProfileValueSource INSTANCE = new SystemProfileValueSource();

9
spring-test/src/main/java/org/springframework/test/annotation/TestAnnotationUtils.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -26,7 +26,12 @@ import org.springframework.core.annotation.AnnotatedElementUtils;
* @author Sam Brannen * @author Sam Brannen
* @since 4.2 * @since 4.2
*/ */
public class TestAnnotationUtils { public final class TestAnnotationUtils {
private TestAnnotationUtils() {
}
/** /**
* Get the {@code timeout} configured via the {@link Timed @Timed} * Get the {@code timeout} configured via the {@link Timed @Timed}

7
spring-test/src/main/java/org/springframework/test/context/transaction/TestTransaction.java

@ -38,7 +38,12 @@ import org.springframework.util.Assert;
* @since 4.1 * @since 4.1
* @see TransactionalTestExecutionListener * @see TransactionalTestExecutionListener
*/ */
public class TestTransaction { public final class TestTransaction {
private TestTransaction() {
}
/** /**
* Determine whether a test-managed transaction is currently <em>active</em>. * Determine whether a test-managed transaction is currently <em>active</em>.

6
spring-test/src/main/java/org/springframework/test/context/transaction/TransactionContextHolder.java

@ -25,12 +25,16 @@ import org.springframework.lang.Nullable;
* @author Sam Brannen * @author Sam Brannen
* @since 4.1 * @since 4.1
*/ */
class TransactionContextHolder { final class TransactionContextHolder {
private static final ThreadLocal<TransactionContext> currentTransactionContext = private static final ThreadLocal<TransactionContext> currentTransactionContext =
new NamedInheritableThreadLocal<>("Test Transaction Context"); new NamedInheritableThreadLocal<>("Test Transaction Context");
private TransactionContextHolder() {
}
static void setCurrentTransactionContext(TransactionContext transactionContext) { static void setCurrentTransactionContext(TransactionContext transactionContext) {
currentTransactionContext.set(transactionContext); currentTransactionContext.set(transactionContext);
} }

8
spring-test/src/main/java/org/springframework/test/jdbc/JdbcTestUtils.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -38,11 +38,15 @@ import org.springframework.util.StringUtils;
* @see org.springframework.jdbc.datasource.init.ResourceDatabasePopulator * @see org.springframework.jdbc.datasource.init.ResourceDatabasePopulator
* @see org.springframework.jdbc.datasource.init.DatabasePopulatorUtils * @see org.springframework.jdbc.datasource.init.DatabasePopulatorUtils
*/ */
public class JdbcTestUtils { public final class JdbcTestUtils {
private static final Log logger = LogFactory.getLog(JdbcTestUtils.class); private static final Log logger = LogFactory.getLog(JdbcTestUtils.class);
private JdbcTestUtils() {
}
/** /**
* Count the rows in the given table. * Count the rows in the given table.
* @param jdbcTemplate the JdbcTemplate with which to perform JDBC operations * @param jdbcTemplate the JdbcTemplate with which to perform JDBC operations

4
spring-test/src/main/java/org/springframework/test/web/client/ExpectedCount.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -38,7 +38,7 @@ import org.springframework.util.Assert;
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
* @since 4.3 * @since 4.3
*/ */
public class ExpectedCount { public final class ExpectedCount {
private final int minCount; private final int minCount;

2
spring-test/src/main/java/org/springframework/test/web/client/MockRestServiceServer.java

@ -64,7 +64,7 @@ import org.springframework.web.client.support.RestGatewaySupport;
* @since 3.2 * @since 3.2
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class MockRestServiceServer { public final class MockRestServiceServer {
private final RequestExpectationManager expectationManager; private final RequestExpectationManager expectationManager;

7
spring-test/src/main/java/org/springframework/test/web/servlet/setup/MockMvcBuilders.java

@ -33,7 +33,12 @@ import org.springframework.web.context.WebApplicationContext;
* @see #webAppContextSetup(WebApplicationContext) * @see #webAppContextSetup(WebApplicationContext)
* @see #standaloneSetup(Object...) * @see #standaloneSetup(Object...)
*/ */
public class MockMvcBuilders { public final class MockMvcBuilders {
private MockMvcBuilders() {
}
/** /**
* Build a {@link MockMvc} instance using the given, fully initialized * Build a {@link MockMvc} instance using the given, fully initialized

6
spring-tx/src/main/java/org/springframework/dao/IncorrectResultSizeDataAccessException.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -28,9 +28,9 @@ package org.springframework.dao;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class IncorrectResultSizeDataAccessException extends DataRetrievalFailureException { public class IncorrectResultSizeDataAccessException extends DataRetrievalFailureException {
private int expectedSize; private final int expectedSize;
private int actualSize; private final int actualSize;
/** /**

2
spring-tx/src/main/java/org/springframework/jca/cci/connection/SingleConnectionFactory.java

@ -225,7 +225,7 @@ public class SingleConnectionFactory extends DelegatingConnectionFactory impleme
/** /**
* Invocation handler that suppresses close calls on CCI Connections. * Invocation handler that suppresses close calls on CCI Connections.
*/ */
private static class CloseSuppressingInvocationHandler implements InvocationHandler { private static final class CloseSuppressingInvocationHandler implements InvocationHandler {
private final Connection target; private final Connection target;

2
spring-tx/src/main/java/org/springframework/transaction/HeuristicCompletionException.java

@ -65,7 +65,7 @@ public class HeuristicCompletionException extends TransactionException {
/** /**
* The outcome state of the transaction: have some or all resources been committed? * The outcome state of the transaction: have some or all resources been committed?
*/ */
private int outcomeState = STATE_UNKNOWN; private final int outcomeState;
/** /**

4
spring-tx/src/main/java/org/springframework/transaction/InvalidTimeoutException.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,7 +27,7 @@ package org.springframework.transaction;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class InvalidTimeoutException extends TransactionUsageException { public class InvalidTimeoutException extends TransactionUsageException {
private int timeout; private final int timeout;
/** /**

2
spring-tx/src/main/java/org/springframework/transaction/support/AbstractPlatformTransactionManager.java

@ -1273,7 +1273,7 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
* Holder for suspended resources. * Holder for suspended resources.
* Used internally by {@code suspend} and {@code resume}. * Used internally by {@code suspend} and {@code resume}.
*/ */
protected static class SuspendedResourcesHolder { protected static final class SuspendedResourcesHolder {
@Nullable @Nullable
private final Object suspendedResources; private final Object suspendedResources;

2
spring-web/src/main/java/org/springframework/http/ContentDisposition.java

@ -39,7 +39,7 @@ import static java.time.format.DateTimeFormatter.*;
* @since 5.0 * @since 5.0
* @see <a href="https://tools.ietf.org/html/rfc2183">RFC 2183</a> * @see <a href="https://tools.ietf.org/html/rfc2183">RFC 2183</a>
*/ */
public class ContentDisposition { public final class ContentDisposition {
@Nullable @Nullable
private final String type; private final String type;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save