changeset 4108:5aa6f825b4ec

8162917: langtools/test/tools/javadoc/CompletionError.java is not runnable Reviewed-by: ksrini
author jjg
date Mon, 17 Apr 2017 17:03:19 -0700
parents 2a8b403a6233
children b9a29aa786dd
files test/tools/javadoc/CompletionError.java
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/test/tools/javadoc/CompletionError.java	Mon Apr 17 15:28:37 2017 -0700
+++ b/test/tools/javadoc/CompletionError.java	Mon Apr 17 17:03:19 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,8 +27,10 @@
  * @summary Check that CompletionFailures for missing classes are not incorrectly passed to
  *          the javadoc API clients.
  * @library /tools/lib
- * @modules jdk.javadoc com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
+ * @build toolbox.JavacTask toolbox.ToolBox
  * @run main CompletionError
  */
 
@@ -37,6 +39,9 @@
 import com.sun.javadoc.*;
 import com.sun.tools.javadoc.Main;
 
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 public class CompletionError extends Doclet
 {
     private static final String template =
@@ -49,6 +54,9 @@
             "   public String toString() { return null; }" +
             "}";
 
+    private static final String testSrc = System.getProperty("test.src");
+    private static final String testClassPath = System.getProperty("test.class.path");
+
     public static void main(String[] args) throws Exception {
         String[] templateParts = template.split("#");
         int sources = templateParts.length / 2;
@@ -75,8 +83,8 @@
                 tb.deleteFiles("CompletionErrorMissing.class", "CompletionErrorIntfMissing.class", "CompletionErrorExcMissing.class");
                 // run javadoc:
                 if (Main.execute("javadoc", "CompletionError", CompletionError.class.getClassLoader(),
-                                 "-classpath", ".",
-                                 System.getProperty("test.src", ".") + File.separatorChar + "CompletionError.java") != 0)
+                                 "-classpath", "." + File.pathSeparator + testClassPath,
+                                 new File(testSrc, "CompletionError.java").getPath()) != 0)
                     throw new Error();
             }
         }