langtools/test/tools/javac/IncorrectInheritance/IncorrectInheritanceTest.java
author vromero
Thu, 13 Mar 2014 20:13:43 +0000
changeset 23396 06e3726c6b3f
child 26100 bb7dd001d190
permissions -rw-r--r--
8034924: Incorrect inheritance of inaccessible static method Reviewed-by: jjg, jlahoda
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23396
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
     1
/*
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
     2
 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
     4
 *
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
     7
 * published by the Free Software Foundation.
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
     8
 *
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    13
 * accompanied this code).
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    14
 *
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    18
 *
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    21
 * questions.
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    22
 */
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    23
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    24
/*
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    25
 * @test
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    26
 * @bug 8034924
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    27
 * @summary Incorrect inheritance of inaccessible static method
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    28
 * @library /tools/javac/lib
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    29
 * @build ToolBox
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    30
 * @run main IncorrectInheritanceTest
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    31
 */
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    32
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    33
public class IncorrectInheritanceTest {
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    34
    private static final String ASrc =
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    35
            "package pkg;\n" +
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    36
            "\n" +
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    37
            "public class A {\n" +
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    38
            "    static void foo(Object o) {}\n" +
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    39
            "    private static void bar(Object o) {}\n" +
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    40
            "}";
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    41
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    42
    private static final String BSrc =
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    43
            "import pkg.A;\n" +
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    44
            "class B extends A {\n" +
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    45
            "    public void foo(Object o) {}\n" +
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    46
            "    public void bar(Object o) {}\n" +
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    47
            "}";
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    48
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    49
    private static final String CSrc =
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    50
            "class C extends B {\n" +
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    51
            "    public void m(Object o) {\n" +
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    52
            "        foo(o);\n" +
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    53
            "        bar(o);\n" +
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    54
            "    }\n" +
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    55
            "}";
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    56
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    57
    public static void main(String[] args) throws Exception {
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    58
        new IncorrectInheritanceTest().test();
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    59
    }
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    60
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    61
    public void test() throws Exception {
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    62
        ToolBox.JavaToolArgs javacParams =
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    63
                new ToolBox.JavaToolArgs()
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    64
                .setSources(ASrc, BSrc, CSrc);
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    65
        ToolBox.javac(javacParams);
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    66
    }
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    67
06e3726c6b3f 8034924: Incorrect inheritance of inaccessible static method
vromero
parents:
diff changeset
    68
}