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,10 @@ 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.fullSupport 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
2097
2094
// int h = hash;
2098
2095
// if (h == 0 && value.length > 0) {
2099
2096
// char val[] = value;
@@ -2104,6 +2101,12 @@ public int hashCode() {
2104
2101
// hash = h;
2105
2102
// }
2106
2103
// return h;
2104
+ int len = length ();
2105
+ int h = 0 ;
2106
+ for (int i = 0 ; i < len ; i ++) {
2107
+ h = 31 * h + CProverString .charAt (this , i );
2108
+ }
2109
+ return h ;
2107
2110
}
2108
2111
2109
2112
/**
You can’t perform that action at this time.
0 commit comments