Polish ternary expressions

This commit is contained in:
Phillip Webb
2018-07-29 09:16:06 +01:00
parent b24bb688b8
commit aeb885192e
49 changed files with 59 additions and 60 deletions

View File

@@ -178,7 +178,7 @@ class JsonReader {
.setReplacement(deprecationJsonObject.optString("replacement", null));
return deprecation;
}
return (object.optBoolean("deprecated") ? new Deprecation() : null);
return object.optBoolean("deprecated") ? new Deprecation() : null;
}
private Deprecation.Level parseDeprecationLevel(String value) {

View File

@@ -302,7 +302,7 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
|| isDeprecated(source);
this.metadataCollector.add(ItemMetadata.newProperty(prefix, name,
dataType, sourceType, null, description, defaultValue,
(deprecated ? getItemDeprecation(getter) : null)));
deprecated ? getItemDeprecation(getter) : null));
}
});
}
@@ -344,7 +344,7 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
boolean deprecated = isDeprecated(field) || isDeprecated(source);
this.metadataCollector.add(ItemMetadata.newProperty(prefix, name,
dataType, sourceType, null, description, defaultValue,
(deprecated ? new ItemDeprecation() : null)));
deprecated ? new ItemDeprecation() : null));
}
});
}

View File

@@ -111,7 +111,7 @@ public class JsonMarshaller {
.setReplacement(deprecationJsonObject.optString("replacement", null));
return deprecation;
}
return (object.optBoolean("deprecated") ? new ItemDeprecation() : null);
return object.optBoolean("deprecated") ? new ItemDeprecation() : null;
}
private ItemHint toItemHint(JSONObject object) throws Exception {

View File

@@ -43,7 +43,7 @@ public class JavaExecutable {
private File findInJavaHome(String javaHome) {
File bin = new File(new File(javaHome), "bin");
File command = new File(bin, "java.exe");
command = (command.exists() ? command : new File(bin, "java"));
command = command.exists() ? command : new File(bin, "java");
Assert.state(command.exists(), () -> "Unable to find java in " + javaHome);
return command;
}

View File

@@ -304,7 +304,7 @@ public class PropertiesLauncher extends Launcher {
for (String path : commaSeparatedPaths.split(",")) {
path = cleanupPath(path);
// "" means the user wants root of archive but not current directory
path = ("".equals(path) ? "/" : path);
path = "".equals(path) ? "/" : path;
paths.add(path);
}
if (paths.isEmpty()) {

View File

@@ -124,8 +124,8 @@ public class Handler extends URLStreamHandler {
private void log(boolean warning, String message, Exception cause) {
try {
Logger.getLogger(getClass().getName())
.log((warning ? Level.WARNING : Level.FINEST), message, cause);
Level level = warning ? Level.WARNING : Level.FINEST;
Logger.getLogger(getClass().getName()).log(level, message, cause);
}
catch (Exception ex) {
if (warning) {

View File

@@ -214,7 +214,7 @@ final class JarURLConnection extends java.net.JarURLConnection {
@Override
public Object getContent() throws IOException {
connect();
return (this.jarEntryName.isEmpty() ? this.jarFile : super.getContent());
return this.jarEntryName.isEmpty() ? this.jarFile : super.getContent();
}
@Override
@@ -386,7 +386,7 @@ final class JarURLConnection extends java.net.JarURLConnection {
private String deduceContentType() {
// Guess the content type, don't bother with streams as mark is not supported
String type = (isEmpty() ? "x-java/jar" : null);
String type = isEmpty() ? "x-java/jar" : null;
type = (type != null) ? type : guessContentTypeFromName(toString());
type = (type != null) ? type : "content/unknown";
return type;