Skip to content

Commit 45158d1

Browse files
authored
Fix referential comparison of the two strings (#446)
* Fix referential comparison of the two strings * Use the Objects helper for comparisons
1 parent d5ee0c9 commit 45158d1

File tree

1 file changed

+1
-1
lines changed
  • google-http-client/src/main/java/com/google/api/client/util

1 file changed

+1
-1
lines changed

google-http-client/src/main/java/com/google/api/client/util/ClassInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ private ClassInfo(Class<?> srcClass, boolean ignoreCase) {
165165
// name set has a special comparator to keep null first
166166
TreeSet<String> nameSet = new TreeSet<String>(new Comparator<String>() {
167167
public int compare(String s0, String s1) {
168-
return s0 == s1 ? 0 : s0 == null ? -1 : s1 == null ? 1 : s0.compareTo(s1);
168+
return Objects.equal(s0, s1) ? 0 : s0 == null ? -1 : s1 == null ? 1 : s0.compareTo(s1);
169169
}
170170
});
171171
// iterate over declared fields

0 commit comments

Comments
 (0)