Replace NOT operator with explicit false check (#67817)

We have an in-house rule to compare explicitly against `false` instead
of using the logical not operator (`!`). However, this hasn't
historically been enforced, meaning that there are many violations in
the source at present.

We now have a Checkstyle rule that can detect these cases, but before we
can turn it on, we need to fix the existing violations. This is being
done over a series of PRs, since there are a lot to fix.
This commit is contained in:
Rory Hunter 2021-01-26 14:47:09 +00:00 committed by GitHub
parent 9a1611da80
commit ad1f876daa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
119 changed files with 264 additions and 246 deletions

View file

@ -29,7 +29,7 @@ public class JavaVersion {
public static final List<Integer> JAVA_11 = parse("11");
static List<Integer> parse(final String value) {
if (!value.matches("^0*[0-9]+(\\.[0-9]+)*$")) {
if (value.matches("^0*[0-9]+(\\.[0-9]+)*$") == false) {
throw new IllegalArgumentException(value);
}

View file

@ -723,7 +723,7 @@ class InstallPluginCommand extends EnvironmentAwareCommand {
// be on the safe side: do not rely on that directories are always extracted
// before their children (although this makes sense, but is it guaranteed?)
if (!Files.isSymbolicLink(targetFile.getParent())) {
if (Files.isSymbolicLink(targetFile.getParent()) == false) {
Files.createDirectories(targetFile.getParent());
}
if (entry.isDirectory() == false) {

View file

@ -136,7 +136,7 @@ class RemovePluginCommand extends EnvironmentAwareCommand {
final Path pluginBinDir = env.binFile().resolve(pluginName);
if (Files.exists(pluginBinDir)) {
if (!Files.isDirectory(pluginBinDir)) {
if (Files.isDirectory(pluginBinDir) == false) {
throw new UserException(ExitCodes.IO_ERROR, "bin dir for " + pluginName + " is not a directory");
}
try (Stream<Path> paths = Files.list(pluginBinDir)) {