title: ASM create method with parameter name w/ ClassWriter
body: <p>Kotlin Code using org.objectweb.asm library</p>
  <pre class="lang-kotlin prettyprint-override"><code>import org.objectweb.asm.ClassWriter
  import org.objectweb.asm.Opcodes.*
  
  fun main(args: Array&lt;String&gt;) {
      val classWriter = ClassWriter(ClassWriter.COMPUTE_MAXS)
  
      classWriter.visit(
              V1_8,
              ACC_PUBLIC,
              &quot;com/github/patrick/learnasm/build/HelloWorld&quot;,
              null,
              &quot;java/lang/Object&quot;,
              null
      )
  
      val methodVisitor = classWriter.visitMethod(
              ACC_PUBLIC + ACC_STATIC,
              &quot;main&quot;,
              &quot;([Ljava/lang/String;)V&quot;,
              null,
              null
      )
  
      methodVisitor.visitFieldInsn(
              GETSTATIC,
              &quot;java/lang/System&quot;,
              &quot;out&quot;,
              &quot;Ljava/io/PrintStream;&quot;
      )
  
      methodVisitor.visitLdcInsn(
              &quot;Hello World!&quot;
      )
  
      methodVisitor.visitMethodInsn(
              INVOKEVIRTUAL,
              &quot;java/io/PrintStream&quot;,
              &quot;println&quot;,
              &quot;(Ljava/lang/String;)V&quot;,
              false
      )
  
      methodVisitor.visitInsn(
              RETURN
      )
  
      methodVisitor.visitMaxs(
              0,
              0
      )
  
      methodVisitor.visitEnd()
  
      val bytes = classWriter.toByteArray()
      val clazz = defineClass(
              &quot;com.github.patrick.learnasm.build.HelloWorld&quot;,
              bytes,
              0,
              bytes.count()
      )
  
      clazz.getDeclaredMethod(&quot;main&quot;, Array&lt;String&gt;::class.java).invoke(null, null)
  }
  </code></pre>
  <p>I am trying to learn asm, and I'm curious whether creating a method with named parameter is possible.</p>
  <p>For example in this case, the created class has no parameter name (defaults to var0 in decompiler), and I wish I could save parameter names like &quot;args&quot;. Would it be possible?</p>