izumi icon indicating copy to clipboard operation
izumi copied to clipboard

We should prevent unitialized proxies from being used in Sets

Open pshirshov opened this issue 6 years ago • 0 comments

Right now proxied value which needs to be added into a set will fail.

We have two strategies to address the issue:

  1. We may stop proxying equals/hashcode. It's easy and reliable strategy but may lead to some hard-to-discover problems in user's logic
  2. When instantiating a set we may check if any of it's members is a proxy. Then we may (a) create an instance of custom "lazy set" which would instantiate real one on first usage (b) wrap a proxy into another one with equals/hashcode inherited from Object. In that case the user may only be exposed to an incorrect behaviour when he checks equality of set element against same dependency injected somewhere else.

pshirshov avatar Feb 12 '19 17:02 pshirshov