< prev index next >

test/tools/javac/6627362/T6627362.java

Print this page
rev 3947 : imported patch xmodule-to-patch-module


  51 
  52     void testStandard() throws Exception {
  53         // compile and disassemble E.java, check for reference to Object.clone()
  54         File x = new File(testSrc, "x");
  55         String[] jcArgs = { "-d", ".",
  56                             new File(x, "E.java").getPath() };
  57         compile(jcArgs);
  58 
  59         String[] jpArgs = { "-classpath", ".", "-c", "E" };
  60 
  61         StringWriter sw = new StringWriter();
  62         javap(new PrintWriter(sw, true), jpArgs);
  63         check(sw.toString(), "Method \"[LE;\".clone:()Ljava/lang/Object;");
  64         callValues();
  65     }
  66 
  67     void testNoClone() throws Exception {
  68         // compile and disassemble E.java, using modified Object.java,
  69         // check for reference to System.arraycopy
  70         File x = new File(testSrc, "x");
  71         String[] jcArgs = { "-d", ".", "-Xmodule:java.base",
  72                             new File(x, "E.java").getPath(),
  73                             new File(x, "Object.java").getPath()};
  74         compile(jcArgs);
  75 
  76         String[] jpArgs = { "-classpath", ".", "-c", "E" };
  77 
  78         StringWriter sw = new StringWriter();
  79         javap(new PrintWriter(sw, true), jpArgs);
  80         check(sw.toString(), "// Method java/lang/System.arraycopy:(Ljava/lang/Object;ILjava/lang/Object;II)V");
  81         callValues();
  82     }
  83 
  84     void compile(String... args) {
  85         int rc = com.sun.tools.javac.Main.compile(args);
  86         if (rc != 0)
  87             throw new Error("javac failed: " + Arrays.asList(args) + ": " + rc);
  88     }
  89 
  90     void javap(PrintWriter out, String... args) throws Exception {
  91         int rc = com.sun.tools.javap.Main.run(args, out);
  92         if (rc != 0)
  93             throw new Error("javap failed: " + Arrays.asList(args) + ": " + rc);




  51 
  52     void testStandard() throws Exception {
  53         // compile and disassemble E.java, check for reference to Object.clone()
  54         File x = new File(testSrc, "x");
  55         String[] jcArgs = { "-d", ".",
  56                             new File(x, "E.java").getPath() };
  57         compile(jcArgs);
  58 
  59         String[] jpArgs = { "-classpath", ".", "-c", "E" };
  60 
  61         StringWriter sw = new StringWriter();
  62         javap(new PrintWriter(sw, true), jpArgs);
  63         check(sw.toString(), "Method \"[LE;\".clone:()Ljava/lang/Object;");
  64         callValues();
  65     }
  66 
  67     void testNoClone() throws Exception {
  68         // compile and disassemble E.java, using modified Object.java,
  69         // check for reference to System.arraycopy
  70         File x = new File(testSrc, "x");
  71         String[] jcArgs = { "-d", ".", "--patch-module", "java.base=" + x.getAbsolutePath(),
  72                             new File(x, "E.java").getPath(),
  73                             new File(new File(new File(x, "java"), "lang"), "Object.java").getPath()};
  74         compile(jcArgs);
  75 
  76         String[] jpArgs = { "-classpath", ".", "-c", "E" };
  77 
  78         StringWriter sw = new StringWriter();
  79         javap(new PrintWriter(sw, true), jpArgs);
  80         check(sw.toString(), "// Method java/lang/System.arraycopy:(Ljava/lang/Object;ILjava/lang/Object;II)V");
  81         callValues();
  82     }
  83 
  84     void compile(String... args) {
  85         int rc = com.sun.tools.javac.Main.compile(args);
  86         if (rc != 0)
  87             throw new Error("javac failed: " + Arrays.asList(args) + ": " + rc);
  88     }
  89 
  90     void javap(PrintWriter out, String... args) throws Exception {
  91         int rc = com.sun.tools.javap.Main.run(args, out);
  92         if (rc != 0)
  93             throw new Error("javap failed: " + Arrays.asList(args) + ": " + rc);


< prev index next >