]> source.dussan.org Git - jgit.git/commitdiff
Increase severity of OperatorPrecedence to ERROR, and fix instances 79/143779/1
authorDavid Pursehouse <david.pursehouse@gmail.com>
Wed, 12 Jun 2019 00:06:46 +0000 (09:06 +0900)
committerDavid Pursehouse <david.pursehouse@gmail.com>
Wed, 12 Jun 2019 00:28:54 +0000 (09:28 +0900)
Fix all remaining instances of the OperatorPrededence warning, by adding
parentheses to make the precedence explicit.

Change-Id: Ib296dfed09f9be042d0ff0f7fad8214e4dd766b4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/WildMatcher.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackParser.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObject.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpConfig.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java
tools/BUILD

index 2ad87dade6545860be3e1579429e708480b1de2d..239e2c81d32c659c7ffcb5fb15a0d5afcb86f907 100644 (file)
@@ -64,7 +64,7 @@ public final class WildMatcher extends AbstractMatcher {
        public final boolean matches(String path, boolean assumeDirectory,
                        boolean pathMatch) {
                return !dirOnly || assumeDirectory
-                               || !pathMatch && isSubdirectory(path);
+                               || (!pathMatch && isSubdirectory(path));
        }
 
        /** {@inheritDoc} */
index 3a30d7daf55f978c9a87db857c19a3d3f0913fff..45e3b199f7e4c5f6f473c121761f3492c9c502c0 100644 (file)
@@ -429,7 +429,7 @@ public class DfsPackParser extends PackParser {
                final byte[] buf = buffer();
                int sz = data.length;
                int len = 0;
-               buf[len++] = (byte) ((typeCode << 4) | sz & 15);
+               buf[len++] = (byte) ((typeCode << 4) | (sz & 15));
                sz >>>= 4;
                while (sz > 0) {
                        buf[len - 1] |= 0x80;
index 6e8a15e86d3f5beda46efa2de0bdc9702e5ce5da..ade7a8e96dfd8d63b7f600a6b799be3af783934c 100644 (file)
@@ -353,7 +353,7 @@ public class ObjectDirectoryPackParser extends PackParser {
                final byte[] buf = buffer();
                int sz = data.length;
                int len = 0;
-               buf[len++] = (byte) ((typeCode << 4) | sz & 15);
+               buf[len++] = (byte) ((typeCode << 4) | (sz & 15));
                sz >>>= 4;
                while (sz > 0) {
                        buf[len - 1] |= 0x80;
index cf474afbbe2cad48a8ccf9dd3d8921c230a9b07d..79f1307578bbb013195a4d946a13717a048a03c2 100644 (file)
@@ -295,7 +295,7 @@ public class UnpackedObject {
                 * can always correctly determine the buffer format.
                 */
                final int fb = hdr[0] & 0xff;
-               return (fb & 0x8f) == 0x08 && (((fb << 8) | hdr[1] & 0xff) % 31) == 0;
+               return (fb & 0x8f) == 0x08 && (((fb << 8) | (hdr[1] & 0xff)) % 31) == 0;
        }
 
        static InputStream inflate(final InputStream in, final long size,
index 4dd9cc57744ac2c4c77958f5e2447ce5c918f4f7..a61c243bdf326031258df366aa29d3148d8bacab 100644 (file)
@@ -677,7 +677,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection
                                state.writeTo(out, null);
                        }
 
-                       if (receivedContinue && havesSinceLastContinue > MAX_HAVES
+                       if ((receivedContinue && havesSinceLastContinue > MAX_HAVES)
                                        || havesSent >= maxHaves) {
                                // Our history must be really different from the remote's.
                                // We just sent a whole slew of have lines, and it did not
index 54c21cbc8cbf09804efa9f64c199c694cbc50ceb..36ff2836ae2c0567666e79f8160236b4aacba866 100644 (file)
@@ -397,8 +397,9 @@ public class HttpConfig {
                                // A longer path match is always preferred even over a user
                                // match. If the path matches are equal, a match with user wins
                                // over a match without user.
-                               if (matchLength > bestMatchLength || !withUser && hasUser
-                                               && matchLength >= 0 && matchLength == bestMatchLength) {
+                               if (matchLength > bestMatchLength
+                                               || (!withUser && hasUser && matchLength >= 0
+                                                               && matchLength == bestMatchLength)) {
                                        bestMatch = s;
                                        bestMatchLength = matchLength;
                                        withUser = hasUser;
@@ -444,7 +445,7 @@ public class HttpConfig {
                int uLength = uriPath.length();
                int mLength = matchPath.length();
                if (mLength == uLength || matchPath.charAt(mLength - 1) == '/'
-                               || mLength < uLength && uriPath.charAt(mLength) == '/') {
+                               || (mLength < uLength && uriPath.charAt(mLength) == '/')) {
                        return mLength;
                }
                return -1;
@@ -464,7 +465,7 @@ public class HttpConfig {
                        if (slash < 0) {
                                slash = length;
                        }
-                       if (slash == i || slash == i + 1 && path.charAt(i) == '.') {
+                       if (slash == i || (slash == i + 1 && path.charAt(i) == '.')) {
                                // Skip /. or also double slashes
                        } else if (slash == i + 2 && path.charAt(i) == '.'
                                        && path.charAt(i + 1) == '.') {
index 70fb1f0e563e60f426d719a7a6a9b35ed9a221f1..34730d395c0904d8fba666be84ddd5a1de100391 100644 (file)
@@ -362,8 +362,8 @@ public class URIish implements Serializable {
                if (p.length() >= 3
                                && p.charAt(0) == '/'
                                && p.charAt(2) == ':'
-                               && (p.charAt(1) >= 'A' && p.charAt(1) <= 'Z' || p.charAt(1) >= 'a'
-                                               && p.charAt(1) <= 'z'))
+                               && ((p.charAt(1) >= 'A' && p.charAt(1) <= 'Z')
+                                               || (p.charAt(1) >= 'a' && p.charAt(1) <= 'z')))
                        return p.substring(1);
                else if (s != null && p.length() >= 2 && p.charAt(0) == '/'
                                && p.charAt(1) == '~')
index 38daececbed163642e15d673ab20a0b9a53dd6ef..d94ce02ad18a1c4031c442f77c0070e6b5be3c2c 100644 (file)
@@ -64,7 +64,7 @@ java_package_configuration(
         "-Xep:NullableConstructor:ERROR",
         "-Xep:NullablePrimitive:ERROR",
         "-Xep:NullableVoid:ERROR",
-        "-Xep:OperatorPrecedence:WARN",
+        "-Xep:OperatorPrecedence:ERROR",
         "-Xep:OverridesGuiceInjectableMethod:ERROR",
         "-Xep:PreconditionsInvalidPlaceholder:ERROR",
         "-Xep:ProtoFieldPreconditionsCheckNotNull:ERROR",