8060485: (str) contentEquals checks the String contents twice on mismatch
authorshade
Tue, 14 Oct 2014 19:35:03 +0200
changeset 27087 de850fa3be4d
parent 27086 d2d044ae0869
child 27088 ea6446a9121b
8060485: (str) contentEquals checks the String contents twice on mismatch Reviewed-by: martin, chegar, alanb
jdk/src/java.base/share/classes/java/lang/String.java
--- 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;