Skip to content

Commit 03d9d8a

Browse files
Avoid String concatenation in compareTo (#645)
1 parent 8d143ac commit 03d9d8a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/main/java/hudson/tasks/junit/CaseResult.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -955,9 +955,13 @@ public int compareTo(CaseResult that) {
955955
if (this == that) {
956956
return 0;
957957
}
958-
int r = this.getFullName().compareTo(that.getFullName());
959-
if (r != 0) {
960-
return r;
958+
int r1 = this.className.compareTo(that.className);
959+
if (r1 != 0) {
960+
return r1;
961+
}
962+
int r2 = this.getName().compareTo(that.getName());
963+
if (r2 != 0) {
964+
return r2;
961965
}
962966
// Only equals is exact reference
963967
return System.identityHashCode(this) >= System.identityHashCode(that) ? 1 : -1;

0 commit comments

Comments
 (0)