345N/A/*
952N/A * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
345N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
345N/A *
345N/A * This code is free software; you can redistribute it and/or modify it
345N/A * under the terms of the GNU General Public License version 2 only, as
345N/A * published by the Free Software Foundation.
345N/A *
345N/A * This code is distributed in the hope that it will be useful, but WITHOUT
345N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
345N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
345N/A * version 2 for more details (a copy is included in the LICENSE file that
345N/A * accompanied this code).
345N/A *
345N/A * You should have received a copy of the GNU General Public License version
345N/A * 2 along with this work; if not, write to the Free Software Foundation,
345N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
345N/A *
553N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
553N/A * or visit www.oracle.com if you need additional information or have any
553N/A * questions.
345N/A */
345N/A
345N/A
345N/A/*
345N/A * @test
952N/A * @bug 4880672 7031005
345N/A * @summary javap does not output inner interfaces of an interface
345N/A */
345N/A
345N/Aimport java.io.*;
345N/Aimport java.util.*;
345N/A
345N/Apublic class T4880672
345N/A{
345N/A public static void main(String... args) {
345N/A new T4880672().run();
345N/A }
345N/A
345N/A void run() {
345N/A verify("java.util.Map", "public interface java.util.Map$Entry");
952N/A verify("T4880672", "class T4880672$A$B");
345N/A verify("C", ""); // must not give error if no InnerClasses attribute
345N/A if (errors > 0)
345N/A throw new Error(errors + " found.");
345N/A }
345N/A
345N/A void verify(String className, String... expects) {
345N/A String output = javap(className);
345N/A for (String expect: expects) {
345N/A if (output.indexOf(expect)< 0)
345N/A error(expect + " not found");
345N/A }
345N/A }
345N/A
345N/A void error(String msg) {
345N/A System.err.println(msg);
345N/A errors++;
345N/A }
345N/A
345N/A int errors;
345N/A
345N/A String javap(String className) {
345N/A String testClasses = System.getProperty("test.classes", ".");
345N/A StringWriter sw = new StringWriter();
345N/A PrintWriter out = new PrintWriter(sw);
345N/A String[] args = { "-XDinner", "-classpath", testClasses, className };
345N/A int rc = com.sun.tools.javap.Main.run(args, out);
345N/A out.close();
345N/A String output = sw.toString();
345N/A System.out.println("class " + className);
345N/A System.out.println(output);
345N/A if (rc != 0)
345N/A throw new Error("javap failed. rc=" + rc);
345N/A if (output.indexOf("Error:") != -1)
345N/A throw new Error("javap reported error.");
345N/A return output;
345N/A }
345N/A
345N/A class A {
345N/A class B { }
345N/A }
345N/A}
345N/A
345N/Aclass C { }
345N/A