How to get KClass of @file:JvmName



package com.dfdfdfd.di.module

fun getEncryptionService(context: Context): EncryptionService {
    return EncryptionServiceDefault(context)

I wrote in this way to retrieve class with static functions.

@Component(modules = [
EncryptionModule::class, //error Unresolved reference EncryptionModule

Please, help me. How to retrieve const instance of KClass in this case?


Did you figure this out?


At Kotlin language level top level functions are independent of the file they are declared in. They belong directly to their package. @JvmName annotations do not change this, they merely change details of the compilation result not the validity of your Kotlin (unless you use it to avoid platform issues on uncompilable Kotlin). On the JVM a class is needed that contains these static members. It still isn’t possible to create instances of them. Instead you may be thinking about an object rather than a toplevel.