8177484: The old standard doclet should be deprecated for removal

Reviewed-by: ksrini
This commit is contained in:
Jonathan Gibbons 2017-03-30 16:36:48 -07:00
parent 7b69bf343e
commit a50968d79f
3 changed files with 22 additions and 18 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014, 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
@ -47,7 +47,8 @@ define SetupInterimModule
$$(wildcard $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1)), \
EXCLUDES := sun com/sun/tools/jdeps com/sun/tools/javap \
com/sun/tools/jdeprscan, \
EXCLUDE_FILES := module-info.java JavacToolProvider.java JavadocToolProvider.java, \
EXCLUDE_FILES := module-info.java JavacToolProvider.java \
JavadocToolProvider.java Standard.java, \
COPY := .gif .png .xml .css .js javax.tools.JavaCompilerTool, \
BIN := $(BUILDTOOLS_OUTPUTDIR)/override_modules/$(strip $1), \
ADD_JAVAC_FLAGS := -Xbootclasspath/p:$$(call PathList, \

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -33,7 +33,7 @@ import com.sun.tools.doclets.formats.html.*;
* @deprecated The doclet has been superseded by its replacement,
* {@code jdk.javadoc.doclets.StandardDoclet}.
*/
@Deprecated
@Deprecated(forRemoval=true, since="9")
public class Standard {
public static int optionLength(String option) {

View File

@ -88,9 +88,8 @@ import static jdk.javadoc.internal.tool.Main.Result.*;
*/
public class Start extends ToolOption.Helper {
@SuppressWarnings("deprecation")
private static final Class<?> OldStdDoclet =
com.sun.tools.doclets.standard.Standard.class;
private static final String OldStdDocletName =
"com.sun.tools.doclets.standard.Standard";
private static final Class<?> StdDoclet =
jdk.javadoc.doclet.StandardDoclet.class;
@ -334,7 +333,7 @@ public class Start extends ToolOption.Helper {
messager.getWriter(WriterKind.ERROR),
messager.getWriter(WriterKind.WARNING),
messager.getWriter(WriterKind.NOTICE),
"com.sun.tools.doclets.standard.Standard",
OldStdDocletName,
nargv);
return (rc == 0) ? OK : ERROR;
}
@ -764,27 +763,31 @@ public class Start extends ToolOption.Helper {
// Step 4: we have a doclet, try loading it
if (docletName != null) {
try {
return Class.forName(docletName, true, getClass().getClassLoader());
} catch (ClassNotFoundException cnfe) {
if (apiMode) {
throw new IllegalArgumentException("Cannot find doclet class " + userDocletName);
}
String text = messager.getText("main.doclet_class_not_found", userDocletName);
throw new ToolException(CMDERR, text, cnfe);
}
return loadDocletClass(docletName);
}
// Step 5: we don't have a doclet specified, do we have taglets ?
if (!userTagletNames.isEmpty() && hasOldTaglet(userTagletNames, userTagletPath)) {
// found a bogey, return the old doclet
return OldStdDoclet;
return loadDocletClass(OldStdDocletName);
}
// finally
return StdDoclet;
}
private Class<?> loadDocletClass(String docletName) throws ToolException {
try {
return Class.forName(docletName, true, getClass().getClassLoader());
} catch (ClassNotFoundException cnfe) {
if (apiMode) {
throw new IllegalArgumentException("Cannot find doclet class " + docletName);
}
String text = messager.getText("main.doclet_class_not_found", docletName);
throw new ToolException(CMDERR, text, cnfe);
}
}
/*
* This method returns true iff it finds a legacy taglet, but for
* all other conditions including errors it returns false, allowing