How to get Method Parameter names in java 8 lambda expression?
<p>from <a href="https://stackoverflow.com/questions/21455403/how-to-get-method-parameter-names-in-java-8-using-reflection">How to get Method Parameter names in Java 8 using reflection?</a>
I know using <code>javac -parameters</code> argument can keep the parameter names in *.class file.
but it is invalid in lambda expression?</p>

<p>example:</p>

<pre><code>import java.lang.reflect.Method;
import java.lang.reflect.Parameter;

public class MyTest {
    public static void main(String[] args) {
        for(Method m : Test.class.getDeclaredMethods()) {
            System.out.println(m.getName());
            for(Parameter p : m.getParameters()) {
                System.out.println(" =&gt; " + p.getName());
            }
        }
    }
}
interface MyInterface {
    Object doSomething(int a, int b);
}

class Test {

    private void bar(MyInterface iface) {
    }

    public void foo() {
        bar((x, y) -&gt; null);
    }

}
</code></pre>

<p>When I do</p>

<pre><code>javac -parameters MyTest.java
java MyTest
</code></pre>

<p>It print</p>

<pre><code>bar
 =&gt; iface
foo
lambda$foo$0
 =&gt; arg0
 =&gt; arg1
</code></pre>

<p>I try to do <code>javap -c -p -verbose Test</code> :</p>

<pre><code>{
  Test();
    descriptor: ()V
    flags:
    Code:
      stack=1, locals=1, args_size=1
         0: aload_0
         1: invokespecial #1                  // Method java/lang/Object."&lt;init&gt;":()V
         4: return
      LineNumberTable:
        line 21: 0

  private void bar(MyInterface);
    descriptor: (LMyInterface;)V
    flags: ACC_PRIVATE
    Code:
      stack=0, locals=2, args_size=2
         0: return
      LineNumberTable:
        line 24: 0
    MethodParameters:
      Name                           Flags
      iface

  public void foo();
    descriptor: ()V
    flags: ACC_PUBLIC
    Code:
      stack=2, locals=1, args_size=1
         0: aload_0
         1: invokedynamic #2,  0              // InvokeDynamic #0:doSomething:()LMyInterface;
         6: invokespecial #3                  // Method bar:(LMyInterface;)V
         9: return
      LineNumberTable:
        line 27: 0
        line 28: 9

  private static java.lang.Object lambda$foo$0(int, int);
    descriptor: (II)Ljava/lang/Object;
    flags: ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
    Code:
      stack=1, locals=2, args_size=2
         0: aconst_null
         1: areturn
      LineNumberTable:
        line 27: 0
}
</code></pre>

<p>I can find parameter name <code>iface</code> , but can not find <code>x</code> or <code>y</code></p>