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

@@ -357,7 +357,7 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
this.metadataCollector.add(ItemMetadata.newGroup(nestedPrefix,
this.typeUtils.getQualifiedName(returnElement),
this.typeUtils.getQualifiedName(element),
(getter != null ? getter.toString() : null)));
(getter != null) ? getter.toString() : null));
processTypeElement(nestedPrefix, (TypeElement) returnElement, source);
}
}

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.
@@ -51,8 +51,8 @@ public class MetadataCollector {
/**
* Creates a new {@code MetadataProcessor} instance.
* @param processingEnvironment The processing environment of the build
* @param previousMetadata Any previous metadata or {@code null}
* @param processingEnvironment the processing environment of the build
* @param previousMetadata any previous metadata or {@code null}
*/
public MetadataCollector(ProcessingEnvironment processingEnvironment,
ConfigurationMetadata previousMetadata) {

View File

@@ -139,8 +139,8 @@ class TypeUtils {
}
public String getJavaDoc(Element element) {
String javadoc = (element != null
? this.env.getElementUtils().getDocComment(element) : null);
String javadoc = (element != null)
? this.env.getElementUtils().getDocComment(element) : null;
if (javadoc != null) {
javadoc = javadoc.replaceAll("[\r\n]+", "").trim();
}

View File

@@ -35,7 +35,7 @@ final class Trees extends ReflectionWrapper {
public Tree getTree(Element element) throws Exception {
Object tree = findMethod("getTree", Element.class).invoke(getInstance(), element);
return (tree != null ? new Tree(tree) : null);
return (tree != null) ? new Tree(tree) : null;
}
public static Trees instance(ProcessingEnvironment env) throws Exception {

View File

@@ -43,7 +43,7 @@ class VariableTree extends ReflectionWrapper {
public ExpressionTree getInitializer() throws Exception {
Object instance = findMethod("getInitializer").invoke(getInstance());
return (instance != null ? new ExpressionTree(instance) : null);
return (instance != null) ? new ExpressionTree(instance) : null;
}
@SuppressWarnings("unchecked")

View File

@@ -169,8 +169,8 @@ public class ConfigurationMetadata {
private List<ItemMetadata> getCandidates(String name) {
List<ItemMetadata> candidates = this.items.get(name);
return (candidates != null ? new ArrayList<ItemMetadata>(candidates)
: new ArrayList<ItemMetadata>());
return (candidates != null) ? new ArrayList<ItemMetadata>(candidates)
: new ArrayList<ItemMetadata>();
}
private boolean nullSafeEquals(Object o1, Object o2) {
@@ -181,7 +181,7 @@ public class ConfigurationMetadata {
}
public static String nestedPrefix(String prefix, String name) {
String nestedPrefix = (prefix != null ? prefix : "");
String nestedPrefix = (prefix != null) ? prefix : "";
String dashedName = toDashedCase(name);
nestedPrefix += ("".equals(nestedPrefix) ? dashedName : "." + dashedName);
return nestedPrefix;

View File

@@ -68,13 +68,6 @@ public class ItemDeprecation {
this.level = level;
}
@Override
public String toString() {
return "ItemDeprecation{" + "reason='" + this.reason + '\'' + ", "
+ "replacement='" + this.replacement + '\'' + ", " + "level='"
+ this.level + '\'' + '}';
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -97,6 +90,13 @@ public class ItemDeprecation {
return result;
}
@Override
public String toString() {
return "ItemDeprecation{" + "reason='" + this.reason + '\'' + ", "
+ "replacement='" + this.replacement + '\'' + ", " + "level='"
+ this.level + '\'' + '}';
}
private boolean nullSafeEquals(Object o1, Object o2) {
if (o1 == o2) {
return true;
@@ -108,7 +108,7 @@ public class ItemDeprecation {
}
private int nullSafeHashCode(Object o) {
return (o != null ? o.hashCode() : 0);
return (o != null) ? o.hashCode() : 0;
}
}

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.
@@ -44,10 +44,10 @@ public class ItemHint implements Comparable<ItemHint> {
public ItemHint(String name, List<ValueHint> values, List<ValueProvider> providers) {
this.name = toCanonicalName(name);
this.values = (values != null ? new ArrayList<ValueHint>(values)
: new ArrayList<ValueHint>());
this.providers = (providers != null ? new ArrayList<ValueProvider>(providers)
: new ArrayList<ValueProvider>());
this.values = (values != null) ? new ArrayList<ValueHint>(values)
: new ArrayList<ValueHint>();
this.providers = (providers != null) ? new ArrayList<ValueProvider>(providers)
: new ArrayList<ValueProvider>();
}
private String toCanonicalName(String name) {

View File

@@ -60,11 +60,11 @@ public final class ItemMetadata implements Comparable<ItemMetadata> {
while (prefix != null && prefix.endsWith(".")) {
prefix = prefix.substring(0, prefix.length() - 1);
}
StringBuilder fullName = new StringBuilder(prefix != null ? prefix : "");
StringBuilder fullName = new StringBuilder((prefix != null) ? prefix : "");
if (fullName.length() > 0 && name != null) {
fullName.append(".");
}
fullName.append(name != null ? ConfigurationMetadata.toDashedCase(name) : "");
fullName.append((name != null) ? ConfigurationMetadata.toDashedCase(name) : "");
return fullName.toString();
}
@@ -132,17 +132,6 @@ public final class ItemMetadata implements Comparable<ItemMetadata> {
this.deprecation = deprecation;
}
@Override
public String toString() {
StringBuilder string = new StringBuilder(this.name);
buildToStringProperty(string, "type", this.type);
buildToStringProperty(string, "sourceType", this.sourceType);
buildToStringProperty(string, "description", this.description);
buildToStringProperty(string, "defaultValue", this.defaultValue);
buildToStringProperty(string, "deprecation", this.deprecation);
return string.toString();
}
protected void buildToStringProperty(StringBuilder string, String property,
Object value) {
if (value != null) {
@@ -182,6 +171,17 @@ public final class ItemMetadata implements Comparable<ItemMetadata> {
return result;
}
@Override
public String toString() {
StringBuilder string = new StringBuilder(this.name);
buildToStringProperty(string, "type", this.type);
buildToStringProperty(string, "sourceType", this.sourceType);
buildToStringProperty(string, "description", this.description);
buildToStringProperty(string, "defaultValue", this.defaultValue);
buildToStringProperty(string, "deprecation", this.deprecation);
return string.toString();
}
private boolean nullSafeEquals(Object o1, Object o2) {
if (o1 == o2) {
return true;
@@ -193,7 +193,7 @@ public final class ItemMetadata implements Comparable<ItemMetadata> {
}
private int nullSafeHashCode(Object o) {
return (o != null ? o.hashCode() : 0);
return (o != null) ? o.hashCode() : 0;
}
@Override