T6715753.java revision 3294:9adfb22ff08f
1237434Skib/*
2237434Skib * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
3237434Skib * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4237434Skib *
5237434Skib * This code is free software; you can redistribute it and/or modify it
6237434Skib * under the terms of the GNU General Public License version 2 only, as
7237434Skib * published by the Free Software Foundation.
8237434Skib *
9237434Skib * This code is distributed in the hope that it will be useful, but WITHOUT
10237434Skib * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11237434Skib * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12237434Skib * version 2 for more details (a copy is included in the LICENSE file that
13237434Skib * accompanied this code).
14237434Skib *
15237434Skib * You should have received a copy of the GNU General Public License version
16237434Skib * 2 along with this work; if not, write to the Free Software Foundation,
17237434Skib * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18237434Skib *
19237434Skib * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20237434Skib * or visit www.oracle.com if you need additional information or have any
21237434Skib * questions.
22237434Skib */
23237434Skib
24237434Skib/*
25237434Skib * @test
26237434Skib * @bug 6715753
27237434Skib * @summary Use javap to inquire about a specific inner class
28237434Skib * @modules jdk.jdeps/com.sun.tools.javap
29237434Skib */
30237434Skib
31237434Skibimport java.io.*;
32237434Skib
33237434Skibpublic class T6715753 {
34237434Skib    public static void main(String... args) throws Exception {
35237434Skib        new T6715753().run();
36237434Skib    }
37237434Skib
38237434Skib    void run() throws Exception {
39237434Skib        StringWriter sw = new StringWriter();
40237434Skib        PrintWriter pw = new PrintWriter(sw);
41237434Skib        String[] args = { "-notAnOption" };
42237434Skib        int rc = com.sun.tools.javap.Main.run(args, pw);
43237434Skib        String log = sw.toString();
44237434Skib        if (rc == 0
45237434Skib            || log.indexOf("-notAnOption") == -1
46237434Skib            || log.indexOf("javap") == -1) { // locale-independent indication of usage message
47237434Skib            System.err.println("rc: " + rc + ", log=\n" + log);
48237434Skib            throw new Exception("test failed");
49237434Skib        }
50237434Skib    }
51237434Skib}
52237434Skib