diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2019-06-12 09:06:46 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@gmail.com> | 2019-06-12 09:28:54 +0900 |
commit | 0f4554f12644b110f7b744a9f5f0ee34873e9497 (patch) | |
tree | dda7f58a73d7d69f9c633d116a75c01da60bee8b /org.eclipse.jgit | |
parent | c177c6f4c53eb8d42bc3de81a8d914949e6ab5aa (diff) | |
download | jgit-0f4554f12644b110f7b744a9f5f0ee34873e9497.tar.gz jgit-0f4554f12644b110f7b744a9f5f0ee34873e9497.zip |
Increase severity of OperatorPrecedence to ERROR, and fix instances
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>
Diffstat (limited to 'org.eclipse.jgit')
7 files changed, 12 insertions, 11 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/WildMatcher.java b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/WildMatcher.java index 2ad87dade6..239e2c81d3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/WildMatcher.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/WildMatcher.java @@ -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} */ diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackParser.java index 3a30d7daf5..45e3b199f7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackParser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackParser.java @@ -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; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java index 6e8a15e86d..ade7a8e96d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java @@ -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; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObject.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObject.java index cf474afbbe..79f1307578 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObject.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObject.java @@ -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, diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java index 4dd9cc5774..a61c243bdf 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java @@ -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 diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpConfig.java index 54c21cbc8c..36ff2836ae 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpConfig.java @@ -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) == '.') { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java index 70fb1f0e56..34730d395c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java @@ -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) == '~') |