From 9d5aced8c5ab4ac2098b35d806711591e61ac41d Mon Sep 17 00:00:00 2001 From: www Date: Fri, 5 Oct 2018 01:48:39 +0800 Subject: [PATCH] Fix formatting Prefix the opening brace with a single space in some classes. Replace tab character with space in javadoc of AttributeAccessor. Also fix some other trivial formatting errors. Closes gh-1979 --- .../beans/factory/NoUniqueBeanDefinitionException.java | 4 ++-- .../annotation/AutowiredAnnotationBeanPostProcessor.java | 2 +- .../beans/factory/config/BeanExpressionContext.java | 4 ++-- .../factory/config/PreferencesPlaceholderConfigurer.java | 4 ++-- .../beans/factory/config/PropertyOverrideConfigurer.java | 2 +- .../factory/support/AbstractAutowireCapableBeanFactory.java | 4 ++-- .../beans/factory/support/DefaultListableBeanFactory.java | 2 +- .../factory/support/PropertiesBeanDefinitionReader.java | 2 +- .../beans/factory/support/SimpleInstantiationStrategy.java | 2 +- .../beans/factory/support/StaticListableBeanFactory.java | 2 +- .../factory/xml/SimpleConstructorNamespaceHandler.java | 6 +++--- .../java/org/springframework/core/AttributeAccessor.java | 4 ++-- .../src/main/java/org/springframework/util/ObjectUtils.java | 4 ++-- .../util/UpdateMessageDigestInputStream.java | 6 +++--- 14 files changed, 24 insertions(+), 24 deletions(-) diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/NoUniqueBeanDefinitionException.java b/spring-beans/src/main/java/org/springframework/beans/factory/NoUniqueBeanDefinitionException.java index f94e9d8805..b3e6e287ca 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/NoUniqueBeanDefinitionException.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/NoUniqueBeanDefinitionException.java @@ -60,7 +60,7 @@ public class NoUniqueBeanDefinitionException extends NoSuchBeanDefinitionExcepti public NoUniqueBeanDefinitionException(Class type, Collection beanNamesFound) { super(type, "expected single matching bean but found " + beanNamesFound.size() + ": " + StringUtils.collectionToCommaDelimitedString(beanNamesFound)); - this.numberOfBeansFound = beanNamesFound.size(); + this.numberOfBeansFound = beanNamesFound.size(); this.beanNamesFound = beanNamesFound; } @@ -82,7 +82,7 @@ public class NoUniqueBeanDefinitionException extends NoSuchBeanDefinitionExcepti public NoUniqueBeanDefinitionException(ResolvableType type, Collection beanNamesFound) { super(type, "expected single matching bean but found " + beanNamesFound.size() + ": " + StringUtils.collectionToCommaDelimitedString(beanNamesFound)); - this.numberOfBeansFound = beanNamesFound.size(); + this.numberOfBeansFound = beanNamesFound.size(); this.beanNamesFound = beanNamesFound; } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java index 745b4ee4ee..8de861d21c 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java @@ -707,7 +707,7 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean ReflectionUtils.makeAccessible(method); method.invoke(bean, arguments); } - catch (InvocationTargetException ex){ + catch (InvocationTargetException ex) { throw ex.getTargetException(); } } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/BeanExpressionContext.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/BeanExpressionContext.java index 3e0b4000bb..d3cadc3726 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/BeanExpressionContext.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/BeanExpressionContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,7 +59,7 @@ public class BeanExpressionContext { if (this.beanFactory.containsBean(key)) { return this.beanFactory.getBean(key); } - else if (this.scope != null){ + else if (this.scope != null) { return this.scope.resolveContextualObject(key); } else { diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/PreferencesPlaceholderConfigurer.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/PreferencesPlaceholderConfigurer.java index bfdaea4810..5d760a50de 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/PreferencesPlaceholderConfigurer.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/PreferencesPlaceholderConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -121,7 +121,7 @@ public class PreferencesPlaceholderConfigurer extends PropertyPlaceholderConfigu @Nullable protected String resolvePlaceholder(@Nullable String path, String key, Preferences preferences) { if (path != null) { - // Do not create the node if it does not exist... + // Do not create the node if it does not exist... try { if (preferences.nodeExists(path)) { return preferences.node(path).get(key, null); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyOverrideConfigurer.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyOverrideConfigurer.java index 9f97840f15..e94b0b0839 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyOverrideConfigurer.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyOverrideConfigurer.java @@ -132,7 +132,7 @@ public class PropertyOverrideConfigurer extends PropertyResourceConfigurer { "': expected 'beanName" + this.beanNameSeparator + "property'"); } String beanName = key.substring(0, separatorIndex); - String beanProperty = key.substring(separatorIndex+1); + String beanProperty = key.substring(separatorIndex + 1); this.beanNames.add(beanName); applyPropertyValue(factory, beanName, beanProperty, value); if (logger.isDebugEnabled()) { 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 6ca0b123fc..f827fbf7fd 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 @@ -1122,7 +1122,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac return obtainFromSupplier(instanceSupplier, beanName); } - if (mbd.getFactoryMethodName() != null) { + if (mbd.getFactoryMethodName() != null) { return instantiateUsingFactoryMethod(beanName, mbd, args); } @@ -1149,7 +1149,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac // Candidate constructors for autowiring? Constructor[] ctors = determineConstructorsFromBeanPostProcessors(beanClass, beanName); if (ctors != null || mbd.getResolvedAutowireMode() == AUTOWIRE_CONSTRUCTOR || - mbd.hasConstructorArgumentValues() || !ObjectUtils.isEmpty(args)) { + mbd.hasConstructorArgumentValues() || !ObjectUtils.isEmpty(args)) { return autowireConstructor(beanName, mbd, ctors, args); } 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 e6b927a001..9bd153dc24 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 @@ -661,7 +661,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto @Override @Nullable public A findAnnotationOnBean(String beanName, Class annotationType) - throws NoSuchBeanDefinitionException{ + throws NoSuchBeanDefinitionException { A ann = null; Class beanType = getType(beanName); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReader.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReader.java index 84e298cfd5..d1549b00a2 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReader.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReader.java @@ -510,7 +510,7 @@ public class PropertiesBeanDefinitionReader extends AbstractBeanDefinitionReader * Reads the value of the entry. Correctly interprets bean references for * values that are prefixed with an asterisk. */ - private Object readValue(Map.Entry entry) { + private Object readValue(Map.Entry entry) { Object val = entry.getValue(); if (val instanceof String) { String strVal = (String) val; diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/SimpleInstantiationStrategy.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/SimpleInstantiationStrategy.java index 35b91cc4de..b0068b0cee 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/SimpleInstantiationStrategy.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/SimpleInstantiationStrategy.java @@ -75,7 +75,7 @@ public class SimpleInstantiationStrategy implements InstantiationStrategy { (PrivilegedExceptionAction>) clazz::getDeclaredConstructor); } else { - constructorToUse = clazz.getDeclaredConstructor(); + constructorToUse = clazz.getDeclaredConstructor(); } bd.resolvedConstructorOrFactoryMethod = constructorToUse; } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/StaticListableBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/StaticListableBeanFactory.java index 2ae91e7bdf..4063297856 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/StaticListableBeanFactory.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/StaticListableBeanFactory.java @@ -432,7 +432,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory { @Override @Nullable public A findAnnotationOnBean(String beanName, Class annotationType) - throws NoSuchBeanDefinitionException{ + throws NoSuchBeanDefinitionException { Class beanType = getType(beanName); return (beanType != null ? AnnotationUtils.findAnnotation(beanType, annotationType) : null); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandler.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandler.java index da1f062dbe..138cdef5cd 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandler.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -118,7 +118,7 @@ public class SimpleConstructorNamespaceHandler implements NamespaceHandler { "Constructor argument '" + argName + "' specifies a negative index", attr); } - if (cvs.hasIndexedArgumentValue(index)){ + if (cvs.hasIndexedArgumentValue(index)) { parserContext.getReaderContext().error( "Constructor argument '" + argName + "' with index "+ index+" already defined using ." + " Only one approach may be used per argument.", attr); @@ -130,7 +130,7 @@ public class SimpleConstructorNamespaceHandler implements NamespaceHandler { // no escaping -> ctr name else { String name = Conventions.attributeNameToPropertyName(argName); - if (containsArgWithName(name, cvs)){ + if (containsArgWithName(name, cvs)) { parserContext.getReaderContext().error( "Constructor argument '" + argName + "' already defined using ." + " Only one approach may be used per argument.", attr); diff --git a/spring-core/src/main/java/org/springframework/core/AttributeAccessor.java b/spring-core/src/main/java/org/springframework/core/AttributeAccessor.java index 9d407f708f..440ae47f02 100644 --- a/spring-core/src/main/java/org/springframework/core/AttributeAccessor.java +++ b/spring-core/src/main/java/org/springframework/core/AttributeAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ import org.springframework.lang.Nullable; public interface AttributeAccessor { /** - * Set the attribute defined by {@code name} to the supplied {@code value}. + * Set the attribute defined by {@code name} to the supplied {@code value}. * If {@code value} is {@code null}, the attribute is {@link #removeAttribute removed}. *

In general, users should take care to prevent overlaps with other * metadata attributes by using fully-qualified names, perhaps using diff --git a/spring-core/src/main/java/org/springframework/util/ObjectUtils.java b/spring-core/src/main/java/org/springframework/util/ObjectUtils.java index de27ed8207..e48de23acf 100644 --- a/spring-core/src/main/java/org/springframework/util/ObjectUtils.java +++ b/spring-core/src/main/java/org/springframework/util/ObjectUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -251,7 +251,7 @@ public abstract class ObjectUtils { * @param obj the object to append * @return the new array (of the same component type; never {@code null}) */ - public static A[] addObjectToArray(@Nullable A[] array, @Nullable O obj) { + public static A[] addObjectToArray(@Nullable A[] array, @Nullable O obj) { Class compType = Object.class; if (array != null) { compType = array.getClass().getComponentType(); diff --git a/spring-core/src/main/java/org/springframework/util/UpdateMessageDigestInputStream.java b/spring-core/src/main/java/org/springframework/util/UpdateMessageDigestInputStream.java index 90bfa4a7e8..875e51bfb3 100644 --- a/spring-core/src/main/java/org/springframework/util/UpdateMessageDigestInputStream.java +++ b/spring-core/src/main/java/org/springframework/util/UpdateMessageDigestInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ abstract class UpdateMessageDigestInputStream extends InputStream { */ public void updateMessageDigest(MessageDigest messageDigest) throws IOException { int data; - while ((data = read()) != -1){ + while ((data = read()) != -1) { messageDigest.update((byte) data); } } @@ -54,7 +54,7 @@ abstract class UpdateMessageDigestInputStream extends InputStream { public void updateMessageDigest(MessageDigest messageDigest, int len) throws IOException { int data; int bytesRead = 0; - while (bytesRead < len && (data = read()) != -1){ + while (bytesRead < len && (data = read()) != -1) { messageDigest.update((byte) data); bytesRead++; }