test/tools/javac/lambda/ErroneousArg.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  *  speculative cache mismatches between Resolve.access and Attr.checkId leads to compiler crashes
     6  * @compile/fail/ref=ErroneousArg.out -XDrawDiagnostics ErroneousArg.java
     7  */
     8 class ErroneousArg {
    10     private static class Foo {
    11         static int j() { return 1; }
    12     }
    14     static Foo foo = new Foo();
    16     static void m(String s) { }
    17     static void m(Integer i) { }
    19     static int f(String s) { return 1; }
    21     static int g(String s) { return 1; }
    22     static int g(Double s) { return 1; }
    24     int h() { return 1; }
    25 }
    27 class TestErroneousArg extends ErroneousArg {
    28     static void test() {
    29         m(unknown()); //method not found
    30         m(f(1)); //inapplicable method
    31         m(g(1)); //inapplicable methods
    32         m(g(null)); //ambiguous
    33         m(h()); //static error
    34         m(foo.j()); //inaccessible method
    35     }
    36 }

mercurial