dashorst opened a new issue, #1866:
URL: https://github.com/apache/wicket/issues/1866

   `PageParameters.equals` and `PageParameters.hashCode` disagree about the 
named parameters, so two `PageParameters` that are equal can have different 
hash codes. That breaks the contract of `Object.hashCode`.
   
   `equals` compares the named parameters regardless of their order: the lists 
must hold the same pairs, each the same number of times. `hashCode` uses 
`namedParameters.hashCode()`, the order-sensitive hash of the `List<NamedPair>`.
   
   ```java
   PageParameters a = new PageParameters().add("a", "1").add("b", "2");
   PageParameters b = new PageParameters().add("b", "2").add("a", "1");
   
   a.equals(b);                    // true
   a.hashCode() == b.hashCode();   // false
   ```
   
   Anything that puts `PageParameters` in a hash-based collection, or in a key 
that includes them, can treat these two as different. The fix is to make 
`hashCode` order-insensitive for the named parameters, for example by summing 
the hash codes of the pairs.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to