T6937244.java revision 2942:08092deced3f
1251881Speter/* 2251881Speter * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. 3251881Speter * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4251881Speter * 5251881Speter * This code is free software; you can redistribute it and/or modify it 6251881Speter * under the terms of the GNU General Public License version 2 only, as 7251881Speter * published by the Free Software Foundation. 8251881Speter * 9251881Speter * This code is distributed in the hope that it will be useful, but WITHOUT 10251881Speter * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11251881Speter * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12251881Speter * version 2 for more details (a copy is included in the LICENSE file that 13251881Speter * accompanied this code). 14251881Speter * 15251881Speter * You should have received a copy of the GNU General Public License version 16251881Speter * 2 along with this work; if not, write to the Free Software Foundation, 17251881Speter * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18251881Speter * 19251881Speter * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20251881Speter * or visit www.oracle.com if you need additional information or have any 21251881Speter * questions. 22251881Speter */ 23251881Speter 24251881Speter/* 25251881Speter * @test 26251881Speter * @bug 6937244 27251881Speter * @summary fields display with JVMS names, not Java names 28251881Speter * @modules jdk.jdeps 29251881Speter */ 30251881Speter 31251881Speterimport java.io.*; 32251881Speter 33251881Speterpublic class T6937244 { 34251881Speter public static void main(String[] args) throws Exception { 35251881Speter new T6937244().run(); 36251881Speter } 37251881Speter 38251881Speter void run() throws Exception { 39251881Speter StringWriter sw = new StringWriter(); 40251881Speter PrintWriter pw = new PrintWriter(sw); 41251881Speter String[] args = { "java.lang.String" }; 42251881Speter int rc = com.sun.tools.javap.Main.run(args, pw); 43251881Speter pw.close(); 44251881Speter String out = sw.toString(); 45251881Speter System.err.println(out); 46251881Speter if (rc != 0) 47251881Speter throw new Exception("unexpected exit from javap: " + rc); 48251881Speter for (String line: out.split("[\r\n]+")) { 49251881Speter if (line.contains("CASE_INSENSITIVE_ORDER")) { 50251881Speter if (line.matches("\\s*\\Qpublic static final java.util.Comparator<java.lang.String> CASE_INSENSITIVE_ORDER;\\E\\s*")) 51251881Speter return; 52251881Speter throw new Exception("declaration not shown as expected"); 53251881Speter } 54251881Speter } 55251881Speter throw new Exception("declaration of CASE_INSENSITIVE_ORDER not found"); 56251881Speter } 57251881Speter} 58251881Speter 59251881Speter