diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java index 296fdd5b0f8..4d0392c2478 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -381,7 +381,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence } private boolean maybeBindJoinPoint(Class candidateParameterType) { - if (candidateParameterType.equals(JoinPoint.class)) { + if (JoinPoint.class == candidateParameterType) { this.joinPointArgumentIndex = 0; return true; } @@ -391,7 +391,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence } private boolean maybeBindProceedingJoinPoint(Class candidateParameterType) { - if (candidateParameterType.equals(ProceedingJoinPoint.class)) { + if (ProceedingJoinPoint.class == candidateParameterType) { if (!supportsProceedingJoinPoint()) { throw new IllegalArgumentException("ProceedingJoinPoint is only supported for around advice"); } @@ -408,7 +408,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence } private boolean maybeBindJoinPointStaticPart(Class candidateParameterType) { - if (candidateParameterType.equals(JoinPoint.StaticPart.class)) { + if (JoinPoint.StaticPart.class == candidateParameterType) { this.joinPointStaticPartArgumentIndex = 0; return true; } diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAfterReturningAdvice.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAfterReturningAdvice.java index d19e870b4b6..59d5ae6e097 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAfterReturningAdvice.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAfterReturningAdvice.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -93,7 +93,7 @@ public class AspectJAfterReturningAdvice extends AbstractAspectJAdvice implement if (returnValue != null) { return ClassUtils.isAssignableValue(type, returnValue); } - else if (type.equals(Object.class) && method.getReturnType().equals(void.class)) { + else if (Object.class == type && void.class == method.getReturnType()) { return true; } else{ diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectMetadata.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectMetadata.java index 06e49632d8e..a70010e1f99 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectMetadata.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,7 +72,7 @@ public class AspectMetadata { Class currClass = aspectClass; AjType ajType = null; - while (!currClass.equals(Object.class)) { + while (currClass != Object.class) { AjType ajTypeToCheck = AjTypeSystem.getAjType(currClass); if (ajTypeToCheck.isAspect()) { ajType = ajTypeToCheck; diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java index 2fe16a309c8..bf8cab2b087 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java @@ -157,7 +157,7 @@ public class ReflectiveAspectJAdvisorFactory extends AbstractAspectJAdvisorFacto return null; } - if (DeclareParents.class.equals(declareParents.defaultImpl())) { + if (DeclareParents.class == declareParents.defaultImpl()) { // This is what comes back if it wasn't set. This seems bizarre... // TODO this restriction possibly should be relaxed throw new IllegalStateException("defaultImpl must be set on DeclareParents"); diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java b/spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java index f60b5d3711c..1220efd351a 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java @@ -255,7 +255,7 @@ class CglibAopProxy implements AopProxy, Serializable { * methods across ClassLoaders, and writes warnings to the log for each one found. */ private void doValidateClass(Class proxySuperClass, ClassLoader proxyClassLoader) { - if (!Object.class.equals(proxySuperClass)) { + if (Object.class != proxySuperClass) { Method[] methods = proxySuperClass.getDeclaredMethods(); for (Method method : methods) { int mod = method.getModifiers(); diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAopProxyFactory.java b/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAopProxyFactory.java index cb2bac235a7..8f6e212ea54 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAopProxyFactory.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAopProxyFactory.java @@ -71,7 +71,7 @@ public class DefaultAopProxyFactory implements AopProxyFactory, Serializable { */ private boolean hasNoUserSuppliedProxyInterfaces(AdvisedSupport config) { Class[] interfaces = config.getProxiedInterfaces(); - return (interfaces.length == 0 || (interfaces.length == 1 && SpringProxy.class.equals(interfaces[0]))); + return (interfaces.length == 0 || (interfaces.length == 1 && SpringProxy.class == interfaces[0])); } } diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/ProxyProcessorSupport.java b/spring-aop/src/main/java/org/springframework/aop/framework/ProxyProcessorSupport.java index c7caf8115f7..af1cf603988 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/ProxyProcessorSupport.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/ProxyProcessorSupport.java @@ -126,7 +126,7 @@ public class ProxyProcessorSupport extends ProxyConfig implements Ordered, BeanC * @return whether the given interface is just a container callback */ protected boolean isConfigurationCallbackInterface(Class ifc) { - return (ifc.equals(InitializingBean.class) || ifc.equals(DisposableBean.class) || + return (InitializingBean.class == ifc || DisposableBean.class == ifc || ObjectUtils.containsElement(ifc.getInterfaces(), Aware.class)); } diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptor.java index 564e3b80d02..5b2ec8f00ee 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptor.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -109,7 +109,7 @@ public class ThrowsAdviceInterceptor implements MethodInterceptor, AfterAdvice { logger.trace("Trying to find handler for exception of type [" + exceptionClass.getName() + "]"); } Method handler = this.exceptionHandlerMap.get(exceptionClass); - while (handler == null && !exceptionClass.equals(Throwable.class)) { + while (handler == null && exceptionClass != Throwable.class) { exceptionClass = exceptionClass.getSuperclass(); handler = this.exceptionHandlerMap.get(exceptionClass); } diff --git a/spring-beans-groovy/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.java b/spring-beans-groovy/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.java index c5bb508e90d..bcbe1985d17 100644 --- a/spring-beans-groovy/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.java +++ b/spring-beans-groovy/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.java @@ -619,7 +619,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp try { Closure callable = (Closure) value; Class parameterType = callable.getParameterTypes()[0]; - if (parameterType.equals(Object.class)) { + if (Object.class == parameterType) { this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(""); callable.call(this.currentBeanDefinition); } diff --git a/spring-beans/src/main/java/org/springframework/beans/BeanUtils.java b/spring-beans/src/main/java/org/springframework/beans/BeanUtils.java index 8c03d708311..1b3993476eb 100644 --- a/spring-beans/src/main/java/org/springframework/beans/BeanUtils.java +++ b/spring-beans/src/main/java/org/springframework/beans/BeanUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -517,12 +517,12 @@ public abstract class BeanUtils { * @return whether the given type represents a "simple" value type */ public static boolean isSimpleValueType(Class clazz) { - return ClassUtils.isPrimitiveOrWrapper(clazz) || clazz.isEnum() || + return (ClassUtils.isPrimitiveOrWrapper(clazz) || clazz.isEnum() || CharSequence.class.isAssignableFrom(clazz) || Number.class.isAssignableFrom(clazz) || Date.class.isAssignableFrom(clazz) || - clazz.equals(URI.class) || clazz.equals(URL.class) || - clazz.equals(Locale.class) || clazz.equals(Class.class); + URI.class == clazz || URL.class == clazz || + Locale.class == clazz || Class.class == clazz); } diff --git a/spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java b/spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java index e7926fd723b..41c2f4c5767 100644 --- a/spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java +++ b/spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java @@ -288,7 +288,7 @@ public class CachedIntrospectionResults { // This call is slow so we do it once. PropertyDescriptor[] pds = this.beanInfo.getPropertyDescriptors(); for (PropertyDescriptor pd : pds) { - if (Class.class.equals(beanClass) && + if (Class.class == beanClass && ("classLoader".equals(pd.getName()) || "protectionDomain".equals(pd.getName()))) { // Ignore Class.getClassLoader() and getProtectionDomain() methods - nobody needs to bind to those continue; diff --git a/spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java b/spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java index 1a66a70de2c..1411f5569b3 100644 --- a/spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java +++ b/spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -153,7 +153,7 @@ class ExtendedBeanInfo implements BeanInfo { int nParams = parameterTypes.length; return (methodName.length() > 3 && methodName.startsWith("set") && Modifier.isPublic(method.getModifiers()) && (!void.class.isAssignableFrom(method.getReturnType()) || Modifier.isStatic(method.getModifiers())) && - (nParams == 1 || (nParams == 2 && parameterTypes[0].equals(int.class)))); + (nParams == 1 || (nParams == 2 && int.class == parameterTypes[0]))); } private void handleCandidateWriteMethod(Method method) throws IntrospectionException { diff --git a/spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java b/spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java index 149d7ec3e67..2da9f5f0feb 100644 --- a/spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java +++ b/spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java @@ -201,7 +201,7 @@ class TypeConverterDelegate { // Try to apply some standard type conversion rules if appropriate. if (convertedValue != null) { - if (Object.class.equals(requiredType)) { + if (Object.class == requiredType) { return (T) convertedValue; } else if (requiredType.isArray()) { @@ -227,7 +227,7 @@ class TypeConverterDelegate { convertedValue = Array.get(convertedValue, 0); standardConversion = true; } - if (String.class.equals(requiredType) && ClassUtils.isPrimitiveOrWrapper(convertedValue.getClass())) { + if (String.class == requiredType && ClassUtils.isPrimitiveOrWrapper(convertedValue.getClass())) { // We can stringify any primitive value... return (T) convertedValue.toString(); } @@ -305,7 +305,7 @@ class TypeConverterDelegate { } if (conversionAttemptEx != null) { - if (editor == null && !standardConversion && requiredType != null && !Object.class.equals(requiredType)) { + if (editor == null && !standardConversion && requiredType != null && Object.class != requiredType) { throw conversionAttemptEx; } logger.debug("Original ConversionService attempt failed - ignored since " + @@ -318,7 +318,7 @@ class TypeConverterDelegate { private Object attemptToConvertStringToEnum(Class requiredType, String trimmedValue, Object currentConvertedValue) { Object convertedValue = currentConvertedValue; - if (Enum.class.equals(requiredType)) { + if (Enum.class == requiredType) { // target type is declared as raw enum, treat the trimmed value as .FIELD_NAME int index = trimmedValue.lastIndexOf("."); if (index > - 1) { @@ -370,7 +370,7 @@ class TypeConverterDelegate { if (requiredType != null) { // No custom editor -> check BeanWrapperImpl's default editors. editor = this.propertyEditorRegistry.getDefaultEditor(requiredType); - if (editor == null && !String.class.equals(requiredType)) { + if (editor == null && String.class != requiredType) { // No BeanWrapper default editor -> check standard JavaBean editor. editor = BeanUtils.findEditorByConvention(requiredType); } @@ -436,7 +436,7 @@ class TypeConverterDelegate { String newTextValue = (String) convertedValue; return doConvertTextValue(oldValue, newTextValue, editor); } - else if (String.class.equals(requiredType)) { + else if (String.class == requiredType) { returnValue = convertedValue; } } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/QualifierAnnotationAutowireCandidateResolver.java b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/QualifierAnnotationAutowireCandidateResolver.java index 920f2a20157..d8fcc731e69 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/QualifierAnnotationAutowireCandidateResolver.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/QualifierAnnotationAutowireCandidateResolver.java @@ -146,7 +146,7 @@ public class QualifierAnnotationAutowireCandidateResolver extends GenericTypeAwa MethodParameter methodParam = descriptor.getMethodParameter(); if (methodParam != null) { Method method = methodParam.getMethod(); - if (method == null || void.class.equals(method.getReturnType())) { + if (method == null || void.class == method.getReturnType()) { match = checkQualifiers(bdHolder, methodParam.getMethodAnnotations()); } } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/ServiceLocatorFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/ServiceLocatorFactoryBean.java index 29b2bcf3b9c..92345d7eab9 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/ServiceLocatorFactoryBean.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/ServiceLocatorFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -314,7 +314,7 @@ public class ServiceLocatorFactoryBean implements FactoryBean, BeanFacto Class[] paramTypes = exceptionConstructor.getParameterTypes(); Object[] args = new Object[paramTypes.length]; for (int i = 0; i < paramTypes.length; i++) { - if (paramTypes[i].equals(String.class)) { + if (String.class == paramTypes[i]) { args[i] = cause.getMessage(); } else if (paramTypes[i].isInstance(cause)) { @@ -409,7 +409,7 @@ public class ServiceLocatorFactoryBean implements FactoryBean, BeanFacto Class serviceLocatorReturnType = interfaceMethod.getReturnType(); // Check whether the method is a valid service locator. - if (paramTypes.length > 1 || void.class.equals(serviceLocatorReturnType)) { + if (paramTypes.length > 1 || void.class == serviceLocatorReturnType) { throw new UnsupportedOperationException( "May only call methods with signature ' xxx()' or ' xxx( id)' " + "on factory interface, but tried to call: " + interfaceMethod); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java index bbc3e573379..a3fc160fe35 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java @@ -603,7 +603,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac if (bp instanceof SmartInstantiationAwareBeanPostProcessor) { SmartInstantiationAwareBeanPostProcessor ibp = (SmartInstantiationAwareBeanPostProcessor) bp; Class predicted = ibp.predictBeanType(targetType, beanName); - if (predicted != null && (typesToMatch.length != 1 || !FactoryBean.class.equals(typesToMatch[0]) || + if (predicted != null && (typesToMatch.length != 1 || FactoryBean.class != typesToMatch[0] || FactoryBean.class.isAssignableFrom(predicted))) { return predicted; } @@ -779,7 +779,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac } } }); - if (objectType.value != null && !Object.class.equals(objectType.value)) { + if (objectType.value != null && Object.class != objectType.value) { return objectType.value; } } @@ -1284,7 +1284,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac PropertyDescriptor pd = bw.getPropertyDescriptor(propertyName); // Don't try autowiring by type for type Object: never makes sense, // even if it technically is a unsatisfied, non-simple property. - if (!Object.class.equals(pd.getPropertyType())) { + if (Object.class != pd.getPropertyType()) { MethodParameter methodParam = BeanUtils.getWriteMethodParameter(pd); // Do not allow eager init for type matching in case of a prioritized post-processor. boolean eager = !PriorityOrdered.class.isAssignableFrom(bw.getWrappedClass()); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java index 8853e4daf8f..22d524d9427 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java @@ -516,7 +516,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp RootBeanDefinition mbd = getMergedLocalBeanDefinition(beanName); Class classToMatch = typeToMatch.getRawClass(); - Class[] typesToMatch = (FactoryBean.class.equals(classToMatch) ? + Class[] typesToMatch = (FactoryBean.class == classToMatch ? new Class[] {classToMatch} : new Class[] {FactoryBean.class, classToMatch}); // Check decorated bean definition, if any: We assume it'll be easier diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java index b868471c18c..50c56791124 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java @@ -552,7 +552,7 @@ class ConstructorResolver { "exists and that it is " + (isStatic ? "static" : "non-static") + "."); } - else if (void.class.equals(factoryMethodToUse.getReturnType())) { + else if (void.class == factoryMethodToUse.getReturnType()) { throw new BeanCreationException(mbd.getResourceDescription(), beanName, "Invalid factory method '" + mbd.getFactoryMethodName() + "': needs to have a non-void return type!"); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java index cde61d672cc..891a60db341 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java @@ -949,10 +949,10 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto if (descriptor.getDependencyType().equals(javaUtilOptionalClass)) { return new OptionalDependencyFactory().createOptionalDependency(descriptor, beanName); } - else if (descriptor.getDependencyType().equals(ObjectFactory.class)) { + else if (ObjectFactory.class == descriptor.getDependencyType()) { return new DependencyObjectFactory(descriptor, beanName); } - else if (descriptor.getDependencyType().equals(javaxInjectProviderClass)) { + else if (javaxInjectProviderClass == descriptor.getDependencyType()) { return new DependencyProviderFactory().createDependencyProvider(descriptor, beanName); } else { @@ -1031,10 +1031,10 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto } else if (Map.class.isAssignableFrom(type) && type.isInterface()) { Class keyType = descriptor.getMapKeyType(); - if (keyType == null || !String.class.isAssignableFrom(keyType)) { + if (String.class != keyType) { if (descriptor.isRequired()) { throw new FatalBeanException("Key type [" + keyType + "] of map [" + type.getName() + - "] must be assignable to [java.lang.String]"); + "] must be [java.lang.String]"); } return null; } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/DisposableBeanAdapter.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/DisposableBeanAdapter.java index 39721647a34..d6533455144 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/DisposableBeanAdapter.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/DisposableBeanAdapter.java @@ -130,7 +130,7 @@ class DisposableBeanAdapter implements DisposableBean, Runnable, Serializable { throw new BeanDefinitionValidationException("Method '" + destroyMethodName + "' of bean '" + beanName + "' has more than one parameter - not supported as destroy method"); } - else if (paramTypes.length == 1 && !paramTypes[0].equals(boolean.class)) { + else if (paramTypes.length == 1 && boolean.class != paramTypes[0]) { throw new BeanDefinitionValidationException("Method '" + destroyMethodName + "' of bean '" + beanName + "' has a non-boolean parameter - not supported as destroy method"); } diff --git a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomCollectionEditor.java b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomCollectionEditor.java index 55fc75594ad..607a99afcf9 100644 --- a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomCollectionEditor.java +++ b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomCollectionEditor.java @@ -159,10 +159,10 @@ public class CustomCollectionEditor extends PropertyEditorSupport { "Could not instantiate collection class [" + collectionType.getName() + "]: " + ex.getMessage()); } } - else if (List.class.equals(collectionType)) { + else if (List.class == collectionType) { return new ArrayList(initialCapacity); } - else if (SortedSet.class.equals(collectionType)) { + else if (SortedSet.class == collectionType) { return new TreeSet(); } else { diff --git a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomMapEditor.java b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomMapEditor.java index 82183026808..85865e546ff 100644 --- a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomMapEditor.java +++ b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomMapEditor.java @@ -137,7 +137,7 @@ public class CustomMapEditor extends PropertyEditorSupport { "Could not instantiate map class [" + mapType.getName() + "]: " + ex.getMessage()); } } - else if (SortedMap.class.equals(mapType)) { + else if (SortedMap.class == mapType) { return new TreeMap(); } else { diff --git a/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AnnotationJCacheOperationSource.java b/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AnnotationJCacheOperationSource.java index 622982bcdd6..ffc199b81a4 100644 --- a/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AnnotationJCacheOperationSource.java +++ b/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AnnotationJCacheOperationSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -160,10 +160,10 @@ public abstract class AnnotationJCacheOperationSource extends AbstractFallbackJC protected CacheResolverFactory determineCacheResolverFactory(CacheDefaults defaults, Class candidate) { - if (!CacheResolverFactory.class.equals(candidate)) { + if (CacheResolverFactory.class != candidate) { return getBean(candidate); } - else if (defaults != null && !CacheResolverFactory.class.equals(defaults.cacheResolverFactory())) { + else if (defaults != null && CacheResolverFactory.class != defaults.cacheResolverFactory()) { return getBean(defaults.cacheResolverFactory()); } else { @@ -172,10 +172,10 @@ public abstract class AnnotationJCacheOperationSource extends AbstractFallbackJC } protected KeyGenerator determineKeyGenerator(CacheDefaults defaults, Class candidate) { - if (!CacheKeyGenerator.class.equals(candidate)) { + if (CacheKeyGenerator.class != candidate) { return new KeyGeneratorAdapter(this, getBean(candidate)); } - else if (defaults != null && !CacheKeyGenerator.class.equals(defaults.cacheKeyGenerator())) { + else if (defaults != null && CacheKeyGenerator.class != defaults.cacheKeyGenerator()) { return new KeyGeneratorAdapter(this, getBean(defaults.cacheKeyGenerator())); } else { diff --git a/spring-context/src/main/java/org/springframework/context/annotation/AnnotatedBeanDefinitionReader.java b/spring-context/src/main/java/org/springframework/context/annotation/AnnotatedBeanDefinitionReader.java index 8d84306904e..780f8be00b6 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/AnnotatedBeanDefinitionReader.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/AnnotatedBeanDefinitionReader.java @@ -147,10 +147,10 @@ public class AnnotatedBeanDefinitionReader { AnnotationConfigUtils.processCommonDefinitionAnnotations(abd); if (qualifiers != null) { for (Class qualifier : qualifiers) { - if (Primary.class.equals(qualifier)) { + if (Primary.class == qualifier) { abd.setPrimary(true); } - else if (Lazy.class.equals(qualifier)) { + else if (Lazy.class == qualifier) { abd.setLazyInit(true); } else { diff --git a/spring-context/src/main/java/org/springframework/context/annotation/AutoProxyRegistrar.java b/spring-context/src/main/java/org/springframework/context/annotation/AutoProxyRegistrar.java index f3b04532250..cc5c911c01e 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/AutoProxyRegistrar.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/AutoProxyRegistrar.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,8 +62,8 @@ public class AutoProxyRegistrar implements ImportBeanDefinitionRegistrar { AnnotationAttributes candidate = AnnotationConfigUtils.attributesFor(importingClassMetadata, annoType); Object mode = candidate.get("mode"); Object proxyTargetClass = candidate.get("proxyTargetClass"); - if (mode != null && proxyTargetClass != null && mode.getClass().equals(AdviceMode.class) && - proxyTargetClass.getClass().equals(Boolean.class)) { + if (mode != null && proxyTargetClass != null && AdviceMode.class == mode.getClass() && + Boolean.class == proxyTargetClass.getClass()) { candidateFound = true; if (mode == AdviceMode.PROXY) { AopConfigUtils.registerAutoProxyCreatorIfNecessary(registry); diff --git a/spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java b/spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java index 96f68ae39e5..a17cb138c15 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java @@ -595,7 +595,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean else if (beanFactory instanceof ConfigurableBeanFactory){ resourceName = ((ConfigurableBeanFactory) beanFactory).resolveEmbeddedValue(resourceName); } - if (resourceType != null && !Object.class.equals(resourceType)) { + if (resourceType != null && Object.class != resourceType) { checkResourceType(resourceType); } else { @@ -639,7 +639,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean resourceName = Introspector.decapitalize(resourceName.substring(3)); } } - if (resourceType != null && !Object.class.equals(resourceType)) { + if (resourceType != null && Object.class != resourceType) { checkResourceType(resourceType); } else { @@ -652,7 +652,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean this.lookupType = resourceType; } else { - this.lookupType = (!Object.class.equals(resource.value()) ? resource.value() : Service.class); + this.lookupType = resource.value(); } this.mappedName = resource.mappedName(); this.wsdlLocation = resource.wsdlLocation(); @@ -666,7 +666,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean } catch (NoSuchBeanDefinitionException notFound) { // Service to be created through generated class. - if (Service.class.equals(this.lookupType)) { + if (Service.class == this.lookupType) { throw new IllegalStateException("No resource with name '" + this.name + "' found in context, " + "and no specific JAX-WS Service subclass specified. The typical solution is to either specify " + "a LocalJaxWsServiceFactoryBean with the given name or to specify the (generated) Service " + @@ -723,7 +723,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean } } Class resourceType = resource.beanInterface(); - if (resourceType != null && !Object.class.equals(resourceType)) { + if (resourceType != null && Object.class != resourceType) { checkResourceType(resourceType); } else { diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ComponentScanAnnotationParser.java b/spring-context/src/main/java/org/springframework/context/annotation/ComponentScanAnnotationParser.java index afbb2716393..7b0ef1c17ce 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ComponentScanAnnotationParser.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ComponentScanAnnotationParser.java @@ -83,7 +83,7 @@ class ComponentScanAnnotationParser { scanner.setResourceLoader(this.resourceLoader); Class generatorClass = componentScan.getClass("nameGenerator"); - boolean useInheritedGenerator = BeanNameGenerator.class.equals(generatorClass); + boolean useInheritedGenerator = BeanNameGenerator.class == generatorClass; scanner.setBeanNameGenerator(useInheritedGenerator ? this.beanNameGenerator : BeanUtils.instantiateClass(generatorClass)); diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassBeanDefinitionReader.java b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassBeanDefinitionReader.java index 1231c046b98..570df5ac555 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassBeanDefinitionReader.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassBeanDefinitionReader.java @@ -320,7 +320,7 @@ class ConfigurationClassBeanDefinitionReader { Class readerClass = entry.getValue(); // Default reader selection necessary? - if (readerClass.equals(BeanDefinitionReader.class)) { + if (BeanDefinitionReader.class == readerClass) { if (StringUtils.endsWithIgnoreCase(resource, ".groovy")) { // When clearly asking for Groovy, that's what they'll get... readerClass = GroovyBeanDefinitionReader.class; diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassEnhancer.java b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassEnhancer.java index fa9eb47055d..7b1f6b2232a 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassEnhancer.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassEnhancer.java @@ -240,7 +240,7 @@ class ConfigurationClassEnhancer { public boolean isMatch(Method candidateMethod) { return (candidateMethod.getName().equals("setBeanFactory") && candidateMethod.getParameterTypes().length == 1 && - candidateMethod.getParameterTypes()[0].equals(BeanFactory.class) && + BeanFactory.class == candidateMethod.getParameterTypes()[0] && BeanFactoryAware.class.isAssignableFrom(candidateMethod.getDeclaringClass())); } } diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ContextAnnotationAutowireCandidateResolver.java b/spring-context/src/main/java/org/springframework/context/annotation/ContextAnnotationAutowireCandidateResolver.java index 62d8fe840d2..faf0355fd5c 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ContextAnnotationAutowireCandidateResolver.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ContextAnnotationAutowireCandidateResolver.java @@ -54,7 +54,7 @@ public class ContextAnnotationAutowireCandidateResolver extends QualifierAnnotat MethodParameter methodParam = descriptor.getMethodParameter(); if (methodParam != null) { Method method = methodParam.getMethod(); - if (method == null || void.class.equals(method.getReturnType())) { + if (method == null || void.class == method.getReturnType()) { Lazy lazy = AnnotationUtils.getAnnotation(methodParam.getAnnotatedElement(), Lazy.class); if (lazy != null && lazy.value()) { return true; diff --git a/spring-context/src/main/java/org/springframework/context/event/EventPublicationInterceptor.java b/spring-context/src/main/java/org/springframework/context/event/EventPublicationInterceptor.java index f9cfda74bff..259dc150b12 100644 --- a/spring-context/src/main/java/org/springframework/context/event/EventPublicationInterceptor.java +++ b/spring-context/src/main/java/org/springframework/context/event/EventPublicationInterceptor.java @@ -63,7 +63,7 @@ public class EventPublicationInterceptor * if it does not expose a constructor that takes a single {@code Object} argument */ public void setApplicationEventClass(Class applicationEventClass) { - if (ApplicationEvent.class.equals(applicationEventClass) || + if (ApplicationEvent.class == applicationEventClass || !ApplicationEvent.class.isAssignableFrom(applicationEventClass)) { throw new IllegalArgumentException("applicationEventClass needs to extend ApplicationEvent"); } diff --git a/spring-context/src/main/java/org/springframework/format/datetime/joda/JodaDateTimeFormatAnnotationFormatterFactory.java b/spring-context/src/main/java/org/springframework/format/datetime/joda/JodaDateTimeFormatAnnotationFormatterFactory.java index 0e1a057d0a1..c70a9ee6ff1 100644 --- a/spring-context/src/main/java/org/springframework/format/datetime/joda/JodaDateTimeFormatAnnotationFormatterFactory.java +++ b/spring-context/src/main/java/org/springframework/format/datetime/joda/JodaDateTimeFormatAnnotationFormatterFactory.java @@ -92,13 +92,13 @@ public class JodaDateTimeFormatAnnotationFormatterFactory extends EmbeddedValueR @Override public Parser getParser(DateTimeFormat annotation, Class fieldType) { - if (LocalDate.class.equals(fieldType)) { + if (LocalDate.class == fieldType) { return new LocalDateParser(getFormatter(annotation, fieldType)); } - else if (LocalTime.class.equals(fieldType)) { + else if (LocalTime.class == fieldType) { return new LocalTimeParser(getFormatter(annotation, fieldType)); } - else if (LocalDateTime.class.equals(fieldType)) { + else if (LocalDateTime.class == fieldType) { return new LocalDateTimeParser(getFormatter(annotation, fieldType)); } else { diff --git a/spring-context/src/main/java/org/springframework/format/datetime/standard/TemporalAccessorParser.java b/spring-context/src/main/java/org/springframework/format/datetime/standard/TemporalAccessorParser.java index dc17e3064c6..74eb3648d9f 100644 --- a/spring-context/src/main/java/org/springframework/format/datetime/standard/TemporalAccessorParser.java +++ b/spring-context/src/main/java/org/springframework/format/datetime/standard/TemporalAccessorParser.java @@ -67,22 +67,22 @@ public final class TemporalAccessorParser implements Parser { @Override public TemporalAccessor parse(String text, Locale locale) throws ParseException { DateTimeFormatter formatterToUse = DateTimeContextHolder.getFormatter(this.formatter, locale); - if (LocalDate.class.equals(this.temporalAccessorType)) { + if (LocalDate.class == this.temporalAccessorType) { return LocalDate.parse(text, formatterToUse); } - else if (LocalTime.class.equals(this.temporalAccessorType)) { + else if (LocalTime.class == this.temporalAccessorType) { return LocalTime.parse(text, formatterToUse); } - else if (LocalDateTime.class.equals(this.temporalAccessorType)) { + else if (LocalDateTime.class == this.temporalAccessorType) { return LocalDateTime.parse(text, formatterToUse); } - else if (ZonedDateTime.class.equals(this.temporalAccessorType)) { + else if (ZonedDateTime.class == this.temporalAccessorType) { return ZonedDateTime.parse(text, formatterToUse); } - else if (OffsetDateTime.class.equals(this.temporalAccessorType)) { + else if (OffsetDateTime.class == this.temporalAccessorType) { return OffsetDateTime.parse(text, formatterToUse); } - else if (OffsetTime.class.equals(this.temporalAccessorType)) { + else if (OffsetTime.class == this.temporalAccessorType) { return OffsetTime.parse(text, formatterToUse); } else { diff --git a/spring-context/src/main/java/org/springframework/jmx/export/assembler/AbstractReflectiveMBeanInfoAssembler.java b/spring-context/src/main/java/org/springframework/jmx/export/assembler/AbstractReflectiveMBeanInfoAssembler.java index d49122fec7f..a950b7eb7fe 100644 --- a/spring-context/src/main/java/org/springframework/jmx/export/assembler/AbstractReflectiveMBeanInfoAssembler.java +++ b/spring-context/src/main/java/org/springframework/jmx/export/assembler/AbstractReflectiveMBeanInfoAssembler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -352,7 +352,7 @@ public abstract class AbstractReflectiveMBeanInfoAssembler extends AbstractMBean if (method.isSynthetic()) { continue; } - if (method.getDeclaringClass().equals(Object.class)) { + if (Object.class == method.getDeclaringClass()) { continue; } diff --git a/spring-context/src/main/java/org/springframework/jndi/JndiObjectFactoryBean.java b/spring-context/src/main/java/org/springframework/jndi/JndiObjectFactoryBean.java index dcfd93939a0..b86838bd9d7 100644 --- a/spring-context/src/main/java/org/springframework/jndi/JndiObjectFactoryBean.java +++ b/spring-context/src/main/java/org/springframework/jndi/JndiObjectFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -368,7 +368,7 @@ public class JndiObjectFactoryBean extends JndiObjectLocator } protected boolean isEligible(Method method) { - return !Object.class.equals(method.getDeclaringClass()); + return (Object.class != method.getDeclaringClass()); } } diff --git a/spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java b/spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java index 3eb3a9a8198..cfbf474e684 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java +++ b/spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java @@ -248,7 +248,7 @@ public class ScheduledAnnotationBeanPostProcessor implements BeanPostProcessor, protected void processScheduled(Scheduled scheduled, Method method, Object bean) { try { - Assert.isTrue(void.class.equals(method.getReturnType()), + Assert.isTrue(void.class == method.getReturnType(), "Only void-returning methods may be annotated with @Scheduled"); Assert.isTrue(method.getParameterTypes().length == 0, "Only no-arg methods may be annotated with @Scheduled"); diff --git a/spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java b/spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java index 2f44c305972..15ecf85ee14 100644 --- a/spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java +++ b/spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java @@ -141,7 +141,7 @@ public abstract class BridgeMethodResolver { private static Method findGenericDeclaration(Method bridgeMethod) { // Search parent types for method that has same signature as bridge. Class superclass = bridgeMethod.getDeclaringClass().getSuperclass(); - while (superclass != null && !Object.class.equals(superclass)) { + while (superclass != null && Object.class != superclass) { Method method = searchForMatch(superclass, bridgeMethod); if (method != null && !method.isBridge()) { return method; diff --git a/spring-core/src/main/java/org/springframework/core/CollectionFactory.java b/spring-core/src/main/java/org/springframework/core/CollectionFactory.java index 6cd952414ed..e9af0617fcd 100644 --- a/spring-core/src/main/java/org/springframework/core/CollectionFactory.java +++ b/spring-core/src/main/java/org/springframework/core/CollectionFactory.java @@ -178,20 +178,20 @@ public abstract class CollectionFactory { public static Collection createCollection(Class collectionType, Class elementType, int capacity) { Assert.notNull(collectionType, "Collection type must not be null"); if (collectionType.isInterface()) { - if (Set.class.equals(collectionType) || Collection.class.equals(collectionType)) { + if (Set.class == collectionType || Collection.class == collectionType) { return new LinkedHashSet(capacity); } - else if (List.class.equals(collectionType)) { + else if (List.class == collectionType) { return new ArrayList(capacity); } - else if (SortedSet.class.equals(collectionType) || NavigableSet.class.equals(collectionType)) { + else if (SortedSet.class == collectionType || NavigableSet.class == collectionType) { return new TreeSet(); } else { throw new IllegalArgumentException("Unsupported Collection interface: " + collectionType.getName()); } } - else if (EnumSet.class.equals(collectionType)) { + else if (EnumSet.class == collectionType) { Assert.notNull(elementType, "Cannot create EnumSet for unknown element type"); // Cast is necessary for compilation in Eclipse 4.4.1. return (Collection) EnumSet.noneOf(asEnumType(elementType)); @@ -294,20 +294,20 @@ public abstract class CollectionFactory { public static Map createMap(Class mapType, Class keyType, int capacity) { Assert.notNull(mapType, "Map type must not be null"); if (mapType.isInterface()) { - if (Map.class.equals(mapType)) { + if (Map.class == mapType) { return new LinkedHashMap(capacity); } - else if (SortedMap.class.equals(mapType) || NavigableMap.class.equals(mapType)) { + else if (SortedMap.class == mapType || NavigableMap.class == mapType) { return new TreeMap(); } - else if (MultiValueMap.class.equals(mapType)) { + else if (MultiValueMap.class == mapType) { return new LinkedMultiValueMap(); } else { throw new IllegalArgumentException("Unsupported Map interface: " + mapType.getName()); } } - else if (EnumMap.class.equals(mapType)) { + else if (EnumMap.class == mapType) { Assert.notNull(keyType, "Cannot create EnumMap for unknown key type"); return new EnumMap(asEnumType(keyType)); } diff --git a/spring-core/src/main/java/org/springframework/core/Conventions.java b/spring-core/src/main/java/org/springframework/core/Conventions.java index 99e3406f7ad..2c4152ff194 100644 --- a/spring-core/src/main/java/org/springframework/core/Conventions.java +++ b/spring-core/src/main/java/org/springframework/core/Conventions.java @@ -168,7 +168,7 @@ public abstract class Conventions { public static String getVariableNameForReturnType(Method method, Class resolvedType, Object value) { Assert.notNull(method, "Method must not be null"); - if (Object.class.equals(resolvedType)) { + if (Object.class == resolvedType) { if (value == null) { throw new IllegalArgumentException("Cannot generate variable name for an Object return type with null value"); } diff --git a/spring-core/src/main/java/org/springframework/core/ExceptionDepthComparator.java b/spring-core/src/main/java/org/springframework/core/ExceptionDepthComparator.java index ca014d89857..5819d30c125 100644 --- a/spring-core/src/main/java/org/springframework/core/ExceptionDepthComparator.java +++ b/spring-core/src/main/java/org/springframework/core/ExceptionDepthComparator.java @@ -63,12 +63,12 @@ public class ExceptionDepthComparator implements Comparator declaredException, Class exceptionToMatch, int depth) { - if (declaredException.equals(exceptionToMatch)) { + if (exceptionToMatch.equals(declaredException)) { // Found it! return depth; } // If we've gone as far as we can go and haven't found it... - if (Throwable.class.equals(exceptionToMatch)) { + if (exceptionToMatch == Throwable.class) { return Integer.MAX_VALUE; } return getDepth(declaredException, exceptionToMatch.getSuperclass(), depth + 1); diff --git a/spring-core/src/main/java/org/springframework/core/ParameterizedTypeReference.java b/spring-core/src/main/java/org/springframework/core/ParameterizedTypeReference.java index e64f58901df..f3d516702fd 100644 --- a/spring-core/src/main/java/org/springframework/core/ParameterizedTypeReference.java +++ b/spring-core/src/main/java/org/springframework/core/ParameterizedTypeReference.java @@ -77,10 +77,10 @@ public abstract class ParameterizedTypeReference { private static Class findParameterizedTypeReferenceSubclass(Class child) { Class parent = child.getSuperclass(); - if (Object.class.equals(parent)) { + if (Object.class == parent) { throw new IllegalStateException("Expected ParameterizedTypeReference superclass"); } - else if (ParameterizedTypeReference.class.equals(parent)) { + else if (ParameterizedTypeReference.class == parent) { return child; } else { diff --git a/spring-core/src/main/java/org/springframework/core/ResolvableType.java b/spring-core/src/main/java/org/springframework/core/ResolvableType.java index ac17d9373e1..1dd9dee7cae 100644 --- a/spring-core/src/main/java/org/springframework/core/ResolvableType.java +++ b/spring-core/src/main/java/org/springframework/core/ResolvableType.java @@ -527,7 +527,7 @@ public class ResolvableType implements Serializable { WildcardType wt = (WildcardType) this.type; if (wt.getLowerBounds().length == 0) { Type[] upperBounds = wt.getUpperBounds(); - if (upperBounds.length == 0 || (upperBounds.length == 1 && Object.class.equals(upperBounds[0]))) { + if (upperBounds.length == 0 || (upperBounds.length == 1 && Object.class == upperBounds[0])) { return true; } } @@ -770,7 +770,7 @@ public class ResolvableType implements Serializable { } private Type resolveBounds(Type[] bounds) { - if (ObjectUtils.isEmpty(bounds) || Object.class.equals(bounds[0])) { + if (ObjectUtils.isEmpty(bounds) || Object.class == bounds[0]) { return null; } return bounds[0]; diff --git a/spring-core/src/main/java/org/springframework/core/SerializableTypeWrapper.java b/spring-core/src/main/java/org/springframework/core/SerializableTypeWrapper.java index 0474171c3af..4b52ee0dda4 100644 --- a/spring-core/src/main/java/org/springframework/core/SerializableTypeWrapper.java +++ b/spring-core/src/main/java/org/springframework/core/SerializableTypeWrapper.java @@ -244,10 +244,10 @@ abstract class SerializableTypeWrapper { } return this.provider.getType().equals(other); } - if (Type.class.equals(method.getReturnType()) && args == null) { + if (Type.class == method.getReturnType() && args == null) { return forTypeProvider(new MethodInvokeTypeProvider(this.provider, method, -1)); } - if (Type[].class.equals(method.getReturnType()) && args == null) { + if (Type[].class == method.getReturnType() && args == null) { Type[] result = new Type[((Type[]) method.invoke(this.provider.getType(), args)).length]; for (int i = 0; i < result.length; i++) { result[i] = forTypeProvider(new MethodInvokeTypeProvider(this.provider, method, i)); diff --git a/spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java b/spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java index e559ffb2dbb..da93678e2e8 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java @@ -694,7 +694,7 @@ public class AnnotatedElementUtils { Class clazz = method.getDeclaringClass(); while (true) { clazz = clazz.getSuperclass(); - if (clazz == null || clazz.equals(Object.class)) { + if (clazz == null || Object.class == clazz) { break; } @@ -744,7 +744,7 @@ public class AnnotatedElementUtils { // Search on superclass if (searchOnSuperclasses) { Class superclass = clazz.getSuperclass(); - if (superclass != null && !superclass.equals(Object.class)) { + if (superclass != null && Object.class != superclass) { T result = searchWithFindSemantics(superclass, annotationType, searchOnInterfaces, searchOnSuperclasses, searchOnMethodsInInterfaces, searchOnMethodsInSuperclasses, processor, visited, metaDepth); diff --git a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java index 22b6f13c8bb..336fe8ce87a 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java @@ -368,7 +368,7 @@ public abstract class AnnotationUtils { Class clazz = method.getDeclaringClass(); while (result == null) { clazz = clazz.getSuperclass(); - if (clazz == null || clazz.equals(Object.class)) { + if (clazz == null || Object.class == clazz) { break; } try { @@ -511,7 +511,7 @@ public abstract class AnnotationUtils { } Class superclass = clazz.getSuperclass(); - if (superclass == null || superclass.equals(Object.class)) { + if (superclass == null || Object.class == superclass) { return null; } return findAnnotation(superclass, annotationType, visited); @@ -541,7 +541,7 @@ public abstract class AnnotationUtils { */ public static Class findAnnotationDeclaringClass(Class annotationType, Class clazz) { Assert.notNull(annotationType, "Annotation type must not be null"); - if (clazz == null || clazz.equals(Object.class)) { + if (clazz == null || Object.class == clazz) { return null; } if (isAnnotationDeclaredLocally(annotationType, clazz)) { @@ -576,7 +576,7 @@ public abstract class AnnotationUtils { */ public static Class findAnnotationDeclaringClassForTypes(List> annotationTypes, Class clazz) { Assert.notEmpty(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; } for (Class annotationType : annotationTypes) { diff --git a/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java b/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java index 625401c6d7f..45ef411029c 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java +++ b/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java @@ -677,7 +677,7 @@ public class TypeDescriptor implements Serializable { private static TypeDescriptor nested(TypeDescriptor typeDescriptor, int nestingLevel) { ResolvableType nested = typeDescriptor.resolvableType; for (int i = 0; i < nestingLevel; i++) { - if (Object.class.equals(nested.getType())) { + if (Object.class == nested.getType()) { // Could be a collection type but we don't know about its element type, // so let's just assume there is an element type of type Object... } diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/FallbackObjectToStringConverter.java b/spring-core/src/main/java/org/springframework/core/convert/support/FallbackObjectToStringConverter.java index a876760af1c..c0d6a3d6913 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/FallbackObjectToStringConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/FallbackObjectToStringConverter.java @@ -50,7 +50,7 @@ final class FallbackObjectToStringConverter implements ConditionalGenericConvert @Override public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) { Class sourceClass = sourceType.getObjectType(); - if (String.class.equals(sourceClass)) { + if (String.class == sourceClass) { // no conversion required return false; } diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/ObjectToObjectConverter.java b/spring-core/src/main/java/org/springframework/core/convert/support/ObjectToObjectConverter.java index 609cbae59e3..9730733c617 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/ObjectToObjectConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/ObjectToObjectConverter.java @@ -71,7 +71,7 @@ final class ObjectToObjectConverter implements ConditionalGenericConverter { // no conversion required return false; } - return (String.class.equals(targetType.getType()) ? + return (String.class == targetType.getType() ? hasFactoryConstructor(String.class, sourceType.getType()) : hasToMethodOrFactoryMethodOrConstructor(targetType.getType(), sourceType.getType())); } @@ -85,7 +85,7 @@ final class ObjectToObjectConverter implements ConditionalGenericConverter { Class targetClass = targetType.getType(); try { // Do not invoke a toString() method - if (!String.class.equals(targetClass)) { + if (String.class != targetClass) { Method method = getToMethod(targetClass, sourceClass); if (method != null) { ReflectionUtils.makeAccessible(method); diff --git a/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java b/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java index c7ab35367c0..be84de59293 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java @@ -759,7 +759,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String methodName = method.getName(); - if (Object.class.equals(method.getDeclaringClass())) { + if (Object.class == method.getDeclaringClass()) { if (methodName.equals("equals")) { // Only consider equal when proxies are identical. return (proxy == args[0]); diff --git a/spring-core/src/main/java/org/springframework/util/ClassUtils.java b/spring-core/src/main/java/org/springframework/util/ClassUtils.java index 5f6463d77c9..23301777785 100644 --- a/spring-core/src/main/java/org/springframework/util/ClassUtils.java +++ b/spring-core/src/main/java/org/springframework/util/ClassUtils.java @@ -27,6 +27,7 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; +import java.util.IdentityHashMap; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.Map; @@ -34,7 +35,7 @@ import java.util.Set; /** * Miscellaneous class utility methods. - *

Mainly for internal use within the framework. + * Mainly for internal use within the framework. * * @author Juergen Hoeller * @author Keith Donald @@ -75,13 +76,13 @@ public abstract class ClassUtils { * Map with primitive wrapper type as key and corresponding primitive * type as value, for example: Integer.class -> int.class. */ - private static final Map, Class> primitiveWrapperTypeMap = new HashMap, Class>(8); + private static final Map, Class> primitiveWrapperTypeMap = new IdentityHashMap, Class>(8); /** * Map with primitive type as key and corresponding wrapper * type as value, for example: int.class -> Integer.class. */ - private static final Map, Class> primitiveTypeToWrapperMap = new HashMap, Class>(8); + private static final Map, Class> primitiveTypeToWrapperMap = new IdentityHashMap, Class>(8); /** * Map with primitive type name as key and corresponding primitive @@ -352,9 +353,9 @@ public abstract class ClassUtils { */ public static Class getUserClass(Class clazz) { if (clazz != null && clazz.getName().contains(CGLIB_CLASS_SEPARATOR)) { - Class superClass = clazz.getSuperclass(); - if (superClass != null && !Object.class.equals(superClass)) { - return superClass; + Class superclass = clazz.getSuperclass(); + if (superclass != null && Object.class != superclass) { + return superclass; } } return clazz; @@ -1186,7 +1187,7 @@ public abstract class ClassUtils { Class ancestor = clazz1; do { ancestor = ancestor.getSuperclass(); - if (ancestor == null || Object.class.equals(ancestor)) { + if (ancestor == null || Object.class == ancestor) { return null; } } diff --git a/spring-core/src/main/java/org/springframework/util/NumberUtils.java b/spring-core/src/main/java/org/springframework/util/NumberUtils.java index 6f902081510..478d8070a57 100644 --- a/spring-core/src/main/java/org/springframework/util/NumberUtils.java +++ b/spring-core/src/main/java/org/springframework/util/NumberUtils.java @@ -86,28 +86,28 @@ public abstract class NumberUtils { if (targetClass.isInstance(number)) { return (T) number; } - else if (targetClass.equals(Byte.class)) { + else if (Byte.class == targetClass) { long value = number.longValue(); if (value < Byte.MIN_VALUE || value > Byte.MAX_VALUE) { raiseOverflowException(number, targetClass); } return (T) new Byte(number.byteValue()); } - else if (targetClass.equals(Short.class)) { + else if (Short.class == targetClass) { long value = number.longValue(); if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) { raiseOverflowException(number, targetClass); } return (T) new Short(number.shortValue()); } - else if (targetClass.equals(Integer.class)) { + else if (Integer.class == targetClass) { long value = number.longValue(); if (value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) { raiseOverflowException(number, targetClass); } return (T) new Integer(number.intValue()); } - else if (targetClass.equals(Long.class)) { + else if (Long.class == targetClass) { BigInteger bigInt = null; if (number instanceof BigInteger) { bigInt = (BigInteger) number; @@ -121,7 +121,7 @@ public abstract class NumberUtils { } return (T) new Long(number.longValue()); } - else if (targetClass.equals(BigInteger.class)) { + else if (BigInteger.class == targetClass) { if (number instanceof BigDecimal) { // do not lose precision - use BigDecimal's own conversion return (T) ((BigDecimal) number).toBigInteger(); @@ -131,13 +131,13 @@ public abstract class NumberUtils { return (T) BigInteger.valueOf(number.longValue()); } } - else if (targetClass.equals(Float.class)) { + else if (Float.class == targetClass) { return (T) new Float(number.floatValue()); } - else if (targetClass.equals(Double.class)) { + else if (Double.class == targetClass) { return (T) new Double(number.doubleValue()); } - else if (targetClass.equals(BigDecimal.class)) { + else if (BigDecimal.class == targetClass) { // always use BigDecimal(String) here to avoid unpredictability of BigDecimal(double) // (see BigDecimal javadoc for details) return (T) new BigDecimal(number.toString()); @@ -183,28 +183,28 @@ public abstract class NumberUtils { Assert.notNull(targetClass, "Target class must not be null"); String trimmed = StringUtils.trimAllWhitespace(text); - if (targetClass.equals(Byte.class)) { + if (Byte.class == targetClass) { return (T) (isHexNumber(trimmed) ? Byte.decode(trimmed) : Byte.valueOf(trimmed)); } - else if (targetClass.equals(Short.class)) { + else if (Short.class == targetClass) { return (T) (isHexNumber(trimmed) ? Short.decode(trimmed) : Short.valueOf(trimmed)); } - else if (targetClass.equals(Integer.class)) { + else if (Integer.class == targetClass) { return (T) (isHexNumber(trimmed) ? Integer.decode(trimmed) : Integer.valueOf(trimmed)); } - else if (targetClass.equals(Long.class)) { + else if (Long.class == targetClass) { return (T) (isHexNumber(trimmed) ? Long.decode(trimmed) : Long.valueOf(trimmed)); } - else if (targetClass.equals(BigInteger.class)) { + else if (BigInteger.class == targetClass) { return (T) (isHexNumber(trimmed) ? decodeBigInteger(trimmed) : new BigInteger(trimmed)); } - else if (targetClass.equals(Float.class)) { + else if (Float.class == targetClass) { return (T) Float.valueOf(trimmed); } - else if (targetClass.equals(Double.class)) { + else if (Double.class == targetClass) { return (T) Double.valueOf(trimmed); } - else if (targetClass.equals(BigDecimal.class) || targetClass.equals(Number.class)) { + else if (BigDecimal.class == targetClass || Number.class == targetClass) { return (T) new BigDecimal(trimmed); } else { @@ -236,7 +236,7 @@ public abstract class NumberUtils { boolean resetBigDecimal = false; if (numberFormat instanceof DecimalFormat) { decimalFormat = (DecimalFormat) numberFormat; - if (BigDecimal.class.equals(targetClass) && !decimalFormat.isParseBigDecimal()) { + if (BigDecimal.class == targetClass && !decimalFormat.isParseBigDecimal()) { decimalFormat.setParseBigDecimal(true); resetBigDecimal = true; } diff --git a/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java b/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java index 95b491edde7..209599a087d 100644 --- a/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java +++ b/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java @@ -89,7 +89,7 @@ public abstract class ReflectionUtils { Assert.notNull(clazz, "Class must not be null"); Assert.isTrue(name != null || type != null, "Either name or type of the field must be specified"); Class searchType = clazz; - while (!Object.class.equals(searchType) && searchType != null) { + while (Object.class != searchType && searchType != null) { Field[] fields = getDeclaredFields(searchType); for (Field field : fields) { if ((name == null || name.equals(field.getName())) && diff --git a/spring-core/src/main/java/org/springframework/util/TypeUtils.java b/spring-core/src/main/java/org/springframework/util/TypeUtils.java index b25c4605ba4..93a3d4104a1 100644 --- a/spring-core/src/main/java/org/springframework/util/TypeUtils.java +++ b/spring-core/src/main/java/org/springframework/util/TypeUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ public abstract class TypeUtils { Assert.notNull(rhsType, "Right-hand side type must not be null"); // all types are assignable to themselves and to class Object - if (lhsType.equals(rhsType) || lhsType.equals(Object.class)) { + if (lhsType.equals(rhsType) || Object.class == lhsType) { return true; } diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Indexer.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Indexer.java index 254c6ee9e66..9dba62b6e06 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Indexer.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Indexer.java @@ -166,7 +166,7 @@ public class Indexer extends SpelNodeImpl { // Try and treat the index value as a property of the context object // TODO could call the conversion service to convert the value to a String - if (String.class.equals(indexValue.getTypeDescriptor().getType())) { + if (String.class == indexValue.getTypeDescriptor().getType()) { this.indexedType = IndexedType.OBJECT; return new PropertyIndexingValueRef(targetObject, (String) indexValue.getValue(), state.getEvaluationContext(), targetDescriptor); diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/PropertyOrFieldReference.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/PropertyOrFieldReference.java index b5634a0fee6..faae9ab2f63 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/PropertyOrFieldReference.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/PropertyOrFieldReference.java @@ -97,43 +97,40 @@ public class PropertyOrFieldReference extends SpelNodeImpl { if (result.getValue() == null && isAutoGrowNullReferences && nextChildIs(Indexer.class, PropertyOrFieldReference.class)) { TypeDescriptor resultDescriptor = result.getTypeDescriptor(); - // Creating lists and maps - if ((resultDescriptor.getType().equals(List.class) || resultDescriptor.getType().equals(Map.class))) { - // Create a new collection or map ready for the indexer - if (resultDescriptor.getType().equals(List.class)) { - try { - if (isWritableProperty(this.name, contextObject, evalContext)) { - List newList = ArrayList.class.newInstance(); - writeProperty(contextObject, evalContext, this.name, newList); - result = readProperty(contextObject, evalContext, this.name); - } - } - catch (InstantiationException ex) { - throw new SpelEvaluationException(getStartPosition(), ex, - SpelMessage.UNABLE_TO_CREATE_LIST_FOR_INDEXING); - } - catch (IllegalAccessException ex) { - throw new SpelEvaluationException(getStartPosition(), ex, - SpelMessage.UNABLE_TO_CREATE_LIST_FOR_INDEXING); + // Create a new collection or map ready for the indexer + if (List.class == resultDescriptor.getType()) { + try { + if (isWritableProperty(this.name, contextObject, evalContext)) { + List newList = ArrayList.class.newInstance(); + writeProperty(contextObject, evalContext, this.name, newList); + result = readProperty(contextObject, evalContext, this.name); } } - else { - try { - if (isWritableProperty(this.name,contextObject, evalContext)) { - Map newMap = HashMap.class.newInstance(); - writeProperty(contextObject, evalContext, this.name, newMap); - result = readProperty(contextObject, evalContext, this.name); - } - } - catch (InstantiationException ex) { - throw new SpelEvaluationException(getStartPosition(), ex, - SpelMessage.UNABLE_TO_CREATE_MAP_FOR_INDEXING); - } - catch (IllegalAccessException ex) { - throw new SpelEvaluationException(getStartPosition(), ex, - SpelMessage.UNABLE_TO_CREATE_MAP_FOR_INDEXING); + catch (InstantiationException ex) { + throw new SpelEvaluationException(getStartPosition(), ex, + SpelMessage.UNABLE_TO_CREATE_LIST_FOR_INDEXING); + } + catch (IllegalAccessException ex) { + throw new SpelEvaluationException(getStartPosition(), ex, + SpelMessage.UNABLE_TO_CREATE_LIST_FOR_INDEXING); + } + } + else if (Map.class == resultDescriptor.getType()) { + try { + if (isWritableProperty(this.name,contextObject, evalContext)) { + Map newMap = HashMap.class.newInstance(); + writeProperty(contextObject, evalContext, this.name, newMap); + result = readProperty(contextObject, evalContext, this.name); } } + catch (InstantiationException ex) { + throw new SpelEvaluationException(getStartPosition(), ex, + SpelMessage.UNABLE_TO_CREATE_MAP_FOR_INDEXING); + } + catch (IllegalAccessException ex) { + throw new SpelEvaluationException(getStartPosition(), ex, + SpelMessage.UNABLE_TO_CREATE_MAP_FOR_INDEXING); + } } else { // 'simple' object diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/SingleColumnRowMapper.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/SingleColumnRowMapper.java index fb4897845bf..f2f1292df20 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/SingleColumnRowMapper.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/SingleColumnRowMapper.java @@ -165,7 +165,7 @@ public class SingleColumnRowMapper implements RowMapper { */ @SuppressWarnings("unchecked") protected Object convertValueToRequiredType(Object value, Class requiredType) { - if (String.class.equals(requiredType)) { + if (String.class == requiredType) { return value.toString(); } else if (Number.class.isAssignableFrom(requiredType)) { diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java index 5995ce4a0eb..176364d18a1 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -144,50 +144,50 @@ public abstract class JdbcUtils { Object value; // Explicitly extract typed value, as far as possible. - if (String.class.equals(requiredType)) { + if (String.class == requiredType) { return rs.getString(index); } - else if (boolean.class.equals(requiredType) || Boolean.class.equals(requiredType)) { + else if (boolean.class == requiredType || Boolean.class == requiredType) { value = rs.getBoolean(index); } - else if (byte.class.equals(requiredType) || Byte.class.equals(requiredType)) { + else if (byte.class == requiredType || Byte.class == requiredType) { value = rs.getByte(index); } - else if (short.class.equals(requiredType) || Short.class.equals(requiredType)) { + else if (short.class == requiredType || Short.class == requiredType) { value = rs.getShort(index); } - else if (int.class.equals(requiredType) || Integer.class.equals(requiredType)) { + else if (int.class == requiredType || Integer.class == requiredType) { value = rs.getInt(index); } - else if (long.class.equals(requiredType) || Long.class.equals(requiredType)) { + else if (long.class == requiredType || Long.class == requiredType) { value = rs.getLong(index); } - else if (float.class.equals(requiredType) || Float.class.equals(requiredType)) { + else if (float.class == requiredType || Float.class == requiredType) { value = rs.getFloat(index); } - else if (double.class.equals(requiredType) || Double.class.equals(requiredType) || - Number.class.equals(requiredType)) { + else if (double.class == requiredType || Double.class == requiredType || + Number.class == requiredType) { value = rs.getDouble(index); } - else if (BigDecimal.class.equals(requiredType)) { + else if (BigDecimal.class == requiredType) { return rs.getBigDecimal(index); } - else if (java.sql.Date.class.equals(requiredType)) { + else if (java.sql.Date.class == requiredType) { return rs.getDate(index); } - else if (java.sql.Time.class.equals(requiredType)) { + else if (java.sql.Time.class == requiredType) { return rs.getTime(index); } - else if (java.sql.Timestamp.class.equals(requiredType) || java.util.Date.class.equals(requiredType)) { + else if (java.sql.Timestamp.class == requiredType || java.util.Date.class == requiredType) { return rs.getTimestamp(index); } - else if (byte[].class.equals(requiredType)) { + else if (byte[].class == requiredType) { return rs.getBytes(index); } - else if (Blob.class.equals(requiredType)) { + else if (Blob.class == requiredType) { return rs.getBlob(index); } - else if (Clob.class.equals(requiredType)) { + else if (Clob.class == requiredType) { return rs.getClob(index); } else { diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLErrorCodeSQLExceptionTranslator.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLErrorCodeSQLExceptionTranslator.java index 31da42194af..d9afb8837fe 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLErrorCodeSQLExceptionTranslator.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLErrorCodeSQLExceptionTranslator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -321,27 +321,27 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep Constructor[] constructors = exceptionClass.getConstructors(); for (Constructor constructor : constructors) { Class[] parameterTypes = constructor.getParameterTypes(); - if (parameterTypes.length == 1 && parameterTypes[0].equals(String.class)) { + if (parameterTypes.length == 1 && String.class == parameterTypes[0]) { if (constructorType < MESSAGE_ONLY_CONSTRUCTOR) constructorType = MESSAGE_ONLY_CONSTRUCTOR; } - if (parameterTypes.length == 2 && parameterTypes[0].equals(String.class) && - parameterTypes[1].equals(Throwable.class)) { + if (parameterTypes.length == 2 && String.class == parameterTypes[0] && + Throwable.class == parameterTypes[1]) { if (constructorType < MESSAGE_THROWABLE_CONSTRUCTOR) constructorType = MESSAGE_THROWABLE_CONSTRUCTOR; } - if (parameterTypes.length == 2 && parameterTypes[0].equals(String.class) && - parameterTypes[1].equals(SQLException.class)) { + if (parameterTypes.length == 2 && String.class == parameterTypes[0] && + SQLException.class == parameterTypes[1]) { if (constructorType < MESSAGE_SQLEX_CONSTRUCTOR) constructorType = MESSAGE_SQLEX_CONSTRUCTOR; } - if (parameterTypes.length == 3 && parameterTypes[0].equals(String.class) && - parameterTypes[1].equals(String.class) && parameterTypes[2].equals(Throwable.class)) { + if (parameterTypes.length == 3 && String.class == parameterTypes[0] && + String.class == parameterTypes[1] && Throwable.class == parameterTypes[2]) { if (constructorType < MESSAGE_SQL_THROWABLE_CONSTRUCTOR) constructorType = MESSAGE_SQL_THROWABLE_CONSTRUCTOR; } - if (parameterTypes.length == 3 && parameterTypes[0].equals(String.class) && - parameterTypes[1].equals(String.class) && parameterTypes[2].equals(SQLException.class)) { + if (parameterTypes.length == 3 && String.class == parameterTypes[0] && + String.class == parameterTypes[1] && SQLException.class == parameterTypes[2]) { if (constructorType < MESSAGE_SQL_SQLEX_CONSTRUCTOR) constructorType = MESSAGE_SQL_SQLEX_CONSTRUCTOR; } diff --git a/spring-jms/src/main/java/org/springframework/jms/connection/TransactionAwareConnectionFactoryProxy.java b/spring-jms/src/main/java/org/springframework/jms/connection/TransactionAwareConnectionFactoryProxy.java index f14e9b2015e..541acae0f7d 100644 --- a/spring-jms/src/main/java/org/springframework/jms/connection/TransactionAwareConnectionFactoryProxy.java +++ b/spring-jms/src/main/java/org/springframework/jms/connection/TransactionAwareConnectionFactoryProxy.java @@ -234,14 +234,14 @@ public class TransactionAwareConnectionFactoryProxy // Use hashCode of Connection proxy. return System.identityHashCode(proxy); } - else if (Session.class.equals(method.getReturnType())) { + else if (Session.class == method.getReturnType()) { Session session = ConnectionFactoryUtils.getTransactionalSession( getTargetConnectionFactory(), this.target, isSynchedLocalTransactionAllowed()); if (session != null) { return getCloseSuppressingSessionProxy(session); } } - else if (QueueSession.class.equals(method.getReturnType())) { + else if (QueueSession.class == method.getReturnType()) { QueueSession session = ConnectionFactoryUtils.getTransactionalQueueSession( (QueueConnectionFactory) getTargetConnectionFactory(), (QueueConnection) this.target, isSynchedLocalTransactionAllowed()); @@ -249,7 +249,7 @@ public class TransactionAwareConnectionFactoryProxy return getCloseSuppressingSessionProxy(session); } } - else if (TopicSession.class.equals(method.getReturnType())) { + else if (TopicSession.class == method.getReturnType()) { TopicSession session = ConnectionFactoryUtils.getTransactionalTopicSession( (TopicConnectionFactory) getTargetConnectionFactory(), (TopicConnection) this.target, isSynchedLocalTransactionAllowed()); diff --git a/spring-messaging/src/main/java/org/springframework/messaging/converter/AbstractMessageConverter.java b/spring-messaging/src/main/java/org/springframework/messaging/converter/AbstractMessageConverter.java index 6403e0709fc..69cc344b8c8 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/converter/AbstractMessageConverter.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/converter/AbstractMessageConverter.java @@ -146,7 +146,7 @@ public abstract class AbstractMessageConverter implements MessageConverter { * @param payloadClass either byte[] or String */ public void setSerializedPayloadClass(Class payloadClass) { - Assert.isTrue(byte[].class.equals(payloadClass) || String.class.equals(payloadClass), + Assert.isTrue(byte[].class == payloadClass || String.class == payloadClass, "Payload class must be byte[] or String: " + payloadClass); this.serializedPayloadClass = payloadClass; } diff --git a/spring-messaging/src/main/java/org/springframework/messaging/converter/ByteArrayMessageConverter.java b/spring-messaging/src/main/java/org/springframework/messaging/converter/ByteArrayMessageConverter.java index 1d8348f25ea..921db926493 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/converter/ByteArrayMessageConverter.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/converter/ByteArrayMessageConverter.java @@ -37,7 +37,7 @@ public class ByteArrayMessageConverter extends AbstractMessageConverter { @Override protected boolean supports(Class clazz) { - return byte[].class.equals(clazz); + return byte[].class == clazz; } @Override diff --git a/spring-messaging/src/main/java/org/springframework/messaging/converter/MappingJackson2MessageConverter.java b/spring-messaging/src/main/java/org/springframework/messaging/converter/MappingJackson2MessageConverter.java index 1ed703680c6..5a0e9e02fd8 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/converter/MappingJackson2MessageConverter.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/converter/MappingJackson2MessageConverter.java @@ -215,7 +215,7 @@ public class MappingJackson2MessageConverter extends AbstractMessageConverter { public Object convertToInternal(Object payload, MessageHeaders headers) { try { Class serializationView = getSerializationView(headers); - if (byte[].class.equals(getSerializedPayloadClass())) { + if (byte[].class == getSerializedPayloadClass()) { ByteArrayOutputStream out = new ByteArrayOutputStream(1024); JsonEncoding encoding = getJsonEncoding(getMimeType(headers)); JsonGenerator generator = this.objectMapper.getFactory().createGenerator(out, encoding); diff --git a/spring-messaging/src/main/java/org/springframework/messaging/converter/MarshallingMessageConverter.java b/spring-messaging/src/main/java/org/springframework/messaging/converter/MarshallingMessageConverter.java index 5463679aec4..78c6ade2a35 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/converter/MarshallingMessageConverter.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/converter/MarshallingMessageConverter.java @@ -172,7 +172,7 @@ public class MarshallingMessageConverter extends AbstractMessageConverter { public Object convertToInternal(Object payload, MessageHeaders headers) { Assert.notNull(this.marshaller, "Property 'marshaller' is required"); try { - if (byte[].class.equals(getSerializedPayloadClass())) { + if (byte[].class == getSerializedPayloadClass()) { ByteArrayOutputStream out = new ByteArrayOutputStream(); Result result = new StreamResult(out); diff --git a/spring-messaging/src/main/java/org/springframework/messaging/converter/StringMessageConverter.java b/spring-messaging/src/main/java/org/springframework/messaging/converter/StringMessageConverter.java index bd834b3eab3..b43bd14a0ac 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/converter/StringMessageConverter.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/converter/StringMessageConverter.java @@ -46,7 +46,7 @@ public class StringMessageConverter extends AbstractMessageConverter { @Override protected boolean supports(Class clazz) { - return String.class.equals(clazz); + return String.class == clazz; } @Override @@ -58,7 +58,7 @@ public class StringMessageConverter extends AbstractMessageConverter { @Override public Object convertToInternal(Object payload, MessageHeaders headers) { - if (byte[].class.equals(getSerializedPayloadClass())) { + if (byte[].class == getSerializedPayloadClass()) { Charset charset = getContentTypeCharset(getMimeType(headers)); payload = ((String) payload).getBytes(charset); } diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/HeadersMethodArgumentResolver.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/HeadersMethodArgumentResolver.java index 781f34cae49..3438974f3a3 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/HeadersMethodArgumentResolver.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/HeadersMethodArgumentResolver.java @@ -46,7 +46,7 @@ public class HeadersMethodArgumentResolver implements HandlerMethodArgumentResol public boolean supportsParameter(MethodParameter parameter) { Class paramType = parameter.getParameterType(); return ((parameter.hasParameterAnnotation(Headers.class) && Map.class.isAssignableFrom(paramType)) || - MessageHeaders.class.equals(paramType) || + MessageHeaders.class == paramType || MessageHeaderAccessor.class.isAssignableFrom(paramType)); } @@ -58,7 +58,7 @@ public class HeadersMethodArgumentResolver implements HandlerMethodArgumentResol if (Map.class.isAssignableFrom(paramType)) { return message.getHeaders(); } - else if (MessageHeaderAccessor.class.equals(paramType)) { + else if (MessageHeaderAccessor.class == paramType) { MessageHeaderAccessor accessor = MessageHeaderAccessor.getAccessor(message, MessageHeaderAccessor.class); return (accessor != null ? accessor : new MessageHeaderAccessor(message)); } diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractMethodMessageHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractMethodMessageHandler.java index a085fb6f40b..126ccd92a3e 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractMethodMessageHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractMethodMessageHandler.java @@ -459,7 +459,7 @@ public abstract class AbstractMethodMessageHandler try { Object returnValue = invocable.invoke(message); MethodParameter returnType = handlerMethod.getReturnType(); - if (void.class.equals(returnType.getParameterType())) { + if (void.class == returnType.getParameterType()) { return; } this.returnValueHandlers.handleReturnValue(returnValue, returnType, message); @@ -485,7 +485,7 @@ public abstract class AbstractMethodMessageHandler try { Object returnValue = invocable.invoke(message, ex); MethodParameter returnType = invocable.getReturnType(); - if (void.class.equals(returnType.getParameterType())) { + if (void.class == returnType.getParameterType()) { return; } this.returnValueHandlers.handleReturnValue(returnValue, returnType, message); diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateAccessor.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateAccessor.java index 5383b80a81c..a5174439d7f 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateAccessor.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateAccessor.java @@ -408,7 +408,7 @@ public abstract class HibernateAccessor implements InitializingBean, BeanFactory if (getJdbcExceptionTranslator() != null && ex instanceof JDBCException) { return convertJdbcAccessException((JDBCException) ex, getJdbcExceptionTranslator()); } - else if (GenericJDBCException.class.equals(ex.getClass())) { + else if (GenericJDBCException.class == ex.getClass()) { return convertJdbcAccessException((GenericJDBCException) ex, getDefaultJdbcExceptionTranslator()); } return SessionFactoryUtils.convertHibernateAccessException(ex); diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTransactionManager.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTransactionManager.java index 7939cf0bc16..229e1bfbfbc 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTransactionManager.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTransactionManager.java @@ -794,7 +794,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana if (getJdbcExceptionTranslator() != null && ex instanceof JDBCException) { return convertJdbcAccessException((JDBCException) ex, getJdbcExceptionTranslator()); } - else if (GenericJDBCException.class.equals(ex.getClass())) { + else if (GenericJDBCException.class == ex.getClass()) { return convertJdbcAccessException((GenericJDBCException) ex, getDefaultJdbcExceptionTranslator()); } return SessionFactoryUtils.convertHibernateAccessException(ex); diff --git a/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java b/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java index d1a8d548c43..7ccd9c4b870 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java @@ -557,7 +557,7 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi public boolean supports(Type genericType) { if (genericType instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) genericType; - if (JAXBElement.class.equals(parameterizedType.getRawType()) && + if (JAXBElement.class == parameterizedType.getRawType() && parameterizedType.getActualTypeArguments().length == 1) { Type typeArgument = parameterizedType.getActualTypeArguments()[0]; if (typeArgument instanceof Class) { @@ -610,13 +610,13 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi * Compare section 8.5.1 of the JAXB2 spec. */ private boolean isPrimitiveWrapper(Class clazz) { - return Boolean.class.equals(clazz) || - Byte.class.equals(clazz) || - Short.class.equals(clazz) || - Integer.class.equals(clazz) || - Long.class.equals(clazz) || - Float.class.equals(clazz) || - Double.class.equals(clazz); + return Boolean.class == clazz || + Byte.class == clazz || + Short.class == clazz || + Integer.class == clazz || + Long.class == clazz || + Float.class == clazz || + Double.class == clazz; } /** @@ -624,20 +624,20 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi * Compare section 8.5.2 of the JAXB2 spec. */ private boolean isStandardClass(Class clazz) { - return String.class.equals(clazz) || + return String.class == clazz || BigInteger.class.isAssignableFrom(clazz) || BigDecimal.class.isAssignableFrom(clazz) || Calendar.class.isAssignableFrom(clazz) || Date.class.isAssignableFrom(clazz) || QName.class.isAssignableFrom(clazz) || - URI.class.equals(clazz) || + URI.class == clazz || XMLGregorianCalendar.class.isAssignableFrom(clazz) || Duration.class.isAssignableFrom(clazz) || - Image.class.equals(clazz) || - DataHandler.class.equals(clazz) || + Image.class == clazz || + DataHandler.class == clazz || // Source and subclasses should be supported according to the JAXB2 spec, but aren't in the RI // Source.class.isAssignableFrom(clazz) || - UUID.class.equals(clazz); + UUID.class == clazz; } diff --git a/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueUtils.java b/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueUtils.java index 0d354be4a41..27ce7f640c7 100644 --- a/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueUtils.java +++ b/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueUtils.java @@ -85,7 +85,7 @@ public abstract class ProfileValueUtils { } ProfileValueSource profileValueSource; - if (SystemProfileValueSource.class.equals(profileValueSourceType)) { + if (SystemProfileValueSource.class == profileValueSourceType) { profileValueSource = SystemProfileValueSource.getInstance(); } else { diff --git a/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java b/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java index 5b2ded0ac45..bdbc08814ff 100644 --- a/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java +++ b/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java @@ -463,7 +463,7 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot configAttributes)); } Class 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}. *

The default implementation simply delegates to * {@code getBootstrapContext().getCacheAwareContextLoaderDelegate()}. - *

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. + *

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 *

The default implementation simply returns the supplied instance unmodified. *

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; diff --git a/spring-test/src/main/java/org/springframework/test/context/support/ActiveProfilesUtils.java b/spring-test/src/main/java/org/springframework/test/context/support/ActiveProfilesUtils.java index 0c1b48c6321..68508b54dbc 100644 --- a/spring-test/src/main/java/org/springframework/test/context/support/ActiveProfilesUtils.java +++ b/spring-test/src/main/java/org/springframework/test/context/support/ActiveProfilesUtils.java @@ -97,7 +97,7 @@ abstract class ActiveProfilesUtils { validateActiveProfilesConfiguration(declaringClass, annAttrs); Class resolverClass = annAttrs.getClass("resolver"); - if (ActiveProfilesResolver.class.equals(resolverClass)) { + if (ActiveProfilesResolver.class == resolverClass) { resolverClass = DefaultActiveProfilesResolver.class; } diff --git a/spring-test/src/main/java/org/springframework/test/context/transaction/TransactionalTestExecutionListener.java b/spring-test/src/main/java/org/springframework/test/context/transaction/TransactionalTestExecutionListener.java index 4880332958e..4bad9d97a49 100644 --- a/spring-test/src/main/java/org/springframework/test/context/transaction/TransactionalTestExecutionListener.java +++ b/spring-test/src/main/java/org/springframework/test/context/transaction/TransactionalTestExecutionListener.java @@ -410,7 +410,7 @@ public class TransactionalTestExecutionListener extends AbstractTestExecutionLis private List> getSuperClasses(Class clazz) { List> results = new ArrayList>(); Class current = clazz; - while (current != null && !current.equals(Object.class)) { + while (current != null && Object.class != current) { results.add(current); current = current.getSuperclass(); } diff --git a/spring-test/src/main/java/org/springframework/test/util/JsonPathExpectationsHelper.java b/spring-test/src/main/java/org/springframework/test/util/JsonPathExpectationsHelper.java index 2364b13f9eb..3a48aea3a62 100644 --- a/spring-test/src/main/java/org/springframework/test/util/JsonPathExpectationsHelper.java +++ b/spring-test/src/main/java/org/springframework/test/util/JsonPathExpectationsHelper.java @@ -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; diff --git a/spring-test/src/main/java/org/springframework/test/util/MetaAnnotationUtils.java b/spring-test/src/main/java/org/springframework/test/util/MetaAnnotationUtils.java index 87daf46c025..dfbe1f522b6 100644 --- a/spring-test/src/main/java/org/springframework/test/util/MetaAnnotationUtils.java +++ b/spring-test/src/main/java/org/springframework/test/util/MetaAnnotationUtils.java @@ -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 visited, Class... 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; } diff --git a/spring-tx/src/main/java/org/springframework/dao/support/DataAccessUtils.java b/spring-tx/src/main/java/org/springframework/dao/support/DataAccessUtils.java index 0b1faf18f78..c3649bad7e6 100644 --- a/spring-tx/src/main/java/org/springframework/dao/support/DataAccessUtils.java +++ b/spring-tx/src/main/java/org/springframework/dao/support/DataAccessUtils.java @@ -139,7 +139,7 @@ public abstract class DataAccessUtils { Object result = requiredUniqueResult(results); if (requiredType != null && !requiredType.isInstance(result)) { - if (String.class.equals(requiredType)) { + if (String.class == requiredType) { result = result.toString(); } else if (Number.class.isAssignableFrom(requiredType) && Number.class.isInstance(result)) { diff --git a/spring-tx/src/main/java/org/springframework/transaction/interceptor/RollbackRuleAttribute.java b/spring-tx/src/main/java/org/springframework/transaction/interceptor/RollbackRuleAttribute.java index c7267cd9d78..918e38a455e 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/interceptor/RollbackRuleAttribute.java +++ b/spring-tx/src/main/java/org/springframework/transaction/interceptor/RollbackRuleAttribute.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -116,7 +116,7 @@ public class RollbackRuleAttribute implements Serializable{ return depth; } // If we've gone as far as we can go and haven't found it... - if (exceptionClass.equals(Throwable.class)) { + if (exceptionClass == Throwable.class) { return -1; } return getDepth(exceptionClass.getSuperclass(), depth + 1); diff --git a/spring-web/src/main/java/org/springframework/http/converter/BufferedImageHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/BufferedImageHttpMessageConverter.java index 25d39f12fee..66c14320710 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/BufferedImageHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/BufferedImageHttpMessageConverter.java @@ -129,7 +129,7 @@ public class BufferedImageHttpMessageConverter implements HttpMessageConverter clazz, MediaType mediaType) { - return (BufferedImage.class.equals(clazz) && isReadable(mediaType)); + return (BufferedImage.class == clazz && isReadable(mediaType)); } private boolean isReadable(MediaType mediaType) { @@ -142,7 +142,7 @@ public class BufferedImageHttpMessageConverter implements HttpMessageConverter clazz, MediaType mediaType) { - return (BufferedImage.class.equals(clazz) && isWritable(mediaType)); + return (BufferedImage.class == clazz && isWritable(mediaType)); } private boolean isWritable(MediaType mediaType) { diff --git a/spring-web/src/main/java/org/springframework/http/converter/ByteArrayHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/ByteArrayHttpMessageConverter.java index 800a9febaa3..87c003d7a58 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/ByteArrayHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/ByteArrayHttpMessageConverter.java @@ -43,7 +43,7 @@ public class ByteArrayHttpMessageConverter extends AbstractHttpMessageConverter< @Override public boolean supports(Class clazz) { - return byte[].class.equals(clazz); + return byte[].class == clazz; } @Override diff --git a/spring-web/src/main/java/org/springframework/http/converter/ResourceHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/ResourceHttpMessageConverter.java index 4429d4d5d2c..9eebbbf322f 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/ResourceHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/ResourceHttpMessageConverter.java @@ -80,7 +80,7 @@ public class ResourceHttpMessageConverter extends AbstractHttpMessageConverter clazz) { - return String.class.equals(clazz); + return String.class == clazz; } @Override diff --git a/spring-web/src/main/java/org/springframework/http/converter/xml/Jaxb2CollectionHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/xml/Jaxb2CollectionHttpMessageConverter.java index cb81421b2ba..10cac6a5a37 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/xml/Jaxb2CollectionHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/xml/Jaxb2CollectionHttpMessageConverter.java @@ -182,10 +182,10 @@ public class Jaxb2CollectionHttpMessageConverter collectionClass.getName() + "]: " + ex.getMessage()); } } - else if (List.class.equals(collectionClass)) { + else if (List.class == collectionClass) { return (T) new ArrayList(); } - else if (SortedSet.class.equals(collectionClass)) { + else if (SortedSet.class == collectionClass) { return (T) new TreeSet(); } else { diff --git a/spring-web/src/main/java/org/springframework/http/converter/xml/SourceHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/xml/SourceHttpMessageConverter.java index 8c9c4ec9ef8..a34c2a669c0 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/xml/SourceHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/xml/SourceHttpMessageConverter.java @@ -118,16 +118,16 @@ public class SourceHttpMessageConverter extends AbstractHttpMe throws IOException, HttpMessageNotReadableException { InputStream body = inputMessage.getBody(); - if (DOMSource.class.equals(clazz)) { + if (DOMSource.class == clazz) { return (T) readDOMSource(body); } - else if (SAXSource.class.equals(clazz)) { + else if (SAXSource.class == clazz) { return (T) readSAXSource(body); } - else if (StAXSource.class.equals(clazz)) { + else if (StAXSource.class == clazz) { return (T) readStAXSource(body); } - else if (StreamSource.class.equals(clazz) || Source.class.equals(clazz)) { + else if (StreamSource.class == clazz || Source.class == clazz) { return (T) readStreamSource(body); } else { diff --git a/spring-web/src/main/java/org/springframework/web/bind/WebDataBinder.java b/spring-web/src/main/java/org/springframework/web/bind/WebDataBinder.java index 56ff681eeb1..77562398265 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/WebDataBinder.java +++ b/spring-web/src/main/java/org/springframework/web/bind/WebDataBinder.java @@ -251,7 +251,7 @@ public class WebDataBinder extends DataBinder { * @return the empty value (for most fields: null) */ protected Object getEmptyValue(String field, Class fieldType) { - if (fieldType != null && boolean.class.equals(fieldType) || Boolean.class.equals(fieldType)) { + if (fieldType != null && boolean.class == fieldType || Boolean.class == fieldType) { // Special handling of boolean property. return Boolean.FALSE; } diff --git a/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodInvoker.java b/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodInvoker.java index d1e86e4ffbc..57490c5d2bd 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodInvoker.java +++ b/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodInvoker.java @@ -740,7 +740,7 @@ public class HandlerMethodInvoker { private Object checkValue(String name, Object value, Class paramType) { if (value == null) { - if (boolean.class.equals(paramType)) { + if (boolean.class == paramType) { return Boolean.FALSE; } else if (paramType.isPrimitive()) { diff --git a/spring-web/src/main/java/org/springframework/web/client/RestTemplate.java b/spring-web/src/main/java/org/springframework/web/client/RestTemplate.java index 504df69d014..062e3d6fb59 100644 --- a/spring-web/src/main/java/org/springframework/web/client/RestTemplate.java +++ b/spring-web/src/main/java/org/springframework/web/client/RestTemplate.java @@ -80,7 +80,7 @@ import org.springframework.web.util.UriTemplateHandler; * HTTP PATCH, HTTP PUT with response body, etc.). Note however that the underlying HTTP * library used must also support the desired combination. * - *

For each HTTP method there are 3 variants -- two accept a URI template string + *

For each HTTP method there are three variants: two accept a URI template string * and URI variables (array or map) while a third accepts a {@link URI}. * Note that for URI templates it is assumed encoding is necessary, e.g. * {@code restTemplate.getForObject("http://example.com/hotel list")} becomes @@ -816,7 +816,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat private final HttpMessageConverterExtractor delegate; public ResponseEntityResponseExtractor(Type responseType) { - if (responseType != null && !Void.class.equals(responseType)) { + if (responseType != null && Void.class != responseType) { this.delegate = new HttpMessageConverterExtractor(responseType, getMessageConverters(), logger); } else { diff --git a/spring-web/src/main/java/org/springframework/web/method/annotation/RequestParamMethodArgumentResolver.java b/spring-web/src/main/java/org/springframework/web/method/annotation/RequestParamMethodArgumentResolver.java index 543aa9db6f7..71e61ede605 100644 --- a/spring-web/src/main/java/org/springframework/web/method/annotation/RequestParamMethodArgumentResolver.java +++ b/spring-web/src/main/java/org/springframework/web/method/annotation/RequestParamMethodArgumentResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,8 +53,8 @@ import org.springframework.web.util.WebUtils; * type {@link MultipartFile} in conjunction with Spring's {@link MultipartResolver} * abstraction, and arguments of type {@code javax.servlet.http.Part} in conjunction * with Servlet 3.0 multipart requests. This resolver can also be created in default - * resolution mode in which simple types (int, long, etc.) not annotated - * with @{@link RequestParam} are also treated as request parameters with the + * resolution mode in which simple types (int, long, etc.) not annotated with + * @{@link RequestParam} are also treated as request parameters with the * parameter name derived from the argument name. * *

If the method parameter type is {@link Map}, the name specified in the @@ -138,7 +138,7 @@ public class RequestParamMethodArgumentResolver extends AbstractNamedValueMethod if (parameter.hasParameterAnnotation(RequestPart.class)) { return false; } - else if (MultipartFile.class.equals(paramType) || "javax.servlet.http.Part".equals(paramType.getName())) { + else if (MultipartFile.class == paramType || "javax.servlet.http.Part".equals(paramType.getName())) { return true; } else if (this.useDefaultResolution) { @@ -163,7 +163,7 @@ public class RequestParamMethodArgumentResolver extends AbstractNamedValueMethod WebUtils.getNativeRequest(servletRequest, MultipartHttpServletRequest.class); Object arg; - if (MultipartFile.class.equals(parameter.getParameterType())) { + if (MultipartFile.class == parameter.getParameterType()) { assertIsMultipartRequest(servletRequest); Assert.notNull(multipartRequest, "Expected MultipartHttpServletRequest: is a MultipartResolver configured?"); arg = multipartRequest.getFile(name); @@ -202,7 +202,7 @@ public class RequestParamMethodArgumentResolver extends AbstractNamedValueMethod if (arg == null) { String[] paramValues = webRequest.getParameterValues(name); if (paramValues != null) { - arg = paramValues.length == 1 ? paramValues[0] : paramValues; + arg = (paramValues.length == 1 ? paramValues[0] : paramValues); } } } @@ -219,27 +219,27 @@ public class RequestParamMethodArgumentResolver extends AbstractNamedValueMethod private boolean isMultipartFileCollection(MethodParameter parameter) { Class collectionType = getCollectionParameterType(parameter); - return ((collectionType != null) && collectionType.equals(MultipartFile.class)); + return (collectionType != null && MultipartFile.class == collectionType); } private boolean isPartCollection(MethodParameter parameter) { Class collectionType = getCollectionParameterType(parameter); - return ((collectionType != null) && "javax.servlet.http.Part".equals(collectionType.getName())); + return (collectionType != null && "javax.servlet.http.Part".equals(collectionType.getName())); } private boolean isPartArray(MethodParameter parameter) { Class paramType = parameter.getParameterType().getComponentType(); - return ((paramType != null) && "javax.servlet.http.Part".equals(paramType.getName())); + return (paramType != null && "javax.servlet.http.Part".equals(paramType.getName())); } private boolean isMultipartFileArray(MethodParameter parameter) { Class paramType = parameter.getParameterType().getComponentType(); - return ((paramType != null) && MultipartFile.class.equals(paramType)); + return (paramType != null && MultipartFile.class == paramType); } private Class getCollectionParameterType(MethodParameter parameter) { Class paramType = parameter.getParameterType(); - if (Collection.class.equals(paramType) || List.class.isAssignableFrom(paramType)){ + if (Collection.class == paramType || List.class.isAssignableFrom(paramType)){ Class valueType = GenericCollectionTypeResolver.getCollectionParameterType(parameter); if (valueType != null) { return valueType; @@ -258,7 +258,7 @@ public class RequestParamMethodArgumentResolver extends AbstractNamedValueMethod UriComponentsBuilder builder, Map uriVariables, ConversionService conversionService) { Class paramType = parameter.getParameterType(); - if (Map.class.isAssignableFrom(paramType) || MultipartFile.class.equals(paramType) || + if (Map.class.isAssignableFrom(paramType) || MultipartFile.class == paramType || "javax.servlet.http.Part".equals(paramType.getName())) { return; } diff --git a/spring-web/src/main/java/org/springframework/web/method/annotation/SessionStatusMethodArgumentResolver.java b/spring-web/src/main/java/org/springframework/web/method/annotation/SessionStatusMethodArgumentResolver.java index 1e4dedf7707..b6b30f9a4e1 100644 --- a/spring-web/src/main/java/org/springframework/web/method/annotation/SessionStatusMethodArgumentResolver.java +++ b/spring-web/src/main/java/org/springframework/web/method/annotation/SessionStatusMethodArgumentResolver.java @@ -34,7 +34,7 @@ public class SessionStatusMethodArgumentResolver implements HandlerMethodArgumen @Override public boolean supportsParameter(MethodParameter parameter) { - return SessionStatus.class.equals(parameter.getParameterType()); + return SessionStatus.class == parameter.getParameterType(); } @Override diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/FrameworkPortlet.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/FrameworkPortlet.java index 8a278cbdf11..8933a4d4d4f 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/FrameworkPortlet.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/FrameworkPortlet.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -517,8 +517,9 @@ public abstract class FrameworkPortlet extends GenericPortletBean // Expose current RequestAttributes to current thread. RequestAttributes previousRequestAttributes = RequestContextHolder.getRequestAttributes(); PortletRequestAttributes requestAttributes = null; - if (previousRequestAttributes == null || previousRequestAttributes.getClass().equals(PortletRequestAttributes.class) || - previousRequestAttributes.getClass().equals(ServletRequestAttributes.class)) { + if (previousRequestAttributes == null || + PortletRequestAttributes.class == previousRequestAttributes.getClass() || + ServletRequestAttributes.class == previousRequestAttributes.getClass()) { requestAttributes = new PortletRequestAttributes(request, response); RequestContextHolder.setRequestAttributes(requestAttributes, this.threadContextInheritable); } diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/SimpleMappingExceptionResolver.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/SimpleMappingExceptionResolver.java index 2338cacb575..2704be2e0cf 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/SimpleMappingExceptionResolver.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/SimpleMappingExceptionResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -190,7 +190,7 @@ public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionReso return depth; } // If we've gone as far as we can go and haven't found it... - if (exceptionClass.equals(Throwable.class)) { + if (exceptionClass == Throwable.class) { return -1; } return getDepth(exceptionMapping, exceptionClass.getSuperclass(), depth + 1); diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerAdapter.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerAdapter.java index 31ac98086e6..b39b304c175 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerAdapter.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerAdapter.java @@ -520,7 +520,7 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator } private String determineDefaultPhase(Method handlerMethod) { - if (!void.class.equals(handlerMethod.getReturnType())) { + if (void.class != handlerMethod.getReturnType()) { return PortletRequest.RENDER_PHASE; } for (Class argType : handlerMethod.getParameterTypes()) { @@ -650,7 +650,7 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator else if (Principal.class.isAssignableFrom(parameterType)) { return request.getUserPrincipal(); } - else if (Locale.class.equals(parameterType)) { + else if (Locale.class == parameterType) { return request.getLocale(); } else if (InputStream.class.isAssignableFrom(parameterType)) { @@ -677,7 +677,7 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator } return ((MimeResponse) response).getWriter(); } - else if (Event.class.equals(parameterType)) { + else if (Event.class == parameterType) { if (!(request instanceof EventRequest)) { throw new IllegalStateException("Event can only get obtained from EventRequest"); } diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java index 6ec21b5d3dd..0764dd0d442 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java @@ -328,7 +328,7 @@ public class AnnotationMethodHandlerExceptionResolver extends AbstractHandlerExc else if (Principal.class.isAssignableFrom(parameterType)) { return request.getUserPrincipal(); } - else if (Locale.class.equals(parameterType)) { + else if (Locale.class == parameterType) { return request.getLocale(); } else if (InputStream.class.isAssignableFrom(parameterType)) { @@ -355,7 +355,7 @@ public class AnnotationMethodHandlerExceptionResolver extends AbstractHandlerExc } return ((MimeResponse) response).getWriter(); } - else if (Event.class.equals(parameterType)) { + else if (Event.class == parameterType) { if (!(request instanceof EventRequest)) { throw new IllegalStateException("Event can only get obtained from EventRequest"); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/SimpleMappingExceptionResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/SimpleMappingExceptionResolver.java index 8ca6708dca1..b24363f10b3 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/SimpleMappingExceptionResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/SimpleMappingExceptionResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -267,7 +267,7 @@ public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionReso return depth; } // If we've gone as far as we can go and haven't found it... - if (exceptionClass.equals(Throwable.class)) { + if (exceptionClass == Throwable.class) { return -1; } return getDepth(exceptionMapping, exceptionClass.getSuperclass(), depth + 1); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java index 3dd4726785b..49be5840b61 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java @@ -891,7 +891,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator else if (Principal.class.isAssignableFrom(parameterType)) { return request.getUserPrincipal(); } - else if (Locale.class.equals(parameterType)) { + else if (Locale.class == parameterType) { return RequestContextUtils.getLocale(request); } else if (InputStream.class.isAssignableFrom(parameterType)) { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java index 18e02fe0630..3e8a37318fa 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java @@ -341,7 +341,7 @@ public class AnnotationMethodHandlerExceptionResolver extends AbstractHandlerExc else if (Principal.class.isAssignableFrom(parameterType)) { return request.getUserPrincipal(); } - else if (Locale.class.equals(parameterType)) { + else if (Locale.class == parameterType) { return RequestContextUtils.getLocale(request); } else if (InputStream.class.isAssignableFrom(parameterType)) { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessor.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessor.java index 38d38e02f9c..0a88f5b8492 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessor.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessor.java @@ -102,8 +102,8 @@ public class HttpEntityMethodProcessor extends AbstractMessageConverterMethodPro @Override public boolean supportsParameter(MethodParameter parameter) { - return (HttpEntity.class.equals(parameter.getParameterType()) || - RequestEntity.class.equals(parameter.getParameterType())); + return (HttpEntity.class == parameter.getParameterType() || + RequestEntity.class == parameter.getParameterType()); } @Override @@ -121,7 +121,7 @@ public class HttpEntityMethodProcessor extends AbstractMessageConverterMethodPro Type paramType = getHttpEntityType(parameter); Object body = readWithMessageConverters(webRequest, parameter, paramType); - if (RequestEntity.class.equals(parameter.getParameterType())) { + if (RequestEntity.class == parameter.getParameterType()) { URI url = inputMessage.getURI(); HttpMethod httpMethod = inputMessage.getMethod(); return new RequestEntity(body, inputMessage.getHeaders(), httpMethod, url); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilder.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilder.java index acd72c9d3cf..22274cee600 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilder.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilder.java @@ -701,7 +701,7 @@ public class MvcUriComponentsBuilder { this.controllerMethod = method; this.argumentValues = args; Class returnType = method.getReturnType(); - return (void.class.equals(returnType) ? null : returnType.cast(initProxy(returnType, this))); + return (void.class == returnType ? null : returnType.cast(initProxy(returnType, this))); } } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolver.java index 2f6475ca53f..75014314ebf 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolver.java @@ -111,7 +111,7 @@ public class RequestPartMethodArgumentResolver extends AbstractMessageConverterM if (parameter.hasParameterAnnotation(RequestParam.class)){ return false; } - else if (MultipartFile.class.equals(parameter.getParameterType())) { + else if (MultipartFile.class == parameter.getParameterType()) { return true; } else if ("javax.servlet.http.Part".equals(parameter.getParameterType().getName())) { @@ -144,7 +144,7 @@ public class RequestPartMethodArgumentResolver extends AbstractMessageConverterM String partName = getPartName(parameter); Object arg; - if (MultipartFile.class.equals(paramType)) { + if (MultipartFile.class == paramType) { Assert.notNull(multipartRequest, "Expected MultipartHttpServletRequest: is a MultipartResolver configured?"); arg = multipartRequest.getFile(partName); } @@ -224,12 +224,12 @@ public class RequestPartMethodArgumentResolver extends AbstractMessageConverterM private boolean isMultipartFileCollection(MethodParameter methodParam) { Class collectionType = getCollectionParameterType(methodParam); - return MultipartFile.class.equals(collectionType); + return MultipartFile.class == collectionType; } private boolean isMultipartFileArray(MethodParameter methodParam) { Class paramType = methodParam.getNestedParameterType().getComponentType(); - return MultipartFile.class.equals(paramType); + return MultipartFile.class == paramType; } private boolean isPartCollection(MethodParameter methodParam) { @@ -244,7 +244,7 @@ public class RequestPartMethodArgumentResolver extends AbstractMessageConverterM private Class getCollectionParameterType(MethodParameter methodParam) { Class paramType = methodParam.getNestedParameterType(); - if (Collection.class.equals(paramType) || List.class.isAssignableFrom(paramType)){ + if (Collection.class == paramType || List.class.isAssignableFrom(paramType)){ Class valueType = GenericCollectionTypeResolver.getCollectionParameterType(methodParam); if (valueType != null) { return valueType; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyAdviceChain.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyAdviceChain.java index 8a357ffee8f..d41295cfa11 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyAdviceChain.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyAdviceChain.java @@ -72,10 +72,10 @@ class RequestResponseBodyAdviceChain implements RequestBodyAdvice, ResponseBodyA } private List getAdvice(Class adviceType) { - if (RequestBodyAdvice.class.equals(adviceType)) { + if (RequestBodyAdvice.class == adviceType) { return this.requestBodyAdvice; } - else if (ResponseBodyAdvice.class.equals(adviceType)) { + else if (ResponseBodyAdvice.class == adviceType) { return this.responseBodyAdvice; } else { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletRequestMethodArgumentResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletRequestMethodArgumentResolver.java index 6c0db89cc70..1ec50e65ee0 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletRequestMethodArgumentResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletRequestMethodArgumentResolver.java @@ -69,12 +69,12 @@ public class ServletRequestMethodArgumentResolver implements HandlerMethodArgume MultipartRequest.class.isAssignableFrom(paramType) || HttpSession.class.isAssignableFrom(paramType) || Principal.class.isAssignableFrom(paramType) || - Locale.class.equals(paramType) || - TimeZone.class.equals(paramType) || + Locale.class == paramType || + TimeZone.class == paramType || "java.time.ZoneId".equals(paramType.getName()) || InputStream.class.isAssignableFrom(paramType) || Reader.class.isAssignableFrom(paramType) || - HttpMethod.class.equals(paramType)); + HttpMethod.class == paramType); } @Override @@ -98,16 +98,16 @@ public class ServletRequestMethodArgumentResolver implements HandlerMethodArgume else if (HttpSession.class.isAssignableFrom(paramType)) { return request.getSession(); } - else if (HttpMethod.class.equals(paramType)) { + else if (HttpMethod.class == paramType) { return ((ServletWebRequest) webRequest).getHttpMethod(); } else if (Principal.class.isAssignableFrom(paramType)) { return request.getUserPrincipal(); } - else if (Locale.class.equals(paramType)) { + else if (Locale.class == paramType) { return RequestContextUtils.getLocale(request); } - else if (TimeZone.class.equals(paramType)) { + else if (TimeZone.class == paramType) { TimeZone timeZone = RequestContextUtils.getTimeZone(request); return (timeZone != null ? timeZone : TimeZone.getDefault()); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/UriComponentsBuilderMethodArgumentResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/UriComponentsBuilderMethodArgumentResolver.java index d01f2e8cb72..d8d3208437d 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/UriComponentsBuilderMethodArgumentResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/UriComponentsBuilderMethodArgumentResolver.java @@ -42,7 +42,7 @@ public class UriComponentsBuilderMethodArgumentResolver implements HandlerMethod @Override public boolean supportsParameter(MethodParameter parameter) { Class type = parameter.getParameterType(); - return (UriComponentsBuilder.class.equals(type) || ServletUriComponentsBuilder.class.equals(type)); + return (UriComponentsBuilder.class == type || ServletUriComponentsBuilder.class == type); } @Override diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ViewNameMethodReturnValueHandler.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ViewNameMethodReturnValueHandler.java index 65919d22677..14ad890d583 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ViewNameMethodReturnValueHandler.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ViewNameMethodReturnValueHandler.java @@ -68,7 +68,7 @@ public class ViewNameMethodReturnValueHandler implements HandlerMethodReturnValu @Override public boolean supportsReturnType(MethodParameter returnType) { Class paramType = returnType.getParameterType(); - return (void.class.equals(paramType) || String.class.equals(paramType)); + return (void.class == paramType || String.class == paramType); } @Override diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/MultiActionController.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/MultiActionController.java index a47920ae4e6..188c9667162 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/MultiActionController.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/MultiActionController.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.web.servlet.mvc.multiaction; +package org.springframework.web.servlet. mvc.multiaction; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -288,12 +288,12 @@ public class MultiActionController extends AbstractController implements LastMod */ private boolean isHandlerMethod(Method method) { Class returnType = method.getReturnType(); - if (ModelAndView.class.equals(returnType) || Map.class.equals(returnType) || String.class.equals(returnType) || - void.class.equals(returnType)) { + if (ModelAndView.class == returnType || Map.class == returnType || String.class == returnType || + void.class == returnType) { Class[] parameterTypes = method.getParameterTypes(); return (parameterTypes.length >= 2 && - HttpServletRequest.class.equals(parameterTypes[0]) && - HttpServletResponse.class.equals(parameterTypes[1]) && + HttpServletRequest.class == parameterTypes[0] && + HttpServletResponse.class == parameterTypes[1] && !("handleRequest".equals(method.getName()) && parameterTypes.length == 2)); } return false; @@ -329,7 +329,7 @@ public class MultiActionController extends AbstractController implements LastMod method.getName() + LAST_MODIFIED_METHOD_SUFFIX, new Class[] {HttpServletRequest.class}); Class returnType = lastModifiedMethod.getReturnType(); - if (!(long.class.equals(returnType) || Long.class.equals(returnType))) { + if (!(long.class == returnType || Long.class == returnType)) { throw new IllegalStateException("last-modified method [" + lastModifiedMethod + "] declares an invalid return type - needs to be 'long' or 'Long'"); } @@ -452,7 +452,7 @@ public class MultiActionController extends AbstractController implements LastMod params.add(request); params.add(response); - if (paramTypes.length >= 3 && paramTypes[2].equals(HttpSession.class)) { + if (paramTypes.length >= 3 && HttpSession.class == paramTypes[2]) { HttpSession session = request.getSession(false); if (session == null) { throw new HttpSessionRequiredException( @@ -462,8 +462,7 @@ public class MultiActionController extends AbstractController implements LastMod } // If last parameter isn't of HttpSession type, it's a command. - if (paramTypes.length >= 3 && - !paramTypes[paramTypes.length - 1].equals(HttpSession.class)) { + if (paramTypes.length >= 3 && HttpSession.class != paramTypes[paramTypes.length - 1]) { Object command = newCommandObject(paramTypes[paramTypes.length - 1]); params.add(command); bind(request, command); @@ -608,7 +607,7 @@ public class MultiActionController extends AbstractController implements LastMod logger.debug("Trying to find handler for exception class [" + exceptionClass.getName() + "]"); } Method handler = this.exceptionHandlerMap.get(exceptionClass); - while (handler == null && !exceptionClass.equals(Throwable.class)) { + while (handler == null && exceptionClass != Throwable.class) { if (logger.isDebugEnabled()) { logger.debug("Trying to find handler for exception superclass [" + exceptionClass.getName() + "]"); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/CheckboxTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/CheckboxTag.java index c7abcaa49a5..ebde41ea32c 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/CheckboxTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/CheckboxTag.java @@ -71,7 +71,7 @@ public class CheckboxTag extends AbstractSingleCheckedElementTag { Object boundValue = getBoundValue(); Class valueType = getBindStatus().getValueType(); - if (Boolean.class.equals(valueType) || boolean.class.equals(valueType)) { + if (Boolean.class == valueType || boolean.class == valueType) { // the concrete type may not be a Boolean - can be String if (boundValue instanceof String) { boundValue = Boolean.valueOf((String) boundValue); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/InternalResourceViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/InternalResourceViewResolver.java index eb9a1bf5fcb..679e8a9579c 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/InternalResourceViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/InternalResourceViewResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ public class InternalResourceViewResolver extends UrlBasedViewResolver { */ public InternalResourceViewResolver() { Class viewClass = requiredViewClass(); - if (viewClass.equals(InternalResourceView.class) && jstlPresent) { + if (InternalResourceView.class == viewClass && jstlPresent) { viewClass = JstlView.class; } setViewClass(viewClass); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityViewResolver.java index d1c903cc1d5..e812ec92d82 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityViewResolver.java @@ -106,7 +106,7 @@ public class VelocityViewResolver extends AbstractTemplateViewResolver { super.initApplicationContext(); if (this.toolboxConfigLocation != null) { - if (VelocityView.class.equals(getViewClass())) { + if (VelocityView.class == getViewClass()) { logger.info("Using VelocityToolboxView instead of default VelocityView " + "due to specified toolboxConfigLocation"); setViewClass(VelocityToolboxView.class); diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParser.java b/spring-websocket/src/main/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParser.java index 1982e8b85b1..0c8bab682ec 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParser.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParser.java @@ -573,7 +573,7 @@ class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser { RuntimeBeanReference webSocketHandler = new RuntimeBeanReference(WEB_SOCKET_HANDLER_BEAN_NAME); beanDef.getPropertyValues().add("subProtocolWebSocketHandler", webSocketHandler); - if (StompBrokerRelayMessageHandler.class.equals(broker.getBeanClass())) { + if (StompBrokerRelayMessageHandler.class == broker.getBeanClass()) { beanDef.getPropertyValues().add("stompBrokerRelay", broker); } String name = inChannel.getBeanName() + "Executor"; diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/AbstractTyrusRequestUpgradeStrategy.java b/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/AbstractTyrusRequestUpgradeStrategy.java index 9a871e3dded..7048de47732 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/AbstractTyrusRequestUpgradeStrategy.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/AbstractTyrusRequestUpgradeStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -199,7 +199,7 @@ public abstract class AbstractTyrusRequestUpgradeStrategy extends AbstractStanda private static Constructor getEndpointConstructor() { for (Constructor current : TyrusEndpointWrapper.class.getConstructors()) { Class[] types = current.getParameterTypes(); - if (types[0].equals(Endpoint.class) && types[1].equals(EndpointConfig.class)) { + if (Endpoint.class == types[0] && EndpointConfig.class == types[1]) { return current; } }