8219632: Remove reference to com.sun.javadoc API in RemoveOldDoclet test
Reviewed-by: jjg
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java Mon Mar 11 02:05:07 2019 -0400
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java Mon Mar 11 14:17:08 2019 +0530
@@ -756,13 +756,6 @@
}
String text = messager.getText("main.doclet_class_not_found", userDocletName);
throw new ToolException(CMDERR, text, cnfe);
- } catch (NoClassDefFoundError ncfe) {
- if (ncfe.getMessage().contains("com/sun/javadoc/Doclet")) {
- String text = messager.getText("main.not_a_doclet", userDocletName);
- throw new ToolException(ERROR, text, ncfe);
- } else {
- throw ncfe;
- }
}
}
--- a/test/langtools/jdk/javadoc/tool/removeOldDoclet/OldDoclet.jasm Mon Mar 11 02:05:07 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-
-super public class OldDoclet
- extends com/sun/javadoc/Doclet
- version 55:0
-{
-
-
-public Method "<init>":"()V"
- stack 1 locals 1
-{
- aload_0;
- invokespecial Method com/sun/javadoc/Doclet."<init>":"()V";
- return;
-
-}
-
-public static Method start:"(Lcom/sun/javadoc/RootDoc;)Z"
- stack 2 locals 1
-{
- getstatic Field java/lang/System.out:"Ljava/io/PrintStream;";
- ldc String "OLD_DOCLET_MARKER";
- invokevirtual Method java/io/PrintStream.println:"(Ljava/lang/String;)V";
- iconst_1;
- ireturn;
-
-}
-
-} // end Class OldDoclet
--- a/test/langtools/jdk/javadoc/tool/removeOldDoclet/RemoveOldDoclet.java Mon Mar 11 02:05:07 2019 -0400
+++ b/test/langtools/jdk/javadoc/tool/removeOldDoclet/RemoveOldDoclet.java Mon Mar 11 14:17:08 2019 +0530
@@ -28,7 +28,6 @@
* @library /tools/lib ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
* @build javadoc.tester.* toolbox.ToolBox builder.ClassBuilder
- * @compile OldDoclet.jasm
* @run main RemoveOldDoclet
*/
@@ -44,6 +43,7 @@
public class RemoveOldDoclet extends JavadocTester {
final ToolBox tb;
+ static final String Doclet_CLASS_NAME = TestDoclet.class.getName();
public static void main(String... args) throws Exception {
RemoveOldDoclet tester = new RemoveOldDoclet();
@@ -55,7 +55,7 @@
}
@Test
- public void testInvokeOldDoclet(Path base) throws Exception {
+ public void testInvalidDoclet(Path base) throws Exception {
Path srcDir = base.resolve("src");
Path outDir = base.resolve("out");
@@ -64,14 +64,21 @@
.write(srcDir);
javadoc("-d", outDir.toString(),
- "-doclet", "OldDoclet",
+ "-doclet", Doclet_CLASS_NAME,
"-docletpath", System.getProperty("test.classes", "."),
"-sourcepath", srcDir.toString(),
"pkg");
checkExit(Exit.ERROR);
checkOutput(Output.OUT, true,
- "javadoc: error - Class OldDoclet is not a valid doclet.\n"
- + "Note: As of JDK 13, the com.sun.javadoc API is no longer supported.");
+ "javadoc: error - Class " + Doclet_CLASS_NAME + " is not a valid doclet.\n"
+ + "Note: As of JDK 13, the com.sun.javadoc API is no longer supported.");
+ }
+
+ static class TestDoclet {
+ public static boolean start() {
+ System.out.println("OLD_DOCLET_MARKER");
+ return true;
+ }
}
}