Sat, 22 Dec 2018 13:10:38 -0800
Added tag jdk8u202-b25 for changeset 15d8c732039b
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * @test /nodynamiccopyright/ |
aoqi@0 | 3 | * @bug 8003280 |
aoqi@0 | 4 | * @summary Add lambda tests |
aoqi@0 | 5 | * speculative cache mismatches between Resolve.access and Attr.checkId leads to compiler crashes |
aoqi@0 | 6 | * @compile/fail/ref=ErroneousArg.out -XDrawDiagnostics ErroneousArg.java |
aoqi@0 | 7 | */ |
aoqi@0 | 8 | class ErroneousArg { |
aoqi@0 | 9 | |
aoqi@0 | 10 | private static class Foo { |
aoqi@0 | 11 | static int j() { return 1; } |
aoqi@0 | 12 | } |
aoqi@0 | 13 | |
aoqi@0 | 14 | static Foo foo = new Foo(); |
aoqi@0 | 15 | |
aoqi@0 | 16 | static void m(String s) { } |
aoqi@0 | 17 | static void m(Integer i) { } |
aoqi@0 | 18 | |
aoqi@0 | 19 | static int f(String s) { return 1; } |
aoqi@0 | 20 | |
aoqi@0 | 21 | static int g(String s) { return 1; } |
aoqi@0 | 22 | static int g(Double s) { return 1; } |
aoqi@0 | 23 | |
aoqi@0 | 24 | int h() { return 1; } |
aoqi@0 | 25 | } |
aoqi@0 | 26 | |
aoqi@0 | 27 | class TestErroneousArg extends ErroneousArg { |
aoqi@0 | 28 | static void test() { |
aoqi@0 | 29 | m(unknown()); //method not found |
aoqi@0 | 30 | m(f(1)); //inapplicable method |
aoqi@0 | 31 | m(g(1)); //inapplicable methods |
aoqi@0 | 32 | m(g(null)); //ambiguous |
aoqi@0 | 33 | m(h()); //static error |
aoqi@0 | 34 | m(foo.j()); //inaccessible method |
aoqi@0 | 35 | } |
aoqi@0 | 36 | } |