test/tools/javac/lambda/MostSpecific06.java

Thu, 26 Mar 2015 11:34:50 +0100

author
jlahoda
date
Thu, 26 Mar 2015 11:34:50 +0100
changeset 2734
ba758e1ffa69
parent 0
959103a6100f
permissions
-rw-r--r--

8054220: Debugger doesn't show variables *outside* lambda
8058227: Debugger has no access to outer variables inside Lambda
Summary: Put local variables captured by lambda into the lambda method's LocalVariableTable.
Reviewed-by: mcimadamore, rfield

     1 /*
     2  * @test /nodynamiccopyright/
     3  * @bug 8003280
     4  * @summary Add lambda tests
     5  *  most specific resolution crashes on stuck lambdas
     6  * @compile/fail/ref=MostSpecific06.out -XDrawDiagnostics MostSpecific06.java
     7  */
     8 import java.util.*;
    10 class MostSpecific06 {
    12     interface Predicate<X> {
    13         boolean accept(X x);
    14     }
    16     interface ExtPredicate<X> extends Predicate<X> { }
    20     void test(boolean cond, ArrayList<String> als) {
    21         m(u -> true, als, als);
    22         m((u -> true), als, als);
    23         m(cond ? u -> true : u -> false, als, als);
    24     }
    26     <U> U m(Predicate<U> p, List<U> lu, ArrayList<U> au) { return null; }
    29     <U> U m(ExtPredicate<U> ep, ArrayList<U> au, List<U> lu) { return null; }
    30 }

mercurial