Kapt: Clear Javac shared ZIP cache after annotation processing or stub generation (KT-25756)

This commit is contained in:
Yan Zhulanow
2018-10-31 14:59:52 +09:00
parent 0ffa901859
commit cd968ba8fe
@@ -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(