google / guice

Guice (pronounced 'juice') is a lightweight dependency injection framework for Java 11 and above, brought to you by Google.
https://github.com/google/guice
Apache License 2.0
12.48k stars 1.67k forks source link

Fix removal of bindings in ProvisionListenerCallbackStore and simplify #1787

Open HannesWell opened 9 months ago

HannesWell commented 9 months ago

Bindings have never been removed from the cache in ProvisionListenerCallbackStore.remove() because the key of the cache were KeyBinding objects, while it was attempted to remove Binding objects.

Additionally use a standard Java ConcurrentHashMap instead of a simple Guava Cache, which also allows to remove the now unnecessary KeyBinding helper class. Instead of a new KeyBinding object a new new lambda object is created for each cache lookup.

This also helps for https://github.com/google/guice/issues/1785.