Don't obfuscate static fields in fr.username404.gui.feature to fix reflection on objects

This commit is contained in:
Username404 2021-05-17 14:44:44 +02:00
parent 84032f60eb
commit 82de485b17
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
2 changed files with 2 additions and 5 deletions

View File

@ -45,7 +45,7 @@ subprojects {
keep("class $group.snowygui.fabric.**")
keep("class $group.snowygui.forge.**")
keepnames("class $group.snowygui.Snowy")
keep("class $group.snowygui.gui.feature.**")
keep("class $group.snowygui.gui.feature.** { static <fields>; }")
keepclassmembers("class $group.snowygui.** { public protected <methods>; }")
keepattributes("*Annotation*, Signature, InnerClasses, EnclosingMethod, MethodParameters, Synthetic, Exceptions")
obfuscationdictionary("$dictionariesDir/dictionary.txt")

View File

@ -11,7 +11,6 @@ import fr.username404.snowygui.gui.Renderable.Rendering.defaultRectFunc
import fr.username404.snowygui.gui.elements.ClickBox
import fr.username404.snowygui.gui.feature.ButtonInfo.Companion.Type
import kotlin.reflect.full.findAnnotation
import kotlin.reflect.jvm.isAccessible
sealed class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) {
companion object {
@ -22,9 +21,7 @@ sealed class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) {
((try {
it.getConstructor().newInstance()
} catch (e: NoSuchMethodException) {
try {
it.kotlin.objectInstance!!
} catch (e: NullPointerException) { it.kotlin.constructors.first().also { build -> build.isAccessible = true }.call() }
it.kotlin.objectInstance!!
}) as ButtonImpl).let { impl ->
with(impl) {
if (info.kind == ButtonInfo.Companion.Type.TOGGLE) {