Browse Source

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 <david.pursehouse@gmail.com>
stable-5.4
David Pursehouse 5 years ago committed by Matthias Sohn
parent
commit
858736df37
  1. 4
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java

4
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);
}

Loading…
Cancel
Save