I have the following code snippet and I want to access scriptDsl property from Java internally from the same code base. I do not want to expose scriptDsl publically.
class ScriptDsl {
internal val scriptDsl: JScriptDsl by lazy { //... }
}
when compiled, scriptDsl becomes public final JScriptDsl getScriptDsl$esw_ocs_dsl_kt() but I want to provide custom name here which is possible for non delegated properties using JvmName("scriptDsl").
How to do it for internal delegated properties?
I am fine if there are any other better solutions, my requirements are"
- I want to call
scriptDslfrom java within the same module - I am calling it using reflection so need to know the name beforehand
ScriptDslis public and I do not want propertyscriptDslto be accessed outside modulescriptDslhas to be lazy because it depends on other properties which might not be avaibale while declaration
Note: I know internal in kotlin is public in java.
From kotlin docs:
internal declarations become public in Java. Members of internal classes go through name mangling, to make it harder to accidentally use them from Java and to allow overloading for members with the same signature that don't see each other according to Kotlin rules;