T6863746.java revision 3294:9adfb22ff08f
1265574Smarcel/*
2265574Smarcel * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
3265574Smarcel * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4265574Smarcel *
5265574Smarcel * This code is free software; you can redistribute it and/or modify it
6265574Smarcel * under the terms of the GNU General Public License version 2 only, as
7265574Smarcel * published by the Free Software Foundation.
8265574Smarcel *
9265574Smarcel * This code is distributed in the hope that it will be useful, but WITHOUT
10265574Smarcel * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11265574Smarcel * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12265574Smarcel * version 2 for more details (a copy is included in the LICENSE file that
13265574Smarcel * accompanied this code).
14265574Smarcel *
15265574Smarcel * You should have received a copy of the GNU General Public License version
16265574Smarcel * 2 along with this work; if not, write to the Free Software Foundation,
17265574Smarcel * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18265574Smarcel *
19265574Smarcel * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20265574Smarcel * or visit www.oracle.com if you need additional information or have any
21265574Smarcel * questions.
22265574Smarcel */
23265574Smarcel
24265574Smarcelimport java.io.*;
25265574Smarcel
26265574Smarcel/*
27265574Smarcel * @test
28265574Smarcel * @bug 6863746
29265574Smarcel * @summary javap should not scan ct.sym by default
30265574Smarcel * @modules jdk.jdeps/com.sun.tools.javap
31265574Smarcel */
32265574Smarcel
33265574Smarcelpublic class T6863746 {
34265574Smarcel    public static void main(String... args) throws Exception{
35265574Smarcel        new T6863746().run();
36265579Smarcel    }
37265574Smarcel
38265574Smarcel    public void run() throws Exception {
39265574Smarcel        String[] args = { "-c", "java.lang.Object" };
40265574Smarcel        StringWriter sw = new StringWriter();
41265618Smarcel        PrintWriter pw = new PrintWriter(sw);
42265618Smarcel        int rc = com.sun.tools.javap.Main.run(args, pw);
43265725Smarcel        pw.close();
44265618Smarcel        String out = sw.toString();
45265618Smarcel        System.out.println(out);
46265618Smarcel        String[] lines = out.split("\n");
47265618Smarcel        // If ct.sym is being read, the output does not include
48265618Smarcel        // Code attributes, so check for Code attributes as a
49265618Smarcel        // way of detecting that ct.sym is not being used.
50265618Smarcel        if (lines.length < 50 || out.indexOf("Code:") == -1)
51265618Smarcel            throw new Exception("unexpected output from javap");
52265618Smarcel    }
53265618Smarcel}
54265574Smarcel