mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +00:00
We are working on a feature in the Kotlin Gradle plugin called `kotlin.incremental.useClasspathSnapshot` to improve incremental Kotlin compilation. In this feature, we need to extract ABI information from a .class file. If the .class file is a Kotlin class, this info can be found in the class header data. But if the .class file is a Java class, this info is not readily available. The RuntimeModuleData class in the ':core:descriptors.runtime' project can help with that: It uses reflection to generate `ClassDescriptor`s. However, reflection requires a full classpath to work correctly, whereas we want to generate a `ClassDescriptor` directly for each class file (also, reflection is probably slow). To address that, this commit refactors RuntimeModuleData so that it can support a generic Kotlin/JavaClassFinder, which can be based on either reflection or bytecode analysis. The existing code continues to use reflection while the new feature will use bytecode analysis (e.g., using the existing BinaryJavaClass). Bug: KT-45777 Test: Existing tests should pass (this is a refactoring-only change)