T6937244.java revision 3294:9adfb22ff08f
1219019Sgabor/*
2219019Sgabor * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
3219019Sgabor * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4219019Sgabor *
5219019Sgabor * This code is free software; you can redistribute it and/or modify it
6219019Sgabor * under the terms of the GNU General Public License version 2 only, as
7219019Sgabor * published by the Free Software Foundation.
8219019Sgabor *
9219019Sgabor * This code is distributed in the hope that it will be useful, but WITHOUT
10219019Sgabor * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11219019Sgabor * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12219019Sgabor * version 2 for more details (a copy is included in the LICENSE file that
13219019Sgabor * accompanied this code).
14219019Sgabor *
15219019Sgabor * You should have received a copy of the GNU General Public License version
16219019Sgabor * 2 along with this work; if not, write to the Free Software Foundation,
17219019Sgabor * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18219019Sgabor *
19219019Sgabor * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20219019Sgabor * or visit www.oracle.com if you need additional information or have any
21219019Sgabor * questions.
22219019Sgabor */
23219019Sgabor
24219019Sgabor/*
25219019Sgabor * @test
26219019Sgabor * @bug 6937244
27219019Sgabor * @summary fields display with JVMS names, not Java names
28219019Sgabor * @modules jdk.jdeps/com.sun.tools.javap
29219019Sgabor */
30219019Sgabor
31219019Sgaborimport java.io.*;
32219019Sgabor
33219019Sgaborpublic class T6937244 {
34219019Sgabor    public static void main(String[] args) throws Exception {
35219019Sgabor        new T6937244().run();
36219019Sgabor    }
37219019Sgabor
38219019Sgabor    void run() throws Exception {
39219019Sgabor        StringWriter sw = new StringWriter();
40219019Sgabor        PrintWriter pw = new PrintWriter(sw);
41219019Sgabor        String[] args = { "java.lang.String" };
42219019Sgabor        int rc = com.sun.tools.javap.Main.run(args, pw);
43219019Sgabor        pw.close();
44219019Sgabor        String out = sw.toString();
45219019Sgabor        System.err.println(out);
46219019Sgabor        if (rc != 0)
47219019Sgabor            throw new Exception("unexpected exit from javap: " + rc);
48219019Sgabor        for (String line: out.split("[\r\n]+")) {
49219019Sgabor            if (line.contains("CASE_INSENSITIVE_ORDER")) {
50219019Sgabor                if (line.matches("\\s*\\Qpublic static final java.util.Comparator<java.lang.String> CASE_INSENSITIVE_ORDER;\\E\\s*"))
51219019Sgabor                    return;
52219019Sgabor                throw new Exception("declaration not shown as expected");
53219019Sgabor            }
54219019Sgabor        }
55219019Sgabor        throw new Exception("declaration of CASE_INSENSITIVE_ORDER not found");
56219019Sgabor    }
57219019Sgabor}
58219019Sgabor
59219019Sgabor