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