jjg@528: /* jjg@953: * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. jjg@528: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jjg@528: * jjg@528: * This code is free software; you can redistribute it and/or modify it jjg@528: * under the terms of the GNU General Public License version 2 only, as jjg@528: * published by the Free Software Foundation. jjg@528: * jjg@528: * This code is distributed in the hope that it will be useful, but WITHOUT jjg@528: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jjg@528: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jjg@528: * version 2 for more details (a copy is included in the LICENSE file that jjg@528: * accompanied this code). jjg@528: * jjg@528: * You should have received a copy of the GNU General Public License version jjg@528: * 2 along with this work; if not, write to the Free Software Foundation, jjg@528: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jjg@528: * 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@528: */ jjg@528: jjg@528: /* jjg@528: * @test jjg@528: * @bug 6937244 jjg@528: * @summary fields display with JVMS names, not Java names jjg@528: */ jjg@528: jjg@528: import java.io.*; jjg@528: import java.util.*; jjg@528: jjg@528: public class T6937244A { jjg@528: public static void main(String[] args) throws Exception { jjg@528: new T6937244A().run(); jjg@528: } jjg@528: jjg@528: void run() throws Exception { jjg@528: StringWriter sw = new StringWriter(); jjg@528: PrintWriter pw = new PrintWriter(sw); jjg@528: String[] args = { "Test" }; jjg@528: int rc = com.sun.tools.javap.Main.run(args, pw); jjg@528: pw.close(); jjg@528: String out = sw.toString(); jjg@528: System.err.println(out); jjg@528: if (rc != 0) jjg@528: throw new Exception("unexpected exit from javap: " + rc); jjg@528: jjg@528: int count = 0; jjg@528: jjg@528: for (String line: out.split("[\r\n]+")) { jjg@953: if (line.contains("implements")) { jjg@953: verify(line, "implements java.util.List"); jjg@528: count++; jjg@528: } jjg@528: jjg@528: if (line.contains("field")) { jjg@528: verify(line, "java.util.List field"); jjg@528: count++; jjg@528: } jjg@528: jjg@528: if (line.contains("method")) { jjg@528: verify(line, "java.util.List method(java.util.List) throws java.lang.Exception"); jjg@528: count++; jjg@528: } jjg@528: } jjg@528: jjg@528: // final backstop check jjg@528: if (out.contains("/")) jjg@528: throw new Exception("unexpected \"/\" in output"); jjg@528: jjg@528: if (count != 3) jjg@528: throw new Exception("wrong number of matches found: " + count); jjg@528: } jjg@528: jjg@528: void verify(String line, String expect) throws Exception { jjg@528: if (!line.contains(expect)) { jjg@528: System.err.println("line: " + line); jjg@528: System.err.println("expect: " + expect); jjg@528: throw new Exception("expected string not found in line"); jjg@528: } jjg@528: } jjg@528: } jjg@528: jjg@528: jjg@528: abstract class Test implements List { jjg@528: public List field; jjg@528: public List method(List arg) throws Exception { return null; } jjg@528: } jjg@528: