Skip to content

Commit 9d69092

Browse files
java-team-github-botGoogle Java Core Libraries
authored andcommitted
Fix -Wbitwise-instead-of-logical warnings.
PiperOrigin-RevId: 414465058
1 parent fb306ec commit 9d69092

File tree

8 files changed

+14
-14
lines changed

8 files changed

+14
-14
lines changed

android/guava/src/com/google/common/collect/GeneralRange.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ private GeneralRange(
138138
checkArgument(
139139
cmp <= 0, "lowerEndpoint (%s) > upperEndpoint (%s)", lowerEndpoint, upperEndpoint);
140140
if (cmp == 0) {
141-
checkArgument(lowerBoundType != OPEN | upperBoundType != OPEN);
141+
checkArgument(lowerBoundType != OPEN || upperBoundType != OPEN);
142142
}
143143
}
144144
}

android/guava/src/com/google/common/math/LongMath.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ public static long divide(long p, long q, RoundingMode mode) {
425425
// subtracting two nonnegative longs can't overflow
426426
// cmpRemToHalfDivisor has the same sign as compare(abs(rem), abs(q) / 2).
427427
if (cmpRemToHalfDivisor == 0) { // exactly on the half mark
428-
increment = (mode == HALF_UP | (mode == HALF_EVEN & (div & 1) != 0));
428+
increment = (mode == HALF_UP || (mode == HALF_EVEN && (div & 1) != 0));
429429
} else {
430430
increment = cmpRemToHalfDivisor > 0; // closer to the UP value
431431
}

android/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ public void run() {
423423
Executor queuedExecutor;
424424
// Intentionally using non-short-circuit operator
425425
while ((queuedTask = executingTaskQueue.nextTask) != null
426-
& (queuedExecutor = executingTaskQueue.nextExecutor) != null) {
426+
&& (queuedExecutor = executingTaskQueue.nextExecutor) != null) {
427427
executingTaskQueue.nextTask = null;
428428
executingTaskQueue.nextExecutor = null;
429429
queuedExecutor.execute(queuedTask);

android/guava/src/com/google/common/util/concurrent/Monitor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ public boolean tryEnterIf(Guard guard) {
735735
* @throws InterruptedException if interrupted while waiting
736736
*/
737737
public void waitFor(Guard guard) throws InterruptedException {
738-
if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) {
738+
if (!((guard.monitor == this) && lock.isHeldByCurrentThread())) {
739739
throw new IllegalMonitorStateException();
740740
}
741741
if (!guard.isSatisfied()) {
@@ -753,7 +753,7 @@ public void waitFor(Guard guard) throws InterruptedException {
753753
@SuppressWarnings("GoodTime") // should accept a java.time.Duration
754754
public boolean waitFor(Guard guard, long time, TimeUnit unit) throws InterruptedException {
755755
final long timeoutNanos = toSafeNanos(time, unit);
756-
if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) {
756+
if (!((guard.monitor == this) && lock.isHeldByCurrentThread())) {
757757
throw new IllegalMonitorStateException();
758758
}
759759
if (guard.isSatisfied()) {
@@ -770,7 +770,7 @@ public boolean waitFor(Guard guard, long time, TimeUnit unit) throws Interrupted
770770
* currently occupying this monitor.
771771
*/
772772
public void waitForUninterruptibly(Guard guard) {
773-
if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) {
773+
if (!((guard.monitor == this) && lock.isHeldByCurrentThread())) {
774774
throw new IllegalMonitorStateException();
775775
}
776776
if (!guard.isSatisfied()) {
@@ -787,7 +787,7 @@ public void waitForUninterruptibly(Guard guard) {
787787
@SuppressWarnings("GoodTime") // should accept a java.time.Duration
788788
public boolean waitForUninterruptibly(Guard guard, long time, TimeUnit unit) {
789789
final long timeoutNanos = toSafeNanos(time, unit);
790-
if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) {
790+
if (!((guard.monitor == this) && lock.isHeldByCurrentThread())) {
791791
throw new IllegalMonitorStateException();
792792
}
793793
if (guard.isSatisfied()) {

guava/src/com/google/common/collect/GeneralRange.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ private GeneralRange(
138138
checkArgument(
139139
cmp <= 0, "lowerEndpoint (%s) > upperEndpoint (%s)", lowerEndpoint, upperEndpoint);
140140
if (cmp == 0) {
141-
checkArgument(lowerBoundType != OPEN | upperBoundType != OPEN);
141+
checkArgument(lowerBoundType != OPEN || upperBoundType != OPEN);
142142
}
143143
}
144144
}

guava/src/com/google/common/math/LongMath.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ public static long divide(long p, long q, RoundingMode mode) {
425425
// subtracting two nonnegative longs can't overflow
426426
// cmpRemToHalfDivisor has the same sign as compare(abs(rem), abs(q) / 2).
427427
if (cmpRemToHalfDivisor == 0) { // exactly on the half mark
428-
increment = (mode == HALF_UP | (mode == HALF_EVEN & (div & 1) != 0));
428+
increment = (mode == HALF_UP || (mode == HALF_EVEN && (div & 1) != 0));
429429
} else {
430430
increment = cmpRemToHalfDivisor > 0; // closer to the UP value
431431
}

guava/src/com/google/common/util/concurrent/ExecutionSequencer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ public void run() {
423423
Executor queuedExecutor;
424424
// Intentionally using non-short-circuit operator
425425
while ((queuedTask = executingTaskQueue.nextTask) != null
426-
& (queuedExecutor = executingTaskQueue.nextExecutor) != null) {
426+
&& (queuedExecutor = executingTaskQueue.nextExecutor) != null) {
427427
executingTaskQueue.nextTask = null;
428428
executingTaskQueue.nextExecutor = null;
429429
queuedExecutor.execute(queuedTask);

guava/src/com/google/common/util/concurrent/Monitor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ public boolean tryEnterIf(Guard guard) {
822822
* @throws InterruptedException if interrupted while waiting
823823
*/
824824
public void waitFor(Guard guard) throws InterruptedException {
825-
if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) {
825+
if (!((guard.monitor == this) && lock.isHeldByCurrentThread())) {
826826
throw new IllegalMonitorStateException();
827827
}
828828
if (!guard.isSatisfied()) {
@@ -852,7 +852,7 @@ public boolean waitFor(Guard guard, Duration time) throws InterruptedException {
852852
@SuppressWarnings("GoodTime") // should accept a java.time.Duration
853853
public boolean waitFor(Guard guard, long time, TimeUnit unit) throws InterruptedException {
854854
final long timeoutNanos = toSafeNanos(time, unit);
855-
if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) {
855+
if (!((guard.monitor == this) && lock.isHeldByCurrentThread())) {
856856
throw new IllegalMonitorStateException();
857857
}
858858
if (guard.isSatisfied()) {
@@ -869,7 +869,7 @@ public boolean waitFor(Guard guard, long time, TimeUnit unit) throws Interrupted
869869
* currently occupying this monitor.
870870
*/
871871
public void waitForUninterruptibly(Guard guard) {
872-
if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) {
872+
if (!((guard.monitor == this) && lock.isHeldByCurrentThread())) {
873873
throw new IllegalMonitorStateException();
874874
}
875875
if (!guard.isSatisfied()) {
@@ -897,7 +897,7 @@ public boolean waitForUninterruptibly(Guard guard, Duration time) {
897897
@SuppressWarnings("GoodTime") // should accept a java.time.Duration
898898
public boolean waitForUninterruptibly(Guard guard, long time, TimeUnit unit) {
899899
final long timeoutNanos = toSafeNanos(time, unit);
900-
if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) {
900+
if (!((guard.monitor == this) && lock.isHeldByCurrentThread())) {
901901
throw new IllegalMonitorStateException();
902902
}
903903
if (guard.isSatisfied()) {

0 commit comments

Comments
 (0)