Use correct class loader in kotlinx-metadata to load MetadataExtensions implementations
By default, ServiceLoader.load uses thread context class loader, which can differ from the MetadataExtensions' class loader (which also loads JvmMetadataExtensions, since they're in the same .jar) in many cases, for example when used in annotation processing #KT-24881 Fixed
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
## 0.0.3
|
||||
|
||||
- Support metadata of local delegated properties (see `JvmDeclarationContainerExtensionVisitor.visitLocalDelegatedProperty`)
|
||||
- [`KT-24881`](https://youtrack.jetbrains.com/issue/KT-24881) Use correct class loader in kotlinx-metadata to load MetadataExtensions implementations
|
||||
|
||||
## 0.0.2
|
||||
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ interface MetadataExtensions {
|
||||
|
||||
companion object {
|
||||
val INSTANCES: List<MetadataExtensions> by lazy {
|
||||
ServiceLoader.load(MetadataExtensions::class.java).toList().also {
|
||||
ServiceLoader.load(MetadataExtensions::class.java, MetadataExtensions::class.java.classLoader).toList().also {
|
||||
if (it.isEmpty()) error(
|
||||
"No MetadataExtensions instances found in the classpath. Please ensure that the META-INF/services/ " +
|
||||
"is not stripped from your application and that the Java virtual machine is not running " +
|
||||
|
||||
Reference in New Issue
Block a user