Wed, 08 Oct 2014 14:16:40 -0700
Merge
mcimadamore@2559 | 1 | /* |
mcimadamore@2559 | 2 | * @test /nodynamiccopyright/ |
mcimadamore@2559 | 3 | * @bug 8055514 |
mcimadamore@2559 | 4 | * @summary Wrong, confusing error when non-static varargs referenced in static context |
mcimadamore@2559 | 5 | * @compile/fail/ref=T8055514.out -Xlint:varargs -Werror -XDrawDiagnostics T8055514.java |
mcimadamore@2559 | 6 | */ |
mcimadamore@2559 | 7 | class T8055514 { |
mcimadamore@2559 | 8 | void m(int... args) { } |
mcimadamore@2559 | 9 | |
mcimadamore@2559 | 10 | void m2(int... args) { } |
mcimadamore@2559 | 11 | static void m2(String s) { } |
mcimadamore@2559 | 12 | |
mcimadamore@2559 | 13 | void m3(int... args) { } |
mcimadamore@2559 | 14 | static void m3(String s) { } |
mcimadamore@2559 | 15 | static void m3(Runnable r) { } |
mcimadamore@2559 | 16 | |
mcimadamore@2559 | 17 | void m4(int... args) { } |
mcimadamore@2559 | 18 | void m4(int i1, int i2, int i3) { } |
mcimadamore@2559 | 19 | |
mcimadamore@2559 | 20 | static void test() { |
mcimadamore@2559 | 21 | m(1,2,3); //only one candidate (varargs) - varargs error wins |
mcimadamore@2559 | 22 | m2(1,2,3); //two candidates - only one applicable (varargs) - varargs error wins |
mcimadamore@2559 | 23 | m3(1,2,3); //three candidates - only one applicable (varargs) - varargs error wins |
mcimadamore@2559 | 24 | m4(1,2,3); //two candidates - both applicable - basic error wins |
mcimadamore@2559 | 25 | } |
mcimadamore@2559 | 26 | } |