name.remal.gradle_plugins.dsl.extensions.java.lang.reflect.Field.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-plugins-kotlin-dsl Show documentation
Show all versions of gradle-plugins-kotlin-dsl Show documentation
Remal Gradle plugins: gradle-plugins-kotlin-dsl
package name.remal.gradle_plugins.dsl.extensions
import java.lang.reflect.Field
import java.lang.reflect.Modifier.FINAL
fun Field.makeNotFinal() = apply {
val modifiersField = Field::class.java.getDeclaredField("modifiers")
modifiersField.isAccessible = true
modifiersField.setInt(this, modifiers and FINAL.inv())
}