From 8aa0c9071f24258de596fb7030b93fa2fabcb4e6 Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Wed, 5 Jun 2024 22:35:56 -0500 Subject: [PATCH] fix null annotation values --- gradle.properties | 2 +- .../xyz/wagyourtail/unimined/expect/TransformPlatform.kt | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 8d56ef7..1aff643 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ kotlin.code.style=official -version = 1.0.0 +version = 1.0.1 asmVersion=9.7 \ No newline at end of file diff --git a/src/main/kotlin/xyz/wagyourtail/unimined/expect/TransformPlatform.kt b/src/main/kotlin/xyz/wagyourtail/unimined/expect/TransformPlatform.kt index 7198a7e..f7a518f 100644 --- a/src/main/kotlin/xyz/wagyourtail/unimined/expect/TransformPlatform.kt +++ b/src/main/kotlin/xyz/wagyourtail/unimined/expect/TransformPlatform.kt @@ -5,7 +5,7 @@ import org.objectweb.asm.tree.* import xyz.wagyourtail.unimined.expect.utils.toByteArray import java.nio.file.Path import kotlin.io.path.* - +import kotlin.math.max class TransformPlatform(val platformName: String) { @@ -53,11 +53,11 @@ class TransformPlatform(val platformName: String) { } @Suppress("UNCHECKED_CAST") - val platforms = annotation.values[1] as List + val platforms = annotation.values[1] as? List var platformClass: String? = null - for (platform in platforms) { + for (platform in platforms ?: emptyList()) { val name = platform.values[1] as String val clazz = platform.values[3] as String if(name == platformName) { @@ -86,7 +86,8 @@ class TransformPlatform(val platformName: String) { ) method.instructions.add(InsnNode(type.returnType.getOpcode(Opcodes.IRETURN))) - method.maxStack = -1 + method.maxStack = max(type.returnType.size, stackIndex) + method.maxLocals = stackIndex } private fun platformOnly(method: MethodNode, classNode: ClassNode, annotation: AnnotationNode) {