name.remal.gradle_plugins.dsl.extensions.org.objectweb.asm.tree.MethodNode.kt Maven / Gradle / Ivy
package name.remal.gradle_plugins.dsl.extensions
import org.objectweb.asm.Type.getArgumentTypes
import org.objectweb.asm.tree.AnnotationNode
import org.objectweb.asm.tree.MethodNode
import org.objectweb.asm.tree.TypeAnnotationNode
val MethodNode.hasParameters: Boolean get() = getArgumentTypes(desc).isNotEmpty()
val MethodNode.allAnnotations: List
get() = sequenceOf(visibleAnnotations, invisibleAnnotations)
.filterNotNull()
.flatten()
.toList()
val MethodNode.allTypeAnnotations: List
get() = sequenceOf(visibleTypeAnnotations, invisibleTypeAnnotations)
.filterNotNull()
.flatten()
.toList()
fun MethodNode.getAllParameterAnnotations(paramIndex: Int): List {
return sequenceOf(visibleParameterAnnotations, invisibleParameterAnnotations)
.flatMap { it?.getOrNull(paramIndex)?.asSequence() ?: emptySequence() }
.filterNotNull()
.toList()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy