Fri, 24 Apr 2020 03:58:51 +0100
Merge
jjg@528 | 1 | /* |
ohair@554 | 2 | * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. |
jjg@528 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
jjg@528 | 4 | * |
jjg@528 | 5 | * This code is free software; you can redistribute it and/or modify it |
jjg@528 | 6 | * under the terms of the GNU General Public License version 2 only, as |
jjg@528 | 7 | * published by the Free Software Foundation. |
jjg@528 | 8 | * |
jjg@528 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
jjg@528 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
jjg@528 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
jjg@528 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
jjg@528 | 13 | * accompanied this code). |
jjg@528 | 14 | * |
jjg@528 | 15 | * You should have received a copy of the GNU General Public License version |
jjg@528 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
jjg@528 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
jjg@528 | 18 | * |
ohair@554 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@554 | 20 | * or visit www.oracle.com if you need additional information or have any |
ohair@554 | 21 | * questions. |
jjg@528 | 22 | */ |
jjg@528 | 23 | |
jjg@528 | 24 | /* |
jjg@528 | 25 | * @test |
jjg@528 | 26 | * @bug 6937244 |
jjg@528 | 27 | * @summary fields display with JVMS names, not Java names |
jjg@528 | 28 | */ |
jjg@528 | 29 | |
jjg@528 | 30 | import java.io.*; |
jjg@528 | 31 | |
jjg@528 | 32 | public class T6937244 { |
jjg@528 | 33 | public static void main(String[] args) throws Exception { |
jjg@528 | 34 | new T6937244().run(); |
jjg@528 | 35 | } |
jjg@528 | 36 | |
jjg@528 | 37 | void run() throws Exception { |
jjg@528 | 38 | StringWriter sw = new StringWriter(); |
jjg@528 | 39 | PrintWriter pw = new PrintWriter(sw); |
jjg@528 | 40 | String[] args = { "java.lang.String" }; |
jjg@528 | 41 | int rc = com.sun.tools.javap.Main.run(args, pw); |
jjg@528 | 42 | pw.close(); |
jjg@528 | 43 | String out = sw.toString(); |
jjg@528 | 44 | System.err.println(out); |
jjg@528 | 45 | if (rc != 0) |
jjg@528 | 46 | throw new Exception("unexpected exit from javap: " + rc); |
jjg@528 | 47 | for (String line: out.split("[\r\n]+")) { |
jjg@528 | 48 | if (line.contains("CASE_INSENSITIVE_ORDER")) { |
jjg@528 | 49 | if (line.matches("\\s*\\Qpublic static final java.util.Comparator<java.lang.String> CASE_INSENSITIVE_ORDER;\\E\\s*")) |
jjg@528 | 50 | return; |
jjg@528 | 51 | throw new Exception("declaration not shown as expected"); |
jjg@528 | 52 | } |
jjg@528 | 53 | } |
jjg@528 | 54 | throw new Exception("declaration of CASE_INSENSITIVE_ORDER not found"); |
jjg@528 | 55 | } |
jjg@528 | 56 | } |
jjg@528 | 57 |