mcimadamore@2559: /* mcimadamore@2559: * @test /nodynamiccopyright/ mcimadamore@2559: * @bug 8055514 mcimadamore@2559: * @summary Wrong, confusing error when non-static varargs referenced in static context mcimadamore@2559: * @compile/fail/ref=T8055514.out -Xlint:varargs -Werror -XDrawDiagnostics T8055514.java mcimadamore@2559: */ mcimadamore@2559: class T8055514 { mcimadamore@2559: void m(int... args) { } mcimadamore@2559: mcimadamore@2559: void m2(int... args) { } mcimadamore@2559: static void m2(String s) { } mcimadamore@2559: mcimadamore@2559: void m3(int... args) { } mcimadamore@2559: static void m3(String s) { } mcimadamore@2559: static void m3(Runnable r) { } mcimadamore@2559: mcimadamore@2559: void m4(int... args) { } mcimadamore@2559: void m4(int i1, int i2, int i3) { } mcimadamore@2559: mcimadamore@2559: static void test() { mcimadamore@2559: m(1,2,3); //only one candidate (varargs) - varargs error wins mcimadamore@2559: m2(1,2,3); //two candidates - only one applicable (varargs) - varargs error wins mcimadamore@2559: m3(1,2,3); //three candidates - only one applicable (varargs) - varargs error wins mcimadamore@2559: m4(1,2,3); //two candidates - both applicable - basic error wins mcimadamore@2559: } mcimadamore@2559: }