8060485: (str) contentEquals checks the String contents twice on mismatch
Reviewed-by: martin, chegar, alanb
--- a/jdk/src/java.base/share/classes/java/lang/String.java Tue Oct 14 23:22:00 2014 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/String.java Tue Oct 14 19:35:03 2014 +0200
@@ -1045,8 +1045,9 @@
}
}
// Argument is a String
- if (cs.equals(this))
- return true;
+ if (cs instanceof String) {
+ return equals(cs);
+ }
// Argument is a generic CharSequence
char v1[] = value;
int n = v1.length;