baxter
10/22/2024, 11:11 PMURLClassLoader
holds references to the underlying open files in the URLs, and each time the loadProviders()
function is called, it creates a new URLClassLoader
, which uses new URL objects, which open new file descriptors. These are closed when URLClassLoader.close()
is called, but it never is, and remain open until that class loader is garbage collected.
However, if the class loader is closed once the SymbolProcessorProvider
classes are loaded, the compiler will fail later on when it tries to load the classes used by the SymbolProcessorProvider
implementations, since the class loader that loaded the provider is now closed. The fix I am working on for the Kotlin compiler is passing in a Disposable
and registering a new disposable with the one passed in as the parent, so that it's closed when the compiler is done. However, to fix it in KSP, would require more changes.
Not sure what the best short-term fix would be here.