77ba9a1bbb
KAPT was relying on clearing JarFileFactory to make sure annotation processing does not hold onto annotation processing classpath once done. Once KAPT switched to using Gradle workers, multiple KAPT runs were sharing the same class loader ie. the same version of JarFileFactory. Clearing the cache resulted in race condition, as some runs were unable to load processors from jars. This commit fixes this problem by avoiding the use of ServiceLoader which was causing the issue. Jars would be added to the cache, but they would never be removed. That's why JarFileFactory had to be clearned manually. By loading the processor names manually (simply exploring the classpath), no file handles leak. Fixes https://youtrack.jetbrains.com/issue/KT-34604 Test: verified against the test project from the bug