Recaf icon indicating copy to clipboard operation
Recaf copied to clipboard

Adapt all Dependent injections in Application/Workspace scoped types

Open Col-E opened this issue 1 year ago • 0 comments

Background: https://rmannibucau.wordpress.com/2015/03/02/cdi-and-instance-3-pitfalls-you-need-to-know/

A recent example of the problem can be found in f1da92e8fc8fca95339a154792b15607c353e8e5 - Where AntiDecompilationSummarizer defines a Instance<MappingGeneratorPane>

  • The AntiDecompilationSummarizer class is ApplicationScoped
  • Generated values from the Instance<MappingGeneratorPane> were not being "destroyed" in the container, thus leading to leakage issues
  • Calling generatorPaneProvider.destroy(value) addresses the issue, but this needs to be handled in all similar cases. Something more automatic would be ideal. In our usage of dependent. If we can automatically call destroy so that the CDI won't prevent garbage collection, while still ensuring the generated beans have access to injected services that would be great. Otherwise we can probably re-create the Dependent scope.

Col-E avatar Jun 11 '24 08:06 Col-E