aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Ostrovsky <david@ostrovsky.org>2020-05-22 07:49:49 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2020-06-01 18:56:32 -0400
commit3e2ec7e5e81a489a326d872aa0670119ff2c1152 (patch)
treef81c4dbd5bf8db0543810396a85eeb18516cf034
parent55371c5f063370aeca85acab16f867734ff4226c (diff)
downloadjgit-3e2ec7e5e81a489a326d872aa0670119ff2c1152.tar.gz
jgit-3e2ec7e5e81a489a326d872aa0670119ff2c1152.zip
Fix BadComparable error flagged by error prone
Running recent error prone version complaining on that code: LfsPointer.java:171: error: [BadComparable] Possible sign flip from narrowing conversion return (int) (getSize() - o.getSize()); ^ (see https://errorprone.info/bugpattern/BadComparable) Did you mean 'return Long.compare(getSize(), o.getSize());'? Bug: 562756 Change-Id: I0522f1025319a9290c448a064fbafdb4b16d1d59 Signed-off-by: David Ostrovsky <david@ostrovsky.org>
-rw-r--r--org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java
index 55d2cfa6ec..4e2d8a998d 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java
@@ -168,7 +168,7 @@ public class LfsPointer implements Comparable<LfsPointer> {
return x;
}
- return (int) (getSize() - o.getSize());
+ return Long.compare(getSize(), o.getSize());
}
}