author | ascarpino |
Fri, 12 May 2017 08:20:11 -0700 | |
changeset 45992 | 38bdf44057b9 |
parent 36526 | 3b41f1c69604 |
permissions | -rw-r--r-- |
5216
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
1 |
/* |
36526 | 2 |
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. |
5216
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
4 |
* |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
8 |
* |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
13 |
* accompanied this code). |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
14 |
* |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
18 |
* |
5520 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
5216
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
22 |
*/ |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
23 |
|
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
24 |
/* |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
25 |
* @test |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
26 |
* @bug 6937244 |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
27 |
* @summary fields display with JVMS names, not Java names |
36526 | 28 |
* @modules jdk.jdeps/com.sun.tools.javap |
5216
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
29 |
*/ |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
30 |
|
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
31 |
import java.io.*; |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
32 |
import java.util.*; |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
33 |
|
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
34 |
public class T6937244A { |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
35 |
public static void main(String[] args) throws Exception { |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
36 |
new T6937244A().run(); |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
37 |
} |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
38 |
|
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
39 |
void run() throws Exception { |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
40 |
StringWriter sw = new StringWriter(); |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
41 |
PrintWriter pw = new PrintWriter(sw); |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
42 |
String[] args = { "Test" }; |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
43 |
int rc = com.sun.tools.javap.Main.run(args, pw); |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
44 |
pw.close(); |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
45 |
String out = sw.toString(); |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
46 |
System.err.println(out); |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
47 |
if (rc != 0) |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
48 |
throw new Exception("unexpected exit from javap: " + rc); |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
49 |
|
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
50 |
int count = 0; |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
51 |
|
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
52 |
for (String line: out.split("[\r\n]+")) { |
9078 | 53 |
if (line.contains("implements")) { |
54 |
verify(line, "implements java.util.List<java.lang.String>"); |
|
5216
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
55 |
count++; |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
56 |
} |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
57 |
|
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
58 |
if (line.contains("field")) { |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
59 |
verify(line, "java.util.List<java.lang.String> field"); |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
60 |
count++; |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
61 |
} |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
62 |
|
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
63 |
if (line.contains("method")) { |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
64 |
verify(line, "java.util.List<java.lang.String> method(java.util.List<java.lang.String>) throws java.lang.Exception"); |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
65 |
count++; |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
66 |
} |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
67 |
} |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
68 |
|
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
69 |
// final backstop check |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
70 |
if (out.contains("/")) |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
71 |
throw new Exception("unexpected \"/\" in output"); |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
72 |
|
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
73 |
if (count != 3) |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
74 |
throw new Exception("wrong number of matches found: " + count); |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
75 |
} |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
76 |
|
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
77 |
void verify(String line, String expect) throws Exception { |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
78 |
if (!line.contains(expect)) { |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
79 |
System.err.println("line: " + line); |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
80 |
System.err.println("expect: " + expect); |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
81 |
throw new Exception("expected string not found in line"); |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
82 |
} |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
83 |
} |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
84 |
} |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
85 |
|
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
86 |
|
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
87 |
abstract class Test implements List<String> { |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
88 |
public List<String> field; |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
89 |
public List<String> method(List<String> arg) throws Exception { return null; } |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
90 |
} |
b7f7018fa96a
6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80 used output of javap is changed
jjg
parents:
diff
changeset
|
91 |