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