From 13a1ce7466eb620773930f1d485cb9b31c6bda2c Mon Sep 17 00:00:00 2001
From: Ivan Frade <ifrade@google.com>
Date: Wed, 13 Nov 2024 16:11:17 -0800
Subject: [PATCH] [errorprone] RawText: Add parenthesis for explicit op
 precedence

errorprone reports:

[OperatorPrecedence] Use grouping parenthesis to make the
operator precedence explicit

Take the chance to fix also
https://errorprone.info/bugpattern/YodaCondition in the same lines.

Change-Id: I6d8f00842ef2bb24cd00fc413121b8a4e20c186b
---
 org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java
index 5a4d2aa45..fdfe53361 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java
@@ -365,7 +365,7 @@ public static boolean isBinary(byte[] raw, int length, boolean complete) {
 		byte current;
 		while (ptr < length - 2) {
 			current = raw[++ptr];
-			if ('\0' == current || '\r' == current && raw[++ptr] != '\n') {
+			if (current == '\0' || (current == '\r' && raw[++ptr] != '\n')) {
 				return true;
 			}
 		}
@@ -373,7 +373,7 @@ public static boolean isBinary(byte[] raw, int length, boolean complete) {
 		if (ptr == length - 2) {
 			// if '\r' be last, then if isComplete then return binary
 			current = raw[++ptr];
-			return '\0' == current || '\r' == current && isComplete;
+			return current == '\0' || (current == '\r' && isComplete);
 		}
 
 		return false;
@@ -490,7 +490,7 @@ public static boolean isCrLfText(byte[] raw, int length, boolean complete) {
 		if (ptr == length - 2) {
 			// if '\r' be last, then if isComplete then return binary
 			current = raw[++ptr];
-			if('\0' == current || '\r' == current && complete){
+			if (current == '\0' || (current == '\r' && complete)) {
 				return false;
 			}
 		}
-- 
GitLab