< prev index next >

test/tools/javap/T7004698.java

Print this page




  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;




  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-modules", "jdk.jdeps",
  46                 "--add-exports", "jdk.jdeps/com.sun.tools.javap=ALL-UNNAMED",
  47                 "-d", classesDir.getPath(),
  48                 srcFile.getPath());
  49 
  50         File classFile = new File(classesDir, T7004698.class.getSimpleName() + ".class");
  51         String out = javap("-v", classFile.getPath());
  52 
  53         Pattern attrBody = Pattern.compile("[0-9a-f, ]+//[-0-9a-z:, ]+");
  54         Pattern endOfAttr = Pattern.compile("(^$|[A-Z][A-Za-z0-9_]+:.*|})");
  55         boolean inAttr = false;
  56         int count = 0;
  57         int errors = 0;
  58         for (String line: out.split(System.getProperty("line.separator"))) {
  59             line = line.trim();
  60             if (line.equals("CharacterRangeTable:")) {
  61                 inAttr = true;
  62                 count++;
  63             } else if (inAttr) {
  64                 if (endOfAttr.matcher(line).matches()) {
  65                     inAttr = false;


< prev index next >