7mind / izumi

Productivity-oriented collection of lightweight fancy stuff for Scala toolchain
https://izumi.7mind.io
BSD 2-Clause "Simplified" License
613 stars 66 forks source link

#1968: locator-private bindings #2162

Closed pshirshov closed 4 weeks ago

pshirshov commented 1 month ago

This P/R introduces the concept of Locator-private bindings. Locator-local instances cannot be seen by inherited locators. There are 3 supported modes:

  1. All the bindings are public unless explicitly marked as confined (the old behavior, kept as the default one)
  2. All the bindings are private unless explicitly marked as exposed
  3. Only GC roots are public

For bootstrap injectors the default behavior is (3). Also, from now on the bootstrap planning uses predefined set of roots instead of Roots.Everything, so bootstrap context are subjected to garbage colleciton.

THIS CHANGE IS INCOMPATIBLE WITH PREVIOUS VERSIONS and requires manual intervention if you have any custom bootstrap modules in your code.

All the bootstrap entities which you need to be available in the downstream locators, must be explicitly marked as exposed. There is no way to define GC roots for the bootstrap injector, so it considers all the exposed entities in bootstrap modules to be roots.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 74.54545% with 28 lines in your changes missing coverage. Please review.

Please upload report for BASE (develop@d04afdd). Learn more about missing BASE report. Report is 8 commits behind head on develop.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #2162 +/- ## ========================================== Coverage ? 66.45% ========================================== Files ? 591 Lines ? 11498 Branches ? 1335 ========================================== Hits ? 7641 Misses ? 3857 Partials ? 0 ```