All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.name.remal.gradle_plugins.dsl.extensions.kotlin.reflect.KClass-PluginId.kt Maven / Gradle / Ivy

The newest version!
package name.remal.gradle_plugins.dsl.extensions

import name.remal.gradle_plugins.dsl.PluginId
import kotlin.reflect.KClass

fun  KClass.getOrInstantiate(): T {
    try {
        this.objectInstance?.let { return it }
    } catch (ignored: IllegalAccessException) {
        // do nothing
    }

    return this.java.getDeclaredConstructor().makeAccessible().newInstance()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy