45N/A/*
553N/A * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
45N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
45N/A *
45N/A * This code is free software; you can redistribute it and/or modify it
45N/A * under the terms of the GNU General Public License version 2 only, as
45N/A * published by the Free Software Foundation.
45N/A *
45N/A * This code is distributed in the hope that it will be useful, but WITHOUT
45N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
45N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
45N/A * version 2 for more details (a copy is included in the LICENSE file that
45N/A * accompanied this code).
45N/A *
45N/A * You should have received a copy of the GNU General Public License version
45N/A * 2 along with this work; if not, write to the Free Software Foundation,
45N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
45N/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.
45N/A */
45N/A
45N/A/*
45N/A * @test
45N/A * @bug 4975569 6622215
45N/A * @summary javap doesn't print new flag bits
45N/A */
45N/A
45N/Aimport java.io.*;
45N/Aimport java.util.*;
45N/A
45N/Apublic class T4975569
45N/A{
45N/A public static void main(String... args) {
45N/A new T4975569().run();
45N/A }
45N/A
45N/A void run() {
45N/A verify("T4975569$Anno", "flags: ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION");
45N/A verify("T4975569$E", "flags: ACC_FINAL, ACC_SUPER, ACC_ENUM");
45N/A verify("T4975569$S", "flags: ACC_BRIDGE, ACC_SYNTHETIC",
348N/A "InnerClasses:\n static");
45N/A verify("T4975569$V", "void m(java.lang.String...)",
45N/A "flags: ACC_VARARGS");
348N/A verify("T4975569$Prot", "InnerClasses:\n protected");
45N/A //verify("T4975569$Priv", "InnerClasses");
45N/A if (errors > 0)
45N/A throw new Error(errors + " found.");
45N/A }
45N/A
45N/A void verify(String className, String... expects) {
45N/A String output = javap(className);
45N/A for (String expect: expects) {
45N/A if (output.indexOf(expect)< 0)
45N/A error(expect + " not found");
45N/A }
45N/A }
45N/A
45N/A void error(String msg) {
45N/A System.err.println(msg);
45N/A errors++;
45N/A }
45N/A
45N/A int errors;
45N/A
45N/A String javap(String className) {
385N/A String newline = System.getProperty("line.separator");
45N/A String testClasses = System.getProperty("test.classes", ".");
45N/A StringWriter sw = new StringWriter();
45N/A PrintWriter out = new PrintWriter(sw);
45N/A String[] args = { "-v", "-classpath", testClasses, className };
45N/A int rc = com.sun.tools.javap.Main.run(args, out);
45N/A if (rc != 0)
45N/A throw new Error("javap failed. rc=" + rc);
45N/A out.close();
385N/A String output = sw.toString().replaceAll(newline, "\n");
45N/A System.out.println("class " + className);
45N/A System.out.println(output);
45N/A return output;
45N/A }
45N/A
45N/A List x() { return null; };
45N/A
45N/A class V { void m(String... args) { } }
45N/A enum E { e; }
45N/A @interface Anno { }
45N/A static class S extends T4975569 {
45N/A ArrayList x() { return null; }
45N/A }
45N/A
45N/A protected class Prot { }
45N/A //private class Priv { int i; }
45N/A}
45N/A