jdk

Форк
0
/
IncorrectSignatureDeterminationForInnerClassesTest.java 
91 строка · 2.8 Кб
1
/*
2
 * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
 *
5
 * This code is free software; you can redistribute it and/or modify it
6
 * under the terms of the GNU General Public License version 2 only, as
7
 * published by the Free Software Foundation.
8
 *
9
 * This code is distributed in the hope that it will be useful, but WITHOUT
10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
 * version 2 for more details (a copy is included in the LICENSE file that
13
 * accompanied this code).
14
 *
15
 * You should have received a copy of the GNU General Public License version
16
 * 2 along with this work; if not, write to the Free Software Foundation,
17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
 *
19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
 * or visit www.oracle.com if you need additional information or have any
21
 * questions.
22
 */
23

24
/*
25
 * @test
26
 * @bug 8022162
27
 * @summary Incorrect signature determination for certain inner class generics
28
 * @library /tools/lib
29
 * @modules jdk.compiler/com.sun.tools.javac.api
30
 *          jdk.compiler/com.sun.tools.javac.main
31
 *          jdk.jdeps/com.sun.tools.javap
32
 * @build toolbox.ToolBox toolbox.JavacTask
33
 * @run main IncorrectSignatureDeterminationForInnerClassesTest
34
 */
35

36
import toolbox.JavacTask;
37
import toolbox.ToolBox;
38

39
public class IncorrectSignatureDeterminationForInnerClassesTest {
40

41
    private static final String DSrc =
42
        "package p1;\n" +
43

44
        "public class D<T> {\n" +
45
        "}\n" +
46

47
        "abstract class Q<T> {\n" +
48
        "    protected void m(M.E e) {}\n" +
49

50
        "    public class M extends D<T> {\n" +
51
        "        public class E {}\n" +
52
        "    }\n" +
53
        "}";
54

55
    private static final String HSrc =
56
        "package p1;\n" +
57

58
        "public class H {\n" +
59
        "    static class EQ extends Q<Object> {\n" +
60
        "        private void m2(M.E item) {\n" +
61
        "            m(item);\n" +
62
        "        }\n" +
63
        "    }\n" +
64
        "}";
65

66
    public static void main(String args[]) throws Exception {
67
        new IncorrectSignatureDeterminationForInnerClassesTest().run();
68
    }
69

70
    void run() throws Exception {
71
        compile();
72
    }
73

74
    void compile() throws Exception {
75
        ToolBox tb = new ToolBox();
76
        tb.createDirectories("classes");
77

78
        new JavacTask(tb)
79
                .outdir("classes")
80
                .sources(DSrc)
81
                .run();
82

83
        // compile class H against the class files for classes D and Q
84
        new JavacTask(tb)
85
                .outdir("classes")
86
                .classpath("classes")
87
                .sources(HSrc)
88
                .run();
89
    }
90

91
}
92

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.