From 858736df37dd9d1b60f6173efae791912dd14d67 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Wed, 12 Jun 2019 13:10:32 +0900 Subject: [PATCH] PackWriter: Prefer boolean operators over logical operators in comparisons Using the | and & operators in boolean conditions results in a warning from Error Prone: [ShortCircuitBoolean] Prefer the short-circuiting boolean operators && and || to & and |. see https://errorprone.info/bugpattern/ShortCircuitBoolean Change-Id: I4275c60306e43c74030c4465ba02cb853ad444e1 Signed-off-by: David Pursehouse --- .../org/eclipse/jgit/internal/storage/pack/PackWriter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java index 714e8308f..650678921 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java @@ -2198,7 +2198,7 @@ public class PackWriter implements AutoCloseable { if (!cachedPacks.isEmpty()) { if (otp.isEdge()) return; - if ((nFmt == PACK_WHOLE) | (nFmt == PACK_DELTA)) { + if (nFmt == PACK_WHOLE || nFmt == PACK_DELTA) { for (CachedPack pack : cachedPacks) { if (pack.hasObject(otp, next)) { otp.setEdge(); @@ -2241,7 +2241,7 @@ public class PackWriter implements AutoCloseable { otp.clearReuseAsIs(); } - otp.setDeltaAttempted(reuseDeltas & next.wasDeltaAttempted()); + otp.setDeltaAttempted(reuseDeltas && next.wasDeltaAttempted()); otp.select(next); }