test/tools/javac/lambda/ErroneousArg.java

changeset 0
959103a6100f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/lambda/ErroneousArg.java	Wed Apr 27 01:34:52 2016 +0800
     1.3 @@ -0,0 +1,36 @@
     1.4 +/*
     1.5 + * @test /nodynamiccopyright/
     1.6 + * @bug 8003280
     1.7 + * @summary Add lambda tests
     1.8 + *  speculative cache mismatches between Resolve.access and Attr.checkId leads to compiler crashes
     1.9 + * @compile/fail/ref=ErroneousArg.out -XDrawDiagnostics ErroneousArg.java
    1.10 + */
    1.11 +class ErroneousArg {
    1.12 +
    1.13 +    private static class Foo {
    1.14 +        static int j() { return 1; }
    1.15 +    }
    1.16 +
    1.17 +    static Foo foo = new Foo();
    1.18 +
    1.19 +    static void m(String s) { }
    1.20 +    static void m(Integer i) { }
    1.21 +
    1.22 +    static int f(String s) { return 1; }
    1.23 +
    1.24 +    static int g(String s) { return 1; }
    1.25 +    static int g(Double s) { return 1; }
    1.26 +
    1.27 +    int h() { return 1; }
    1.28 +}
    1.29 +
    1.30 +class TestErroneousArg extends ErroneousArg {
    1.31 +    static void test() {
    1.32 +        m(unknown()); //method not found
    1.33 +        m(f(1)); //inapplicable method
    1.34 +        m(g(1)); //inapplicable methods
    1.35 +        m(g(null)); //ambiguous
    1.36 +        m(h()); //static error
    1.37 +        m(foo.j()); //inaccessible method
    1.38 +    }
    1.39 +}

mercurial