Class identity comparisons wherever possible
Issue: SPR-12926
This commit is contained in:
@@ -85,7 +85,7 @@ public abstract class ProfileValueUtils {
|
||||
}
|
||||
|
||||
ProfileValueSource profileValueSource;
|
||||
if (SystemProfileValueSource.class.equals(profileValueSourceType)) {
|
||||
if (SystemProfileValueSource.class == profileValueSourceType) {
|
||||
profileValueSource = SystemProfileValueSource.getInstance();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -463,7 +463,7 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
|
||||
configAttributes));
|
||||
}
|
||||
Class<? extends ContextLoader> contextLoaderClass = configAttributes.getContextLoaderClass();
|
||||
if (!ContextLoader.class.equals(contextLoaderClass)) {
|
||||
if (ContextLoader.class != contextLoaderClass) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(String.format(
|
||||
"Found explicit ContextLoader class [%s] for context configuration attributes %s",
|
||||
@@ -480,10 +480,9 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
|
||||
* interaction with the {@code ContextCache}.
|
||||
* <p>The default implementation simply delegates to
|
||||
* {@code getBootstrapContext().getCacheAwareContextLoaderDelegate()}.
|
||||
* <p>Concrete subclasses may choose to override this method to return a
|
||||
* custom {@code CacheAwareContextLoaderDelegate} implementation with custom
|
||||
* {@link org.springframework.test.context.cache.ContextCache ContextCache}
|
||||
* support.
|
||||
* <p>Concrete subclasses may choose to override this method to return a custom
|
||||
* {@code CacheAwareContextLoaderDelegate} implementation with custom
|
||||
* {@link org.springframework.test.context.cache.ContextCache ContextCache} support.
|
||||
* @return the context loader delegate (never {@code null})
|
||||
*/
|
||||
protected CacheAwareContextLoaderDelegate getCacheAwareContextLoaderDelegate() {
|
||||
@@ -509,10 +508,8 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
|
||||
* <p>The default implementation simply returns the supplied instance unmodified.
|
||||
* <p>Concrete subclasses may choose to return a specialized subclass of
|
||||
* {@link MergedContextConfiguration} based on properties in the supplied instance.
|
||||
* @param mergedConfig the {@code MergedContextConfiguration} to process;
|
||||
* never {@code null}
|
||||
* @return a fully initialized {@code MergedContextConfiguration}; never
|
||||
* {@code null}
|
||||
* @param mergedConfig the {@code MergedContextConfiguration} to process; never {@code null}
|
||||
* @return a fully initialized {@code MergedContextConfiguration}; never {@code null}
|
||||
*/
|
||||
protected MergedContextConfiguration processMergedContextConfiguration(MergedContextConfiguration mergedConfig) {
|
||||
return mergedConfig;
|
||||
|
||||
@@ -97,7 +97,7 @@ abstract class ActiveProfilesUtils {
|
||||
validateActiveProfilesConfiguration(declaringClass, annAttrs);
|
||||
|
||||
Class<? extends ActiveProfilesResolver> resolverClass = annAttrs.getClass("resolver");
|
||||
if (ActiveProfilesResolver.class.equals(resolverClass)) {
|
||||
if (ActiveProfilesResolver.class == resolverClass) {
|
||||
resolverClass = DefaultActiveProfilesResolver.class;
|
||||
}
|
||||
|
||||
|
||||
@@ -410,7 +410,7 @@ public class TransactionalTestExecutionListener extends AbstractTestExecutionLis
|
||||
private List<Class<?>> getSuperClasses(Class<?> clazz) {
|
||||
List<Class<?>> results = new ArrayList<Class<?>>();
|
||||
Class<?> current = clazz;
|
||||
while (current != null && !current.equals(Object.class)) {
|
||||
while (current != null && Object.class != current) {
|
||||
results.add(current);
|
||||
current = current.getSuperclass();
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class JsonPathExpectationsHelper {
|
||||
for (Method candidate : JsonPath.class.getMethods()) {
|
||||
if (candidate.getName().equals("compile")) {
|
||||
Class<?>[] paramTypes = candidate.getParameterTypes();
|
||||
if (paramTypes.length == 2 && paramTypes[0].equals(String.class) && paramTypes[1].isArray()) {
|
||||
if (paramTypes.length == 2 && String.class == paramTypes[0] && paramTypes[1].isArray()) {
|
||||
compileMethod = candidate;
|
||||
emptyFilters = Array.newInstance(paramTypes[1].getComponentType(), 0);
|
||||
break;
|
||||
|
||||
@@ -103,7 +103,7 @@ public abstract class MetaAnnotationUtils {
|
||||
|
||||
Assert.notNull(annotationType, "Annotation type must not be null");
|
||||
|
||||
if (clazz == null || clazz.equals(Object.class)) {
|
||||
if (clazz == null || Object.class == clazz) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ public abstract class MetaAnnotationUtils {
|
||||
Set<Annotation> visited, Class<? extends Annotation>... annotationTypes) {
|
||||
|
||||
assertNonEmptyAnnotationTypeArray(annotationTypes, "The list of annotation types must not be empty");
|
||||
if (clazz == null || clazz.equals(Object.class)) {
|
||||
if (clazz == null || Object.class == clazz) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user