cursive icon indicating copy to clipboard operation
cursive copied to clipboard

`IllegalArgumentException` with `:shrunk` field in custom `IPersistentMap` implementation

Open evg-tso opened this issue 1 year ago • 0 comments

After a recent upgrade of Cursive (version 1.13.5 and later), we encountered an issue where tests start to fail with the following error:

Error: java. lang. IllegalArgumentException: No such field :shrunk - that an item isn't found when it doesn't exist

This error occurs when Cursive tries to access the :shrunk field via clojure.lang.RT.get(). The key issue is that we are using a custom implementation of IPersistentMap, which only allows access to a predefined set of keys. The :shrunk field is not part of this set, which causes the error.

This is a Cursive only error, as running lein test doesn't fail.

Steps to Reproduce

  1. Create a custom implementation of IPersistentMap that restricts access to a predefined set of keys.
  2. Run tests in Cursive that involve assertions or other actions that might trigger access to the :shrunk key.
  3. See the IllegalArgumentException when Cursive tries to access a non-existent :shrunk field.

For a minimal reproduction, please refer to the example repository here: Repro Example.

Additional Context

The root cause is detailed in the README within the provided repo. To summarize, Cursive tries to access the :shrunk field, but our custom IPersistentMap does not support this field, leading to an exception. The issue occurs even though the tests pass successfully when run via lein test.

image

evg-tso avatar Sep 30 '24 09:09 evg-tso