8219632: Remove reference to com.sun.javadoc API in RemoveOldDoclet test

Reviewed-by: jjg
This commit is contained in:
Priya Lakshmi Muthuswamy 2019-03-11 14:17:08 +05:30
parent c7ae2d10b7
commit 472d55d722
3 changed files with 12 additions and 40 deletions

View File

@ -756,13 +756,6 @@ public class Start extends ToolOption.Helper {
}
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;
}
}
}

View File

@ -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

View File

@ -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 @@ import javadoc.tester.JavadocTester;
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 @@ public class RemoveOldDoclet extends JavadocTester {
}
@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 @@ public class RemoveOldDoclet extends JavadocTester {
.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;
}
}
}