Merge branch '1.5.x' into 2.0.x

This commit is contained in:
Phillip Webb
2018-05-03 12:43:50 -07:00
138 changed files with 274 additions and 269 deletions

View File

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

View File

@@ -156,8 +156,8 @@ class TypeElementMembers {
}
private String getAccessorName(String methodName) {
String name = methodName.startsWith("is") ? methodName.substring(2)
: methodName.substring(3);
String name = (methodName.startsWith("is") ? methodName.substring(2)
: methodName.substring(3));
name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
return name;
}

View File

@@ -139,8 +139,8 @@ class TypeUtils {
}
public String getJavaDoc(Element element) {
String javadoc = (element == null ? null
: this.env.getElementUtils().getDocComment(element));
String javadoc = (element != null
? this.env.getElementUtils().getDocComment(element) : null);
if (javadoc != null) {
javadoc = javadoc.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 ? null : new Tree(tree));
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 ? null : new ExpressionTree(instance));
return (instance != null ? new ExpressionTree(instance) : null);
}
@SuppressWarnings("unchecked")

View File

@@ -178,7 +178,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

@@ -108,7 +108,7 @@ public class ItemDeprecation {
}
private int nullSafeHashCode(Object o) {
return (o == null ? 0 : o.hashCode());
return (o != null ? o.hashCode() : 0);
}
}

View File

@@ -61,11 +61,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();
}
@@ -196,7 +196,7 @@ public final class ItemMetadata implements Comparable<ItemMetadata> {
}
private int nullSafeHashCode(Object o) {
return (o == null ? 0 : o.hashCode());
return (o != null ? o.hashCode() : 0);
}
@Override

View File

@@ -98,8 +98,8 @@ public class TestConfigurationMetadataAnnotationProcessor
}
return this.metadata;
}
catch (IOException e) {
throw new RuntimeException("Failed to read metadata from disk", e);
catch (IOException ex) {
throw new RuntimeException("Failed to read metadata from disk", ex);
}
}