Error Prone: Enable and fix StringEquality
There is one instance that needs to be suppressed because the JGit API depends on returning a sentinel that is used with reference equality. Arguably, this static method should be moved to JGit, but for now it's easy enough to suppress. The benefits of avoiding bugs in this case outweighs this annoyance. Change-Id: I636dbedaa299c169926471f75fc3ef5c7d48285e
This commit is contained in:
committed by
David Pursehouse
parent
650070ee81
commit
fabead2ec8
@@ -139,7 +139,7 @@ public class UploadArchive extends AbstractGitCommand {
|
||||
PacketLineIn packetIn = new PacketLineIn(in);
|
||||
for (; ; ) {
|
||||
String s = packetIn.readString();
|
||||
if (s == PacketLineIn.END) {
|
||||
if (isPacketLineEnd(s)) {
|
||||
break;
|
||||
}
|
||||
if (!s.startsWith(argCmd)) {
|
||||
@@ -163,6 +163,11 @@ public class UploadArchive extends AbstractGitCommand {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("StringEquality") // JGit API depends on reference equality with sentinel.
|
||||
private static boolean isPacketLineEnd(String s) {
|
||||
return s == PacketLineIn.END;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl() throws IOException, PermissionBackendException, Failure {
|
||||
PacketLineOut packetOut = new PacketLineOut(out);
|
||||
|
||||
@@ -41,6 +41,7 @@ java_package_configuration(
|
||||
"-XepDisableWarningsInGeneratedCode",
|
||||
"-Xep:AmbiguousMethodReference:ERROR",
|
||||
"-Xep:BadComparable:ERROR",
|
||||
"-Xep:StringEquality:ERROR",
|
||||
"-Xep:MissingCasesInEnumSwitch:ERROR",
|
||||
"-Xep:WildcardImport:ERROR",
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user