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 @@ -2087,13 +2087,16 @@ public boolean endsWith(String suffix) {
2087
2087
*
2088
2088
* @return a hash code value for this object.
2089
2089
*
2090
- * @diffblue.limitedSupport
2091
- * We guarantee that two strings with different hash code have different
2092
- * content, but the exact value will not correspond to the actual one.
2090
+ * @diffblue.limitedSupport length of the string is limited by unwind value
2093
2091
*/
2094
2092
public int hashCode () {
2095
- // DIFFBLUE MODEL LIBRARY This is treated internally in CBMC
2096
- return CProver .nondetInt ();
2093
+ // DIFFBLUE MODEL LIBRARY
2094
+ int len = length ();
2095
+ int h = 0 ;
2096
+ for (int i = 0 ; i < len ; i ++) {
2097
+ h = 31 * h + CProverString .charAt (this , i );
2098
+ }
2099
+ return h ;
2097
2100
// int h = hash;
2098
2101
// if (h == 0 && value.length > 0) {
2099
2102
// char val[] = value;
You can’t perform that action at this time.
0 commit comments