partially fixed = throwing an exception when comparing with sorted collections, but there are still cases where this will throw.
Some of the tests in the original patch on also still throw exceptions. - https://dev.clojure.org/jira/secure/attachment/12084/0001-fix-for-CLJ-1242-tests.patch.
Note that this is not symmetrical, the reverse doesn't throw.
This issue also exists in ClojureScript (which is where we first discovered it).
The rejected fix for that protected entryAt from ClassCastException would have fixed this as well. The root of the issue is that the exception can come from checking keys so it makes sense to fix it there. The accepted fix for protected only the = test with the sorted-map first. The more basic key access question was punted. I expect this to work:
I think it's worth taking another look at entryAt. Most users would expect the following to succeed:
If there's a performance concern, then the restriction on testing keys should be documented.