Polish ternary expressions
Consistently format ternary expressions and always favor `!=` as the the check.
This commit is contained in:
@@ -95,7 +95,7 @@ public class DefaultLaunchScript implements LaunchScript {
|
||||
value = (String) properties.get(name);
|
||||
}
|
||||
else {
|
||||
value = (value == null ? matcher.group(0) : value.substring(1));
|
||||
value = (value != null ? value.substring(1) : matcher.group(0));
|
||||
}
|
||||
matcher.appendReplacement(expanded, value.replace("$", "\\$"));
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ public class JarWriter implements LoaderClassesWriter {
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
int read = (this.headerStream == null ? -1 : this.headerStream.read());
|
||||
int read = (this.headerStream != null ? this.headerStream.read() : -1);
|
||||
if (read != -1) {
|
||||
this.headerStream = null;
|
||||
return read;
|
||||
@@ -347,8 +347,8 @@ public class JarWriter implements LoaderClassesWriter {
|
||||
|
||||
@Override
|
||||
public int read(byte[] b, int off, int len) throws IOException {
|
||||
int read = (this.headerStream == null ? -1
|
||||
: this.headerStream.read(b, off, len));
|
||||
int read = (this.headerStream != null ? this.headerStream.read(b, off, len)
|
||||
: -1);
|
||||
if (read != -1) {
|
||||
this.headerStream = null;
|
||||
return read;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class Library {
|
||||
* @param unpackRequired if the library needs to be unpacked before it can be used
|
||||
*/
|
||||
public Library(String name, File file, LibraryScope scope, boolean unpackRequired) {
|
||||
this.name = (name == null ? file.getName() : name);
|
||||
this.name = (name != null ? name : file.getName());
|
||||
this.file = file;
|
||||
this.scope = scope;
|
||||
this.unpackRequired = unpackRequired;
|
||||
|
||||
@@ -516,8 +516,8 @@ public abstract class MainClassFinder {
|
||||
"Unable to find a single main class from the following candidates "
|
||||
+ matchingMainClasses);
|
||||
}
|
||||
return matchingMainClasses.isEmpty() ? null
|
||||
: matchingMainClasses.iterator().next().getName();
|
||||
return (matchingMainClasses.isEmpty() ? null
|
||||
: matchingMainClasses.iterator().next().getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user