Upgrade to spring-javaformat 0.0.6

This commit is contained in:
Phillip Webb
2018-08-28 15:22:36 -07:00
parent 17de1571f5
commit 9543fcf44d
290 changed files with 1021 additions and 1014 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-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.
@@ -61,13 +61,13 @@ class OverrideAutoConfigurationContextCustomizerFactory
}
@Override
public int hashCode() {
return getClass().hashCode();
public boolean equals(Object obj) {
return (obj != null && obj.getClass() == getClass());
}
@Override
public boolean equals(Object obj) {
return (obj != null && obj.getClass() == getClass());
public int hashCode() {
return getClass().hashCode();
}
}

View File

@@ -117,21 +117,6 @@ public abstract class AnnotationCustomizableTypeExcludeFilter extends TypeExclud
}
@Override
public int hashCode() {
final int prime = 31;
int result = 0;
result = prime * result + ObjectUtils.hashCode(hasAnnotation());
for (FilterType filterType : FilterType.values()) {
result = prime * result
+ ObjectUtils.nullSafeHashCode(getFilters(filterType));
}
result = prime * result + ObjectUtils.hashCode(isUseDefaultFilters());
result = prime * result + ObjectUtils.nullSafeHashCode(getDefaultIncludes());
result = prime * result + ObjectUtils.nullSafeHashCode(getComponentIncludes());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -155,4 +140,19 @@ public abstract class AnnotationCustomizableTypeExcludeFilter extends TypeExclud
return result;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 0;
result = prime * result + ObjectUtils.hashCode(hasAnnotation());
for (FilterType filterType : FilterType.values()) {
result = prime * result
+ ObjectUtils.nullSafeHashCode(getFilters(filterType));
}
result = prime * result + ObjectUtils.hashCode(isUseDefaultFilters());
result = prime * result + ObjectUtils.nullSafeHashCode(getDefaultIncludes());
result = prime * result + ObjectUtils.nullSafeHashCode(getComponentIncludes());
return result;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-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.
@@ -73,17 +73,17 @@ class TypeExcludeFiltersContextCustomizer implements ContextCustomizer {
}
}
@Override
public int hashCode() {
return this.filters.hashCode();
}
@Override
public boolean equals(Object obj) {
return (obj != null && getClass().equals(obj.getClass()) && this.filters
.equals(((TypeExcludeFiltersContextCustomizer) obj).filters));
}
@Override
public int hashCode() {
return this.filters.hashCode();
}
@Override
public void customizeContext(ConfigurableApplicationContext context,
MergedContextConfiguration mergedContextConfiguration) {

View File

@@ -105,8 +105,8 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?>
}
Annotation mergedAnnotation = AnnotatedElementUtils.getMergedAnnotation(source,
annotationType);
return (mergedAnnotation != null ? mergedAnnotation
: findMergedAnnotation(source.getSuperclass(), annotationType));
return (mergedAnnotation != null) ? mergedAnnotation
: findMergedAnnotation(source.getSuperclass(), annotationType);
}
private void collectProperties(Annotation annotation, Method attribute,
@@ -143,8 +143,8 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?>
private String getName(PropertyMapping typeMapping, PropertyMapping attributeMapping,
Method attribute) {
String prefix = (typeMapping != null ? typeMapping.value() : "");
String name = (attributeMapping != null ? attributeMapping.value() : "");
String prefix = (typeMapping != null) ? typeMapping.value() : "";
String name = (attributeMapping != null) ? attributeMapping.value() : "";
if (!StringUtils.hasText(name)) {
name = toKebabCase(attribute.getName());
}
@@ -201,11 +201,6 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?>
return this.properties.isEmpty();
}
@Override
public int hashCode() {
return this.properties.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@@ -217,4 +212,9 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?>
return this.properties.equals(((AnnotationsPropertySource) obj).properties);
}
@Override
public int hashCode() {
return this.properties.hashCode();
}
}

View File

@@ -55,17 +55,17 @@ class PropertyMappingContextCustomizer implements ContextCustomizer {
new PropertyMappingCheckBeanPostProcessor());
}
@Override
public int hashCode() {
return this.propertySource.hashCode();
}
@Override
public boolean equals(Object obj) {
return (obj != null && getClass().equals(obj.getClass()) && this.propertySource
.equals(((PropertyMappingContextCustomizer) obj).propertySource));
}
@Override
public int hashCode() {
return this.propertySource.hashCode();
}
/**
* {@link BeanPostProcessor} to check that {@link PropertyMapping} is only used on
* test classes.
@@ -115,10 +115,10 @@ class PropertyMappingContextCustomizer implements ContextCustomizer {
private String getAnnotationsDescription(Set<Class<?>> annotations) {
StringBuilder result = new StringBuilder();
for (Class<?> annotation : annotations) {
result.append(result.length() != 0 ? ", " : "");
result.append((result.length() != 0) ? ", " : "");
result.append("@" + ClassUtils.getShortName(annotation));
}
result.insert(0, annotations.size() != 1 ? "annotations " : "annotation ");
result.insert(0, (annotations.size() != 1) ? "annotations " : "annotation ");
return result.toString();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-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.
@@ -49,11 +49,6 @@ class WebDriverContextCustomizerFactory implements ContextCustomizerFactory {
WebDriverScope.registerWith(context);
}
@Override
public int hashCode() {
return getClass().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@@ -65,6 +60,11 @@ class WebDriverContextCustomizerFactory implements ContextCustomizerFactory {
return true;
}
@Override
public int hashCode() {
return getClass().hashCode();
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-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.
@@ -145,7 +145,7 @@ class WebDriverScope implements Scope {
if (context instanceof ConfigurableApplicationContext) {
Scope scope = ((ConfigurableApplicationContext) context).getBeanFactory()
.getRegisteredScope(NAME);
return (scope instanceof WebDriverScope ? (WebDriverScope) scope : null);
return (scope instanceof WebDriverScope) ? (WebDriverScope) scope : null;
}
return null;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-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.
@@ -123,13 +123,13 @@ public class TypeExcludeFiltersContextCustomizerFactoryTests {
}
@Override
public int hashCode() {
return SimpleExclude.class.hashCode();
public boolean equals(Object obj) {
return obj.getClass().equals(getClass());
}
@Override
public boolean equals(Object obj) {
return obj.getClass().equals(getClass());
public int hashCode() {
return SimpleExclude.class.hashCode();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-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.
@@ -33,11 +33,6 @@ public class ExampleBasicObject {
this.value = value;
}
@Override
public int hashCode() {
return this.value.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj != null && obj.getClass().equals(getClass())) {
@@ -46,4 +41,9 @@ public class ExampleBasicObject {
return false;
}
@Override
public int hashCode() {
return this.value.hashCode();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-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.
@@ -29,11 +29,6 @@ public class ExampleCustomObject {
this.value = value;
}
@Override
public int hashCode() {
return this.value.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj != null && obj.getClass().equals(getClass())) {
@@ -42,6 +37,11 @@ public class ExampleCustomObject {
return false;
}
@Override
public int hashCode() {
return this.value.hashCode();
}
@Override
public String toString() {
return this.value;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-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.
@@ -48,11 +48,6 @@ public class ExampleJsonObjectWithView {
this.id = id;
}
@Override
public int hashCode() {
return 0;
}
@Override
public boolean equals(Object obj) {
if (obj == null || obj.getClass() != getClass()) {
@@ -63,6 +58,11 @@ public class ExampleJsonObjectWithView {
&& ObjectUtils.nullSafeEquals(this.id, other.id);
}
@Override
public int hashCode() {
return 0;
}
@Override
public String toString() {
return this.value + " " + this.id;