File tree 1 file changed +8
-5
lines changed
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -1919,13 +1919,16 @@ public boolean endsWith(String suffix) {
1919
1919
*
1920
1920
* @return a hash code value for this object.
1921
1921
*
1922
- * @diffblue.limitedSupport
1923
- * We guarantee that two strings with different hash code have different
1924
- * content, but the exact value will not correspond to the actual one.
1922
+ * @diffblue.limitedSupport length of the string is limited by unwind value
1925
1923
*/
1926
1924
public int hashCode () {
1927
- // DIFFBLUE MODEL LIBRARY This is treated internally in CBMC
1928
- return CProver .nondetInt ();
1925
+ // DIFFBLUE MODEL LIBRARY
1926
+ int len = length ();
1927
+ int h = 0 ;
1928
+ for (int i = 0 ; i < len ; i ++) {
1929
+ h = 31 * h + CProverString .charAt (this , i );
1930
+ }
1931
+ return h ;
1929
1932
// int h = hash;
1930
1933
// if (h == 0 && value.length > 0) {
1931
1934
// char val[] = value;
You can’t perform that action at this time.
0 commit comments