25 * @test
26 * @bug 7004698
27 * @summary javap does not output CharacterRangeTable attributes correctly
28 * @modules jdk.jdeps/com.sun.tools.javap
29 */
30
31 import java.io.*;
32 import java.util.*;
33 import java.util.regex.*;
34
35 public class T7004698 {
36 public static void main(String... args) throws Exception {
37 new T7004698().run();
38 }
39
40 void run() throws Exception {
41 File srcDir = new File(System.getProperty("test.src"));
42 File srcFile = new File(srcDir, T7004698.class.getSimpleName() + ".java");
43 File classesDir = new File(".");
44 compile("-Xjcov",
45 "-XaddExports:jdk.jdeps/com.sun.tools.javap=ALL-UNNAMED",
46 "-d", classesDir.getPath(),
47 srcFile.getPath());
48
49 File classFile = new File(classesDir, T7004698.class.getSimpleName() + ".class");
50 String out = javap("-v", classFile.getPath());
51
52 Pattern attrBody = Pattern.compile("[0-9a-f, ]+//[-0-9a-z:, ]+");
53 Pattern endOfAttr = Pattern.compile("(^$|[A-Z][A-Za-z0-9_]+:.*|})");
54 boolean inAttr = false;
55 int count = 0;
56 int errors = 0;
57 for (String line: out.split(System.getProperty("line.separator"))) {
58 line = line.trim();
59 if (line.equals("CharacterRangeTable:")) {
60 inAttr = true;
61 count++;
62 } else if (inAttr) {
63 if (endOfAttr.matcher(line).matches()) {
64 inAttr = false;
65 } else if (!attrBody.matcher(line).matches()) {
|
25 * @test
26 * @bug 7004698
27 * @summary javap does not output CharacterRangeTable attributes correctly
28 * @modules jdk.jdeps/com.sun.tools.javap
29 */
30
31 import java.io.*;
32 import java.util.*;
33 import java.util.regex.*;
34
35 public class T7004698 {
36 public static void main(String... args) throws Exception {
37 new T7004698().run();
38 }
39
40 void run() throws Exception {
41 File srcDir = new File(System.getProperty("test.src"));
42 File srcFile = new File(srcDir, T7004698.class.getSimpleName() + ".java");
43 File classesDir = new File(".");
44 compile("-Xjcov",
45 "--add-exports", "jdk.jdeps/com.sun.tools.javap=ALL-UNNAMED",
46 "-d", classesDir.getPath(),
47 srcFile.getPath());
48
49 File classFile = new File(classesDir, T7004698.class.getSimpleName() + ".class");
50 String out = javap("-v", classFile.getPath());
51
52 Pattern attrBody = Pattern.compile("[0-9a-f, ]+//[-0-9a-z:, ]+");
53 Pattern endOfAttr = Pattern.compile("(^$|[A-Z][A-Za-z0-9_]+:.*|})");
54 boolean inAttr = false;
55 int count = 0;
56 int errors = 0;
57 for (String line: out.split(System.getProperty("line.separator"))) {
58 line = line.trim();
59 if (line.equals("CharacterRangeTable:")) {
60 inAttr = true;
61 count++;
62 } else if (inAttr) {
63 if (endOfAttr.matcher(line).matches()) {
64 inAttr = false;
65 } else if (!attrBody.matcher(line).matches()) {
|