Kapt: Clear Javac shared ZIP cache after annotation processing or stub generation (KT-25756)
This commit is contained in:
@@ -109,8 +109,17 @@ class ClasspathBasedKapt3Extension(
|
||||
return super.analysisCompleted(project, module, bindingTrace, files)
|
||||
} finally {
|
||||
processorLoader?.close()
|
||||
clearJavacZipCaches()
|
||||
}
|
||||
}
|
||||
|
||||
private fun clearJavacZipCaches() {
|
||||
try {
|
||||
val zipFileIndexCacheClass = Class.forName("com.sun.tools.javac.file.ZipFileIndexCache")
|
||||
val zipFileIndexCacheInstance = zipFileIndexCacheClass.getMethod("getSharedInstance").invoke(null)
|
||||
zipFileIndexCacheClass.getMethod("clearCache").invoke(zipFileIndexCacheInstance)
|
||||
} catch (e: Throwable) {}
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AbstractKapt3Extension(
|
||||
|
||||
Reference in New Issue
Block a user