test/langtools/tools/javac/varargs/6313164/T6313164.java
author darcy
Thu, 12 Jul 2018 14:13:15 -0700
changeset 51047 860a3648c494
parent 47216 71c04702a3d5
permissions -rw-r--r--
8028563: Remove javac support for 6/1.6 source and target values Reviewed-by: jjg, erikj, henryjen
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8229
39266c1b1b0e 6313164: javac generates code that fails byte code verification for the varargs feature
mcimadamore
parents:
diff changeset
     1
/*
39266c1b1b0e 6313164: javac generates code that fails byte code verification for the varargs feature
mcimadamore
parents:
diff changeset
     2
 * @test /nodynamiccopyright/
25008
969bfaae5bce 8036953: Fix timing of varargs access check, per JDK-8016205
vromero
parents: 8229
diff changeset
     3
 * @bug     6313164 8036953
8229
39266c1b1b0e 6313164: javac generates code that fails byte code verification for the varargs feature
mcimadamore
parents:
diff changeset
     4
 * @author mcimadamore
39266c1b1b0e 6313164: javac generates code that fails byte code verification for the varargs feature
mcimadamore
parents:
diff changeset
     5
 * @summary  javac generates code that fails byte code verification for the varargs feature
51047
860a3648c494 8028563: Remove javac support for 6/1.6 source and target values
darcy
parents: 47216
diff changeset
     6
 * @compile/fail/ref=T6313164Source7.out -source 7 -XDrawDiagnostics  -Xlint:-options T6313164.java
25008
969bfaae5bce 8036953: Fix timing of varargs access check, per JDK-8016205
vromero
parents: 8229
diff changeset
     7
 * @compile/fail/ref=T6313164Source8AndHigher.out -XDrawDiagnostics T6313164.java
8229
39266c1b1b0e 6313164: javac generates code that fails byte code verification for the varargs feature
mcimadamore
parents:
diff changeset
     8
 */
39266c1b1b0e 6313164: javac generates code that fails byte code verification for the varargs feature
mcimadamore
parents:
diff changeset
     9
import p1.*;
39266c1b1b0e 6313164: javac generates code that fails byte code verification for the varargs feature
mcimadamore
parents:
diff changeset
    10
39266c1b1b0e 6313164: javac generates code that fails byte code verification for the varargs feature
mcimadamore
parents:
diff changeset
    11
class T6313164 {
25008
969bfaae5bce 8036953: Fix timing of varargs access check, per JDK-8016205
vromero
parents: 8229
diff changeset
    12
    {
969bfaae5bce 8036953: Fix timing of varargs access check, per JDK-8016205
vromero
parents: 8229
diff changeset
    13
        B b = new B();
969bfaae5bce 8036953: Fix timing of varargs access check, per JDK-8016205
vromero
parents: 8229
diff changeset
    14
        b.foo1(new B(), new B()); //error - A not accessible
969bfaae5bce 8036953: Fix timing of varargs access check, per JDK-8016205
vromero
parents: 8229
diff changeset
    15
        /*   7  : ok - A not accessible, but foo2(Object...) applicable
969bfaae5bce 8036953: Fix timing of varargs access check, per JDK-8016205
vromero
parents: 8229
diff changeset
    16
         *   8+ : error - A not accessible
969bfaae5bce 8036953: Fix timing of varargs access check, per JDK-8016205
vromero
parents: 8229
diff changeset
    17
         */
969bfaae5bce 8036953: Fix timing of varargs access check, per JDK-8016205
vromero
parents: 8229
diff changeset
    18
        b.foo2(new B(), new B());
969bfaae5bce 8036953: Fix timing of varargs access check, per JDK-8016205
vromero
parents: 8229
diff changeset
    19
        b.foo3(null, null); //error - A (inferred) not accessible
969bfaae5bce 8036953: Fix timing of varargs access check, per JDK-8016205
vromero
parents: 8229
diff changeset
    20
        b.foo4(null, null); //error - A not accesible
969bfaae5bce 8036953: Fix timing of varargs access check, per JDK-8016205
vromero
parents: 8229
diff changeset
    21
        /*   7  : ok - A not accessible, but foo4(Object...) applicable
969bfaae5bce 8036953: Fix timing of varargs access check, per JDK-8016205
vromero
parents: 8229
diff changeset
    22
         *   8+ : error - A not accessible
969bfaae5bce 8036953: Fix timing of varargs access check, per JDK-8016205
vromero
parents: 8229
diff changeset
    23
         */
969bfaae5bce 8036953: Fix timing of varargs access check, per JDK-8016205
vromero
parents: 8229
diff changeset
    24
        b.foo4(new B(), new C());
8229
39266c1b1b0e 6313164: javac generates code that fails byte code verification for the varargs feature
mcimadamore
parents:
diff changeset
    25
    }
39266c1b1b0e 6313164: javac generates code that fails byte code verification for the varargs feature
mcimadamore
parents:
diff changeset
    26
}