diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotatedType.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotatedType.java deleted file mode 100644 index adc028cc511..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotatedType.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2003, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - - -/** - * Represents an annotated type. - * For example: - *
- *      {@code @NonNull String}
- *      {@code @Positive int}
- * 
- * - * @author Mahmood Ali - * @since 1.8 - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface AnnotatedType extends Type { - - /** - * Returns the annotations associated with this type. - * @return the annotations associated with this type - */ - AnnotationDesc[] annotations(); - - /** - * Returns the underlying type. - * @return the underlying type - */ - Type underlyingType(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationDesc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationDesc.java deleted file mode 100644 index 4098d4c531a..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationDesc.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2003, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - - -/** - * Represents an annotation. - * An annotation associates a value with each element of an annotation type. - * - * @author Scott Seligman - * @since 1.5 - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface AnnotationDesc { - - /** - * Returns the annotation type of this annotation. - * - * @return the annotation type of this annotation. - */ - AnnotationTypeDoc annotationType(); - - /** - * Returns this annotation's elements and their values. - * Only those explicitly present in the annotation are - * included, not those assuming their default values. - * Returns an empty array if there are none. - * - * @return this annotation's elements and their values. - */ - ElementValuePair[] elementValues(); - - /** - * Check for the synthesized bit on the annotation. - * - * @return true if the annotation is synthesized. - */ - boolean isSynthesized(); - - /** - * Represents an association between an annotation type element - * and one of its values. - * - * @author Scott Seligman - * @since 1.5 - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ - @Deprecated(since="9", forRemoval=true) - public interface ElementValuePair { - - /** - * Returns the annotation type element. - * - * @return the annotation type element. - */ - AnnotationTypeElementDoc element(); - - /** - * Returns the value associated with the annotation type element. - * - * @return the value associated with the annotation type element. - */ - AnnotationValue value(); - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationTypeDoc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationTypeDoc.java deleted file mode 100644 index c2399f8e829..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationTypeDoc.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2003, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - - -/** - * Represents an annotation type. - * - * @author Scott Seligman - * @since 1.5 - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface AnnotationTypeDoc extends ClassDoc { - - /** - * Returns the elements of this annotation type. - * Returns an empty array if there are none. - * - * @return the elements of this annotation type. - */ - AnnotationTypeElementDoc[] elements(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationTypeElementDoc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationTypeElementDoc.java deleted file mode 100644 index 584446c2d80..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationTypeElementDoc.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2003, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - - -/** - * Represents an element of an annotation type. - * - * @author Scott Seligman - * @since 1.5 - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface AnnotationTypeElementDoc extends MethodDoc { - - /** - * Returns the default value of this element. - * Returns null if this element has no default. - * - * @return the default value of this element. - */ - AnnotationValue defaultValue(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationValue.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationValue.java deleted file mode 100644 index 0a669b1db1f..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationValue.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2003, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - - -/** - * Represents a value of an annotation type element. - * - * @author Scott Seligman - * @since 1.5 - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface AnnotationValue { - - /** - * Returns the value. - * The type of the returned object is one of the following: - * - * - * @return the value. - */ - Object value(); - - /** - * Returns a string representation of the value. - * - * @return the text of a Java language annotation value expression - * whose value is the value of this element. - */ - String toString(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/ClassDoc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/ClassDoc.java deleted file mode 100644 index 2550d2ac7ac..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/ClassDoc.java +++ /dev/null @@ -1,362 +0,0 @@ -/* - * Copyright (c) 1998, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - - -/** - * Represents a java class or interface and provides access to - * information about the class, the class's comment and tags, and the - * members of the class. A ClassDoc only exists if it was - * processed in this run of javadoc. References to classes - * which may or may not have been processed in this run are - * referred to using Type (which can be converted to ClassDoc, - * if possible). - * - * @see Type - * - * @since 1.2 - * @author Kaiyang Liu (original) - * @author Robert Field (rewrite) - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface ClassDoc extends ProgramElementDoc, Type { - - /** - * Return true if this class is abstract. Return true - * for all interfaces. - * - * @return true if this class is abstract. Return true - * for all interfaces. - */ - boolean isAbstract(); - - /** - * Return true if this class implements or interface extends - * {@code java.io.Serializable}. - * - * Since {@code java.io.Externalizable} extends - * {@code java.io.Serializable}, - * Externalizable objects are also Serializable. - * - * @return true if this class implements or interface extends - * {@code java.io.Serializable}. - */ - boolean isSerializable(); - - /** - * Return true if this class implements or interface extends - * {@code java.io.Externalizable}. - * - * @return true if this class implements or interface extends - * {@code java.io.Externalizable}. - */ - boolean isExternalizable(); - - /** - * Return the serialization methods for this class or - * interface. - * - * @return an array of MethodDoc objects that represents - * the serialization methods for this class or interface. - */ - MethodDoc[] serializationMethods(); - - /** - * Return the Serializable fields of this class or interface. - *

- * Return either a list of default fields documented by - * {@code serial} tag
- * or return a single {@code FieldDoc} for - * {@code serialPersistentField} member. - * There should be a {@code serialField} tag for - * each Serializable field defined by an {@code ObjectStreamField} - * array component of {@code serialPersistentField}. - * - * @return an array of {@code FieldDoc} objects for the Serializable - * fields of this class or interface. - * - * @see #definesSerializableFields() - * @see SerialFieldTag - */ - FieldDoc[] serializableFields(); - - /** - * Return true if Serializable fields are explicitly defined with - * the special class member {@code serialPersistentFields}. - * - * @return true if Serializable fields are explicitly defined with - * the special class member {@code serialPersistentFields}. - * - * @see #serializableFields() - * @see SerialFieldTag - */ - boolean definesSerializableFields(); - - /** - * Return the superclass of this class. Return null if this is an - * interface. - * - *

This method cannot accommodate certain generic type constructs. - * The {@code superclassType} method should be used instead. - * - * @return the ClassDoc for the superclass of this class, null if - * there is no superclass. - * @see #superclassType - */ - ClassDoc superclass(); - - /** - * Return the superclass of this class. Return null if this is an - * interface. A superclass is represented by either a - * {@code ClassDoc} or a {@code ParametrizedType}. - * - * @return the superclass of this class, or null if there is no superclass. - * @since 1.5 - */ - Type superclassType(); - - /** - * Test whether this class is a subclass of the specified class. - * If this is an interface, return false for all classes except - * {@code java.lang.Object} (we must keep this unexpected - * behavior for compatibility reasons). - * - * @param cd the candidate superclass. - * @return true if cd is a superclass of this class. - */ - boolean subclassOf(ClassDoc cd); - - /** - * Return interfaces implemented by this class or interfaces extended - * by this interface. Includes only directly-declared interfaces, not - * inherited interfaces. - * Return an empty array if there are no interfaces. - * - *

This method cannot accommodate certain generic type constructs. - * The {@code interfaceTypes} method should be used instead. - * - * @return an array of ClassDoc objects representing the interfaces. - * @see #interfaceTypes - */ - ClassDoc[] interfaces(); - - /** - * Return interfaces implemented by this class or interfaces extended - * by this interface. Includes only directly-declared interfaces, not - * inherited interfaces. - * Return an empty array if there are no interfaces. - * - * @return an array of interfaces, each represented by a - * {@code ClassDoc} or a {@code ParametrizedType}. - * @since 1.5 - */ - Type[] interfaceTypes(); - - /** - * Return the formal type parameters of this class or interface. - * Return an empty array if there are none. - * - * @return the formal type parameters of this class or interface. - * @since 1.5 - */ - TypeVariable[] typeParameters(); - - /** - * Return the type parameter tags of this class or interface. - * Return an empty array if there are none. - * - * @return the type parameter tags of this class or interface. - * @since 1.5 - */ - ParamTag[] typeParamTags(); - - /** - * Return - * included - * fields in this class or interface. - * Excludes enum constants if this is an enum type. - * - * @return an array of FieldDoc objects representing the included - * fields in this class or interface. - */ - FieldDoc[] fields(); - - /** - * Return fields in this class or interface, filtered to the specified - * access - * modifier option. - * Excludes enum constants if this is an enum type. - * - * @param filter Specify true to filter according to the specified access - * modifier option. - * Specify false to include all fields regardless of - * access modifier option. - * @return an array of FieldDoc objects representing the included - * fields in this class or interface. - */ - FieldDoc[] fields(boolean filter); - - /** - * Return the enum constants if this is an enum type. - * Return an empty array if there are no enum constants, or if - * this is not an enum type. - * - * @return the enum constants if this is an enum type. - */ - FieldDoc[] enumConstants(); - - /** - * Return - * included - * methods in this class or interface. - * Same as {@code methods(true)}. - * - * @return an array of MethodDoc objects representing the included - * methods in this class or interface. Does not include - * constructors or annotation type elements. - */ - MethodDoc[] methods(); - - /** - * Return methods in this class or interface, filtered to the specified - * access - * modifier option. Does not include constructors or annotation - * type elements. - * - * @param filter Specify true to filter according to the specified access - * modifier option. - * Specify false to include all methods regardless of - * access modifier option. - * - * @return an array of MethodDoc objects representing the included - * methods in this class or interface. - */ - MethodDoc[] methods(boolean filter); - - /** - * Return - * included - * constructors in this class. An array containing the default - * no-arg constructor is returned if no other constructors exist. - * Return empty array if this is an interface. - * - * @return an array of ConstructorDoc objects representing the included - * constructors in this class. - */ - ConstructorDoc[] constructors(); - - /** - * Return constructors in this class, filtered to the specified - * access - * modifier option. Return an array containing the default - * no-arg constructor if no other constructors exist. - * - * @param filter Specify true to filter according to the specified access - * modifier option. - * Specify false to include all constructors regardless of - * access modifier option. - * @return an array of ConstructorDoc objects representing the included - * constructors in this class. - */ - ConstructorDoc[] constructors(boolean filter); - - - /** - * Return - * included - * nested classes and interfaces within this class or interface. - * This includes both static and non-static nested classes. - * (This method should have been named {@code nestedClasses()}, - * as inner classes are technically non-static.) Anonymous and local classes - * or interfaces are not included. - * - * @return an array of ClassDoc objects representing the included classes - * and interfaces defined in this class or interface. - */ - ClassDoc[] innerClasses(); - - /** - * Return nested classes and interfaces within this class or interface - * filtered to the specified - * access - * modifier option. - * This includes both static and non-static nested classes. - * Anonymous and local classes are not included. - * - * @param filter Specify true to filter according to the specified access - * modifier option. - * Specify false to include all nested classes regardless of - * access modifier option. - * @return a filtered array of ClassDoc objects representing the included - * classes and interfaces defined in this class or interface. - */ - ClassDoc[] innerClasses(boolean filter); - - /** - * Find the specified class or interface within the context of this class doc. - * Search order: 1) qualified name, 2) nested in this class or interface, - * 3) in this package, 4) in the class imports, 5) in the package imports. - * Return the ClassDoc if found, null if not found. - * @param className Specify the class name to find as a String. - * @return the ClassDoc if found, null if not found. - */ - ClassDoc findClass(String className); - - /** - * Get the list of classes and interfaces declared as imported. - * These are called "single-type-import declarations" in - * The Java™ Language Specification. - * - * @return an array of ClassDoc representing the imported classes. - * - * @deprecated Import declarations are implementation details that - * should not be exposed here. In addition, not all imported - * classes are imported through single-type-import declarations. - */ - @Deprecated(since="9", forRemoval=true) - ClassDoc[] importedClasses(); - - /** - * Get the list of packages declared as imported. - * These are called "type-import-on-demand declarations" in - * The Java™ Language Specification. - * - * @return an array of PackageDoc representing the imported packages. - * - * @deprecated Import declarations are implementation details that - * should not be exposed here. In addition, this method's - * return type does not allow for all type-import-on-demand - * declarations to be returned. - */ - @Deprecated(since="9", forRemoval=true) - PackageDoc[] importedPackages(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/ConstructorDoc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/ConstructorDoc.java deleted file mode 100644 index 8fc1c003b08..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/ConstructorDoc.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 1998, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - -/** - * Represents a constructor of a java class. - * - * @since 1.2 - * @author Robert Field - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface ConstructorDoc extends ExecutableMemberDoc { -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/Doc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/Doc.java deleted file mode 100644 index 34310015fba..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/Doc.java +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright (c) 1998, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - -import java.text.BreakIterator; -import java.util.Locale; - -/** - * Represents Java language constructs (package, class, constructor, - * method, field) which have comments and have been processed by this - * run of javadoc. All Doc objects are unique, that is, they - * are == comparable. - * - * @since 1.2 - * @author Robert Field - * @author Scott Seligman (generics, enums, annotations) - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface Doc extends Comparable { - - /** - * Return the text of the comment for this doc item. - * Tags have been removed. - * - * @return the text of the comment for this doc item. - */ - String commentText(); - - /** - * Return all tags in this Doc item. - * - * @return an array of {@link Tag} objects containing all tags on - * this Doc item. - */ - Tag[] tags(); - - /** - * Return tags of the specified {@linkplain Tag#kind() kind} in - * this Doc item. - * - * For example, if 'tagname' has value "@serial", all tags in - * this Doc item of kind "@serial" will be returned. - * - * @param tagname name of the tag kind to search for. - * @return an array of Tag containing all tags whose 'kind()' - * matches 'tagname'. - */ - Tag[] tags(String tagname); - - /** - * Return the see also tags in this Doc item. - * - * @return an array of SeeTag containing all @see tags. - */ - SeeTag[] seeTags(); - - /** - * Return comment as an array of tags. Includes inline tags - * (i.e. {@link reference} tags) but not - * block tags. - * Each section of plain text is represented as a {@link Tag} - * of {@linkplain Tag#kind() kind} "Text". - * Inline tags are represented as a {@link SeeTag} of kind "@see" - * and name "@link". - * - * @return an array of {@link Tag}s representing the comment - */ - Tag[] inlineTags(); - - /** - * Return the first sentence of the comment as an array of tags. - * Includes inline tags - * (i.e. {@link reference} tags) but not - * block tags. - * Each section of plain text is represented as a {@link Tag} - * of {@linkplain Tag#kind() kind} "Text". - * Inline tags are represented as a {@link SeeTag} of kind "@see" - * and name "@link". - *

- * If the locale is English language, the first sentence is - * determined by the rules described in the Java Language - * Specification (first version): "This sentence ends - * at the first period that is followed by a blank, tab, or - * line terminator or at the first tagline.", in - * addition a line will be terminated by block - * HTML tags: <p> </p> <h1> - * <h2> <h3> <h4> <h5> <h6> - * <hr> <pre> or </pre>. - * If the locale is not English, the sentence end will be - * determined by - * {@link BreakIterator#getSentenceInstance(Locale)}. - - * @return an array of {@link Tag}s representing the - * first sentence of the comment - */ - Tag[] firstSentenceTags(); - - /** - * Return the full unprocessed text of the comment. Tags - * are included as text. Used mainly for store and retrieve - * operations like internalization. - * - * @return the full unprocessed text of the comment. - */ - String getRawCommentText(); - - /** - * Set the full unprocessed text of the comment. Tags - * are included as text. Used mainly for store and retrieve - * operations like internalization. - * - * @param rawDocumentation A String containing the full unprocessed text of the comment. - */ - void setRawCommentText(String rawDocumentation); - - /** - * Returns the non-qualified name of this Doc item. - * - * @return the name - */ - String name(); - - /** - * Compares this doc object with the specified object for order. Returns a - * negative integer, zero, or a positive integer as this doc object is less - * than, equal to, or greater than the given object. - *

- * This method satisfies the {@link java.lang.Comparable} interface. - * - * @param obj the {@code Object} to be compared. - * @return a negative integer, zero, or a positive integer as this Object - * is less than, equal to, or greater than the given Object. - * @exception ClassCastException the specified Object's type prevents it - * from being compared to this Object. - */ - int compareTo(Object obj); - - /** - * Is this Doc item a field (but not an enum constant)? - * - * @return true if it represents a field - */ - boolean isField(); - - /** - * Is this Doc item an enum constant? - * - * @return true if it represents an enum constant - * @since 1.5 - */ - boolean isEnumConstant(); - - /** - * Is this Doc item a constructor? - * - * @return true if it represents a constructor - */ - boolean isConstructor(); - - /** - * Is this Doc item a method (but not a constructor or annotation - * type element)? - * - * @return true if it represents a method - */ - boolean isMethod(); - - /** - * Is this Doc item an annotation type element? - * - * @return true if it represents an annotation type element - * @since 1.5 - */ - boolean isAnnotationTypeElement(); - - /** - * Is this Doc item an interface (but not an annotation type)? - * - * @return true if it represents an interface - */ - boolean isInterface(); - - /** - * Is this Doc item an exception class? - * - * @return true if it represents an exception - */ - boolean isException(); - - /** - * Is this Doc item an error class? - * - * @return true if it represents a error - */ - boolean isError(); - - /** - * Is this Doc item an enum type? - * - * @return true if it represents an enum type - * @since 1.5 - */ - boolean isEnum(); - - /** - * Is this Doc item an annotation type? - * - * @return true if it represents an annotation type - * @since 1.5 - */ - boolean isAnnotationType(); - - /** - * Is this Doc item an - * ordinary - * class? - * (i.e. not an interface, annotation type, enum, exception, or error)? - * - * @return true if it represents an ordinary class - */ - boolean isOrdinaryClass(); - - /** - * Is this Doc item a - * class - * (and not an interface or annotation type)? - * This includes ordinary classes, enums, errors and exceptions. - * - * @return true if it represents a class - */ - boolean isClass(); - - /** - * Return true if this Doc item is - * included - * in the result set. - * - * @return true if this Doc item is - * included - * in the result set. - */ - boolean isIncluded(); - - /** - * Return the source position of the first line of the - * corresponding declaration, or null if - * no position is available. A default constructor returns - * null because it has no location in the source file. - * - * @since 1.4 - * @return the source positino of the first line of the - * corresponding declaration, or null if - * no position is available. A default constructor returns - * null because it has no location in the source file. - */ - SourcePosition position(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/DocErrorReporter.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/DocErrorReporter.java deleted file mode 100644 index 33167d8e191..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/DocErrorReporter.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 1998, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - -/** - * This interface provides error, warning and notice printing. - * - * @since 1.2 - * @author Robert Field - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface DocErrorReporter { - - /** - * Print error message and increment error count. - * - * @param msg message to print - */ - void printError(String msg); - - /** - * Print an error message and increment error count. - * - * @param pos the position item where the error occurs - * @param msg message to print - * @since 1.4 - */ - void printError(SourcePosition pos, String msg); - - /** - * Print warning message and increment warning count. - * - * @param msg message to print - */ - void printWarning(String msg); - - /** - * Print warning message and increment warning count. - * - * @param pos the position item where the warning occurs - * @param msg message to print - * @since 1.4 - */ - void printWarning(SourcePosition pos, String msg); - - /** - * Print a message. - * - * @param msg message to print - */ - void printNotice(String msg); - - /** - * Print a message. - * - * @param pos the position item where the message occurs - * @param msg message to print - * @since 1.4 - */ - void printNotice(SourcePosition pos, String msg); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/Doclet.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/Doclet.java deleted file mode 100644 index 7b4dfc78a9f..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/Doclet.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 1997, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - -/** - * This is an example of a starting class for a doclet, - * showing the entry-point methods. A starting class must - * import com.sun.javadoc.* and implement the - * {@code start(RootDoc)} method, as described in the - * package - * description. If the doclet takes command line options, - * it must also implement {@code optionLength} and - * {@code validOptions}. - * - *

A doclet supporting the language features added since 1.1 - * (such as generics and annotations) should indicate this - * by implementing {@code languageVersion}. In the absence of - * this the doclet should not invoke any of the Doclet API methods - * added since 1.5, and - * the results of several other methods are modified so as - * to conceal the new constructs (such as type parameters) from - * the doclet. - * - *

To start the doclet, pass - * {@code -doclet} followed by the fully-qualified - * name of the starting class on the javadoc tool command line. - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public abstract class Doclet { - - /** - * Generate documentation here. - * This method is required for all doclets. - * - * @param root Supply the RootDoc to the method. - * @return true on success. - */ - public static boolean start(RootDoc root) { - return true; - } - - /** - * Check for doclet-added options. Returns the number of - * arguments you must specify on the command line for the - * given option. For example, "-d docs" would return 2. - *

- * This method is required if the doclet contains any options. - * If this method is missing, Javadoc will print an invalid flag - * error for every option. - * - * @param option the option for which the number of arguements is returned. - * @return number of arguments on the command line for an option - * including the option name itself. Zero return means - * option not known. Negative value means error occurred. - */ - public static int optionLength(String option) { - return 0; // default is option unknown - } - - /** - * Check that options have the correct arguments. - *

- * This method is not required, but is recommended, - * as every option will be considered valid if this method - * is not present. It will default gracefully (to true) - * if absent. - *

- * Printing option related error messages (using the provided - * DocErrorReporter) is the responsibility of this method. - * - * @param options Supply valid options as an array of Strings. - * @param reporter The DocErrorReporter responsible for these options. - * @return true if the options are valid. - */ - public static boolean validOptions(String options[][], - DocErrorReporter reporter) { - return true; // default is options are valid - } - - /** - * Return the version of the Java Programming Language supported - * by this doclet. - *

- * This method is required by any doclet supporting a language version - * newer than 1.1. - * - * @return the language version supported by this doclet. - * @since 1.5 - */ - public static LanguageVersion languageVersion() { - return LanguageVersion.JAVA_1_1; - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/ExecutableMemberDoc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/ExecutableMemberDoc.java deleted file mode 100644 index 71f0a3fce41..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/ExecutableMemberDoc.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 1998, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - -/** - * Represents a method or constructor of a java class. - * - * @since 1.2 - * @author Robert Field - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface ExecutableMemberDoc extends MemberDoc { - - /** - * Return exceptions this method or constructor throws. - * If the type of the exception is a type variable, return the - * {@code ClassDoc} of its erasure. - * - *

The {@code thrownExceptions} method cannot - * accommodate certain generic type constructs. The - * {@code thrownExceptionTypes} method should be used - * instead. - * - * @return an array of ClassDoc[] representing the exceptions - * thrown by this method. - * @see #thrownExceptionTypes - */ - ClassDoc[] thrownExceptions(); - - /** - * Return exceptions this method or constructor throws. - * - * @return an array representing the exceptions thrown by this method. - * Each array element is either a {@code ClassDoc} or a - * {@code TypeVariable}. - * @since 1.5 - */ - Type[] thrownExceptionTypes(); - - /** - * Return true if this method is native - * - * @return true if this method is native - */ - boolean isNative(); - - /** - * Return true if this method is synchronized - * - * @return true if this method is synchronized - */ - boolean isSynchronized(); - - /** - * Return true if this method was declared to take a variable number - * of arguments. - * - * @since 1.5 - * @return true if this method was declared to take a variable number of arguments. - */ - public boolean isVarArgs(); - - /** - * Get argument information. - * - * @see Parameter - * - * @return an array of Parameter, one element per argument - * in the order the arguments are present. - */ - Parameter[] parameters(); - - /** - * Get the receiver type of this executable element. - * - * @return the receiver type of this executable element. - * @since 1.8 - */ - Type receiverType(); - - /** - * Return the throws tags in this method. - * - * @return an array of ThrowTag containing all {@code @exception} - * and {@code @throws} tags. - */ - ThrowsTag[] throwsTags(); - - /** - * Return the param tags in this method, excluding the type - * parameter tags. - * - * @return an array of ParamTag containing all {@code @param} tags - * corresponding to the parameters of this method. - */ - ParamTag[] paramTags(); - - /** - * Return the type parameter tags in this method. - * - * @return an array of ParamTag containing all {@code @param} tags - * corresponding to the type parameters of this method. - * @since 1.5 - */ - ParamTag[] typeParamTags(); - - /** - * Get the signature. It is the parameter list, type is qualified. - * For instance, for a method {@code mymethod(String x, int y)}, - * it will return {@code (java.lang.String,int)}. - * - * @return the parameter list where type is qualified. - */ - String signature(); - - /** - * get flat signature. all types are not qualified. - * return a String, which is the flat signiture of this member. - * It is the parameter list, type is not qualified. - * For instance, for a method {@code mymethod(String x, int y)}, - * it will return {@code (String, int)}. - * - * @return a String, which is the flat signiture of this member. - */ - String flatSignature(); - - /** - * Return the formal type parameters of this method or constructor. - * Return an empty array if this method or constructor is not generic. - * - * @return the formal type parameters of this method or constructor. - * @since 1.5 - */ - TypeVariable[] typeParameters(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/FieldDoc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/FieldDoc.java deleted file mode 100644 index 5e7f9270d6a..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/FieldDoc.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 1998, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - -/** - * Represents a field in a java class. - * - * @see MemberDoc - * - * @since 1.2 - * @author Robert Field - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface FieldDoc extends MemberDoc { - - /** - * Get type of this field. - * - * @return the type of this field. - */ - Type type(); - - /** - * Return true if this field is transient - * - * @return true if this field is transient - */ - boolean isTransient(); - - /** - * Return true if this field is volatile - * - * @return true if this field is volatile - */ - boolean isVolatile(); - - /** - * Return the serialField tags in this FieldDoc item. - * - * @return an array of {@code SerialFieldTag} objects containing - * all {@code @serialField} tags. - */ - SerialFieldTag[] serialFieldTags(); - - /** - * Get the value of a constant field. - * - * @return the value of a constant field. The value is - * automatically wrapped in an object if it has a primitive type. - * If the field is not constant, returns null. - */ - Object constantValue(); - - /** - * Get the value of a constant field. - * - * @return the text of a Java language expression whose value - * is the value of the constant. The expression uses no identifiers - * other than primitive literals. If the field is - * not constant, returns null. - */ - String constantValueExpression(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/LanguageVersion.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/LanguageVersion.java deleted file mode 100644 index 83d338a61a6..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/LanguageVersion.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2003, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - - -/** - * Java Programming Language version. The constants of this enum - * identify the JDK and J2SE releases containing language changes - * relevant to doclets. - *

- * All doclets support at least the 1.1 language version. - * The first release subsequent to this with language changes - * affecting doclets is 1.5. - * - * @since 1.5 - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public enum LanguageVersion { - - /** 1.1 added nested classes and interfaces. */ - JAVA_1_1, - - /** 1.5 added generic types, annotations, enums, and varArgs. */ - JAVA_1_5 -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/MemberDoc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/MemberDoc.java deleted file mode 100644 index 97211fc9a24..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/MemberDoc.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 1998, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - -/** - * Represents a member of a java class: field, constructor, or method. - * This is an abstract class dealing with information common to - * method, constructor and field members. Class members of a class - * (innerclasses) are represented instead by ClassDoc. - * - * @see MethodDoc - * @see FieldDoc - * @see ClassDoc - * - * @author Kaiyang Liu (original) - * @author Robert Field (rewrite) - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface MemberDoc extends ProgramElementDoc { - - /** - * Returns true if this member was synthesized by the compiler. - * - * @return true if this member was synthesized by the compiler. - */ - boolean isSynthetic(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/MethodDoc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/MethodDoc.java deleted file mode 100644 index 0fb086227d8..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/MethodDoc.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 1998, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - -/** - * Represents a method of a java class. - * - * @since 1.2 - * @author Robert Field - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface MethodDoc extends ExecutableMemberDoc { - - /** - * Return true if this method is abstract - * - * @return true if this method is abstract - */ - boolean isAbstract(); - - /** - * Return true if this method is default - * - * @return true if this method is default - */ - boolean isDefault(); - - /** - * Get return type. - * - * @return the return type of this method, null if it - * is a constructor. - */ - Type returnType(); - - /** - * Return the class containing the method that this method overrides. - * - *

The {@code overriddenClass} method cannot - * accommodate certain generic type constructs. The - * {@code overriddenType} method should be used instead. - * - * @return a ClassDoc representing the superclass - * defining a method that this method overrides, or null if - * this method does not override. - */ - ClassDoc overriddenClass(); - - /** - * Return the type containing the method that this method overrides. - * It may be a {@code ClassDoc} or a {@code ParameterizedType}. - * - * @return the supertype whose method is overridden, or null if this - * method does not override another in a superclass - * @since 1.5 - */ - Type overriddenType(); - - /** - * Return the method that this method overrides. - * - * @return a MethodDoc representing a method definition - * in a superclass this method overrides, null if - * this method does not override. - */ - MethodDoc overriddenMethod(); - - /** - * Tests whether this method overrides another. - * The overridden method may be one declared in a superclass or - * a superinterface (unlike {@link #overriddenMethod()}). - * - *

When a non-abstract method overrides an abstract one, it is - * also said to implement the other. - * - * @param meth the other method to examine - * @return {@code true} if this method overrides the other - * @since 1.5 - */ - boolean overrides(MethodDoc meth); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/PackageDoc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/PackageDoc.java deleted file mode 100644 index 24e0828d1c8..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/PackageDoc.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 1998, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - -/** - * Represents a java package. Provides access to information - * about the package, the package's comment and tags, and the - * classes in the package. - *

- * Each method whose return type is an array will return an empty - * array (never null) when there are no objects in the result. - * - * @since 1.2 - * @author Kaiyang Liu (original) - * @author Robert Field (rewrite) - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface PackageDoc extends Doc { - - /** - * Get all classes and interfaces in the package, filtered to the specified - * access - * modifier option. - * - * @return filtered classes and interfaces in this package - * @param filter Specifying true filters according to the specified access - * modifier option. - * Specifying false includes all classes and interfaces - * regardless of access modifier option. - * @since 1.4 - */ - ClassDoc[] allClasses(boolean filter); - - /** - * Get all - * included - * classes and interfaces in the package. Same as allClasses(true). - * - * @return all included classes and interfaces in this package. - */ - ClassDoc[] allClasses(); - - /** - * Get included - * ordinary - * classes (that is, exclude exceptions, errors, enums, interfaces, and - * annotation types) - * in this package. - * - * @return included ordinary classes in this package. - */ - ClassDoc[] ordinaryClasses(); - - /** - * Get included Exception classes in this package. - * - * @return included Exceptions in this package. - */ - ClassDoc[] exceptions(); - - /** - * Get included Error classes in this package. - * - * @return included Errors in this package. - */ - ClassDoc[] errors(); - - /** - * Get included enum types in this package. - * - * @return included enum types in this package. - * @since 1.5 - */ - ClassDoc[] enums(); - - /** - * Get included interfaces in this package, omitting annotation types. - * - * @return included interfaces in this package. - */ - ClassDoc[] interfaces(); - - /** - * Get included annotation types in this package. - * - * @return included annotation types in this package. - * @since 1.5 - */ - AnnotationTypeDoc[] annotationTypes(); - - /** - * Get the annotations of this package. - * Return an empty array if there are none. - * - * @return the annotations of this package. - * @since 1.5 - */ - AnnotationDesc[] annotations(); - - /** - * Lookup a class or interface within this package. - * - * @param className A String containing the name of the class to look up. - * @return ClassDoc of found class or interface, - * or null if not found. - */ - ClassDoc findClass(String className); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/ParamTag.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/ParamTag.java deleted file mode 100644 index 66c82dba4c1..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/ParamTag.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 1998, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - -/** - * Represents an @param documentation tag. - * Stores the name and comment parts of the parameter tag. - * An @param tag may represent either a method or constructor parameter, - * or a type parameter. - * - * @author Robert Field - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface ParamTag extends Tag { - - /** - * Return the name of the parameter or type parameter - * associated with this {@code ParamTag}. - * The angle brackets delimiting a type parameter are not part of - * its name. - * - * @return the parameter name. - */ - String parameterName(); - - /** - * Return the parameter comment - * associated with this {@code ParamTag}. - * - * @return the parameter comment. - */ - String parameterComment(); - - /** - * Return true if this {@code ParamTag} corresponds to a type - * parameter. Return false if it corresponds to an ordinary parameter - * of a method or constructor. - * - * @return true if this {@code ParamTag} corresponds to a type - * parameter. - * @since 1.5 - */ - boolean isTypeParameter(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/Parameter.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/Parameter.java deleted file mode 100644 index aeeeeda6868..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/Parameter.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 1998, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - -/** - * Parameter information. - * This includes a parameter type and parameter name. - * - * @author Robert Field - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface Parameter { - - /** - * Get the type of this parameter. - * - * @return the type of this parameter. - */ - Type type(); - - /** - * Get local name of this parameter. - * For example if parameter is the short 'index', returns "index". - * - * @return the name of this parameter as a string. - */ - String name(); - - /** - * Get type name of this parameter. - * For example if parameter is the short 'index', returns "short". - *

- * This method returns a complete string - * representation of the type, including the dimensions of arrays and - * the type arguments of parameterized types. Names are qualified. - * - * @return a complete string representation of the type. - */ - String typeName(); - - /** - * Returns a string representation of the parameter. - *

- * For example if parameter is the short 'index', returns "short index". - * - * @return type and parameter name of this parameter. - */ - String toString(); - - /** - * Get the annotations of this parameter. - * Return an empty array if there are none. - * - * @return the annotations of this parameter. - * @since 1.5 - */ - AnnotationDesc[] annotations(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/ParameterizedType.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/ParameterizedType.java deleted file mode 100644 index 9c665271e47..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/ParameterizedType.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2003, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - - -/** - * Represents an invocation of a generic class or interface. For example, - * given the generic interface {@code List}, possible invocations - * include: - *

- *      {@code List}
- *      {@code List}
- *      {@code List}
- * 
- * A generic inner class {@code Outer.Inner} might be invoked as: - *
- *      {@code Outer.Inner}
- * 
- * - * @author Scott Seligman - * @since 1.5 - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface ParameterizedType extends Type { - - /** - * Return the generic class or interface that declared this type. - * - * @return the generic class or interface that declared this type. - */ - ClassDoc asClassDoc(); - - /** - * Return the actual type arguments of this type. - * For a generic type that is nested within some other generic type - * (such as {@code Outer.Inner}), - * only the type arguments of the innermost type are included. - * - * @return the actual type arguments of this type. - */ - Type[] typeArguments(); - - /** - * Return the class type that is a direct supertype of this one. - * This is the superclass of this type's declaring class, - * with type arguments substituted in. - * Return null if this is an interface type. - * - *

For example, if this parameterized type is - * {@code java.util.ArrayList}, the result will be - * {@code java.util.AbstractList}. - * - * @return the class type that is a direct supertype of this one. - */ - Type superclassType(); - - /** - * Return the interface types directly implemented by or extended by this - * parameterized type. - * These are the interfaces directly implemented or extended - * by this type's declaring class or interface, - * with type arguments substituted in. - * Return an empty array if there are no interfaces. - * - *

For example, the interface extended by - * {@code java.util.Set} is {@code java.util.Collection}. - * - * @return the interface types directly implemented by or extended by this - * parameterized type. - */ - Type[] interfaceTypes(); - - /** - * Return the type that contains this type as a member. - * Return null is this is a top-level type. - * - *

For example, the containing type of - * {@code AnInterface.Nested} is the {@code ClassDoc} - * representing {@code AnInterface}, and the containing type of - * {@code Outer.Inner} is the - * {@code ParameterizedType} representing {@code Outer}. - * - * @return the type that contains this type as a member. - */ - Type containingType(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/ProgramElementDoc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/ProgramElementDoc.java deleted file mode 100644 index f720e3399a7..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/ProgramElementDoc.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 1998, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - -/** - * Represents a java program element: class, interface, field, - * constructor, or method. - * This is an abstract class dealing with information common to - * these elements. - * - * @see MemberDoc - * @see ClassDoc - * - * @author Robert Field - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface ProgramElementDoc extends Doc { - - /** - * Get the containing class or interface of this program element. - * - * @return a ClassDoc for this element's containing class or interface. - * If this is a top-level class or interface, return null. - */ - ClassDoc containingClass(); - - /** - * Get the package that this program element is contained in. - * - * @return a PackageDoc for this element containing package. - * If in the unnamed package, this PackageDoc will have the - * name "". - */ - PackageDoc containingPackage(); - - /** - * Get the fully qualified name of this program element. - * For example, for the class {@code java.util.Hashtable}, - * return "java.util.Hashtable". - *

- * For the method {@code bar()} in class {@code Foo} - * in the unnamed package, return "Foo.bar". - * - * @return the qualified name of the program element as a String. - */ - String qualifiedName(); - - /** - * Get the modifier specifier integer. - * - * @see java.lang.reflect.Modifier - * - * @return Get the modifier specifier integer. - */ - int modifierSpecifier(); - - /** - * Get modifiers string. - * For example, for: - *

-     *   public abstract int foo() { ... }
-     * 
- * return "public abstract". - * Annotations are not included. - * - * @return "public abstract". - */ - String modifiers(); - - /** - * Get the annotations of this program element. - * Return an empty array if there are none. - * - * @return the annotations of this program element. - * @since 1.5 - */ - AnnotationDesc[] annotations(); - - /** - * Return true if this program element is public. - * - * @return true if this program element is public. - */ - boolean isPublic(); - - /** - * Return true if this program element is protected. - * - * @return true if this program element is protected. - */ - boolean isProtected(); - - /** - * Return true if this program element is private. - * - * @return true if this program element is private. - */ - boolean isPrivate(); - - /** - * Return true if this program element is package private. - * - * @return true if this program element is package private. - */ - boolean isPackagePrivate(); - /** - * Return true if this program element is static. - * - * @return true if this program element is static. - */ - boolean isStatic(); - - /** - * Return true if this program element is final. - * - * @return true if this program element is final. - */ - boolean isFinal(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/RootDoc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/RootDoc.java deleted file mode 100644 index 8403b8f190c..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/RootDoc.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 1998, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - -/** - * Represents the root of the program structure information - * for one run of javadoc. From this root all other program - * structure information can be extracted. - * Also represents the command line information -- the - * packages, classes and options specified by the user. - * - * @since 1.2 - * @author Robert Field - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface RootDoc extends Doc, DocErrorReporter { - - /** - * Command line options. - *

- * For example, given: - *

-     *     javadoc -foo this that -bar other ...
- * - * this method will return: - *
-     *      options()[0][0] = "-foo"
-     *      options()[0][1] = "this"
-     *      options()[0][2] = "that"
-     *      options()[1][0] = "-bar"
-     *      options()[1][1] = "other"
- * - * @return an array of arrays of String. - */ - String[][] options(); - - /** - * Return the packages - * specified - * on the command line. - * If {@code -subpackages} and {@code -exclude} options - * are used, return all the non-excluded packages. - * - * @return packages specified on the command line. - */ - PackageDoc[] specifiedPackages(); - - /** - * Return the classes and interfaces - * specified - * as source file names on the command line. - * - * @return classes and interfaces specified on the command line. - */ - ClassDoc[] specifiedClasses(); - - /** - * Return the - * included - classes and interfaces in all packages. - * - * @return included classes and interfaces in all packages. - */ - ClassDoc[] classes(); - - /** - * Return a PackageDoc for the specified package name. - * - * @param name package name - * - * @return a PackageDoc holding the specified package, null if - * this package is not referenced. - */ - PackageDoc packageNamed(String name); - - /** - * Return a ClassDoc for the specified class or interface name. - * - * @param qualifiedName - * qualified - * class or package name - * - * @return a ClassDoc holding the specified class, null if - * this class is not referenced. - */ - ClassDoc classNamed(String qualifiedName); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/SeeTag.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/SeeTag.java deleted file mode 100644 index 07c3ba2d7ba..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/SeeTag.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 1998, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - -/** - * Represents a user-defined cross-reference to related documentation. - * The tag can reference a package, class or member, or can hold - * plain text. (The plain text might be a reference - * to something not online, such as a printed book, or be a hard-coded - * HTML link.) The reference can either be inline with the comment, - * using {@code {@link}}, or a separate block comment, - * using {@code @see}. - * Method {@code name()} returns "@link" (no curly braces) or - * "@see", depending on the tag. - * Method {@code kind()} returns "@see" for both tags. - * - * @author Kaiyang Liu (original) - * @author Robert Field (rewrite) - * @author Atul M Dambalkar - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface SeeTag extends Tag { - - /** - * Get the label of the {@code @see} tag. - * Return null if no label is present. - * For example, for: - *

- *   {@code @see String#trim() the trim method} - *

- * return "the trim method". - * - * @return "the trim method". - */ - String label(); - - /** - * Get the package doc when {@code @see} references only a package. - * Return null if the package cannot be found, or if - * {@code @see} references any other element (class, - * interface, field, constructor, method) or non-element. - * For example, for: - *

- *   {@code @see java.lang} - *

- * return the {@code PackageDoc} for {@code java.lang}. - * - * @return the {@code PackageDoc} for {@code java.lang}. - */ - public PackageDoc referencedPackage(); - - /** - * Get the class or interface name of the {@code @see} reference. - * The name is fully qualified if the name specified in the - * original {@code @see} tag was fully qualified, or if the class - * or interface can be found; otherwise it is unqualified. - * If {@code @see} references only a package name, then return - * the package name instead. - * For example, for: - *

- *   {@code @see String#valueOf(java.lang.Object)} - *

- * return "java.lang.String". - * For "{@code @see java.lang}", return "java.lang". - * Return null if {@code @see} references a non-element, such as - * {@code @see }. - * - * @return null if {@code @see} references a non-element, such as - * {@code @see }. - */ - String referencedClassName(); - - /** - * Get the class doc referenced by the class name part of @see. - * Return null if the class cannot be found. - * For example, for: - *

- *   {@code @see String#valueOf(java.lang.Object)} - *

- * return the {@code ClassDoc} for {@code java.lang.String}. - * - * @return the {@code ClassDoc} for {@code java.lang.String}. - */ - ClassDoc referencedClass(); - - /** - * Get the field, constructor or method substring of the {@code @see} - * reference. Return null if the reference is to any other - * element or to any non-element. - * References to member classes (nested classes) return null. - * For example, for: - *

- *   {@code @see String#startsWith(String)} - *

- * return "startsWith(String)". - * - * @return "startsWith(String)". - */ - String referencedMemberName(); - - /** - * Get the member doc for the field, constructor or method - * referenced by {@code @see}. Return null if the member cannot - * be found or if the reference is to any other element or to any - * non-element. - * References to member classes (nested classes) return null. - * For example, for: - *

- *   {@code @see String#startsWith(java.lang.String)} - *

- * return the {@code MethodDoc} for {@code startsWith}. - * - * @return the {@code MethodDoc} for {@code startsWith}. - */ - MemberDoc referencedMember(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/SerialFieldTag.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/SerialFieldTag.java deleted file mode 100644 index c8344982164..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/SerialFieldTag.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 1998, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - -/** - * Documents a Serializable field defined by an ObjectStreamField. - *
- * The class parses and stores the three serialField tag parameters:
- *
- * - field name
- * - field type name
- *      (fully-qualified or visible from the current import context)
- * - description of the valid values for the field
-
- * 
- * This tag is only allowed in the javadoc for the special member - * serialPersistentFields. - * - * @author Joe Fialli - * - * @see java.io.ObjectStreamField - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface SerialFieldTag extends Tag, Comparable { - - /** - * Return the serializable field name. - * - * @return the serializable field name. - */ - public String fieldName(); - - /** - * Return the field type string. - * - * @return the field type string. - */ - public String fieldType(); - - /** - * Return the ClassDoc for field type. - * - * @return null if no ClassDoc for field type is visible from - * containingClass context. - */ - public ClassDoc fieldTypeDoc(); - - /** - * Return the field comment. If there is no serialField comment, return - * javadoc comment of corresponding FieldDoc. - * - * @return the field comment. If there is no serialField comment, return - * javadoc comment of corresponding FieldDoc. - */ - public String description(); - - /** - * Compares this Object with the specified Object for order. Returns a - * negative integer, zero, or a positive integer as this Object is less - * than, equal to, or greater than the given Object. - *

- * Included to make SerialFieldTag items java.lang.Comparable. - * - * @param obj the {@code Object} to be compared. - * @return a negative integer, zero, or a positive integer as this Object - * is less than, equal to, or greater than the given Object. - * @exception ClassCastException the specified Object's type prevents it - * from being compared to this Object. - * @since 1.2 - */ - public int compareTo(Object obj); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/SourcePosition.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/SourcePosition.java deleted file mode 100644 index 5447feaeea8..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/SourcePosition.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2001, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - -import java.io.File; - -/** - * This interface describes a source position: filename, line number, - * and column number. - * - * @since 1.4 - * @author Neal M Gafter - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface SourcePosition { - /** The source file. Returns null if no file information is - * available. - * - * @return the source file as a File. - */ - File file(); - - /** The line in the source file. The first line is numbered 1; - * 0 means no line number information is available. - * - * @return the line number in the source file as an integer. - */ - int line(); - - /** The column in the source file. The first column is - * numbered 1; 0 means no column information is available. - * Columns count characters in the input stream; a tab - * advances the column number to the next 8-column tab stop. - * - * @return the column on the source line as an integer. - */ - int column(); - - /** Convert the source position to the form "Filename:line". */ - String toString(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/Tag.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/Tag.java deleted file mode 100644 index 7b4eb4a3b96..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/Tag.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 1998, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - -import java.text.BreakIterator; -import java.util.Locale; - -/** - * Represents a simple documentation tag, such as @since, @author, @version. - * Given a tag (e.g. "@since 1.2"), holds tag name (e.g. "@since") - * and tag text (e.g. "1.2"). Tags with structure or which require - * special processing are handled by subclasses such as ParamTag - * (for @param), SeeTag (for @see and {@link}), and ThrowsTag - * (for @throws). - * - * @author Robert Field - * @author Atul M Dambalkar - * @see SeeTag - * @see ParamTag - * @see ThrowsTag - * @see SerialFieldTag - * @see Doc#tags() - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface Tag { - - /** - * Return the name of this tag. The name is the string - * starting with "@" that is used in a doc comment, such as - * {@code @return}. For inline tags, such as - * {@code {@link}}, the curly brackets - * are not part of the name, so in this example the name - * would be simply {@code @link}. - * - * @return the name of this tag - */ - String name(); - - /** - * Return the containing {@link Doc} of this Tag element. - * - * @return the containing {@link Doc} of this Tag element - */ - Doc holder(); - - /** - * Return the kind of this tag. - * For most tags, - * {@code kind() == name()}; - * the following table lists those cases where there is more - * than one tag of a given kind: - * - * - * - * - * - * - * - *
Related Tags
{@code name() } {@code kind() } - *
{@code @exception } {@code @throws } - *
{@code @link } {@code @see } - *
{@code @linkplain } {@code @see } - *
{@code @see } {@code @see } - *
{@code @serial } {@code @serial } - *
{@code @serialData } {@code @serial } - *
{@code @throws } {@code @throws } - *
- * - * @return the kind of this tag. - */ - String kind(); - - /** - * Return the text of this tag, that is, the portion beyond tag name. - * - * @return the text of this tag - */ - String text(); - - /** - * Convert this object to a string. - */ - String toString(); - - /** - * For a documentation comment with embedded {@code {@link}} - * tags, return an array of {@code Tag} objects. The entire - * doc comment is broken down into strings separated by - * {@code {@link}} tags, where each successive element - * of the array represents either a string or - * {@code {@link}} tag, in order, from start to end. - * Each string is represented by a {@code Tag} object of - * name "Text", where {@link #text()} returns the string. Each - * {@code {@link}} tag is represented by a - * {@link SeeTag} of name "@link" and kind "@see". - * For example, given the following comment - * tag: - *

- * {@code This is a {@link Doc commentlabel} example.} - *

- * return an array of Tag objects: - *

    - *
  • tags[0] is a {@link Tag} with name "Text" and text consisting - * of "This is a " - *
  • tags[1] is a {@link SeeTag} with name "@link", referenced - * class {@code Doc} and label "commentlabel" - *
  • tags[2] is a {@link Tag} with name "Text" and text consisting - * of " example." - *
- * - * @return Tag[] array of tags - * @see ParamTag - * @see ThrowsTag - */ - Tag[] inlineTags(); - - /** - * Return the first sentence of the comment as an array of tags. - * Includes inline tags - * (i.e. {@link reference} tags) but not - * block tags. - * Each section of plain text is represented as a {@link Tag} - * of kind "Text". - * Inline tags are represented as a {@link SeeTag} of kind "@link". - * If the locale is English language, the first sentence is - * determined by the rules described in the Java Language - * Specification (first version): "This sentence ends - * at the first period that is followed by a blank, tab, or - * line terminator or at the first tagline.", in - * addition a line will be terminated by paragraph and - * section terminating HTML tags: <p> </p> <h1> - * <h2> <h3> <h4> <h5> <h6> - * <hr> <pre> or </pre>. - * If the locale is not English, the sentence end will be - * determined by - * {@link BreakIterator#getSentenceInstance(Locale)}. - * - * @return an array of {@link Tag} objects representing the - * first sentence of the comment - */ - Tag[] firstSentenceTags(); - - /** - * Return the source position of this tag. - * @return the source position of this tag. - */ - public SourcePosition position(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/ThrowsTag.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/ThrowsTag.java deleted file mode 100644 index b92430877dc..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/ThrowsTag.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 1998, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - -/** - * Represents a @throws or @exception documentation tag. - * Parses and holds the exception name and exception comment. - * Note: @exception is a backwards compatible synonymy for @throws. - * - * @author Robert Field - * @author Atul M Dambalkar - * @see ExecutableMemberDoc#throwsTags() - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface ThrowsTag extends Tag { - - /** - * Return the name of the exception - * associated with this {@code ThrowsTag}. - * - * @return name of the exception. - */ - String exceptionName(); - - /** - * Return the exception comment - * associated with this {@code ThrowsTag}. - * - * @return exception comment. - */ - String exceptionComment(); - - /** - * Return a {@code ClassDoc} that represents the exception. - * If the type of the exception is a type variable, return the - * {@code ClassDoc} of its erasure. - * - *

This method cannot accommodate certain generic type - * constructs. The {@code exceptionType} method - * should be used instead. - * - * @return {@code ClassDoc} that represents the exception. - * @see #exceptionType - */ - ClassDoc exception(); - - /** - * Return the type of the exception - * associated with this {@code ThrowsTag}. - * This may be a {@code ClassDoc} or a {@code TypeVariable}. - * - * @return the type of the exception. - * @since 1.5 - */ - Type exceptionType(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/Type.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/Type.java deleted file mode 100644 index 48e8e7b2589..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/Type.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) 1997, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - -/** - * Represents a type. A type can be a class or interface, an - * invocation (like {@code List}) of a generic class or interface, - * a type variable, a wildcard type ("{@code ?}"), - * or a primitive data type (like {@code char}). - * - * @since 1.2 - * @author Kaiyang Liu (original) - * @author Robert Field (rewrite) - * @author Scott Seligman (generics) - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface Type { - - /** - * Return unqualified name of type excluding any dimension information. - *

- * For example, a two dimensional array of String returns - * "{@code String}". - * @return unqualified name of type excluding any dimension information. - */ - String typeName(); - - /** - * Return qualified name of type excluding any dimension information. - *

- * For example, a two dimensional array of String - * returns "{@code java.lang.String}". - * @return qualified name of this type excluding any dimension information. - */ - String qualifiedTypeName(); - - /** - * Return the simple name of this type excluding any dimension information. - * This is the unqualified name of the type, except that for nested types - * only the identifier of the innermost type is included. - *

- * For example, the class {@code Outer.Inner} returns - * "{@code Inner}". - * - * @since 1.5 - * @return the simple name of this type excluding any dimension information. - */ - String simpleTypeName(); - - /** - * Return the type's dimension information, as a string. - *

- * For example, a two dimensional array of String returns - * "{@code [][]}". - * @return the type's dimension information as a string. - */ - String dimension(); - - /** - * Return a string representation of the type. - * This includes any dimension information and type arguments. - *

- * For example, a two dimensional array of String may return - * "{@code java.lang.String[][]}", - * and the parameterized type {@code List} may return - * "{@code java.util.List}". - * - * @return a string representation of the type. - */ - String toString(); - - /** - * Return true if this type represents a primitive type. - * - * @return true if this type represents a primitive type. - * @since 1.5 - */ - boolean isPrimitive(); - - /** - * Return this type as a {@code ClassDoc} if it represents a class - * or interface. Array dimensions are ignored. - * If this type is a {@code ParameterizedType}, - * {@code TypeVariable}, or {@code WildcardType}, return - * the {@code ClassDoc} of the type's erasure. If this is an - * {@code AnnotationTypeDoc}, return this as a {@code ClassDoc} - * (but see {@link #asAnnotationTypeDoc()}). - * If this is a primitive type, return null. - * - * @return the {@code ClassDoc} of this type, - * or null if it is a primitive type. - */ - ClassDoc asClassDoc(); - - /** - * Return this type as a {@code ParameterizedType} if it represents - * an invocation of a generic class or interface. Array dimensions - * are ignored. - * - * @return a {@code ParameterizedType} if the type is an - * invocation of a generic type, or null if it is not. - * @since 1.5 - */ - ParameterizedType asParameterizedType(); - - /** - * Return this type as a {@code TypeVariable} if it represents - * a type variable. Array dimensions are ignored. - * - * @return a {@code TypeVariable} if the type is a type variable, - * or null if it is not. - * @since 1.5 - */ - TypeVariable asTypeVariable(); - - /** - * Return this type as a {@code WildcardType} if it represents - * a wildcard type. - * - * @return a {@code WildcardType} if the type is a wildcard type, - * or null if it is not. - * @since 1.5 - */ - WildcardType asWildcardType(); - - /** - * Returns this type as a {@code AnnotatedType} if it represents - * an annotated type. - * - * @return a {@code AnnotatedType} if the type if an annotated type, - * or null if it is not - * @since 1.8 - */ - AnnotatedType asAnnotatedType(); - - /** - * Return this type as an {@code AnnotationTypeDoc} if it represents - * an annotation type. Array dimensions are ignored. - * - * @return an {@code AnnotationTypeDoc} if the type is an annotation - * type, or null if it is not. - * @since 1.5 - */ - AnnotationTypeDoc asAnnotationTypeDoc(); - - /** - * If this type is an array type, return the element type of the - * array. Otherwise, return null. - * - * @return a {@code Type} representing the element type or null. - * @since 1.8 - */ - Type getElementType(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/TypeVariable.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/TypeVariable.java deleted file mode 100644 index b66023f4568..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/TypeVariable.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2003, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - - -/** - * Represents a type variable. - * For example, the generic interface {@code List} has a single - * type variable {@code E}. - * A type variable may have explicit bounds, as in - * {@code C}. - * - * @author Scott Seligman - * @since 1.5 - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface TypeVariable extends Type { - - /** - * Return the bounds of this type variable. - * These are the types given by the extends clause. - * Return an empty array if there are no explicit bounds. - * - * @return the bounds of this type variable. - */ - Type[] bounds(); - - /** - * Return the class, interface, method, or constructor within - * which this type variable is declared. - * - * @return the class, interface, method, or constructor within - * which this type variable is declared. - */ - ProgramElementDoc owner(); - - /** - * Get the annotations of this program element. - * Return an empty array if there are none. - * - * @return the annotations of this program element or - * an empty array if there are none. - */ - public AnnotationDesc[] annotations(); - -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/WildcardType.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/WildcardType.java deleted file mode 100644 index f40a418d77c..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/WildcardType.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2003, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.javadoc; - - -/** - * Represents a wildcard type argument. - * Examples include:

- * {@code }
- * {@code }
- * {@code }
- * 
- * A wildcard type can have explicit extends bounds - * or explicit super bounds or neither, but not both. - * - * @author Scott Seligman - * @since 1.5 - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface WildcardType extends Type { - - /** - * Return the upper bounds of this wildcard type argument - * as given by the extends clause. - * Return an empty array if no such bounds are explicitly given. - * - * @return the extends bounds of this wildcard type argument - */ - Type[] extendsBounds(); - - /** - * Return the lower bounds of this wildcard type argument - * as given by the super clause. - * Return an empty array if no such bounds are explicitly given. - * - * @return the super bounds of this wildcard type argument - */ - Type[] superBounds(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/package-info.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/package-info.java deleted file mode 100644 index ac2883abe23..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/package-info.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 1998, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** -

-Note: The declarations in this package have been superseded by those -in the package {@link jdk.javadoc.doclet}. -For more information, see the Migration Guide in the documentation for that package. -

- -The Doclet API (also called the Javadoc API) provides a mechanism -for clients to inspect the source-level structure of programs and -libraries, including javadoc comments embedded in the source. -This is useful for documentation, program checking, automatic -code generation and many other tools. -

- -Doclets are invoked by javadoc and use this API to write out -program information to files. For example, the standard doclet is called -by default and writes out documentation to HTML files. -

- -The invocation is defined by the abstract {@link com.sun.javadoc.Doclet} class --- the entry point is the {@link com.sun.javadoc.Doclet#start(RootDoc) start} method: -

-    public static boolean start(RootDoc root)
-
-The {@link com.sun.javadoc.RootDoc} instance holds the root of the program structure -information. From this root all other program structure -information can be extracted. -

- - -

Terminology

- - -When calling javadoc, you pass in package names and source file names -- -these are called the specified packages and classes. -You also pass in Javadoc options; the access control Javadoc options -({@code -public}, {@code -protected}, {@code -package}, -and {@code -private}) filter program elements, producing a -result set, called the included set, or "documented" set. -(The unfiltered set is also available through -{@link com.sun.javadoc.PackageDoc#allClasses(boolean) allClasses(false)}.) -

- - -Throughout this API, the term class is normally a -shorthand for "class or interface", as in: {@link com.sun.javadoc.ClassDoc}, -{@link com.sun.javadoc.PackageDoc#allClasses() allClasses()}, and -{@link com.sun.javadoc.PackageDoc#findClass(String) findClass(String)}. -In only a couple of other places, it means "class, as opposed to interface", -as in: {@link com.sun.javadoc.Doc#isClass()}. -In the second sense, this API calls out four kinds of classes: -{@linkplain com.sun.javadoc.Doc#isOrdinaryClass() ordinary classes}, -{@linkplain com.sun.javadoc.Doc#isEnum() enums}, -{@linkplain com.sun.javadoc.Doc#isError() errors} and -{@linkplain com.sun.javadoc.Doc#isException() exceptions}. -Throughout the API, the detailed description of each program element -describes explicitly which meaning is being used. -

- - -A qualified class or interface name is one that has its package -name prepended to it, such as {@code java.lang.String}. A non-qualified -name has no package name, such as {@code String}. -

- - -

Example

- -The following is an example doclet that -displays information in the {@code @param} tags of the processed -classes: -
-import com.sun.javadoc.*;
-
-public class ListParams extends Doclet {
-
-    public static boolean start(RootDoc root) {
-        ClassDoc[] classes = root.classes();
-        for (int i = 0; i < classes.length; ++i) {
-            ClassDoc cd = classes[i];
-            printMembers(cd.constructors());
-            printMembers(cd.methods());
-        }
-        return true;
-    }
-
-    static void printMembers(ExecutableMemberDoc[] mems) {
-        for (int i = 0; i < mems.length; ++i) {
-            ParamTag[] params = mems[i].paramTags();
-            System.out.println(mems[i].qualifiedName());
-            for (int j = 0; j < params.length; ++j) {
-                System.out.println("   " + params[j].parameterName()
-                    + " - " + params[j].parameterComment());
-            }
-        }
-    }
-}
-
-Interfaces and methods from the Javadoc API are marked in -red. -{@link com.sun.javadoc.Doclet Doclet} is an abstract class that specifies -the invocation interface for doclets, -{@link com.sun.javadoc.Doclet Doclet} holds class or interface information, -{@link com.sun.javadoc.ExecutableMemberDoc} is a -superinterface of {@link com.sun.javadoc.MethodDoc} and -{@link com.sun.javadoc.ConstructorDoc}, -and {@link com.sun.javadoc.ParamTag} holds information -from "{@code @param}" tags. -

-This doclet when invoked with a command line like: -

-    javadoc -doclet ListParams -sourcepath <source-location> java.util
-
-producing output like: -
-    ...
-    java.util.ArrayList.add
-       index - index at which the specified element is to be inserted.
-       element - element to be inserted.
-    java.util.ArrayList.remove
-       index - the index of the element to removed.
-    ...
-
-
-@see com.sun.javadoc.Doclet -@see com.sun.javadoc.RootDoc -*/ -package com.sun.javadoc; diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/standard/Standard.java b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/standard/Standard.java deleted file mode 100644 index e14fadc8f55..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/standard/Standard.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2017, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.doclets.standard; - -import com.sun.javadoc.RootDoc; - -/** - * This is not the doclet you are looking for. - * @deprecated The doclet has been superseded by its replacement, - * {@link jdk.javadoc.doclet.StandardDoclet}. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") - -public class Standard { - - public static boolean start(RootDoc root) { - root.printNotice("Notice: " + "This is not the Standard Doclet"); - return true; - } - - public static int optionLength(String option) { - return 0; // all options are unsupported - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/standard/package-info.java b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/standard/package-info.java deleted file mode 100644 index 860dd11c2c3..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/standard/package-info.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** -

-Note: The declarations in this package have been replaced by those -in the new package {@link jdk.javadoc.doclet}. -

-*/ - -package com.sun.tools.doclets.standard; diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Main.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Main.java deleted file mode 100644 index 2c2da152650..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Main.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (c) 2000, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.javadoc; - -import java.io.PrintWriter; - -import com.sun.tools.javadoc.main.Start; - -/** - * Provides external entry points (tool and programmatic) - * for the javadoc program. - * - *

This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @deprecated - * This class is now deprecated and may be removed in a future release. - * See - * {@code javax.tools.ToolProvider::getSystemDocumentationTool} - * and - * {@code javax.tools.DocumentationTool} - * for replacement functionality. - * - * @since 1.4 - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public class Main { - - /** - * Constructor should never be called. - */ - private Main() { - } - - /** - * Command line interface. - * @param args The command line parameters. - */ - public static void main(String... args) { - System.exit(execute(args)); - } - - /** - * Programmatic interface. - * @param args The command line parameters. - * @return The return code. - */ - public static int execute(String... args) { - Start jdoc = new Start(); - return jdoc.begin(args); - } - - /** - * Programmatic interface. - * @param args The command line parameters. - * @param docletParentClassLoader The parent class loader used when - * creating the doclet classloader. If null, the class loader used - * to instantiate doclets will be created without specifying a parent - * class loader. - * @return The return code. - * @since 1.7 - */ - public static int execute(ClassLoader docletParentClassLoader, String... args) { - Start jdoc = new Start(docletParentClassLoader); - return jdoc.begin(args); - } - - /** - * Programmatic interface. - * @param programName Name of the program (for error messages). - * @param args The command line parameters. - * @return The return code. - */ - public static int execute(String programName, String... args) { - Start jdoc = new Start(programName); - return jdoc.begin(args); - } - - /** - * Programmatic interface. - * @param programName Name of the program (for error messages). - * @param args The command line parameters. - * @param docletParentClassLoader The parent class loader used when - * creating the doclet classloader. If null, the class loader used - * to instantiate doclets will be created without specifying a parent - * class loader. - * @return The return code. - * @since 1.7 - */ - public static int execute(String programName, ClassLoader docletParentClassLoader, String... args) { - Start jdoc = new Start(programName, docletParentClassLoader); - return jdoc.begin(args); - } - - /** - * Programmatic interface. - * @param programName Name of the program (for error messages). - * @param defaultDocletClassName Fully qualified class name. - * @param args The command line parameters. - * @return The return code. - */ - public static int execute(String programName, - String defaultDocletClassName, - String... args) { - Start jdoc = new Start(programName, defaultDocletClassName); - return jdoc.begin(args); - } - - /** - * Programmatic interface. - * @param programName Name of the program (for error messages). - * @param defaultDocletClassName Fully qualified class name. - * @param docletParentClassLoader The parent class loader used when - * creating the doclet classloader. If null, the class loader used - * to instantiate doclets will be created without specifying a parent - * class loader. - * @param args The command line parameters. - * @return The return code. - * @since 1.7 - */ - public static int execute(String programName, - String defaultDocletClassName, - ClassLoader docletParentClassLoader, - String... args) { - Start jdoc = new Start(programName, defaultDocletClassName, docletParentClassLoader); - return jdoc.begin(args); - } - - /** - * Programmatic interface. - * @param programName Name of the program (for error messages). - * @param errWriter PrintWriter to receive error messages. - * @param warnWriter PrintWriter to receive error messages. - * @param noticeWriter PrintWriter to receive error messages. - * @param defaultDocletClassName Fully qualified class name. - * @param args The command line parameters. - * @return The return code. - */ - public static int execute(String programName, - PrintWriter errWriter, - PrintWriter warnWriter, - PrintWriter noticeWriter, - String defaultDocletClassName, - String... args) { - Start jdoc = new Start(programName, - errWriter, warnWriter, noticeWriter, - defaultDocletClassName); - return jdoc.begin(args); - } - - /** - * Programmatic interface. - * @param programName Name of the program (for error messages). - * @param errWriter PrintWriter to receive error messages. - * @param warnWriter PrintWriter to receive error messages. - * @param noticeWriter PrintWriter to receive error messages. - * @param defaultDocletClassName Fully qualified class name. - * @param docletParentClassLoader The parent class loader used when - * creating the doclet classloader. If null, the class loader used - * to instantiate doclets will be created without specifying a parent - * class loader. - * @param args The command line parameters. - * @return The return code. - * @since 1.7 - */ - public static int execute(String programName, - PrintWriter errWriter, - PrintWriter warnWriter, - PrintWriter noticeWriter, - String defaultDocletClassName, - ClassLoader docletParentClassLoader, - String... args) { - Start jdoc = new Start(programName, - errWriter, warnWriter, noticeWriter, - defaultDocletClassName, - docletParentClassLoader); - return jdoc.begin(args); - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AbstractTypeImpl.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AbstractTypeImpl.java deleted file mode 100644 index f8b4d06be75..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AbstractTypeImpl.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2003, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.javadoc.main; - -import com.sun.javadoc.*; - -import com.sun.tools.javac.code.Type; - - -/** - * Abstract implementation of Type, with useful - * defaults for the methods in Type (and a couple from - * ProgramElementDoc). - * - *

This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @author Scott Seligman - * @since 1.5 - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -abstract class AbstractTypeImpl implements com.sun.javadoc.Type { - - protected final DocEnv env; - protected final Type type; - - protected AbstractTypeImpl(DocEnv env, Type type) { - this.env = env; - this.type = type; - } - - public String typeName() { - return type.tsym.name.toString(); - } - - public String qualifiedTypeName() { - return type.tsym.getQualifiedName().toString(); - } - - public com.sun.javadoc.Type getElementType() { - return null; - } - - public String simpleTypeName() { - return type.tsym.name.toString(); - } - - public String name() { - return typeName(); - } - - public String qualifiedName() { - return qualifiedTypeName(); - } - - public String toString() { - return qualifiedTypeName(); - } - - public String dimension() { - return ""; - } - - public boolean isPrimitive() { - return false; - } - - public ClassDoc asClassDoc() { - return null; - } - - public TypeVariable asTypeVariable() { - return null; - } - - public WildcardType asWildcardType() { - return null; - } - - public ParameterizedType asParameterizedType() { - return null; - } - - public AnnotationTypeDoc asAnnotationTypeDoc() { - return null; - } - - public AnnotatedType asAnnotatedType() { - return null; - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotatedTypeImpl.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotatedTypeImpl.java deleted file mode 100644 index 89c496ac022..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotatedTypeImpl.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2003, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.javadoc.main; - -import com.sun.javadoc.*; -import com.sun.tools.javac.code.Attribute; -import com.sun.tools.javac.code.Attribute.TypeCompound; -import com.sun.tools.javac.util.List; - -/** - * Implementation of AnnotatedType, which - * represents an annotated type. - * - * @author Mahmood Ali - * @since 1.8 - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public class AnnotatedTypeImpl - extends AbstractTypeImpl implements AnnotatedType { - - AnnotatedTypeImpl(DocEnv env, com.sun.tools.javac.code.Type type) { - super(env, type); - } - - /** - * Get the annotations of this program element. - * Return an empty array if there are none. - */ - @Override - public AnnotationDesc[] annotations() { - List tas = type.getAnnotationMirrors(); - if (tas == null || - tas.isEmpty()) { - return new AnnotationDesc[0]; - } - AnnotationDesc res[] = new AnnotationDesc[tas.length()]; - int i = 0; - for (Attribute.Compound a : tas) { - res[i++] = new AnnotationDescImpl(env, a); - } - return res; - } - - @Override - public com.sun.javadoc.Type underlyingType() { - return TypeMaker.getType(env, type, true, false); - } - - @Override - public AnnotatedType asAnnotatedType() { - return this; - } - - @Override - public String toString() { - return typeName(); - } - - @Override - public String typeName() { - return this.underlyingType().typeName(); - } - - @Override - public String qualifiedTypeName() { - return this.underlyingType().qualifiedTypeName(); - } - - @Override - public String simpleTypeName() { - return this.underlyingType().simpleTypeName(); - } - - @Override - public String dimension() { - return this.underlyingType().dimension(); - } - - @Override - public boolean isPrimitive() { - return this.underlyingType().isPrimitive(); - } - - @Override - public ClassDoc asClassDoc() { - return this.underlyingType().asClassDoc(); - } - - @Override - public TypeVariable asTypeVariable() { - return this.underlyingType().asTypeVariable(); - } - - @Override - public WildcardType asWildcardType() { - return this.underlyingType().asWildcardType(); - } - - @Override - public ParameterizedType asParameterizedType() { - return this.underlyingType().asParameterizedType(); - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationDescImpl.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationDescImpl.java deleted file mode 100644 index 96b7cb5f712..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationDescImpl.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2003, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.javadoc.main; - -import com.sun.javadoc.*; - -import com.sun.tools.javac.code.Attribute; -import com.sun.tools.javac.code.Symbol.*; -import com.sun.tools.javac.util.List; -import com.sun.tools.javac.util.Pair; - - -/** - * Represents an annotation. - * An annotation associates a value with each element of an annotation type. - * Sure it ought to be called "Annotation", but that clashes with - * java.lang.annotation.Annotation. - * - *

This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @author Scott Seligman - * @since 1.5 - */ - -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public class AnnotationDescImpl implements AnnotationDesc { - - private final DocEnv env; - private final Attribute.Compound annotation; - - - AnnotationDescImpl(DocEnv env, Attribute.Compound annotation) { - this.env = env; - this.annotation = annotation; - } - - /** - * Returns the annotation type of this annotation. - */ - public AnnotationTypeDoc annotationType() { - ClassSymbol atsym = (ClassSymbol)annotation.type.tsym; - if (annotation.type.isErroneous()) { - env.warning(null, "javadoc.class_not_found", annotation.type.toString()); - return new AnnotationTypeDocImpl(env, atsym); - } else { - return (AnnotationTypeDoc)env.getClassDoc(atsym); - } - } - - /** - * Returns this annotation's elements and their values. - * Only those explicitly present in the annotation are - * included, not those assuming their default values. - * Returns an empty array if there are none. - */ - public ElementValuePair[] elementValues() { - List> vals = annotation.values; - ElementValuePair res[] = new ElementValuePair[vals.length()]; - int i = 0; - for (Pair val : vals) { - res[i++] = new ElementValuePairImpl(env, val.fst, val.snd); - } - return res; - } - - /** - * Check for the synthesized bit on the annotation. - * - * @return true if the annotation is synthesized. - */ - public boolean isSynthesized() { - return annotation.isSynthesized(); - } - - /** - * Returns a string representation of this annotation. - * String is of one of the forms: - *

-     *     {@code @com.example.foo(name1=val1, name2=val2)}
-     *     {@code @com.example.foo(val)}
-     *     {@code @com.example.foo}
-     * 
- * Omit parens for marker annotations, and omit "value=" when allowed. - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder("@"); - sb.append(annotation.type.tsym); - - ElementValuePair vals[] = elementValues(); - if (vals.length > 0) { // omit parens for marker annotation - sb.append('('); - boolean first = true; - for (ElementValuePair val : vals) { - if (!first) { - sb.append(", "); - } - first = false; - - String name = val.element().name(); - if (vals.length == 1 && name.equals("value")) { - sb.append(val.value()); - } else { - sb.append(val); - } - } - sb.append(')'); - } - return sb.toString(); - } - - - /** - * Represents an association between an annotation type element - * and one of its values. - */ - public static class ElementValuePairImpl implements ElementValuePair { - - private final DocEnv env; - private final MethodSymbol meth; - private final Attribute value; - - ElementValuePairImpl(DocEnv env, MethodSymbol meth, Attribute value) { - this.env = env; - this.meth = meth; - this.value = value; - } - - /** - * Returns the annotation type element. - */ - public AnnotationTypeElementDoc element() { - return env.getAnnotationTypeElementDoc(meth); - } - - /** - * Returns the value associated with the annotation type element. - */ - public AnnotationValue value() { - return new AnnotationValueImpl(env, value); - } - - /** - * Returns a string representation of this pair - * of the form "name=value". - */ - @Override - public String toString() { - return meth.name + "=" + value(); - } - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationTypeDocImpl.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationTypeDocImpl.java deleted file mode 100644 index 36b8c3296d6..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationTypeDocImpl.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2003, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.javadoc.main; - -import com.sun.javadoc.*; - -import com.sun.source.util.TreePath; -import com.sun.tools.javac.code.Symbol; -import com.sun.tools.javac.code.Symbol.*; -import com.sun.tools.javac.util.List; - -import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE; - -import static com.sun.tools.javac.code.Kinds.Kind.*; - -/** - * Represents an annotation type. - * - *

This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @author Scott Seligman - * @since 1.5 - */ - -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public class AnnotationTypeDocImpl - extends ClassDocImpl implements AnnotationTypeDoc { - - public AnnotationTypeDocImpl(DocEnv env, ClassSymbol sym) { - this(env, sym, null); - } - - public AnnotationTypeDocImpl(DocEnv env, ClassSymbol sym, TreePath treePath) { - super(env, sym, treePath); - } - - /** - * Returns true, as this is an annotation type. - * (For legacy doclets, return false.) - */ - public boolean isAnnotationType() { - return !isInterface(); - } - - /** - * Returns false. Though technically an interface, an annotation - * type is not considered an interface for this purpose. - * (For legacy doclets, returns true.) - */ - public boolean isInterface() { - return env.legacyDoclet; - } - - /** - * Returns an empty array, as all methods are annotation type elements. - * (For legacy doclets, returns the elements.) - * @see #elements() - */ - public MethodDoc[] methods(boolean filter) { - return env.legacyDoclet - ? (MethodDoc[])elements() - : new MethodDoc[0]; - } - - /** - * Returns the elements of this annotation type. - * Returns an empty array if there are none. - * Elements are always public, so no need to filter them. - */ - public AnnotationTypeElementDoc[] elements() { - List elements = List.nil(); - for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) { - if (sym != null && sym.kind == MTH) { - MethodSymbol s = (MethodSymbol)sym; - elements = elements.prepend(env.getAnnotationTypeElementDoc(s)); - } - } - return - elements.toArray(new AnnotationTypeElementDoc[elements.length()]); - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationTypeElementDocImpl.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationTypeElementDocImpl.java deleted file mode 100644 index 67e65aa5b67..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationTypeElementDocImpl.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2003, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.javadoc.main; - -import com.sun.javadoc.*; - -import com.sun.source.util.TreePath; -import com.sun.tools.javac.code.Symbol.*; - -/** - * Represents an element of an annotation type. - * - *

This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @author Scott Seligman - * @since 1.5 - */ - -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public class AnnotationTypeElementDocImpl - extends MethodDocImpl implements AnnotationTypeElementDoc { - - public AnnotationTypeElementDocImpl(DocEnv env, MethodSymbol sym) { - super(env, sym); - } - - public AnnotationTypeElementDocImpl(DocEnv env, MethodSymbol sym, TreePath treePath) { - super(env, sym, treePath); - } - - /** - * Returns true, as this is an annotation type element. - * (For legacy doclets, return false.) - */ - public boolean isAnnotationTypeElement() { - return !isMethod(); - } - - /** - * Returns false. Although this is technically a method, we don't - * consider it one for this purpose. - * (For legacy doclets, return true.) - */ - public boolean isMethod() { - return env.legacyDoclet; - } - - /** - * Returns false, even though this is indeed abstract. See - * MethodDocImpl.isAbstract() for the (il)logic behind this. - */ - public boolean isAbstract() { - return false; - } - - /** - * Returns the default value of this element. - * Returns null if this element has no default. - */ - public AnnotationValue defaultValue() { - return (sym.defaultValue == null) - ? null - : new AnnotationValueImpl(env, sym.defaultValue); - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationValueImpl.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationValueImpl.java deleted file mode 100644 index 32f1bfbde5c..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationValueImpl.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2003, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.javadoc.main; - -import com.sun.javadoc.*; - -import com.sun.tools.javac.code.Attribute; - -import static com.sun.tools.javac.code.TypeTag.BOOLEAN; - -/** - * Represents a value of an annotation type element. - * - *

This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @author Scott Seligman - * @since 1.5 - */ - -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public class AnnotationValueImpl implements AnnotationValue { - - private final DocEnv env; - private final Attribute attr; - - - AnnotationValueImpl(DocEnv env, Attribute attr) { - this.env = env; - this.attr = attr; - } - - /** - * Returns the value. - * The type of the returned object is one of the following: - *

  • a wrapper class for a primitive type - *
  • String - *
  • Type (representing a class literal) - *
  • FieldDoc (representing an enum constant) - *
  • AnnotationDesc - *
  • AnnotationValue[] - *
- */ - public Object value() { - ValueVisitor vv = new ValueVisitor(); - attr.accept(vv); - return vv.value; - } - - private class ValueVisitor implements Attribute.Visitor { - public Object value; - - public void visitConstant(Attribute.Constant c) { - if (c.type.hasTag(BOOLEAN)) { - // javac represents false and true as integers 0 and 1 - value = Boolean.valueOf( - ((Integer)c.value).intValue() != 0); - } else { - value = c.value; - } - } - - public void visitClass(Attribute.Class c) { - value = TypeMaker.getType(env, - env.types.erasure(c.classType)); - } - - public void visitEnum(Attribute.Enum e) { - value = env.getFieldDoc(e.value); - } - - public void visitCompound(Attribute.Compound c) { - value = new AnnotationDescImpl(env, c); - } - - public void visitArray(Attribute.Array a) { - AnnotationValue vals[] = new AnnotationValue[a.values.length]; - for (int i = 0; i < vals.length; i++) { - vals[i] = new AnnotationValueImpl(env, a.values[i]); - } - value = vals; - } - - public void visitError(Attribute.Error e) { - value = ""; - } - } - - /** - * Returns a string representation of the value. - * - * @return the text of a Java language annotation value expression - * whose value is the value of this annotation type element. - */ - @Override - public String toString() { - ToStringVisitor tv = new ToStringVisitor(); - attr.accept(tv); - return tv.toString(); - } - - private class ToStringVisitor implements Attribute.Visitor { - private final StringBuilder sb = new StringBuilder(); - - @Override - public String toString() { - return sb.toString(); - } - - public void visitConstant(Attribute.Constant c) { - if (c.type.hasTag(BOOLEAN)) { - // javac represents false and true as integers 0 and 1 - sb.append(((Integer)c.value).intValue() != 0); - } else { - sb.append(FieldDocImpl.constantValueExpression(c.value)); - } - } - - public void visitClass(Attribute.Class c) { - sb.append(c); - } - - public void visitEnum(Attribute.Enum e) { - sb.append(e); - } - - public void visitCompound(Attribute.Compound c) { - sb.append(new AnnotationDescImpl(env, c)); - } - - public void visitArray(Attribute.Array a) { - // Omit braces from singleton. - if (a.values.length != 1) sb.append('{'); - - boolean first = true; - for (Attribute elem : a.values) { - if (first) { - first = false; - } else { - sb.append(", "); - } - elem.accept(this); - } - // Omit braces from singleton. - if (a.values.length != 1) sb.append('}'); - } - - public void visitError(Attribute.Error e) { - sb.append(""); - } - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java deleted file mode 100644 index 6a9cc6ea1e9..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java +++ /dev/null @@ -1,1331 +0,0 @@ -/* - * Copyright (c) 1997, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.javadoc.main; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.Modifier; -import java.net.URI; -import java.util.HashSet; -import java.util.Set; - -import javax.tools.FileObject; -import javax.tools.JavaFileManager.Location; -import javax.tools.StandardJavaFileManager; -import javax.tools.StandardLocation; - -import com.sun.javadoc.*; -import com.sun.source.util.TreePath; -import com.sun.tools.javac.code.Flags; -import com.sun.tools.javac.code.Kinds; -import com.sun.tools.javac.code.Kinds.KindSelector; -import com.sun.tools.javac.code.Scope; -import com.sun.tools.javac.code.Symbol; -import com.sun.tools.javac.code.Symbol.*; -import com.sun.tools.javac.code.Type; -import com.sun.tools.javac.code.Type.ClassType; -import com.sun.tools.javac.code.TypeTag; -import com.sun.tools.javac.comp.AttrContext; -import com.sun.tools.javac.comp.Env; -import com.sun.tools.javac.tree.JCTree; -import com.sun.tools.javac.tree.JCTree.JCFieldAccess; -import com.sun.tools.javac.tree.JCTree.JCImport; -import com.sun.tools.javac.tree.TreeInfo; -import com.sun.tools.javac.util.List; -import com.sun.tools.javac.util.ListBuffer; -import com.sun.tools.javac.util.Name; -import com.sun.tools.javac.util.Names; -import com.sun.tools.javac.util.Position; -import static com.sun.tools.javac.code.Kinds.Kind.*; -import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE; -import static com.sun.tools.javac.code.TypeTag.CLASS; -import static com.sun.tools.javac.tree.JCTree.Tag.*; - -/** - * Represents a java class and provides access to information - * about the class, the class' comment and tags, and the - * members of the class. A ClassDocImpl only exists if it was - * processed in this run of javadoc. References to classes - * which may or may not have been processed in this run are - * referred to using Type (which can be converted to ClassDocImpl, - * if possible). - * - *

This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @see Type - * - * @since 1.2 - * @author Robert Field - * @author Neal Gafter (rewrite) - * @author Scott Seligman (generics, enums, annotations) - */ - -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc { - - public final ClassType type; // protected->public for debugging - public final ClassSymbol tsym; - - boolean isIncluded = false; // Set in RootDocImpl - - private SerializedForm serializedForm; - - /** - * Constructor - */ - public ClassDocImpl(DocEnv env, ClassSymbol sym) { - this(env, sym, null); - } - - /** - * Constructor - */ - public ClassDocImpl(DocEnv env, ClassSymbol sym, TreePath treePath) { - super(env, sym, treePath); - this.type = (ClassType)sym.type; - this.tsym = sym; - } - - public com.sun.javadoc.Type getElementType() { - return null; - } - - /** - * Returns the flags in terms of javac's flags - */ - protected long getFlags() { - return getFlags(tsym); - } - - /** - * Returns the flags of a ClassSymbol in terms of javac's flags - */ - static long getFlags(ClassSymbol clazz) { - try { - return clazz.flags(); - } catch (CompletionFailure ex) { - /* Quietly ignore completion failures and try again - the type - * for which the CompletionFailure was thrown shouldn't be completed - * again by the completer that threw the CompletionFailure. - */ - return getFlags(clazz); - } - } - - /** - * Is a ClassSymbol an annotation type? - */ - static boolean isAnnotationType(ClassSymbol clazz) { - return (getFlags(clazz) & Flags.ANNOTATION) != 0; - } - - /** - * Identify the containing class - */ - protected ClassSymbol getContainingClass() { - return tsym.owner.enclClass(); - } - - /** - * Return true if this is a class, not an interface. - */ - @Override - public boolean isClass() { - return !Modifier.isInterface(getModifiers()); - } - - /** - * Return true if this is a ordinary class, - * not an enumeration, exception, an error, or an interface. - */ - @Override - public boolean isOrdinaryClass() { - if (isEnum() || isInterface() || isAnnotationType()) { - return false; - } - for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) { - if (t.tsym == env.syms.errorType.tsym || - t.tsym == env.syms.exceptionType.tsym) { - return false; - } - } - return true; - } - - /** - * Return true if this is an enumeration. - * (For legacy doclets, return false.) - */ - @Override - public boolean isEnum() { - return (getFlags() & Flags.ENUM) != 0 - && - !env.legacyDoclet; - } - - /** - * Return true if this is an interface, but not an annotation type. - * Overridden by AnnotationTypeDocImpl. - */ - @Override - public boolean isInterface() { - return Modifier.isInterface(getModifiers()); - } - - /** - * Return true if this is an exception class - */ - @Override - public boolean isException() { - if (isEnum() || isInterface() || isAnnotationType()) { - return false; - } - for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) { - if (t.tsym == env.syms.exceptionType.tsym) { - return true; - } - } - return false; - } - - /** - * Return true if this is an error class - */ - @Override - public boolean isError() { - if (isEnum() || isInterface() || isAnnotationType()) { - return false; - } - for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) { - if (t.tsym == env.syms.errorType.tsym) { - return true; - } - } - return false; - } - - /** - * Return true if this is a throwable class - */ - public boolean isThrowable() { - if (isEnum() || isInterface() || isAnnotationType()) { - return false; - } - for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) { - if (t.tsym == env.syms.throwableType.tsym) { - return true; - } - } - return false; - } - - /** - * Return true if this class is abstract - */ - public boolean isAbstract() { - return Modifier.isAbstract(getModifiers()); - } - - /** - * Returns true if this class was synthesized by the compiler. - */ - public boolean isSynthetic() { - return (getFlags() & Flags.SYNTHETIC) != 0; - } - - /** - * Return true if this class is included in the active set. - * A ClassDoc is included iff either it is specified on the - * commandline, or if it's containing package is specified - * on the command line, or if it is a member class of an - * included class. - */ - - public boolean isIncluded() { - if (isIncluded) { - return true; - } - if (env.shouldDocument(tsym)) { - // Class is nameable from top-level and - // the class and all enclosing classes - // pass the modifier filter. - if (containingPackage().isIncluded()) { - return isIncluded=true; - } - ClassDoc outer = containingClass(); - if (outer != null && outer.isIncluded()) { - return isIncluded=true; - } - } - return false; - } - - /** - * Return the package that this class is contained in. - */ - @Override - public PackageDoc containingPackage() { - PackageDocImpl p = env.getPackageDoc(tsym.packge()); - if (p.setDocPath == false) { - FileObject docPath; - try { - Location location = env.fileManager.hasLocation(StandardLocation.SOURCE_PATH) - ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH; - - docPath = env.fileManager.getFileForInput( - location, p.qualifiedName(), "package.html"); - } catch (IOException e) { - docPath = null; - } - - if (docPath == null) { - // fall back on older semantics of looking in same directory as - // source file for this class - SourcePosition po = position(); - if (env.fileManager instanceof StandardJavaFileManager && - po instanceof SourcePositionImpl) { - URI uri = ((SourcePositionImpl) po).filename.toUri(); - if ("file".equals(uri.getScheme())) { - File f = new File(uri); - File dir = f.getParentFile(); - if (dir != null) { - File pf = new File(dir, "package.html"); - if (pf.exists()) { - StandardJavaFileManager sfm = (StandardJavaFileManager) env.fileManager; - docPath = sfm.getJavaFileObjects(pf).iterator().next(); - } - } - - } - } - } - - p.setDocPath(docPath); - } - return p; - } - - /** - * Return the class name without package qualifier - but with - * enclosing class qualifier - as a String. - *

-     * Examples:
-     *  for java.util.Hashtable
-     *  return Hashtable
-     *  for java.util.Map.Entry
-     *  return Map.Entry
-     * 
- */ - public String name() { - if (name == null) { - name = getClassName(tsym, false); - } - return name; - } - - private String name; - - /** - * Return the qualified class name as a String. - *
-     * Example:
-     *  for java.util.Hashtable
-     *  return java.util.Hashtable
-     *  if no qualifier, just return flat name
-     * 
- */ - public String qualifiedName() { - if (qualifiedName == null) { - qualifiedName = getClassName(tsym, true); - } - return qualifiedName; - } - - private String qualifiedName; - - /** - * Return unqualified name of type excluding any dimension information. - *

- * For example, a two dimensional array of String returns 'String'. - */ - public String typeName() { - return name(); - } - - /** - * Return qualified name of type excluding any dimension information. - *

- * For example, a two dimensional array of String - * returns 'java.lang.String'. - */ - public String qualifiedTypeName() { - return qualifiedName(); - } - - /** - * Return the simple name of this type. - */ - public String simpleTypeName() { - if (simpleTypeName == null) { - simpleTypeName = tsym.name.toString(); - } - return simpleTypeName; - } - - private String simpleTypeName; - - /** - * Return the qualified name and any type parameters. - * Each parameter is a type variable with optional bounds. - */ - @Override - public String toString() { - return classToString(env, tsym, true); - } - - /** - * Return the class name as a string. If "full" is true the name is - * qualified, otherwise it is qualified by its enclosing class(es) only. - */ - static String getClassName(ClassSymbol c, boolean full) { - if (full) { - return c.getQualifiedName().toString(); - } else { - String n = ""; - for ( ; c != null; c = c.owner.enclClass()) { - n = c.name + (n.isEmpty() ? "" : ".") + n; - } - return n; - } - } - - /** - * Return the class name with any type parameters as a string. - * Each parameter is a type variable with optional bounds. - * If "full" is true all names are qualified, otherwise they are - * qualified by their enclosing class(es) only. - */ - static String classToString(DocEnv env, ClassSymbol c, boolean full) { - StringBuilder s = new StringBuilder(); - if (!c.isInner()) { // if c is not an inner class - s.append(getClassName(c, full)); - } else { - // c is an inner class, so include type params of outer. - ClassSymbol encl = c.owner.enclClass(); - s.append(classToString(env, encl, full)) - .append('.') - .append(c.name); - } - s.append(TypeMaker.typeParametersString(env, c, full)); - return s.toString(); - } - - /** - * Is this class (or any enclosing class) generic? That is, does - * it have type parameters? - */ - static boolean isGeneric(ClassSymbol c) { - return c.type.allparams().nonEmpty(); - } - - /** - * Return the formal type parameters of this class or interface. - * Return an empty array if there are none. - */ - public TypeVariable[] typeParameters() { - if (env.legacyDoclet) { - return new TypeVariable[0]; - } - TypeVariable res[] = new TypeVariable[type.getTypeArguments().length()]; - TypeMaker.getTypes(env, type.getTypeArguments(), res); - return res; - } - - /** - * Return the type parameter tags of this class or interface. - */ - public ParamTag[] typeParamTags() { - return (env.legacyDoclet) - ? new ParamTag[0] - : comment().typeParamTags(); - } - - /** - * Return the modifier string for this class. If it's an interface - * exclude 'abstract' keyword from the modifier string - */ - @Override - public String modifiers() { - return Modifier.toString(modifierSpecifier()); - } - - @Override - public int modifierSpecifier() { - int modifiers = getModifiers(); - return (isInterface() || isAnnotationType()) - ? modifiers & ~Modifier.ABSTRACT - : modifiers; - } - - /** - * Return the superclass of this class - * - * @return the ClassDocImpl for the superclass of this class, null - * if there is no superclass. - */ - public ClassDoc superclass() { - if (isInterface() || isAnnotationType()) return null; - if (tsym == env.syms.objectType.tsym) return null; - ClassSymbol c = (ClassSymbol)env.types.supertype(type).tsym; - if (c == null || c == tsym) c = (ClassSymbol)env.syms.objectType.tsym; - return env.getClassDoc(c); - } - - /** - * Return the superclass of this class. Return null if this is an - * interface. A superclass is represented by either a - * ClassDoc or a ParameterizedType. - */ - public com.sun.javadoc.Type superclassType() { - if (isInterface() || isAnnotationType() || - (tsym == env.syms.objectType.tsym)) - return null; - Type sup = env.types.supertype(type); - return TypeMaker.getType(env, - (sup.hasTag(TypeTag.NONE)) ? env.syms.objectType : sup); - } - - /** - * Test whether this class is a subclass of the specified class. - * - * @param cd the candidate superclass. - * @return true if cd is a superclass of this class. - */ - public boolean subclassOf(ClassDoc cd) { - return tsym.isSubClass(((ClassDocImpl)cd).tsym, env.types); - } - - /** - * Return interfaces implemented by this class or interfaces - * extended by this interface. - * - * @return An array of ClassDocImpl representing the interfaces. - * Return an empty array if there are no interfaces. - */ - public ClassDoc[] interfaces() { - ListBuffer ta = new ListBuffer<>(); - for (Type t : env.types.interfaces(type)) { - ta.append(env.getClassDoc((ClassSymbol)t.tsym)); - } - //### Cache ta here? - return ta.toArray(new ClassDocImpl[ta.length()]); - } - - /** - * Return interfaces implemented by this class or interfaces extended - * by this interface. Includes only directly-declared interfaces, not - * inherited interfaces. - * Return an empty array if there are no interfaces. - */ - public com.sun.javadoc.Type[] interfaceTypes() { - //### Cache result here? - return TypeMaker.getTypes(env, env.types.interfaces(type)); - } - - /** - * Return fields in class. - * @param filter include only the included fields if filter==true - */ - public FieldDoc[] fields(boolean filter) { - return fields(filter, false); - } - - /** - * Return included fields in class. - */ - public FieldDoc[] fields() { - return fields(true, false); - } - - /** - * Return the enum constants if this is an enum type. - */ - public FieldDoc[] enumConstants() { - return fields(false, true); - } - - /** - * Return fields in class. - * @param filter if true, return only the included fields - * @param enumConstants if true, return the enum constants instead - */ - private FieldDoc[] fields(boolean filter, boolean enumConstants) { - List fields = List.nil(); - for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) { - if (sym != null && sym.kind == VAR) { - VarSymbol s = (VarSymbol)sym; - boolean isEnum = ((s.flags() & Flags.ENUM) != 0) && - !env.legacyDoclet; - if (isEnum == enumConstants && - (!filter || env.shouldDocument(s))) { - fields = fields.prepend(env.getFieldDoc(s)); - } - } - } - return fields.toArray(new FieldDocImpl[fields.length()]); - } - - /** - * Return methods in class. - * This method is overridden by AnnotationTypeDocImpl. - * - * @param filter include only the included methods if filter==true - * @return an array of MethodDocImpl for representing the visible - * methods in this class. Does not include constructors. - */ - public MethodDoc[] methods(boolean filter) { - Names names = tsym.name.table.names; - List methods = List.nil(); - for (Symbol sym :tsym.members().getSymbols(NON_RECURSIVE)) { - if (sym != null - && sym.kind == MTH - && sym.name != names.init - && sym.name != names.clinit) { - MethodSymbol s = (MethodSymbol)sym; - if (!filter || env.shouldDocument(s)) { - methods = methods.prepend(env.getMethodDoc(s)); - } - } - } - //### Cache methods here? - return methods.toArray(new MethodDocImpl[methods.length()]); - } - - /** - * Return included methods in class. - * - * @return an array of MethodDocImpl for representing the visible - * methods in this class. Does not include constructors. - */ - public MethodDoc[] methods() { - return methods(true); - } - - /** - * Return constructors in class. - * - * @param filter include only the included constructors if filter==true - * @return an array of ConstructorDocImpl for representing the visible - * constructors in this class. - */ - public ConstructorDoc[] constructors(boolean filter) { - Names names = tsym.name.table.names; - List constructors = List.nil(); - for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) { - if (sym != null && - sym.kind == MTH && sym.name == names.init) { - MethodSymbol s = (MethodSymbol)sym; - if (!filter || env.shouldDocument(s)) { - constructors = constructors.prepend(env.getConstructorDoc(s)); - } - } - } - //### Cache constructors here? - return constructors.toArray(new ConstructorDocImpl[constructors.length()]); - } - - /** - * Return included constructors in class. - * - * @return an array of ConstructorDocImpl for representing the visible - * constructors in this class. - */ - public ConstructorDoc[] constructors() { - return constructors(true); - } - - /** - * Adds all inner classes of this class, and their - * inner classes recursively, to the list l. - */ - void addAllClasses(ListBuffer l, boolean filtered) { - try { - if (isSynthetic()) return; - // sometimes synthetic classes are not marked synthetic - if (!JavadocTool.isValidClassName(tsym.name.toString())) return; - if (filtered && !env.shouldDocument(tsym)) return; - if (l.contains(this)) return; - l.append(this); - List more = List.nil(); - for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) { - if (sym != null && sym.kind == TYP) { - ClassSymbol s = (ClassSymbol)sym; - ClassDocImpl c = env.getClassDoc(s); - if (c.isSynthetic()) continue; - if (c != null) more = more.prepend(c); - } - } - // this extra step preserves the ordering from oldjavadoc - for (; more.nonEmpty(); more=more.tail) { - more.head.addAllClasses(l, filtered); - } - } catch (CompletionFailure e) { - // quietly ignore completion failures - } - } - - /** - * Return inner classes within this class. - * - * @param filter include only the included inner classes if filter==true. - * @return an array of ClassDocImpl for representing the visible - * classes defined in this class. Anonymous and local classes - * are not included. - */ - public ClassDoc[] innerClasses(boolean filter) { - ListBuffer innerClasses = new ListBuffer<>(); - for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) { - if (sym != null && sym.kind == TYP) { - ClassSymbol s = (ClassSymbol)sym; - if ((s.flags_field & Flags.SYNTHETIC) != 0) continue; - if (!filter || env.isVisible(s)) { - innerClasses.prepend(env.getClassDoc(s)); - } - } - } - //### Cache classes here? - return innerClasses.toArray(new ClassDocImpl[innerClasses.length()]); - } - - /** - * Return included inner classes within this class. - * - * @return an array of ClassDocImpl for representing the visible - * classes defined in this class. Anonymous and local classes - * are not included. - */ - public ClassDoc[] innerClasses() { - return innerClasses(true); - } - - /** - * Find a class within the context of this class. - * Search order: qualified name, in this class (inner), - * in this package, in the class imports, in the package - * imports. - * Return the ClassDocImpl if found, null if not found. - */ - //### The specified search order is not the normal rule the - //### compiler would use. Leave as specified or change it? - public ClassDoc findClass(String className) { - ClassDoc searchResult = searchClass(className); - if (searchResult == null) { - ClassDocImpl enclosingClass = (ClassDocImpl)containingClass(); - //Expand search space to include enclosing class. - while (enclosingClass != null && enclosingClass.containingClass() != null) { - enclosingClass = (ClassDocImpl)enclosingClass.containingClass(); - } - searchResult = enclosingClass == null ? - null : enclosingClass.searchClass(className); - } - return searchResult; - } - - private ClassDoc searchClass(String className) { - Names names = tsym.name.table.names; - - // search by qualified name first - ClassDoc cd = env.lookupClass(className); - if (cd != null) { - return cd; - } - - // search inner classes - //### Add private entry point to avoid creating array? - //### Replicate code in innerClasses here to avoid consing? - for (ClassDoc icd : innerClasses()) { - if (icd.name().equals(className) || - //### This is from original javadoc but it looks suspicious to me... - //### I believe it is attempting to compensate for the confused - //### convention of including the nested class qualifiers in the - //### 'name' of the inner class, rather than the true simple name. - icd.name().endsWith("." + className)) { - return icd; - } else { - ClassDoc innercd = ((ClassDocImpl) icd).searchClass(className); - if (innercd != null) { - return innercd; - } - } - } - - // check in this package - cd = containingPackage().findClass(className); - if (cd != null) { - return cd; - } - - // make sure that this symbol has been completed - tsym.complete(); - - // search imports - - if (tsym.sourcefile != null) { - - //### This information is available only for source classes. - - Env compenv = env.enter.getEnv(tsym); - if (compenv == null) return null; - - Scope s = compenv.toplevel.namedImportScope; - for (Symbol sym : s.getSymbolsByName(names.fromString(className))) { - if (sym.kind == TYP) { - ClassDoc c = env.getClassDoc((ClassSymbol)sym); - return c; - } - } - - s = compenv.toplevel.starImportScope; - for (Symbol sym : s.getSymbolsByName(names.fromString(className))) { - if (sym.kind == TYP) { - ClassDoc c = env.getClassDoc((ClassSymbol)sym); - return c; - } - } - } - - return null; // not found - } - - - private boolean hasParameterTypes(MethodSymbol method, String[] argTypes) { - - if (argTypes == null) { - // wildcard - return true; - } - - int i = 0; - List types = method.type.getParameterTypes(); - - if (argTypes.length != types.length()) { - return false; - } - - for (Type t : types) { - String argType = argTypes[i++]; - // For vararg method, "T..." matches type T[]. - if (i == argTypes.length) { - argType = argType.replace("...", "[]"); - } - if (!hasTypeName(env.types.erasure(t), argType)) { //###(gj) - return false; - } - } - return true; - } - // where - private boolean hasTypeName(Type t, String name) { - return - name.equals(TypeMaker.getTypeName(t, true)) - || - name.equals(TypeMaker.getTypeName(t, false)) - || - (qualifiedName() + "." + name).equals(TypeMaker.getTypeName(t, true)); - } - - - - /** - * Find a method in this class scope. - * Search order: this class, interfaces, superclasses, outerclasses. - * Note that this is not necessarily what the compiler would do! - * - * @param methodName the unqualified name to search for. - * @param paramTypes the array of Strings for method parameter types. - * @return the first MethodDocImpl which matches, null if not found. - */ - public MethodDocImpl findMethod(String methodName, String[] paramTypes) { - // Use hash table 'searched' to avoid searching same class twice. - //### It is not clear how this could happen. - return searchMethod(methodName, paramTypes, new HashSet()); - } - - private MethodDocImpl searchMethod(String methodName, - String[] paramTypes, Set searched) { - //### Note that this search is not necessarily what the compiler would do! - - Names names = tsym.name.table.names; - // do not match constructors - if (names.init.contentEquals(methodName)) { - return null; - } - - ClassDocImpl cdi; - MethodDocImpl mdi; - - if (searched.contains(this)) { - return null; - } - searched.add(this); - - //DEBUG - /*---------------------------------* - System.out.print("searching " + this + " for " + methodName); - if (paramTypes == null) { - System.out.println("()"); - } else { - System.out.print("("); - for (int k=0; k < paramTypes.length; k++) { - System.out.print(paramTypes[k]); - if ((k + 1) < paramTypes.length) { - System.out.print(", "); - } - } - System.out.println(")"); - } - *---------------------------------*/ - - // search current class - - //### Using modifier filter here isn't really correct, - //### but emulates the old behavior. Instead, we should - //### apply the normal rules of visibility and inheritance. - - if (paramTypes == null) { - // If no parameters specified, we are allowed to return - // any method with a matching name. In practice, the old - // code returned the first method, which is now the last! - // In order to provide textually identical results, we - // attempt to emulate the old behavior. - MethodSymbol lastFound = null; - for (Symbol sym : tsym.members().getSymbolsByName(names.fromString(methodName))) { - if (sym.kind == MTH) { - //### Should intern methodName as Name. - if (sym.name.toString().equals(methodName)) { - lastFound = (MethodSymbol)sym; - } - } - } - if (lastFound != null) { - return env.getMethodDoc(lastFound); - } - } else { - for (Symbol sym : tsym.members().getSymbolsByName(names.fromString(methodName))) { - if (sym != null && - sym.kind == MTH) { - //### Should intern methodName as Name. - if (hasParameterTypes((MethodSymbol)sym, paramTypes)) { - return env.getMethodDoc((MethodSymbol)sym); - } - } - } - } - - //### If we found a MethodDoc above, but which did not pass - //### the modifier filter, we should return failure here! - - // search superclass - cdi = (ClassDocImpl)superclass(); - if (cdi != null) { - mdi = cdi.searchMethod(methodName, paramTypes, searched); - if (mdi != null) { - return mdi; - } - } - - // search interfaces - for (ClassDoc intf : interfaces()) { - cdi = (ClassDocImpl) intf; - mdi = cdi.searchMethod(methodName, paramTypes, searched); - if (mdi != null) { - return mdi; - } - } - - // search enclosing class - cdi = (ClassDocImpl)containingClass(); - if (cdi != null) { - mdi = cdi.searchMethod(methodName, paramTypes, searched); - if (mdi != null) { - return mdi; - } - } - - //###(gj) As a temporary measure until type variables are better - //### handled, try again without the parameter types. - //### This should most often find the right method, and occassionally - //### find the wrong one. - //if (paramTypes != null) { - // return findMethod(methodName, null); - //} - - return null; - } - - /** - * Find constructor in this class. - * - * @param constrName the unqualified name to search for. - * @param paramTypes the array of Strings for constructor parameters. - * @return the first ConstructorDocImpl which matches, null if not found. - */ - public ConstructorDoc findConstructor(String constrName, - String[] paramTypes) { - Names names = tsym.name.table.names; - for (Symbol sym : tsym.members().getSymbolsByName(names.fromString(""))) { - if (sym.kind == MTH) { - if (hasParameterTypes((MethodSymbol)sym, paramTypes)) { - return env.getConstructorDoc((MethodSymbol)sym); - } - } - } - - //###(gj) As a temporary measure until type variables are better - //### handled, try again without the parameter types. - //### This will often find the right constructor, and occassionally - //### find the wrong one. - //if (paramTypes != null) { - // return findConstructor(constrName, null); - //} - - return null; - } - - /** - * Find a field in this class scope. - * Search order: this class, outerclasses, interfaces, - * superclasses. IMP: If see tag is defined in an inner class, - * which extends a super class and if outerclass and the super - * class have a visible field in common then Java compiler cribs - * about the ambiguity, but the following code will search in the - * above given search order. - * - * @param fieldName the unqualified name to search for. - * @return the first FieldDocImpl which matches, null if not found. - */ - public FieldDoc findField(String fieldName) { - return searchField(fieldName, new HashSet()); - } - - private FieldDocImpl searchField(String fieldName, Set searched) { - Names names = tsym.name.table.names; - if (searched.contains(this)) { - return null; - } - searched.add(this); - - for (Symbol sym : tsym.members().getSymbolsByName(names.fromString(fieldName))) { - if (sym.kind == VAR) { - //### Should intern fieldName as Name. - return env.getFieldDoc((VarSymbol)sym); - } - } - - //### If we found a FieldDoc above, but which did not pass - //### the modifier filter, we should return failure here! - - ClassDocImpl cdi = (ClassDocImpl)containingClass(); - if (cdi != null) { - FieldDocImpl fdi = cdi.searchField(fieldName, searched); - if (fdi != null) { - return fdi; - } - } - - // search superclass - cdi = (ClassDocImpl)superclass(); - if (cdi != null) { - FieldDocImpl fdi = cdi.searchField(fieldName, searched); - if (fdi != null) { - return fdi; - } - } - - // search interfaces - for (ClassDoc intf : interfaces()) { - cdi = (ClassDocImpl) intf; - FieldDocImpl fdi = cdi.searchField(fieldName, searched); - if (fdi != null) { - return fdi; - } - } - - return null; - } - - /** - * Get the list of classes declared as imported. - * These are called "single-type-import declarations" in the JLS. - * This method is deprecated in the ClassDoc interface. - * - * @return an array of ClassDocImpl representing the imported classes. - * - * @deprecated Import declarations are implementation details that - * should not be exposed here. In addition, not all imported - * classes are imported through single-type-import declarations. - */ - @Deprecated(since="9", forRemoval=true) - public ClassDoc[] importedClasses() { - // information is not available for binary classfiles - if (tsym.sourcefile == null) return new ClassDoc[0]; - - ListBuffer importedClasses = new ListBuffer<>(); - - Env compenv = env.enter.getEnv(tsym); - if (compenv == null) return new ClassDocImpl[0]; - - Name asterisk = tsym.name.table.names.asterisk; - for (JCTree t : compenv.toplevel.defs) { - if (t.hasTag(IMPORT)) { - JCTree imp = ((JCImport) t).qualid; - if ((TreeInfo.name(imp) != asterisk) && - imp.type.tsym.kind.matches(KindSelector.TYP)) { - importedClasses.append( - env.getClassDoc((ClassSymbol)imp.type.tsym)); - } - } - } - - return importedClasses.toArray(new ClassDocImpl[importedClasses.length()]); - } - - /** - * Get the list of packages declared as imported. - * These are called "type-import-on-demand declarations" in the JLS. - * This method is deprecated in the ClassDoc interface. - * - * @return an array of PackageDocImpl representing the imported packages. - * - * ###NOTE: the syntax supports importing all inner classes from a class as well. - * @deprecated Import declarations are implementation details that - * should not be exposed here. In addition, this method's - * return type does not allow for all type-import-on-demand - * declarations to be returned. - */ - @Deprecated(since="9", forRemoval=true) - public PackageDoc[] importedPackages() { - // information is not available for binary classfiles - if (tsym.sourcefile == null) return new PackageDoc[0]; - - ListBuffer importedPackages = new ListBuffer<>(); - - //### Add the implicit "import java.lang.*" to the result - Names names = tsym.name.table.names; - importedPackages.append(env.getPackageDoc(env.syms.enterPackage(env.syms.java_base, names.java_lang))); - - Env compenv = env.enter.getEnv(tsym); - if (compenv == null) return new PackageDocImpl[0]; - - for (JCTree t : compenv.toplevel.defs) { - if (t.hasTag(IMPORT)) { - JCTree imp = ((JCImport) t).qualid; - if (TreeInfo.name(imp) == names.asterisk) { - JCFieldAccess sel = (JCFieldAccess)imp; - Symbol s = sel.selected.type.tsym; - PackageDocImpl pdoc = env.getPackageDoc(s.packge()); - if (!importedPackages.contains(pdoc)) - importedPackages.append(pdoc); - } - } - } - - return importedPackages.toArray(new PackageDocImpl[importedPackages.length()]); - } - - /** - * Return the type's dimension information. - * Always return "", as this is not an array type. - */ - public String dimension() { - return ""; - } - - /** - * Return this type as a class, which it already is. - */ - public ClassDoc asClassDoc() { - return this; - } - - /** - * Return null (unless overridden), as this is not an annotation type. - */ - public AnnotationTypeDoc asAnnotationTypeDoc() { - return null; - } - - /** - * Return null, as this is not a class instantiation. - */ - public ParameterizedType asParameterizedType() { - return null; - } - - /** - * Return null, as this is not a type variable. - */ - public TypeVariable asTypeVariable() { - return null; - } - - /** - * Return null, as this is not a wildcard type. - */ - public WildcardType asWildcardType() { - return null; - } - - /** - * Returns null, as this is not an annotated type. - */ - public AnnotatedType asAnnotatedType() { - return null; - } - - /** - * Return false, as this is not a primitive type. - */ - public boolean isPrimitive() { - return false; - } - - //--- Serialization --- - - //### These methods ignore modifier filter. - - /** - * Return true if this class implements java.io.Serializable. - * - * Since java.io.Externalizable extends - * java.io.Serializable, - * Externalizable objects are also Serializable. - */ - public boolean isSerializable() { - try { - return env.types.isSubtype(type, env.syms.serializableType); - } catch (CompletionFailure ex) { - // quietly ignore completion failures - return false; - } - } - - /** - * Return true if this class implements - * java.io.Externalizable. - */ - public boolean isExternalizable() { - try { - return env.types.isSubtype(type, env.externalizableSym.type); - } catch (CompletionFailure ex) { - // quietly ignore completion failures - return false; - } - } - - /** - * Return the serialization methods for this class. - * - * @return an array of MethodDocImpl that represents - * the serialization methods for this class. - */ - public MethodDoc[] serializationMethods() { - if (serializedForm == null) { - serializedForm = new SerializedForm(env, tsym, this); - } - //### Clone this? - return serializedForm.methods(); - } - - /** - * Return the Serializable fields of class.

- * - * Return either a list of default fields documented by - * serial tag
- * or return a single FieldDoc for - * serialPersistentField member. - * There should be a serialField tag for - * each Serializable field defined by an ObjectStreamField - * array component of serialPersistentField. - * - * @return an array of {@code FieldDoc} for the Serializable fields - * of this class. - * - * @see #definesSerializableFields() - * @see SerialFieldTagImpl - */ - public FieldDoc[] serializableFields() { - if (serializedForm == null) { - serializedForm = new SerializedForm(env, tsym, this); - } - //### Clone this? - return serializedForm.fields(); - } - - /** - * Return true if Serializable fields are explicitly defined with - * the special class member serialPersistentFields. - * - * @see #serializableFields() - * @see SerialFieldTagImpl - */ - public boolean definesSerializableFields() { - if (!isSerializable() || isExternalizable()) { - return false; - } else { - if (serializedForm == null) { - serializedForm = new SerializedForm(env, tsym, this); - } - //### Clone this? - return serializedForm.definesSerializableFields(); - } - } - - /** - * Determine if a class is a RuntimeException. - *

- * Used only by ThrowsTagImpl. - */ - boolean isRuntimeException() { - return tsym.isSubClass(env.syms.runtimeExceptionType.tsym, env.types); - } - - /** - * Return the source position of the entity, or null if - * no position is available. - */ - @Override - public SourcePosition position() { - if (tsym.sourcefile == null) return null; - return SourcePositionImpl.make(tsym.sourcefile, - (tree==null) ? Position.NOPOS : tree.pos, - lineMap); - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Comment.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Comment.java deleted file mode 100644 index 98881933de4..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Comment.java +++ /dev/null @@ -1,462 +0,0 @@ -/* - * Copyright (c) 1997, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.javadoc.main; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import com.sun.javadoc.*; -import com.sun.tools.javac.util.ListBuffer; - -/** - * Comment contains all information in comment part. - * It allows users to get first sentence of this comment, get - * comment for different tags... - * - *

This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @author Kaiyang Liu (original) - * @author Robert Field (rewrite) - * @author Atul M Dambalkar - * @author Neal Gafter (rewrite) - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -class Comment { - - /** - * sorted comments with different tags. - */ - private final ListBuffer tagList = new ListBuffer<>(); - - /** - * text minus any tags. - */ - private String text; - - /** - * Doc environment - */ - private final DocEnv docenv; - - /** - * constructor of Comment. - */ - Comment(final DocImpl holder, final String commentString) { - this.docenv = holder.env; - - /** - * Separate the comment into the text part and zero to N tags. - * Simple state machine is in one of three states: - *

-         * IN_TEXT: parsing the comment text or tag text.
-         * TAG_NAME: parsing the name of a tag.
-         * TAG_GAP: skipping through the gap between the tag name and
-         * the tag text.
-         * 
- */ - @SuppressWarnings("fallthrough") - class CommentStringParser { - /** - * The entry point to the comment string parser - */ - void parseCommentStateMachine() { - final int IN_TEXT = 1; - final int TAG_GAP = 2; - final int TAG_NAME = 3; - int state = TAG_GAP; - boolean newLine = true; - String tagName = null; - int tagStart = 0; - int textStart = 0; - int lastNonWhite = -1; - int len = commentString.length(); - for (int inx = 0; inx < len; ++inx) { - char ch = commentString.charAt(inx); - boolean isWhite = Character.isWhitespace(ch); - switch (state) { - case TAG_NAME: - if (isWhite) { - tagName = commentString.substring(tagStart, inx); - state = TAG_GAP; - } - break; - case TAG_GAP: - if (isWhite) { - break; - } - textStart = inx; - state = IN_TEXT; - /* fall thru */ - case IN_TEXT: - if (newLine && ch == '@') { - parseCommentComponent(tagName, textStart, - lastNonWhite+1); - tagStart = inx; - state = TAG_NAME; - } - break; - } - if (ch == '\n') { - newLine = true; - } else if (!isWhite) { - lastNonWhite = inx; - newLine = false; - } - } - // Finish what's currently being processed - switch (state) { - case TAG_NAME: - tagName = commentString.substring(tagStart, len); - /* fall thru */ - case TAG_GAP: - textStart = len; - /* fall thru */ - case IN_TEXT: - parseCommentComponent(tagName, textStart, lastNonWhite+1); - break; - } - } - - /** - * Save away the last parsed item. - */ - void parseCommentComponent(String tagName, - int from, int upto) { - String tx = upto <= from ? "" : commentString.substring(from, upto); - if (tagName == null) { - text = tx; - } else { - TagImpl tag; - switch (tagName) { - case "@exception": - case "@throws": - warnIfEmpty(tagName, tx); - tag = new ThrowsTagImpl(holder, tagName, tx); - break; - case "@param": - warnIfEmpty(tagName, tx); - tag = new ParamTagImpl(holder, tagName, tx); - break; - case "@see": - warnIfEmpty(tagName, tx); - tag = new SeeTagImpl(holder, tagName, tx); - break; - case "@serialField": - warnIfEmpty(tagName, tx); - tag = new SerialFieldTagImpl(holder, tagName, tx); - break; - case "@return": - warnIfEmpty(tagName, tx); - tag = new TagImpl(holder, tagName, tx); - break; - case "@author": - warnIfEmpty(tagName, tx); - tag = new TagImpl(holder, tagName, tx); - break; - case "@version": - warnIfEmpty(tagName, tx); - tag = new TagImpl(holder, tagName, tx); - break; - default: - tag = new TagImpl(holder, tagName, tx); - break; - } - tagList.append(tag); - } - } - - void warnIfEmpty(String tagName, String tx) { - if (tx.length() == 0) { - docenv.warning(holder, "tag.tag_has_no_arguments", tagName); - } - } - - } - - new CommentStringParser().parseCommentStateMachine(); - } - - /** - * Return the text of the comment. - */ - String commentText() { - return text; - } - - /** - * Return all tags in this comment. - */ - Tag[] tags() { - return tagList.toArray(new Tag[tagList.length()]); - } - - /** - * Return tags of the specified kind in this comment. - */ - Tag[] tags(String tagname) { - ListBuffer found = new ListBuffer<>(); - String target = tagname; - if (target.charAt(0) != '@') { - target = "@" + target; - } - for (Tag tag : tagList) { - if (tag.kind().equals(target)) { - found.append(tag); - } - } - return found.toArray(new Tag[found.length()]); - } - - /** - * Return throws tags in this comment. - */ - ThrowsTag[] throwsTags() { - ListBuffer found = new ListBuffer<>(); - for (Tag next : tagList) { - if (next instanceof ThrowsTag) { - found.append((ThrowsTag)next); - } - } - return found.toArray(new ThrowsTag[found.length()]); - } - - /** - * Return param tags (excluding type param tags) in this comment. - */ - ParamTag[] paramTags() { - return paramTags(false); - } - - /** - * Return type param tags in this comment. - */ - ParamTag[] typeParamTags() { - return paramTags(true); - } - - /** - * Return param tags in this comment. If typeParams is true - * include only type param tags, otherwise include only ordinary - * param tags. - */ - private ParamTag[] paramTags(boolean typeParams) { - ListBuffer found = new ListBuffer<>(); - for (Tag next : tagList) { - if (next instanceof ParamTag) { - ParamTag p = (ParamTag)next; - if (typeParams == p.isTypeParameter()) { - found.append(p); - } - } - } - return found.toArray(new ParamTag[found.length()]); - } - - /** - * Return see also tags in this comment. - */ - SeeTag[] seeTags() { - ListBuffer found = new ListBuffer<>(); - for (Tag next : tagList) { - if (next instanceof SeeTag) { - found.append((SeeTag)next); - } - } - return found.toArray(new SeeTag[found.length()]); - } - - /** - * Return serialField tags in this comment. - */ - SerialFieldTag[] serialFieldTags() { - ListBuffer found = new ListBuffer<>(); - for (Tag next : tagList) { - if (next instanceof SerialFieldTag) { - found.append((SerialFieldTag)next); - } - } - return found.toArray(new SerialFieldTag[found.length()]); - } - - /** - * Return array of tags with text and inline See Tags for a Doc comment. - */ - static Tag[] getInlineTags(DocImpl holder, String inlinetext) { - ListBuffer taglist = new ListBuffer<>(); - int delimend = 0, textstart = 0, len = inlinetext.length(); - boolean inPre = false; - DocEnv docenv = holder.env; - - if (len == 0) { - return taglist.toArray(new Tag[taglist.length()]); - } - while (true) { - int linkstart; - if ((linkstart = inlineTagFound(holder, inlinetext, - textstart)) == -1) { - taglist.append(new TagImpl(holder, "Text", - inlinetext.substring(textstart))); - break; - } else { - inPre = scanForPre(inlinetext, textstart, linkstart, inPre); - int seetextstart = linkstart; - for (int i = linkstart; i < inlinetext.length(); i++) { - char c = inlinetext.charAt(i); - if (Character.isWhitespace(c) || - c == '}') { - seetextstart = i; - break; - } - } - String linkName = inlinetext.substring(linkstart+2, seetextstart); - if (!(inPre && (linkName.equals("code") || linkName.equals("literal")))) { - //Move past the white space after the inline tag name. - while (Character.isWhitespace(inlinetext. - charAt(seetextstart))) { - if (inlinetext.length() <= seetextstart) { - taglist.append(new TagImpl(holder, "Text", - inlinetext.substring(textstart, seetextstart))); - docenv.warning(holder, - "tag.Improper_Use_Of_Link_Tag", - inlinetext); - return taglist.toArray(new Tag[taglist.length()]); - } else { - seetextstart++; - } - } - } - taglist.append(new TagImpl(holder, "Text", - inlinetext.substring(textstart, linkstart))); - textstart = seetextstart; // this text is actually seetag - if ((delimend = findInlineTagDelim(inlinetext, textstart)) == -1) { - //Missing closing '}' character. - // store the text as it is with the {@link. - taglist.append(new TagImpl(holder, "Text", - inlinetext.substring(textstart))); - docenv.warning(holder, - "tag.End_delimiter_missing_for_possible_SeeTag", - inlinetext); - return taglist.toArray(new Tag[taglist.length()]); - } else { - //Found closing '}' character. - if (linkName.equals("see") - || linkName.equals("link") - || linkName.equals("linkplain")) { - taglist.append( new SeeTagImpl(holder, "@" + linkName, - inlinetext.substring(textstart, delimend))); - } else { - taglist.append( new TagImpl(holder, "@" + linkName, - inlinetext.substring(textstart, delimend))); - } - textstart = delimend + 1; - } - } - if (textstart == inlinetext.length()) { - break; - } - } - return taglist.toArray(new Tag[taglist.length()]); - } - - /** regex for case-insensitive match for {@literal
 } and  {@literal 
}. */ - private static final Pattern prePat = Pattern.compile("(?i)<(/?)pre>"); - - private static boolean scanForPre(String inlinetext, int start, int end, boolean inPre) { - Matcher m = prePat.matcher(inlinetext).region(start, end); - while (m.find()) { - inPre = m.group(1).isEmpty(); - } - return inPre; - } - - /** - * Recursively find the index of the closing '}' character for an inline tag - * and return it. If it can't be found, return -1. - * @param inlineText the text to search in. - * @param searchStart the index of the place to start searching at. - * @return the index of the closing '}' character for an inline tag. - * If it can't be found, return -1. - */ - private static int findInlineTagDelim(String inlineText, int searchStart) { - int delimEnd, nestedOpenBrace; - if ((delimEnd = inlineText.indexOf("}", searchStart)) == -1) { - return -1; - } else if (((nestedOpenBrace = inlineText.indexOf("{", searchStart)) != -1) && - nestedOpenBrace < delimEnd){ - //Found a nested open brace. - int nestedCloseBrace = findInlineTagDelim(inlineText, nestedOpenBrace + 1); - return (nestedCloseBrace != -1) ? - findInlineTagDelim(inlineText, nestedCloseBrace + 1) : - -1; - } else { - return delimEnd; - } - } - - /** - * Recursively search for the characters '{', '@', followed by - * name of inline tag and white space, - * if found - * return the index of the text following the white space. - * else - * return -1. - */ - private static int inlineTagFound(DocImpl holder, String inlinetext, int start) { - DocEnv docenv = holder.env; - int linkstart = inlinetext.indexOf("{@", start); - if (start == inlinetext.length() || linkstart == -1) { - return -1; - } else if (inlinetext.indexOf('}', linkstart) == -1) { - //Missing '}'. - docenv.warning(holder, "tag.Improper_Use_Of_Link_Tag", - inlinetext.substring(linkstart, inlinetext.length())); - return -1; - } else { - return linkstart; - } - } - - - /** - * Return array of tags for the locale specific first sentence in the text. - */ - static Tag[] firstSentenceTags(DocImpl holder, String text) { - DocLocale doclocale = holder.env.doclocale; - return getInlineTags(holder, - doclocale.localeSpecificFirstSentence(holder, text)); - } - - /** - * Return text for this Doc comment. - */ - @Override - public String toString() { - return text; - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ConstructorDocImpl.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ConstructorDocImpl.java deleted file mode 100644 index 02c13c9aac3..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ConstructorDocImpl.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 1997, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.javadoc.main; - -import com.sun.javadoc.*; - -import com.sun.source.util.TreePath; -import com.sun.tools.javac.code.Symbol.ClassSymbol; -import com.sun.tools.javac.code.Symbol.MethodSymbol; - -/** - * Represents a constructor of a java class. - * - *

This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @since 1.2 - * @author Robert Field - * @author Neal Gafter (rewrite) - */ - -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public class ConstructorDocImpl - extends ExecutableMemberDocImpl implements ConstructorDoc { - - /** - * constructor. - */ - public ConstructorDocImpl(DocEnv env, MethodSymbol sym) { - super(env, sym); - } - - /** - * constructor. - */ - public ConstructorDocImpl(DocEnv env, MethodSymbol sym, TreePath treePath) { - super(env, sym, treePath); - } - - /** - * Return true if it is a constructor, which it is. - * - * @return true - */ - public boolean isConstructor() { - return true; - } - - /** - * Get the name. - * - * @return the name of the member. - */ - public String name() { - ClassSymbol c = sym.enclClass(); - return c.name.toString(); - } - - /** - * Get the name. - * - * @return the qualified name of the member. - */ - public String qualifiedName() { - return sym.enclClass().getQualifiedName().toString(); - } - - /** - * Returns a string representation of this constructor. Includes the - * qualified signature and any type parameters. - * Type parameters precede the class name, as they do in the syntax - * for invoking constructors with explicit type parameters using "new". - * (This is unlike the syntax for invoking methods with explicit type - * parameters.) - */ - public String toString() { - return typeParametersString() + qualifiedName() + signature(); - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java deleted file mode 100644 index 57050dfcd18..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java +++ /dev/null @@ -1,881 +0,0 @@ -/* - * Copyright (c) 2000, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.javadoc.main; - -import java.lang.reflect.Modifier; -import java.util.*; - -import javax.tools.JavaFileManager; - -import com.sun.javadoc.*; -import com.sun.source.tree.CompilationUnitTree; -import com.sun.source.util.JavacTask; -import com.sun.source.util.TreePath; -import com.sun.tools.doclint.DocLint; -import com.sun.tools.javac.api.BasicJavacTask; -import com.sun.tools.javac.code.*; -import com.sun.tools.javac.code.Symbol.*; -import com.sun.tools.javac.code.Symbol.ClassSymbol; -import com.sun.tools.javac.code.Symbol.CompletionFailure; -import com.sun.tools.javac.code.Symbol.MethodSymbol; -import com.sun.tools.javac.code.Symbol.PackageSymbol; -import com.sun.tools.javac.code.Symbol.VarSymbol; -import com.sun.tools.javac.code.Type.ClassType; -import com.sun.tools.javac.comp.Check; -import com.sun.tools.javac.comp.Enter; -import com.sun.tools.javac.file.JavacFileManager; -import com.sun.tools.javac.tree.JCTree; -import com.sun.tools.javac.tree.JCTree.JCClassDecl; -import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; -import com.sun.tools.javac.tree.JCTree.JCPackageDecl; -import com.sun.tools.javac.util.Context; -import com.sun.tools.javac.util.Convert; -import com.sun.tools.javac.util.Name; -import com.sun.tools.javac.util.Names; - -/** - * Holds the environment for a run of javadoc. - * Holds only the information needed throughout the - * run and not the compiler info that could be GC'ed - * or ported. - * - *

This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @since 1.4 - * @author Robert Field - * @author Neal Gafter (rewrite) - * @author Scott Seligman (generics) - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public class DocEnv { - protected static final Context.Key docEnvKey = new Context.Key<>(); - - public static DocEnv instance(Context context) { - DocEnv instance = context.get(docEnvKey); - if (instance == null) - instance = new DocEnv(context); - return instance; - } - - DocLocale doclocale; - - private final Messager messager; - - /** Predefined symbols known to the compiler. */ - final Symtab syms; - - /** Referenced directly in RootDocImpl. */ - private final ClassFinder finder; - - /** Javadoc's own version of the compiler's enter phase. */ - final Enter enter; - - /** The name table. */ - private final Names names; - - /** The encoding name. */ - private String encoding; - - final Symbol externalizableSym; - - /** Access filter (public, protected, ...). */ - protected ModifierFilter showAccess; - - /** True if we are using a sentence BreakIterator. */ - boolean breakiterator; - - /** - * True if we do not want to print any notifications at all. - */ - boolean quiet = false; - - Check chk; - Types types; - JavaFileManager fileManager; - Context context; - DocLint doclint; - JavaScriptScanner javaScriptScanner; - - WeakHashMap treePaths = new WeakHashMap<>(); - - /** Allow documenting from class files? */ - boolean docClasses = false; - - /** Does the doclet only expect pre-1.5 doclet API? */ - protected boolean legacyDoclet = true; - - /** - * Set this to true if you would like to not emit any errors, warnings and - * notices. - */ - private boolean silent = false; - - /** - * The source language version. - */ - protected Source source; - - /** - * Constructor - * - * @param context Context for this javadoc instance. - */ - protected DocEnv(Context context) { - context.put(docEnvKey, this); - this.context = context; - - messager = Messager.instance0(context); - syms = Symtab.instance(context); - finder = JavadocClassFinder.instance(context); - enter = JavadocEnter.instance(context); - names = Names.instance(context); - externalizableSym = syms.enterClass(syms.java_base, names.fromString("java.io.Externalizable")); - chk = Check.instance(context); - types = Types.instance(context); - fileManager = context.get(JavaFileManager.class); - if (fileManager instanceof JavacFileManager) { - ((JavacFileManager)fileManager).setSymbolFileEnabled(false); - } - - // Default. Should normally be reset with setLocale. - this.doclocale = new DocLocale(this, "", breakiterator); - source = Source.instance(context); - } - - public void setSilent(boolean silent) { - this.silent = silent; - } - - /** - * Look up ClassDoc by qualified name. - */ - public ClassDocImpl lookupClass(String name) { - ClassSymbol c = getClassSymbol(name); - if (c != null) { - return getClassDoc(c); - } else { - return null; - } - } - - /** - * Load ClassDoc by qualified name. - */ - public ClassDocImpl loadClass(String name) { - try { - Name nameImpl = names.fromString(name); - ModuleSymbol mod = syms.inferModule(Convert.packagePart(nameImpl)); - ClassSymbol c = finder.loadClass(mod != null ? mod : syms.errModule, nameImpl); - return getClassDoc(c); - } catch (CompletionFailure ex) { - chk.completionError(null, ex); - return null; - } - } - - /** - * Look up PackageDoc by qualified name. - */ - public PackageDocImpl lookupPackage(String name) { - //### Jing alleges that class check is needed - //### to avoid a compiler bug. Most likely - //### instead a dummy created for error recovery. - //### Should investigate this. - Name nameImpl = names.fromString(name); - ModuleSymbol mod = syms.inferModule(nameImpl); - PackageSymbol p = mod != null ? syms.getPackage(mod, nameImpl) : null; - ClassSymbol c = getClassSymbol(name); - if (p != null && c == null) { - return getPackageDoc(p); - } else { - return null; - } - } - // where - /** Retrieve class symbol by fully-qualified name. - */ - ClassSymbol getClassSymbol(String name) { - // Name may contain nested class qualification. - // Generate candidate flatnames with successively shorter - // package qualifiers and longer nested class qualifiers. - int nameLen = name.length(); - char[] nameChars = name.toCharArray(); - int idx = name.length(); - for (;;) { - Name nameImpl = names.fromChars(nameChars, 0, nameLen); - ModuleSymbol mod = syms.inferModule(Convert.packagePart(nameImpl)); - ClassSymbol s = mod != null ? syms.getClass(mod, nameImpl) : null; - if (s != null) - return s; // found it! - idx = name.substring(0, idx).lastIndexOf('.'); - if (idx < 0) break; - nameChars[idx] = '$'; - } - return null; - } - - /** - * Set the locale. - */ - public void setLocale(String localeName) { - // create locale specifics - doclocale = new DocLocale(this, localeName, breakiterator); - // update Messager if locale has changed. - messager.setLocale(doclocale.locale); - } - - /** Check whether this member should be documented. */ - public boolean shouldDocument(VarSymbol sym) { - long mod = sym.flags(); - - if ((mod & Flags.SYNTHETIC) != 0) { - return false; - } - - return showAccess.checkModifier(translateModifiers(mod)); - } - - /** Check whether this member should be documented. */ - public boolean shouldDocument(MethodSymbol sym) { - long mod = sym.flags(); - - if ((mod & Flags.SYNTHETIC) != 0) { - return false; - } - - return showAccess.checkModifier(translateModifiers(mod)); - } - - /** check whether this class should be documented. */ - public boolean shouldDocument(ClassSymbol sym) { - return - (sym.flags_field&Flags.SYNTHETIC) == 0 && // no synthetics - (docClasses || getClassDoc(sym).tree != null) && - isVisible(sym); - } - - //### Comment below is inaccurate wrt modifier filter testing - /** - * Check the visibility if this is an nested class. - * if this is not a nested class, return true. - * if this is an static visible nested class, - * return true. - * if this is an visible nested class - * if the outer class is visible return true. - * else return false. - * IMPORTANT: This also allows, static nested classes - * to be defined inside an nested class, which is not - * allowed by the compiler. So such an test case will - * not reach upto this method itself, but if compiler - * allows it, then that will go through. - */ - protected boolean isVisible(ClassSymbol sym) { - long mod = sym.flags_field; - if (!showAccess.checkModifier(translateModifiers(mod))) { - return false; - } - ClassSymbol encl = sym.owner.enclClass(); - return (encl == null || (mod & Flags.STATIC) != 0 || isVisible(encl)); - } - - //---------------- print forwarders ----------------// - - /** - * Print error message, increment error count. - * - * @param msg message to print. - */ - public void printError(String msg) { - if (silent) - return; - messager.printError(msg); - } - - /** - * Print error message, increment error count. - * - * @param key selects message from resource - */ - public void error(DocImpl doc, String key) { - if (silent) - return; - messager.error(doc==null ? null : doc.position(), key); - } - - /** - * Print error message, increment error count. - * - * @param key selects message from resource - */ - public void error(SourcePosition pos, String key) { - if (silent) - return; - messager.error(pos, key); - } - - /** - * Print error message, increment error count. - * - * @param msg message to print. - */ - public void printError(SourcePosition pos, String msg) { - if (silent) - return; - messager.printError(pos, msg); - } - - /** - * Print error message, increment error count. - * - * @param key selects message from resource - * @param a1 first argument - */ - public void error(DocImpl doc, String key, String a1) { - if (silent) - return; - messager.error(doc==null ? null : doc.position(), key, a1); - } - - /** - * Print error message, increment error count. - * - * @param key selects message from resource - * @param a1 first argument - * @param a2 second argument - */ - public void error(DocImpl doc, String key, String a1, String a2) { - if (silent) - return; - messager.error(doc==null ? null : doc.position(), key, a1, a2); - } - - /** - * Print error message, increment error count. - * - * @param key selects message from resource - * @param a1 first argument - * @param a2 second argument - * @param a3 third argument - */ - public void error(DocImpl doc, String key, String a1, String a2, String a3) { - if (silent) - return; - messager.error(doc==null ? null : doc.position(), key, a1, a2, a3); - } - - /** - * Print warning message, increment warning count. - * - * @param msg message to print. - */ - public void printWarning(String msg) { - if (silent) - return; - messager.printWarning(msg); - } - - /** - * Print warning message, increment warning count. - * - * @param key selects message from resource - */ - public void warning(DocImpl doc, String key) { - if (silent) - return; - messager.warning(doc==null ? null : doc.position(), key); - } - - /** - * Print warning message, increment warning count. - * - * @param msg message to print. - */ - public void printWarning(SourcePosition pos, String msg) { - if (silent) - return; - messager.printWarning(pos, msg); - } - - /** - * Print warning message, increment warning count. - * - * @param key selects message from resource - * @param a1 first argument - */ - public void warning(DocImpl doc, String key, String a1) { - if (silent) - return; - // suppress messages that have (probably) been covered by doclint - if (doclint != null && doc != null && key.startsWith("tag")) - return; - messager.warning(doc==null ? null : doc.position(), key, a1); - } - - /** - * Print warning message, increment warning count. - * - * @param key selects message from resource - * @param a1 first argument - * @param a2 second argument - */ - public void warning(DocImpl doc, String key, String a1, String a2) { - if (silent) - return; - messager.warning(doc==null ? null : doc.position(), key, a1, a2); - } - - /** - * Print warning message, increment warning count. - * - * @param key selects message from resource - * @param a1 first argument - * @param a2 second argument - * @param a3 third argument - */ - public void warning(DocImpl doc, String key, String a1, String a2, String a3) { - if (silent) - return; - messager.warning(doc==null ? null : doc.position(), key, a1, a2, a3); - } - - /** - * Print warning message, increment warning count. - * - * @param key selects message from resource - * @param a1 first argument - * @param a2 second argument - * @param a3 third argument - */ - public void warning(DocImpl doc, String key, String a1, String a2, String a3, - String a4) { - if (silent) - return; - messager.warning(doc==null ? null : doc.position(), key, a1, a2, a3, a4); - } - - /** - * Print a message. - * - * @param msg message to print. - */ - public void printNotice(String msg) { - if (silent || quiet) - return; - messager.printNotice(msg); - } - - - /** - * Print a message. - * - * @param key selects message from resource - */ - public void notice(String key) { - if (silent || quiet) - return; - messager.notice(key); - } - - /** - * Print a message. - * - * @param msg message to print. - */ - public void printNotice(SourcePosition pos, String msg) { - if (silent || quiet) - return; - messager.printNotice(pos, msg); - } - - /** - * Print a message. - * - * @param key selects message from resource - * @param a1 first argument - */ - public void notice(String key, String a1) { - if (silent || quiet) - return; - messager.notice(key, a1); - } - - /** - * Print a message. - * - * @param key selects message from resource - * @param a1 first argument - * @param a2 second argument - */ - public void notice(String key, String a1, String a2) { - if (silent || quiet) - return; - messager.notice(key, a1, a2); - } - - /** - * Print a message. - * - * @param key selects message from resource - * @param a1 first argument - * @param a2 second argument - * @param a3 third argument - */ - public void notice(String key, String a1, String a2, String a3) { - if (silent || quiet) - return; - messager.notice(key, a1, a2, a3); - } - - /** - * Exit, reporting errors and warnings. - */ - public void exit() { - // Messager should be replaced by a more general - // compilation environment. This can probably - // subsume DocEnv as well. - messager.exit(); - } - - protected Map packageMap = new HashMap<>(); - /** - * Return the PackageDoc of this package symbol. - */ - public PackageDocImpl getPackageDoc(PackageSymbol pack) { - PackageDocImpl result = packageMap.get(pack); - if (result != null) return result; - result = new PackageDocImpl(this, pack); - packageMap.put(pack, result); - return result; - } - - /** - * Create the PackageDoc (or a subtype) for a package symbol. - */ - void makePackageDoc(PackageSymbol pack, TreePath treePath) { - PackageDocImpl result = packageMap.get(pack); - if (result != null) { - if (treePath != null) result.setTreePath(treePath); - } else { - result = new PackageDocImpl(this, pack, treePath); - packageMap.put(pack, result); - } - } - - - protected Map classMap = new HashMap<>(); - /** - * Return the ClassDoc (or a subtype) of this class symbol. - */ - public ClassDocImpl getClassDoc(ClassSymbol clazz) { - ClassDocImpl result = classMap.get(clazz); - if (result != null) return result; - if (isAnnotationType(clazz)) { - result = new AnnotationTypeDocImpl(this, clazz); - } else { - result = new ClassDocImpl(this, clazz); - } - classMap.put(clazz, result); - return result; - } - - /** - * Create the ClassDoc (or a subtype) for a class symbol. - */ - protected void makeClassDoc(ClassSymbol clazz, TreePath treePath) { - ClassDocImpl result = classMap.get(clazz); - if (result != null) { - if (treePath != null) result.setTreePath(treePath); - return; - } - if (isAnnotationType((JCClassDecl) treePath.getLeaf())) { // flags of clazz may not yet be set - result = new AnnotationTypeDocImpl(this, clazz, treePath); - } else { - result = new ClassDocImpl(this, clazz, treePath); - } - classMap.put(clazz, result); - } - - protected static boolean isAnnotationType(ClassSymbol clazz) { - return ClassDocImpl.isAnnotationType(clazz); - } - - protected static boolean isAnnotationType(JCClassDecl tree) { - return (tree.mods.flags & Flags.ANNOTATION) != 0; - } - - protected Map fieldMap = new HashMap<>(); - /** - * Return the FieldDoc of this var symbol. - */ - public FieldDocImpl getFieldDoc(VarSymbol var) { - FieldDocImpl result = fieldMap.get(var); - if (result != null) return result; - result = new FieldDocImpl(this, var); - fieldMap.put(var, result); - return result; - } - /** - * Create a FieldDoc for a var symbol. - */ - protected void makeFieldDoc(VarSymbol var, TreePath treePath) { - FieldDocImpl result = fieldMap.get(var); - if (result != null) { - if (treePath != null) result.setTreePath(treePath); - } else { - result = new FieldDocImpl(this, var, treePath); - fieldMap.put(var, result); - } - } - - protected Map methodMap = new HashMap<>(); - /** - * Create a MethodDoc for this MethodSymbol. - * Should be called only on symbols representing methods. - */ - protected void makeMethodDoc(MethodSymbol meth, TreePath treePath) { - MethodDocImpl result = (MethodDocImpl)methodMap.get(meth); - if (result != null) { - if (treePath != null) result.setTreePath(treePath); - } else { - result = new MethodDocImpl(this, meth, treePath); - methodMap.put(meth, result); - } - } - - /** - * Return the MethodDoc for a MethodSymbol. - * Should be called only on symbols representing methods. - */ - public MethodDocImpl getMethodDoc(MethodSymbol meth) { - assert !meth.isConstructor() : "not expecting a constructor symbol"; - MethodDocImpl result = (MethodDocImpl)methodMap.get(meth); - if (result != null) return result; - result = new MethodDocImpl(this, meth); - methodMap.put(meth, result); - return result; - } - - /** - * Create the ConstructorDoc for a MethodSymbol. - * Should be called only on symbols representing constructors. - */ - protected void makeConstructorDoc(MethodSymbol meth, TreePath treePath) { - ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth); - if (result != null) { - if (treePath != null) result.setTreePath(treePath); - } else { - result = new ConstructorDocImpl(this, meth, treePath); - methodMap.put(meth, result); - } - } - - /** - * Return the ConstructorDoc for a MethodSymbol. - * Should be called only on symbols representing constructors. - */ - public ConstructorDocImpl getConstructorDoc(MethodSymbol meth) { - assert meth.isConstructor() : "expecting a constructor symbol"; - ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth); - if (result != null) return result; - result = new ConstructorDocImpl(this, meth); - methodMap.put(meth, result); - return result; - } - - /** - * Create the AnnotationTypeElementDoc for a MethodSymbol. - * Should be called only on symbols representing annotation type elements. - */ - protected void makeAnnotationTypeElementDoc(MethodSymbol meth, TreePath treePath) { - AnnotationTypeElementDocImpl result = - (AnnotationTypeElementDocImpl)methodMap.get(meth); - if (result != null) { - if (treePath != null) result.setTreePath(treePath); - } else { - result = - new AnnotationTypeElementDocImpl(this, meth, treePath); - methodMap.put(meth, result); - } - } - - /** - * Return the AnnotationTypeElementDoc for a MethodSymbol. - * Should be called only on symbols representing annotation type elements. - */ - public AnnotationTypeElementDocImpl getAnnotationTypeElementDoc( - MethodSymbol meth) { - - AnnotationTypeElementDocImpl result = - (AnnotationTypeElementDocImpl)methodMap.get(meth); - if (result != null) return result; - result = new AnnotationTypeElementDocImpl(this, meth); - methodMap.put(meth, result); - return result; - } - -// private Map parameterizedTypeMap = -// new HashMap(); - /** - * Return the ParameterizedType of this instantiation. -// * ### Could use Type.sameTypeAs() instead of equality matching in hashmap -// * ### to avoid some duplication. - */ - ParameterizedTypeImpl getParameterizedType(ClassType t) { - return new ParameterizedTypeImpl(this, t); -// ParameterizedTypeImpl result = parameterizedTypeMap.get(t); -// if (result != null) return result; -// result = new ParameterizedTypeImpl(this, t); -// parameterizedTypeMap.put(t, result); -// return result; - } - - TreePath getTreePath(JCCompilationUnit tree) { - TreePath p = treePaths.get(tree); - if (p == null) - treePaths.put(tree, p = new TreePath(tree)); - return p; - } - - TreePath getTreePath(JCCompilationUnit toplevel, JCPackageDecl tree) { - TreePath p = treePaths.get(tree); - if (p == null) - treePaths.put(tree, p = new TreePath(getTreePath(toplevel), tree)); - return p; - } - - TreePath getTreePath(JCCompilationUnit toplevel, JCClassDecl tree) { - TreePath p = treePaths.get(tree); - if (p == null) - treePaths.put(tree, p = new TreePath(getTreePath(toplevel), tree)); - return p; - } - - TreePath getTreePath(JCCompilationUnit toplevel, JCClassDecl cdecl, JCTree tree) { - return new TreePath(getTreePath(toplevel, cdecl), tree); - } - - /** - * Set the encoding. - */ - public void setEncoding(String encoding) { - this.encoding = encoding; - } - - /** - * Get the encoding. - */ - public String getEncoding() { - return encoding; - } - - /** - * Convert modifier bits from private coding used by - * the compiler to that of java.lang.reflect.Modifier. - */ - static int translateModifiers(long flags) { - int result = 0; - if ((flags & Flags.ABSTRACT) != 0) - result |= Modifier.ABSTRACT; - if ((flags & Flags.FINAL) != 0) - result |= Modifier.FINAL; - if ((flags & Flags.INTERFACE) != 0) - result |= Modifier.INTERFACE; - if ((flags & Flags.NATIVE) != 0) - result |= Modifier.NATIVE; - if ((flags & Flags.PRIVATE) != 0) - result |= Modifier.PRIVATE; - if ((flags & Flags.PROTECTED) != 0) - result |= Modifier.PROTECTED; - if ((flags & Flags.PUBLIC) != 0) - result |= Modifier.PUBLIC; - if ((flags & Flags.STATIC) != 0) - result |= Modifier.STATIC; - if ((flags & Flags.SYNCHRONIZED) != 0) - result |= Modifier.SYNCHRONIZED; - if ((flags & Flags.TRANSIENT) != 0) - result |= Modifier.TRANSIENT; - if ((flags & Flags.VOLATILE) != 0) - result |= Modifier.VOLATILE; - return result; - } - - void initDoclint(Collection opts, Collection customTagNames, String htmlVersion) { - ArrayList doclintOpts = new ArrayList<>(); - boolean msgOptionSeen = false; - - for (String opt : opts) { - if (opt.startsWith(DocLint.XMSGS_OPTION)) { - if (opt.equals(DocLint.XMSGS_CUSTOM_PREFIX + "none")) - return; - msgOptionSeen = true; - } - doclintOpts.add(opt); - } - - if (!msgOptionSeen) { - doclintOpts.add(DocLint.XMSGS_OPTION); - } - - String sep = ""; - StringBuilder customTags = new StringBuilder(); - for (String customTag : customTagNames) { - customTags.append(sep); - customTags.append(customTag); - sep = DocLint.SEPARATOR; - } - doclintOpts.add(DocLint.XCUSTOM_TAGS_PREFIX + customTags.toString()); - doclintOpts.add(DocLint.XHTML_VERSION_PREFIX + htmlVersion); - - JavacTask t = BasicJavacTask.instance(context); - doclint = new DocLint(); - // standard doclet normally generates H1, H2 - doclintOpts.add(DocLint.XIMPLICIT_HEADERS + "2"); - doclint.init(t, doclintOpts.toArray(new String[doclintOpts.size()]), false); - } - - JavaScriptScanner initJavaScriptScanner(boolean allowScriptInComments) { - if (allowScriptInComments) { - javaScriptScanner = null; - } else { - javaScriptScanner = new JavaScriptScanner(); - } - return javaScriptScanner; - } - - boolean showTagMessages() { - return (doclint == null); - } - - Map shouldCheck = new HashMap<>(); - - boolean shouldCheck(CompilationUnitTree unit) { - return shouldCheck.computeIfAbsent(unit, doclint :: shouldCheck); - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocImpl.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocImpl.java deleted file mode 100644 index 172b998444f..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocImpl.java +++ /dev/null @@ -1,455 +0,0 @@ -/* - * Copyright (c) 1997, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.javadoc.main; - -import java.io.DataInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.text.CollationKey; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.tools.FileObject; - -import com.sun.javadoc.*; -import com.sun.source.util.TreePath; -import com.sun.tools.javac.tree.JCTree; -import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; -import com.sun.tools.javac.util.Position; - -/** - * abstract base class of all Doc classes. Doc item's are representations - * of java language constructs (class, package, method,...) which have - * comments and have been processed by this run of javadoc. All Doc items - * are unique, that is, they are == comparable. - * - *

This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @since 1.2 - * @author Robert Field - * @author Atul M Dambalkar - * @author Neal Gafter (rewrite) - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public abstract class DocImpl implements Doc, Comparable { - - /** - * Doc environment - */ - protected final DocEnv env; //### Rename this everywhere to 'docenv' ? - - /** - * Back pointer to the tree node for this doc item. - * May be null if there is no associated tree. - */ - protected TreePath treePath; - - /** - * The complex comment object, lazily initialized. - */ - private Comment comment; - - /** - * The cached sort key, to take care of Natural Language Text sorting. - */ - private CollationKey collationkey = null; - - /** - * Raw documentation string. - */ - protected String documentation; // Accessed in PackageDocImpl, RootDocImpl - - /** - * Cached first sentence. - */ - private Tag[] firstSentence; - - /** - * Cached inline tags. - */ - private Tag[] inlineTags; - - /** - * Constructor. - */ - DocImpl(DocEnv env, TreePath treePath) { - this.treePath = treePath; - this.documentation = getCommentText(treePath); - this.env = env; - } - - private static String getCommentText(TreePath p) { - if (p == null) - return null; - - JCCompilationUnit topLevel = (JCCompilationUnit) p.getCompilationUnit(); - JCTree tree = (JCTree) p.getLeaf(); - return topLevel.docComments.getCommentText(tree); - } - - /** - * So subclasses have the option to do lazy initialization of - * "documentation" string. - */ - protected String documentation() { - if (documentation == null) documentation = ""; - return documentation; - } - - /** - * For lazy initialization of comment. - */ - Comment comment() { - if (comment == null) { - String d = documentation(); - if (env.javaScriptScanner != null) { - env.javaScriptScanner.parse(d, new JavaScriptScanner.Reporter() { - @Override - public void report() { - env.error(DocImpl.this, "javadoc.JavaScript_in_comment"); - throw new Error(); - } - }); - } - if (env.doclint != null - && treePath != null - && env.shouldCheck(treePath.getCompilationUnit()) - && d.equals(getCommentText(treePath))) { - env.doclint.scan(treePath); - } - comment = new Comment(this, d); - } - return comment; - } - - /** - * Return the text of the comment for this doc item. - * TagImpls have been removed. - */ - public String commentText() { - return comment().commentText(); - } - - /** - * Return all tags in this Doc item. - * - * @return an array of TagImpl containing all tags on this Doc item. - */ - public Tag[] tags() { - return comment().tags(); - } - - /** - * Return tags of the specified kind in this Doc item. - * - * @param tagname name of the tag kind to search for. - * @return an array of TagImpl containing all tags whose 'kind()' - * matches 'tagname'. - */ - public Tag[] tags(String tagname) { - return comment().tags(tagname); - } - - /** - * Return the see also tags in this Doc item. - * - * @return an array of SeeTag containing all @see tags. - */ - public SeeTag[] seeTags() { - return comment().seeTags(); - } - - public Tag[] inlineTags() { - if (inlineTags == null) { - inlineTags = Comment.getInlineTags(this, commentText()); - } - return inlineTags; - } - - public Tag[] firstSentenceTags() { - if (firstSentence == null) { - //Parse all sentences first to avoid duplicate warnings. - inlineTags(); - try { - env.setSilent(true); - firstSentence = Comment.firstSentenceTags(this, commentText()); - } finally { - env.setSilent(false); - } - } - return firstSentence; - } - - /** - * Utility for subclasses which read HTML documentation files. - */ - String readHTMLDocumentation(InputStream input, FileObject filename) throws IOException { - byte[] filecontents = new byte[input.available()]; - try { - DataInputStream dataIn = new DataInputStream(input); - dataIn.readFully(filecontents); - } finally { - input.close(); - } - String encoding = env.getEncoding(); - String rawDoc = (encoding!=null) - ? new String(filecontents, encoding) - : new String(filecontents); - Pattern bodyPat = Pattern.compile("(?is).*]*>(.*) - * Default is name(). - */ - CollationKey generateKey() { - String k = name(); - // System.out.println("COLLATION KEY FOR " + this + " is \"" + k + "\""); - return env.doclocale.collator.getCollationKey(k); - } - - /** - * Returns a string representation of this Doc item. - */ - @Override - public String toString() { - return qualifiedName(); - } - - /** - * Returns the name of this Doc item. - * - * @return the name - */ - public abstract String name(); - - /** - * Returns the qualified name of this Doc item. - * - * @return the name - */ - public abstract String qualifiedName(); - - /** - * Compares this Object with the specified Object for order. Returns a - * negative integer, zero, or a positive integer as this Object is less - * than, equal to, or greater than the given Object. - *

- * Included so that Doc item are java.lang.Comparable. - * - * @param obj the {@code Object} to be compared. - * @return a negative integer, zero, or a positive integer as this Object - * is less than, equal to, or greater than the given Object. - * @exception ClassCastException the specified Object's type prevents it - * from being compared to this Object. - */ - public int compareTo(Object obj) { - // System.out.println("COMPARE \"" + this + "\" to \"" + obj + "\" = " + key().compareTo(((DocImpl)obj).key())); - return key().compareTo(((DocImpl)obj).key()); - } - - /** - * Is this Doc item a field? False until overridden. - * - * @return true if it represents a field - */ - public boolean isField() { - return false; - } - - /** - * Is this Doc item an enum constant? False until overridden. - * - * @return true if it represents an enum constant - */ - public boolean isEnumConstant() { - return false; - } - - /** - * Is this Doc item a constructor? False until overridden. - * - * @return true if it represents a constructor - */ - public boolean isConstructor() { - return false; - } - - /** - * Is this Doc item a method (but not a constructor or annotation - * type element)? - * False until overridden. - * - * @return true if it represents a method - */ - public boolean isMethod() { - return false; - } - - /** - * Is this Doc item an annotation type element? - * False until overridden. - * - * @return true if it represents an annotation type element - */ - public boolean isAnnotationTypeElement() { - return false; - } - - /** - * Is this Doc item a interface (but not an annotation type)? - * False until overridden. - * - * @return true if it represents a interface - */ - public boolean isInterface() { - return false; - } - - /** - * Is this Doc item a exception class? False until overridden. - * - * @return true if it represents a exception - */ - public boolean isException() { - return false; - } - - /** - * Is this Doc item a error class? False until overridden. - * - * @return true if it represents a error - */ - public boolean isError() { - return false; - } - - /** - * Is this Doc item an enum type? False until overridden. - * - * @return true if it represents an enum type - */ - public boolean isEnum() { - return false; - } - - /** - * Is this Doc item an annotation type? False until overridden. - * - * @return true if it represents an annotation type - */ - public boolean isAnnotationType() { - return false; - } - - /** - * Is this Doc item an ordinary class (i.e. not an interface, - * annotation type, enumeration, exception, or error)? - * False until overridden. - * - * @return true if it represents an ordinary class - */ - public boolean isOrdinaryClass() { - return false; - } - - /** - * Is this Doc item a class - * (and not an interface or annotation type)? - * This includes ordinary classes, enums, errors and exceptions. - * False until overridden. - * - * @return true if it represents a class - */ - public boolean isClass() { - return false; - } - - /** - * return true if this Doc is include in the active set. - */ - public abstract boolean isIncluded(); - - /** - * Return the source position of the entity, or null if - * no position is available. - */ - public SourcePosition position() { return null; } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocLocale.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocLocale.java deleted file mode 100644 index ca9aaa74aba..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocLocale.java +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright (c) 2000, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.javadoc.main; - -import java.text.BreakIterator; -import java.text.Collator; -import java.util.Locale; - -/** - * This class holds the information about locales. - * - *

This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @since 1.4 - * @author Robert Field - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -class DocLocale { - - /** - * The locale name will be set by Main, if option is provided on the - * command line. - */ - final String localeName; - - /** - * The locale to be used. If user doesn't provide this, - * then set it to default locale value. - */ - final Locale locale; - - /** - * The collator for this application. This is to take care of Locale - * Specific or Natural Language Text sorting. - */ - final Collator collator; - - /** - * Enclosing DocEnv - */ - private final DocEnv docenv; - - /** - * Sentence instance from the BreakIterator. - */ - private final BreakIterator sentenceBreaker; - - /** - * True is we should use BreakIterator - * to compute first sentence. - */ - private boolean useBreakIterator = false; - - /** - * The HTML sentence terminators. - */ - static final String[] sentenceTerminators = - { - "

", "

", "

", "

", - "

", "

", "

", "
", - "
", "", "", "", "", - "", "
", "
", "
" - }; - - /** - * Constructor - */ - DocLocale(DocEnv docenv, String localeName, boolean useBreakIterator) { - this.docenv = docenv; - this.localeName = localeName; - this.useBreakIterator = useBreakIterator; - locale = getLocale(); - if (locale == null) { - docenv.exit(); - } else { - Locale.setDefault(locale); // NOTE: updating global state - } - collator = Collator.getInstance(locale); - sentenceBreaker = BreakIterator.getSentenceInstance(locale); - } - - /** - * Get the locale if specified on the command line - * else return null and if locale option is not used - * then return default locale. - */ - private Locale getLocale() { - Locale userlocale = null; - if (localeName.length() > 0) { - int firstuscore = localeName.indexOf('_'); - int seconduscore = -1; - String language = null; - String country = null; - String variant = null; - if (firstuscore == 2) { - language = localeName.substring(0, firstuscore); - seconduscore = localeName.indexOf('_', firstuscore + 1); - if (seconduscore > 0) { - if (seconduscore != firstuscore + 3 || - localeName.length() <= seconduscore + 1) { - docenv.error(null, "main.malformed_locale_name", localeName); - return null; - } - country = localeName.substring(firstuscore + 1, - seconduscore); - variant = localeName.substring(seconduscore + 1); - } else if (localeName.length() == firstuscore + 3) { - country = localeName.substring(firstuscore + 1); - } else { - docenv.error(null, "main.malformed_locale_name", localeName); - return null; - } - } else if (firstuscore == -1 && localeName.length() == 2) { - language = localeName; - } else { - docenv.error(null, "main.malformed_locale_name", localeName); - return null; - } - userlocale = searchLocale(language, country, variant); - if (userlocale == null) { - docenv.error(null, "main.illegal_locale_name", localeName); - return null; - } else { - return userlocale; - } - } else { - return Locale.getDefault(); - } - } - - /** - * Search the locale for specified language, specified country and - * specified variant. - */ - private Locale searchLocale(String language, String country, - String variant) { - for (Locale loc : Locale.getAvailableLocales()) { - if (loc.getLanguage().equals(language) && - (country == null || loc.getCountry().equals(country)) && - (variant == null || loc.getVariant().equals(variant))) { - return loc; - } - } - return null; - } - - String localeSpecificFirstSentence(DocImpl doc, String s) { - if (s == null || s.length() == 0) { - return ""; - } - int index = s.indexOf("-->"); - if(s.trim().startsWith(" - - - - -Voice or no voice, the people can always be brought to the bidding of -the leaders. That is easy. All you have to do is tell them they are -being attacked, and denounce the peacemakers for lack of patriotism -and exposing the country to danger. It works the same in any country. -
-        Hermann Goering
-        Commander in Chief, Luftwaffe
-
- - - diff --git a/test/langtools/tools/javadoc/annotations/annotatePackage/pkg2/B.java b/test/langtools/tools/javadoc/annotations/annotatePackage/pkg2/B.java deleted file mode 100644 index b1284f83eaa..00000000000 --- a/test/langtools/tools/javadoc/annotations/annotatePackage/pkg2/B.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2004, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * Doc comment here is ignored. - */ -package pkg2; - -public class B { -} diff --git a/test/langtools/tools/javadoc/annotations/annotatePackage/pkg2/package.html b/test/langtools/tools/javadoc/annotations/annotatePackage/pkg2/package.html deleted file mode 100644 index a15495a6a77..00000000000 --- a/test/langtools/tools/javadoc/annotations/annotatePackage/pkg2/package.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - -Albert Einstein commenting on the book -110 German Scientists Against Einstein: -"If I had been wrong it would only have needed one." - - - - diff --git a/test/langtools/tools/javadoc/annotations/annotateParams/Main.java b/test/langtools/tools/javadoc/annotations/annotateParams/Main.java deleted file mode 100644 index b40b776f0b6..00000000000 --- a/test/langtools/tools/javadoc/annotations/annotateParams/Main.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2004, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 5031171 - * @summary Test parameter annotations. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - for (PackageDoc pkg : root.specifiedPackages()) { - for (ClassDoc cd : pkg.ordinaryClasses()) { - for (ConstructorDoc c : cd.constructors()) { - tester.println(c); - tester.println(); - for (Parameter p : c.parameters()) { - tester.printParameter(p); - } - tester.println(); - } - for (MethodDoc m : cd.methods()) { - tester.println(m); - tester.println(); - for (Parameter p : m.parameters()) { - tester.printParameter(p); - } - tester.println(); - } - } - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/annotations/annotateParams/expected.out b/test/langtools/tools/javadoc/annotations/annotateParams/expected.out deleted file mode 100644 index 2389c13c7c3..00000000000 --- a/test/langtools/tools/javadoc/annotations/annotateParams/expected.out +++ /dev/null @@ -1,17 +0,0 @@ -pkg1.C(boolean) - -parameter boolean p0 - annotations: - @pkg1.A("p0") - -pkg1.C.m(int, int, java.lang.String) - -parameter int p1 - annotations: - @pkg1.A("p1") -parameter int p2 -parameter String p3 - annotations: - @java.lang.Deprecated - @pkg1.A("p3") - diff --git a/test/langtools/tools/javadoc/annotations/annotateParams/pkg1/A.java b/test/langtools/tools/javadoc/annotations/annotateParams/pkg1/A.java deleted file mode 100644 index 2c996e7c52f..00000000000 --- a/test/langtools/tools/javadoc/annotations/annotateParams/pkg1/A.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2004, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -public @interface A { - String value(); -} diff --git a/test/langtools/tools/javadoc/annotations/annotateParams/pkg1/C.java b/test/langtools/tools/javadoc/annotations/annotateParams/pkg1/C.java deleted file mode 100644 index eb53ac60b34..00000000000 --- a/test/langtools/tools/javadoc/annotations/annotateParams/pkg1/C.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2004, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -public class C { - - public C(@A("p0") boolean p0) { - } - - public void m(@A("p1") int p1, - int p2, - @Deprecated @A("p3") String p3) { - } -} diff --git a/test/langtools/tools/javadoc/annotations/badVals/Main.java b/test/langtools/tools/javadoc/annotations/badVals/Main.java deleted file mode 100644 index ef1c5cec4d5..00000000000 --- a/test/langtools/tools/javadoc/annotations/badVals/Main.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2004, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 5029874 - * @summary Verify that bad annotation values don't result in NPE - * @library ../../lib - * @modules jdk.javadoc - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - } - - public static boolean start(RootDoc root) { - try { - for (ClassDoc cd : root.classes()) { - tester.printClass(cd); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/annotations/badVals/pkg1/A.java b/test/langtools/tools/javadoc/annotations/badVals/pkg1/A.java deleted file mode 100644 index 3b703bc2821..00000000000 --- a/test/langtools/tools/javadoc/annotations/badVals/pkg1/A.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2004, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -import java.lang.annotation.*; - -public class A { - - @Retention(BOGUS) // illegal - public @interface A1 {} - - @Target({BOGUS}) // illegal - public @interface A2 {} - - @Retention(true) // illegal - public @interface A3 {} - - public @interface A4 { - ElementType value() default BOGUS; // illegal - } - - public @interface A5 { - int[] value() default {true}; // illegal - } -} diff --git a/test/langtools/tools/javadoc/annotations/defaults/Main.java b/test/langtools/tools/javadoc/annotations/defaults/Main.java deleted file mode 100644 index 03ca9445d6a..00000000000 --- a/test/langtools/tools/javadoc/annotations/defaults/Main.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4904495 - * @summary Test an annotation type with default element values, and - * annotations that use them. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; -import com.sun.javadoc.AnnotationDesc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - for (AnnotationTypeDoc at : - root.specifiedPackages()[0].annotationTypes()) { - tester.printAnnotationType(at); - tester.println(); - } - - for (ClassDoc cd : - root.specifiedPackages()[0].interfaces()) { - for (MethodDoc m : cd.methods()) { - tester.printMethod(m); - } - tester.println(); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/annotations/defaults/expected.out b/test/langtools/tools/javadoc/annotations/defaults/expected.out deleted file mode 100644 index dfe409bd028..00000000000 --- a/test/langtools/tools/javadoc/annotations/defaults/expected.out +++ /dev/null @@ -1,55 +0,0 @@ -@interface pkg1.A - elements: - String value() default "sigh" - int i() default 2 - double d() default 3.14 - boolean b() default true - java.lang.Class c() default java.lang.Boolean.class - java.lang.Class w() default java.lang.Long.class - ElementType e() default java.lang.annotation.ElementType.TYPE - A a() default @pkg1.A(d=2.718) - java.lang.String[] sa() default {"up", "down"} - -method pkg1.B.m1() - signature: () - () - annotations: - @pkg1.A - returns: - void -method pkg1.B.m2() - signature: () - () - annotations: - @pkg1.A("flip") - returns: - void -method pkg1.B.m3() - signature: () - () - annotations: - @pkg1.A("flop") - returns: - void -method pkg1.B.m4() - signature: () - () - annotations: - @pkg1.A(c=java.lang.Boolean.class, w=java.lang.Long.class, sa={}) - returns: - void -method pkg1.B.m5() - signature: () - () - annotations: - @pkg1.A(i=0, e=java.lang.annotation.ElementType.FIELD) - returns: - void -method pkg1.B.m6() - signature: () - () - annotations: - @pkg1.A(a=@pkg1.A("splat")) - returns: - void - diff --git a/test/langtools/tools/javadoc/annotations/defaults/pkg1/A.java b/test/langtools/tools/javadoc/annotations/defaults/pkg1/A.java deleted file mode 100644 index a4c0b4d35b8..00000000000 --- a/test/langtools/tools/javadoc/annotations/defaults/pkg1/A.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -public @interface A { - String value() default "sigh"; - int i() default 1+1; - double d() default 3.14; - boolean b() default true; - Class c() default Boolean.class; - Class w() default Long.class; - java.lang.annotation.ElementType e() default java.lang.annotation.ElementType.TYPE; - A a() default @A(d=2.718); - String[] sa() default {"up", "down"}; -} diff --git a/test/langtools/tools/javadoc/annotations/defaults/pkg1/B.java b/test/langtools/tools/javadoc/annotations/defaults/pkg1/B.java deleted file mode 100644 index 601441298a8..00000000000 --- a/test/langtools/tools/javadoc/annotations/defaults/pkg1/B.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -public interface B { - @A void m1(); - @A("flip") void m2(); - @A(value="flop") void m3(); - @A(c=Boolean.class, w=Long.class, sa={}) - void m4(); - @A(i=0, e=java.lang.annotation.ElementType.FIELD) void m5(); - @A(a=@A("splat")) void m6(); -} diff --git a/test/langtools/tools/javadoc/annotations/elementTypes/Main.java b/test/langtools/tools/javadoc/annotations/elementTypes/Main.java deleted file mode 100644 index 0f8753b8ad5..00000000000 --- a/test/langtools/tools/javadoc/annotations/elementTypes/Main.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4904495 - * @summary Test an annotation type and annotations with elements of various - * types. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import java.util.Arrays; -import com.sun.javadoc.*; -import com.sun.javadoc.AnnotationDesc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - ClassDoc[] cds = root.classes(); - Arrays.sort(cds); - for (ClassDoc cd : cds) { - tester.printClass(cd); - tester.println(); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/annotations/elementTypes/expected.out b/test/langtools/tools/javadoc/annotations/elementTypes/expected.out deleted file mode 100644 index 7cfad55e207..00000000000 --- a/test/langtools/tools/javadoc/annotations/elementTypes/expected.out +++ /dev/null @@ -1,17 +0,0 @@ -@interface pkg1.A - elements: - int i() - double d() - boolean b() - String s() - java.lang.Class c() - java.lang.Class w() - ElementType e() - A a() - java.lang.String[] sa() - -interface pkg1.B - name: B / B / pkg1.B - annotations: - @pkg1.A(i=2, d=3.14, b=true, s="sigh", c=java.lang.Boolean.class, w=java.lang.Long.class, e=java.lang.annotation.ElementType.TYPE, a=@pkg1.A, sa={"up", "down"}) - diff --git a/test/langtools/tools/javadoc/annotations/elementTypes/pkg1/A.java b/test/langtools/tools/javadoc/annotations/elementTypes/pkg1/A.java deleted file mode 100644 index b7ab93ad5aa..00000000000 --- a/test/langtools/tools/javadoc/annotations/elementTypes/pkg1/A.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -public @interface A { - int i(); - double d(); - boolean b(); - String s(); - Class c(); - Class w(); - java.lang.annotation.ElementType e(); - A a(); - String[] sa(); -} diff --git a/test/langtools/tools/javadoc/annotations/elementTypes/pkg1/B.java b/test/langtools/tools/javadoc/annotations/elementTypes/pkg1/B.java deleted file mode 100644 index 64b37f7eb89..00000000000 --- a/test/langtools/tools/javadoc/annotations/elementTypes/pkg1/B.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -@A(i = 1+1, - d = 3.14, - b = true, - s = "sigh", - c = Boolean.class, - w = Long.class, - e = java.lang.annotation.ElementType.TYPE, - a = @A, - sa = {"up", "down"}) -public interface B { -} diff --git a/test/langtools/tools/javadoc/annotations/missing/Main.java b/test/langtools/tools/javadoc/annotations/missing/Main.java deleted file mode 100644 index 88858d316bf..00000000000 --- a/test/langtools/tools/javadoc/annotations/missing/Main.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2009 Google, Inc. 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 6709246 - * @summary Class-cast exception when annotation type is missing. - * @library ../../lib - * @modules jdk.javadoc - */ - -import java.io.IOException; -import com.sun.javadoc.RootDoc; -import com.sun.javadoc.ClassDoc; -import com.sun.javadoc.AnnotationDesc; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "somepackage"); - - public static void main(String... args) throws Exception { - tester.run(); - } - - public static boolean start(RootDoc root) { - for (ClassDoc d : root.classes()) { - for (AnnotationDesc a : d.annotations()) { - System.out.println(a.annotationType()); - } - } - return true; - } -} diff --git a/test/langtools/tools/javadoc/annotations/missing/somepackage/MissingAnnotationClass.java b/test/langtools/tools/javadoc/annotations/missing/somepackage/MissingAnnotationClass.java deleted file mode 100644 index d018cc580da..00000000000 --- a/test/langtools/tools/javadoc/annotations/missing/somepackage/MissingAnnotationClass.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2009 Google, Inc. 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package somepackage; - -/** - * This class has an annotation which is not available. - */ -@NoSuchAnnotation -public class MissingAnnotationClass { -} diff --git a/test/langtools/tools/javadoc/annotations/shortcuts/Main.java b/test/langtools/tools/javadoc/annotations/shortcuts/Main.java deleted file mode 100644 index 2fadd859c9f..00000000000 --- a/test/langtools/tools/javadoc/annotations/shortcuts/Main.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4904495 - * @summary Verify that "shortcuts" are used when printing annotations. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - for (ClassDoc cd : root.classes()) { - if (cd.isInterface()) { - tester.printClass(cd); - } - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/annotations/shortcuts/expected.out b/test/langtools/tools/javadoc/annotations/shortcuts/expected.out deleted file mode 100644 index f53ff244f78..00000000000 --- a/test/langtools/tools/javadoc/annotations/shortcuts/expected.out +++ /dev/null @@ -1,6 +0,0 @@ -interface pkg1.A - name: A / A / pkg1.A - annotations: - @pkg1.Value("there is only one") - @pkg1.Array(favoriteNumbers=3.5) - @pkg1.Marker diff --git a/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/A.java b/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/A.java deleted file mode 100644 index 514032fe4dd..00000000000 --- a/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/A.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -@Value("there is only one") -@Array(favoriteNumbers={3.5}) -@Marker -public interface A { -} diff --git a/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Array.java b/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Array.java deleted file mode 100644 index 12e3b42c1fc..00000000000 --- a/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Array.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -public @interface Array { - double[] favoriteNumbers(); -} diff --git a/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Marker.java b/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Marker.java deleted file mode 100644 index 57abb010167..00000000000 --- a/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Marker.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -public @interface Marker { -} diff --git a/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Value.java b/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Value.java deleted file mode 100644 index 026c7173443..00000000000 --- a/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Value.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -public @interface Value { - String value(); -} diff --git a/test/langtools/tools/javadoc/api/basic/APITest.java b/test/langtools/tools/javadoc/api/basic/APITest.java deleted file mode 100644 index c24bbd1890b..00000000000 --- a/test/langtools/tools/javadoc/api/basic/APITest.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (c) 2012, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.io.File; -import java.io.IOException; -import java.lang.annotation.Annotation; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.URI; -import java.nio.file.DirectoryStream; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.TreeSet; -import java.util.stream.*; - -import javax.tools.JavaFileObject; -import javax.tools.SimpleJavaFileObject; - - -/* - * Superclass with utility methods for API tests. - */ -class APITest { - protected APITest() { } - - /** Marker annotation for test cases. */ - @Retention(RetentionPolicy.RUNTIME) - @interface Test { } - - /** Invoke all methods annotated with @Test. */ - protected void run() throws Exception { - for (Method m: getClass().getDeclaredMethods()) { - Annotation a = m.getAnnotation(Test.class); - if (a != null) { - testCount++; - testName = m.getName(); - System.err.println("test: " + testName); - try { - m.invoke(this, new Object[] { }); - } catch (InvocationTargetException e) { - Throwable cause = e.getCause(); - throw (cause instanceof Exception) ? ((Exception) cause) : e; - } - System.err.println(); - } - } - - if (testCount == 0) - error("no tests found"); - - StringBuilder summary = new StringBuilder(); - if (testCount != 1) - summary.append(testCount).append(" tests"); - if (errorCount > 0) { - if (summary.length() > 0) summary.append(", "); - summary.append(errorCount).append(" errors"); - } - System.err.println(summary); - if (errorCount > 0) - throw new Exception(errorCount + " errors found"); - } - - /** - * Create a directory in which to store generated doc files. - * Avoid using the default (current) directory, so that we can - * be sure that javadoc is writing in the intended location, - * not a default location. - */ - protected File getOutDir() { - File dir = new File(testName); - dir.mkdirs(); - return dir; - } - - /** - * Create a directory in which to store generated doc files. - * Avoid using the default (current) directory, so that we can - * be sure that javadoc is writing in the intended location, - * not a default location. - */ - protected File getOutDir(String path) { - File dir = new File(testName, path); - dir.mkdirs(); - return dir; - } - - protected JavaFileObject createSimpleJavaFileObject() { - return createSimpleJavaFileObject("pkg/C", "package pkg; public class C { }"); - } - - protected JavaFileObject createSimpleJavaFileObject(final String binaryName, final String content) { - return new SimpleJavaFileObject( - URI.create("myfo:///" + binaryName + ".java"), JavaFileObject.Kind.SOURCE) { - @Override - public CharSequence getCharContent(boolean ignoreEncoding) { - return content; - } - }; - } - - protected void checkFiles(File dir, Set expectFiles) { - Set files = new HashSet(); - listFiles(dir, files); - Set foundFiles = new HashSet(); - URI dirURI = dir.toURI(); - for (File f: files) - foundFiles.add(dirURI.relativize(f.toURI()).getPath()); - checkFiles(foundFiles, expectFiles, dir); - } - - protected void checkFiles(Path dir, Set expectFiles) throws IOException { - Set files = new HashSet(); - listFiles(dir, files); - Set foundFiles = new HashSet(); - for (Path f: files) { - foundFiles.add(dir.relativize(f).toString().replace(f.getFileSystem().getSeparator(), "/")); - } - checkFiles(foundFiles, expectFiles, dir); - } - - private void checkFiles(Set foundFiles, Set expectFiles, Object where) { - if (!foundFiles.equals(expectFiles)) { - Set missing = new TreeSet(expectFiles); - missing.removeAll(foundFiles); - if (!missing.isEmpty()) - error("the following files were not found in " + where + ": " + missing); - Set unexpected = new TreeSet(foundFiles); - unexpected.removeAll(expectFiles); - if (!unexpected.isEmpty()) - error("the following unexpected files were found in " + where + ": " + unexpected); - } - } - - protected void listFiles(File dir, Set files) { - for (File f: dir.listFiles()) { - if (f.isDirectory()) - listFiles(f, files); - else if (f.isFile()) - files.add(f); - } - } - - private void listFiles(Path dir, Set files) throws IOException { - try (DirectoryStream ds = Files.newDirectoryStream(dir)) { - for (Path f: ds) { - if (Files.isDirectory(f)) - listFiles(f, files); - else if (Files.isRegularFile(f)) - files.add(f); - } - } - } - - protected void error(String msg) { - System.err.println("Error: " + msg); - errorCount++; - } - - protected int testCount; - protected int errorCount; - - protected String testName; - - /** - * Standard files generated by processing a documented class pkg.C. - */ - protected static Set standardExpectFiles = new HashSet<>(Arrays.asList( - "allclasses-index.html", - "allpackages-index.html", - "constant-values.html", - "deprecated-list.html", - "help-doc.html", - "index-all.html", - "index.html", - "jquery/jquery-3.3.1.js", - "jquery/jquery-migrate-3.0.1.js", - "jquery/jquery-ui.js", - "jquery/jquery-ui.css", - "jquery/jquery-ui.min.js", - "jquery/jquery-ui.min.css", - "jquery/jquery-ui.structure.min.css", - "jquery/jquery-ui.structure.css", - "jquery/external/jquery/jquery.js", - "jquery/jszip/dist/jszip.js", - "jquery/jszip/dist/jszip.min.js", - "jquery/jszip-utils/dist/jszip-utils.js", - "jquery/jszip-utils/dist/jszip-utils.min.js", - "jquery/jszip-utils/dist/jszip-utils-ie.js", - "jquery/jszip-utils/dist/jszip-utils-ie.min.js", - "jquery/images/ui-bg_glass_65_dadada_1x400.png", - "jquery/images/ui-icons_454545_256x240.png", - "jquery/images/ui-bg_glass_95_fef1ec_1x400.png", - "jquery/images/ui-bg_glass_75_dadada_1x400.png", - "jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png", - "jquery/images/ui-icons_888888_256x240.png", - "jquery/images/ui-icons_2e83ff_256x240.png", - "jquery/images/ui-icons_cd0a0a_256x240.png", - "jquery/images/ui-bg_glass_55_fbf9ee_1x400.png", - "jquery/images/ui-icons_222222_256x240.png", - "jquery/images/ui-bg_glass_75_e6e6e6_1x400.png", - "member-search-index.js", - "member-search-index.zip", - "overview-tree.html", - "element-list", - "package-search-index.js", - "package-search-index.zip", - "pkg/C.html", - "pkg/package-summary.html", - "pkg/package-tree.html", - "resources/glass.png", - "resources/x.png", - "script.js", - "search.js", - "stylesheet.css", - "type-search-index.js", - "type-search-index.zip" - )); - - protected static Set noIndexFiles = standardExpectFiles.stream() - .filter(s -> !s.startsWith("jquery") && !s.startsWith("resources") && !s.endsWith("zip") - && !s.equals("index-all.html") && !s.equals("search.js") && !s.endsWith("-search-index.js") - && !s.equals("allclasses-index.html") && !s.equals("allpackages-index.html")) - .collect(Collectors.toSet()); -} - diff --git a/test/langtools/tools/javadoc/api/basic/DocletPathTest.java b/test/langtools/tools/javadoc/api/basic/DocletPathTest.java deleted file mode 100644 index 42d8c463cad..00000000000 --- a/test/langtools/tools/javadoc/api/basic/DocletPathTest.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2012, 2015, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 6493690 - * @summary javadoc should have a javax.tools.Tool service provider - * @modules java.compiler - * jdk.compiler - * @build APITest - * @run main DocletPathTest - */ - -import java.io.File; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.Arrays; -import javax.tools.DocumentationTool; -import javax.tools.DocumentationTool.DocumentationTask; -import javax.tools.JavaCompiler; -import javax.tools.JavaFileObject; -import javax.tools.StandardJavaFileManager; -import javax.tools.StandardLocation; -import javax.tools.ToolProvider; - -/** - * Tests for locating a doclet via the file manager's DOCLET_PATH. - */ -public class DocletPathTest extends APITest { - public static void main(String... args) throws Exception { - new DocletPathTest().run(); - } - - /** - * Verify that an alternate doclet can be specified, and located via - * the file manager's DOCLET_PATH. - */ - @Test - public void testDocletPath() throws Exception { - JavaFileObject docletSrc = - createSimpleJavaFileObject("DocletOnDocletPath", docletSrcText); - File docletDir = getOutDir("classes"); - JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); - try (StandardJavaFileManager cfm = compiler.getStandardFileManager(null, null, null)) { - cfm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(docletDir)); - Iterable cfiles = Arrays.asList(docletSrc); - if (!compiler.getTask(null, cfm, null, null, null, cfiles).call()) - throw new Exception("cannot compile doclet"); - } - - JavaFileObject srcFile = createSimpleJavaFileObject(); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir("api"); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - fm.setLocation(DocumentationTool.Location.DOCLET_PATH, Arrays.asList(docletDir)); - Iterable files = Arrays.asList(srcFile); - Iterable options = Arrays.asList("-doclet", "DocletOnDocletPath"); - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - DocumentationTask t = tool.getTask(pw, fm, null, null, options, files); - boolean ok = t.call(); - String out = sw.toString(); - System.err.println(">>" + out + "<<"); - if (ok) { - if (out.contains(TEST_STRING)) { - System.err.println("doclet executed as expected"); - } else { - error("test string not found in doclet output"); - } - } else { - error("task failed"); - } - } - } - - private static final String TEST_STRING = "DocletOnDocletPath found and running"; - - private static final String docletSrcText = - "import com.sun.javadoc.*;\n" + - "public class DocletOnDocletPath {\n" + - " public static boolean start(RootDoc doc) {\n" + - " doc.printNotice(\"" + TEST_STRING + "\");\n" + - " return true;\n" + - " }\n" + - " public static int optionLength(String option) { return 0; }\n" + - " public static boolean validOptions(String options[][],\n" + - " DocErrorReporter reporter) { return true; }\n" + - " public static LanguageVersion languageVersion() {\n" + - " return LanguageVersion.JAVA_1_1;\n" + - " }\n" + - "}\n"; -} - diff --git a/test/langtools/tools/javadoc/api/basic/DocumentationToolLocationTest.java b/test/langtools/tools/javadoc/api/basic/DocumentationToolLocationTest.java deleted file mode 100644 index d61c49635b3..00000000000 --- a/test/langtools/tools/javadoc/api/basic/DocumentationToolLocationTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2013, 2015, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 8025844 - * @summary test DocumentationTool.Location methods - * @modules java.compiler - * jdk.compiler - * @build APITest - * @run main DocumentationToolLocationTest - */ - -import javax.tools.DocumentationTool; -import java.util.Objects; - -/** - * Test for DocumentationTool.Location methods. - */ -public class DocumentationToolLocationTest extends APITest { - public static void main(String[] args) throws Exception { - new DocumentationToolLocationTest().run(); - } - - /** - * Test getName() method - */ - @Test - public void testGetName() throws Exception { - // getName() returns name(). This is for test coverage of getName. - for (DocumentationTool.Location dl: DocumentationTool.Location.values()) { - String expect = dl.name(); - String found = dl.getName(); - if (!Objects.equals(expect, found)) - throw new Exception("mismatch for " + dl + "; expected " + expect + ", found " + found); - } - } - - /** - * Test generated enum methods values() and valueOf() - */ - @Test - public void testEnumMethods() throws Exception { - DocumentationTool.Location[] values = DocumentationTool.Location.values(); - if (values.length != 3) - throw new Exception("unexpected number of values returned"); - - for (DocumentationTool.Location dl: values) { - DocumentationTool.Location expect = dl; - DocumentationTool.Location found = DocumentationTool.Location.valueOf(dl.name()); - if (!Objects.equals(expect, found)) - throw new Exception("mismatch for " + dl + "; expected " + expect + ", found " + found); - } - } -} diff --git a/test/langtools/tools/javadoc/api/basic/GetSourceVersionsTest.java b/test/langtools/tools/javadoc/api/basic/GetSourceVersionsTest.java deleted file mode 100644 index 6a6a4e9da5e..00000000000 --- a/test/langtools/tools/javadoc/api/basic/GetSourceVersionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2012, 2015, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 6493690 - * @summary javadoc should have a javax.tools.Tool service provider - * @modules java.compiler - * jdk.compiler - * @build APITest - * @run main GetSourceVersionsTest - */ - -import java.util.EnumSet; -import java.util.Set; -import javax.lang.model.SourceVersion; -import javax.tools.DocumentationTool; -import javax.tools.ToolProvider; - -/** - * Tests for DocumentationTool.getSourceVersions method. - */ -public class GetSourceVersionsTest extends APITest { - public static void main(String... args) throws Exception { - new GetSourceVersionsTest().run(); - } - - /** - * Verify getSourceVersions. - */ - @Test - public void testRun() throws Exception { - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - Set found = tool.getSourceVersions(); - Set expect = EnumSet.range(SourceVersion.RELEASE_3, SourceVersion.latest()); - if (!expect.equals(found)) { - System.err.println("expect: " + expect); - System.err.println(" found: " + expect); - error("unexpected versions"); - } - } -} - diff --git a/test/langtools/tools/javadoc/api/basic/GetTask_DiagListenerTest.java b/test/langtools/tools/javadoc/api/basic/GetTask_DiagListenerTest.java deleted file mode 100644 index a090d04df4a..00000000000 --- a/test/langtools/tools/javadoc/api/basic/GetTask_DiagListenerTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2012, 2015, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 6493690 - * @summary javadoc should have a javax.tools.Tool service provider - * @modules java.compiler - * jdk.compiler - * @build APITest - * @run main GetTask_DiagListenerTest - */ - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import javax.tools.Diagnostic; -import javax.tools.DiagnosticCollector; -import javax.tools.DocumentationTool; -import javax.tools.DocumentationTool.DocumentationTask; -import javax.tools.JavaFileObject; -import javax.tools.StandardJavaFileManager; -import javax.tools.ToolProvider; - -/** - * Tests for DocumentationTool.getTask diagnosticListener parameter. - */ -public class GetTask_DiagListenerTest extends APITest { - public static void main(String... args) throws Exception { - new GetTask_DiagListenerTest().run(); - } - - /** - * Verify that a diagnostic listener can be specified. - * Note that messages from the tool and doclet are imperfectly modeled - * because the DocErrorReporter API works in terms of localized strings - * and file:line positions. Therefore, messages reported via DocErrorReporter - * and simply wrapped and passed through. - */ - @Test - public void testDiagListener() throws Exception { - JavaFileObject srcFile = createSimpleJavaFileObject("pkg/C", "package pkg; public error { }"); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable files = Arrays.asList(srcFile); - DiagnosticCollector dc = new DiagnosticCollector(); - DocumentationTask t = tool.getTask(null, fm, dc, null, null, files); - if (t.call()) { - throw new Exception("task succeeded unexpectedly"); - } else { - List diagCodes = new ArrayList(); - for (Diagnostic d: dc.getDiagnostics()) { - System.err.println(d); - diagCodes.add(d.getCode()); - } - List expect = Arrays.asList( - "javadoc.note.msg", // Loading source file - "compiler.err.expected3", // class, interface, or enum expected - "javadoc.note.msg"); // 1 error - if (!diagCodes.equals(expect)) - throw new Exception("unexpected diagnostics occurred"); - System.err.println("diagnostics received as expected"); - } - } - } - -} - diff --git a/test/langtools/tools/javadoc/api/basic/GetTask_DocletClassTest.java b/test/langtools/tools/javadoc/api/basic/GetTask_DocletClassTest.java deleted file mode 100644 index 275c19b02f5..00000000000 --- a/test/langtools/tools/javadoc/api/basic/GetTask_DocletClassTest.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2012, 2015, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 6493690 - * @summary javadoc should have a javax.tools.Tool service provider - * @modules jdk.javadoc - * @build APITest - * @run main GetTask_DocletClassTest - * @key randomness - */ - -import com.sun.javadoc.DocErrorReporter; -import com.sun.javadoc.LanguageVersion; -import com.sun.javadoc.RootDoc; -import java.io.File; -import java.util.Arrays; -import java.util.Collections; -import java.util.Random; -import javax.tools.DocumentationTool; -import javax.tools.DocumentationTool.DocumentationTask; -import javax.tools.JavaFileObject; -import javax.tools.StandardJavaFileManager; -import javax.tools.ToolProvider; - -/** - * Tests for DocumentationTool.getTask docletClass parameter. - */ -public class GetTask_DocletClassTest extends APITest { - public static void main(String... args) throws Exception { - new GetTask_DocletClassTest().run(); - } - - /** - * Verify that an alternate doclet can be specified. - * - * There is no standard interface or superclass for a doclet; - * the only requirement is that it provides static methods that - * can be invoked via reflection. So, for now, the doclet is - * specified as a class. - * Because we cannot create and use a unique instance of the class, - * we verify that the doclet has been called by having it record - * (in a static field!) the comment from the last time it was invoked, - * which is randomly generated each time the test is run. - */ - @Test - public void testDoclet() throws Exception { - Random r = new Random(); - int key = r.nextInt(); - JavaFileObject srcFile = createSimpleJavaFileObject( - "pkg/C", - "package pkg; /** " + key + "*/ public class C { }"); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable files = Arrays.asList(srcFile); - DocumentationTask t = tool.getTask(null, fm, null, TestDoclet.class, null, files); - if (t.call()) { - System.err.println("task succeeded"); - if (TestDoclet.lastCaller.equals(String.valueOf(key))) - System.err.println("found expected key: " + key); - else - error("Expected key not found"); - checkFiles(outDir, Collections.emptySet()); - } else { - throw new Exception("task failed"); - } - } - } - - public static class TestDoclet { - static String lastCaller; - public static boolean start(RootDoc root) { - lastCaller = root.classNamed("pkg.C").commentText().trim(); - return true; - } - - public static int optionLength(String option) { - return 0; // default is option unknown - } - - public static boolean validOptions(String options[][], - DocErrorReporter reporter) { - return true; // default is options are valid - } - - public static LanguageVersion languageVersion() { - return LanguageVersion.JAVA_1_1; - } - } - - /** - * Verify that exceptions from a doclet are thrown as expected. - */ - @Test - public void testBadDoclet() throws Exception { - JavaFileObject srcFile = createSimpleJavaFileObject(); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable files = Arrays.asList(srcFile); - DocumentationTask t = tool.getTask(null, fm, null, BadDoclet.class, null, files); - try { - t.call(); - error("call completed without exception"); - } catch (RuntimeException e) { - Throwable c = e.getCause(); - if (c.getClass() == UnexpectedError.class) - System.err.println("exception caught as expected: " + c); - else - throw e; - } - } - } - - public static class UnexpectedError extends Error { } - - public static class BadDoclet { - public static boolean start(RootDoc root) { - throw new UnexpectedError(); - } - - public static int optionLength(String option) { - return 0; // default is option unknown - } - - public static boolean validOptions(String options[][], - DocErrorReporter reporter) { - return true; // default is options are valid - } - - public static LanguageVersion languageVersion() { - return LanguageVersion.JAVA_1_1; - } - } - -} - diff --git a/test/langtools/tools/javadoc/api/basic/GetTask_FileManagerTest.java b/test/langtools/tools/javadoc/api/basic/GetTask_FileManagerTest.java deleted file mode 100644 index 46925df338c..00000000000 --- a/test/langtools/tools/javadoc/api/basic/GetTask_FileManagerTest.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2012, 2015, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 6493690 8024434 - * @summary javadoc should have a javax.tools.Tool service provider - * @modules jdk.compiler/com.sun.tools.javac.file - * jdk.compiler/com.sun.tools.javac.util - * @build APITest - * @run main GetTask_FileManagerTest - */ - -import java.io.File; -import java.io.IOException; -import java.nio.file.Path; -import java.util.Arrays; -import java.util.Set; - -import javax.tools.DocumentationTool; -import javax.tools.DocumentationTool.DocumentationTask; -import javax.tools.FileObject; -import javax.tools.ForwardingJavaFileManager; -import javax.tools.JavaFileObject; -import javax.tools.JavaFileObject.Kind; -import javax.tools.StandardJavaFileManager; -import javax.tools.ToolProvider; - -import com.sun.tools.javac.file.JavacFileManager; -import com.sun.tools.javac.util.Context; - -/** - * Tests for DocumentationTool.getTask fileManager parameter. - */ -public class GetTask_FileManagerTest extends APITest { - public static void main(String... args) throws Exception { - new GetTask_FileManagerTest().run(); - } - - /** - * Verify that an alternate file manager can be specified: - * in this case, a TestFileManager. - */ - @Test - public void testFileManager() throws Exception { - JavaFileObject srcFile = createSimpleJavaFileObject(); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - StandardJavaFileManager fm = new TestFileManager(); - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable files = Arrays.asList(srcFile); - DocumentationTask t = tool.getTask(null, fm, null, null, Arrays.asList("-verbose"), files); - if (t.call()) { - System.err.println("task succeeded"); - checkFiles(outDir, standardExpectFiles); - } else { - throw new Exception("task failed"); - } - } - - /** - * Verify that exceptions from a bad file manager are thrown as expected. - */ - @Test - public void testBadFileManager() throws Exception { - JavaFileObject srcFile = createSimpleJavaFileObject(); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - StandardJavaFileManager fm = new TestFileManager() { - @Override - public Iterable list(Location location, - String packageName, - Set kinds, - boolean recurse) - throws IOException { - throw new UnexpectedError(); - } - }; - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(getOutDir())); - Iterable files = Arrays.asList(srcFile); - DocumentationTask t = tool.getTask(null, fm, null, null, null, files); - try { - t.call(); - error("call completed without exception"); - } catch (RuntimeException e) { - Throwable c = e.getCause(); - if (c.getClass() == UnexpectedError.class) - System.err.println("exception caught as expected: " + c); - else - throw e; - } - } - - public static class UnexpectedError extends Error { } - - /* - * A JavaFileManager which is not a JavacFileManager, even though it uses one internally for - * convenience. - */ - static class TestFileManager extends ForwardingJavaFileManager - implements StandardJavaFileManager { - TestFileManager() { - super(new JavacFileManager(new Context(), false, null)); - } - - @Override - public Iterable getJavaFileObjectsFromFiles(Iterable files) { - return fileManager.getJavaFileObjectsFromFiles(files); - } - - @Override - public Iterable getJavaFileObjects(File... files) { - return fileManager.getJavaFileObjects(files); - } - - @Override - public Iterable getJavaFileObjectsFromStrings(Iterable names) { - return fileManager.getJavaFileObjectsFromStrings(names); - } - - @Override - public Iterable getJavaFileObjects(String... names) { - return fileManager.getJavaFileObjects(names); - } - - @Override - public void setLocation(Location location, Iterable path) throws IOException { - fileManager.setLocation(location, path); - } - - @Override - public Iterable getLocation(Location location) { - return fileManager.getLocation(location); - } - - } -} diff --git a/test/langtools/tools/javadoc/api/basic/GetTask_FileObjectsTest.java b/test/langtools/tools/javadoc/api/basic/GetTask_FileObjectsTest.java deleted file mode 100644 index e5c72ab6988..00000000000 --- a/test/langtools/tools/javadoc/api/basic/GetTask_FileObjectsTest.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2012, 2015, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 6493690 - * @summary javadoc should have a javax.tools.Tool service provider - * @modules java.compiler - * jdk.compiler - * @build APITest - * @run main GetTask_FileObjectsTest - */ - -import java.io.File; -import java.util.Arrays; -import javax.tools.DocumentationTool; -import javax.tools.DocumentationTool.DocumentationTask; -import javax.tools.JavaFileObject; -import javax.tools.StandardJavaFileManager; -import javax.tools.ToolProvider; - -/** - * Tests for DocumentationTool.getTask fileObjects parameter. - */ -public class GetTask_FileObjectsTest extends APITest { - public static void main(String... args) throws Exception { - new GetTask_FileObjectsTest().run(); - } - - /** - * Verify that expected output files are written via the file manager, - * for a source file read from the file system with StandardJavaFileManager. - */ - @Test - public void testStandardFileObject() throws Exception { - File testSrc = new File(System.getProperty("test.src")); - File srcFile = new File(testSrc, "pkg/C.java"); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable files = fm.getJavaFileObjects(srcFile); - DocumentationTask t = tool.getTask(null, fm, null, null, null, files); - if (t.call()) { - System.err.println("task succeeded"); - checkFiles(outDir, standardExpectFiles); - } else { - throw new Exception("task failed"); - } - } - } - - /** - * Verify that expected output files are written via the file manager, - * for an in-memory file object. - */ - @Test - public void testMemoryFileObject() throws Exception { - JavaFileObject srcFile = createSimpleJavaFileObject(); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable files = Arrays.asList(srcFile); - DocumentationTask t = tool.getTask(null, fm, null, null, null, files); - if (t.call()) { - System.err.println("task succeeded"); - checkFiles(outDir, standardExpectFiles); - } else { - throw new Exception("task failed"); - } - } - } - - /** - * Verify bad file object is handled correctly. - */ - @Test - public void testBadFileObject() throws Exception { - File testSrc = new File(System.getProperty("test.src")); - File srcFile = new File(testSrc, "pkg/C.class"); // unacceptable file kind - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable files = fm.getJavaFileObjects(srcFile); - try { - DocumentationTask t = tool.getTask(null, fm, null, null, null, files); - error("getTask succeeded, no exception thrown"); - } catch (IllegalArgumentException e) { - System.err.println("exception caught as expected: " + e); - } - } - } - - /** - * Verify null is handled correctly. - */ - @Test - public void testNull() throws Exception { - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable files = Arrays.asList((JavaFileObject) null); - try { - DocumentationTask t = tool.getTask(null, fm, null, null, null, files); - error("getTask succeeded, no exception thrown"); - } catch (NullPointerException e) { - System.err.println("exception caught as expected: " + e); - } - } - } - -} - diff --git a/test/langtools/tools/javadoc/api/basic/GetTask_OptionsTest.java b/test/langtools/tools/javadoc/api/basic/GetTask_OptionsTest.java deleted file mode 100644 index 36817ff20a8..00000000000 --- a/test/langtools/tools/javadoc/api/basic/GetTask_OptionsTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2012, 2015, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 6493690 8141492 - * @summary javadoc should have a javax.tools.Tool service provider - * @modules java.compiler - * jdk.compiler - * @build APITest - * @run main GetTask_OptionsTest - */ - -import java.io.File; -import java.util.Arrays; -import java.util.Set; -import java.util.TreeSet; -import javax.tools.DocumentationTool; -import javax.tools.DocumentationTool.DocumentationTask; -import javax.tools.JavaFileObject; -import javax.tools.StandardJavaFileManager; -import javax.tools.ToolProvider; - -/** - * Tests for DocumentationTool.getTask options parameter. - */ -public class GetTask_OptionsTest extends APITest { - public static void main(String... args) throws Exception { - new GetTask_OptionsTest().run(); - } - - /** - * Verify that expected output files are written for given options. - */ - @Test - public void testNoIndex() throws Exception { - JavaFileObject srcFile = createSimpleJavaFileObject(); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable files = Arrays.asList(srcFile); - Iterable options = Arrays.asList("-noindex"); - DocumentationTask t = tool.getTask(null, fm, null, null, options, files); - if (t.call()) { - System.err.println("task succeeded"); - Set expectFiles = new TreeSet(noIndexFiles); - checkFiles(outDir, expectFiles); - } else { - error("task failed"); - } - } - } - - /** - * Verify null is handled correctly. - */ - @Test - public void testNull() throws Exception { - JavaFileObject srcFile = createSimpleJavaFileObject(); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable options = Arrays.asList((String) null); - Iterable files = Arrays.asList(srcFile); - try { - DocumentationTask t = tool.getTask(null, fm, null, null, options, files); - error("getTask succeeded, no exception thrown"); - } catch (NullPointerException e) { - System.err.println("exception caught as expected: " + e); - } - } - } - -} - diff --git a/test/langtools/tools/javadoc/api/basic/GetTask_WriterTest.java b/test/langtools/tools/javadoc/api/basic/GetTask_WriterTest.java deleted file mode 100644 index df64c96ffdc..00000000000 --- a/test/langtools/tools/javadoc/api/basic/GetTask_WriterTest.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2012, 2015, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 6493690 - * @summary javadoc should have a javax.tools.Tool service provider - * @modules java.compiler - * jdk.compiler - * @build APITest - * @run main GetTask_WriterTest - */ - -import java.io.File; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.Arrays; -import javax.tools.DocumentationTool; -import javax.tools.DocumentationTool.DocumentationTask; -import javax.tools.JavaFileObject; -import javax.tools.StandardJavaFileManager; -import javax.tools.ToolProvider; - -/** - * Tests for DocumentationTool.getTask writer parameter. - */ -public class GetTask_WriterTest extends APITest { - public static void main(String... args) throws Exception { - new GetTask_WriterTest().run(); - } - - /** - * Verify that a writer can be provided. - */ - @Test - public void testWriter() throws Exception { - JavaFileObject srcFile = createSimpleJavaFileObject(); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable files = Arrays.asList(srcFile); - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - DocumentationTask t = tool.getTask(pw, fm, null, null, null, files); - if (t.call()) { - System.err.println("task succeeded"); - checkFiles(outDir, standardExpectFiles); - String out = sw.toString(); - System.err.println(">>" + out + "<<"); - for (String f: standardExpectFiles) { - String f1 = f.replace('/', File.separatorChar); - if (f1.endsWith(".html") && !out.contains(f1)) - throw new Exception("expected string not found: " + f1); - } - } else { - throw new Exception("task failed"); - } - } - } -} - diff --git a/test/langtools/tools/javadoc/api/basic/Task_reuseTest.java b/test/langtools/tools/javadoc/api/basic/Task_reuseTest.java deleted file mode 100644 index 536bb52aa98..00000000000 --- a/test/langtools/tools/javadoc/api/basic/Task_reuseTest.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2012, 2015, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 6493690 - * @summary javadoc should have a javax.tools.Tool service provider - * @modules java.compiler - * jdk.compiler - * @build APITest - * @run main Task_reuseTest - */ - -import java.io.File; -import java.util.Arrays; -import java.util.Locale; -import javax.tools.DocumentationTool; -import javax.tools.DocumentationTool.DocumentationTask; -import javax.tools.JavaFileObject; -import javax.tools.StandardJavaFileManager; -import javax.tools.ToolProvider; - -/** - * Tests for reusing a documentation task. - */ -public class Task_reuseTest extends APITest { - public static void main(String... args) throws Exception { - new Task_reuseTest().run(); - } - - /** - * Verify that call can only be called once. - */ - @Test - public void testReuse() throws Exception { - DocumentationTask t = getAndRunTask(); - try { - t.call(); - error("task was reused without exception"); - } catch (IllegalStateException e) { - System.err.println("caught exception " + e); - } - } - - /** - * Verify that cannot update task after call - */ - @Test - public void testUpdateSetLocale() throws Exception { - DocumentationTask t = getAndRunTask(); - try { - t.setLocale(Locale.getDefault()); - error("task was reused without exception"); - } catch (IllegalStateException e) { - System.err.println("caught exception " + e); - } - } - - private DocumentationTask getAndRunTask() throws Exception { - JavaFileObject srcFile = createSimpleJavaFileObject(); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable files = Arrays.asList(srcFile); - DocumentationTask t = tool.getTask(null, fm, null, null, null, files); - if (t.call()) { - System.err.println("task succeeded"); - return t; - } else { - throw new Exception("task failed"); - } - } - } -} - diff --git a/test/langtools/tools/javadoc/api/basic/pkg/C.java b/test/langtools/tools/javadoc/api/basic/pkg/C.java deleted file mode 100644 index 74383c04f08..00000000000 --- a/test/langtools/tools/javadoc/api/basic/pkg/C.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2012, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg; - -public class C { } - diff --git a/test/langtools/tools/javadoc/api/basic/taglets/UnderlineTaglet.java b/test/langtools/tools/javadoc/api/basic/taglets/UnderlineTaglet.java deleted file mode 100644 index 426b0db853e..00000000000 --- a/test/langtools/tools/javadoc/api/basic/taglets/UnderlineTaglet.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * -Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * -Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of Oracle nor the names of - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any - * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND - * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY - * EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY - * DAMAGES OR LIABILITIES SUFFERED BY LICENSEE AS A RESULT OF OR - * RELATING TO USE, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR - * ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE - * FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, - * SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER - * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF - * THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that Software is not designed, licensed or - * intended for use in the design, construction, operation or - * maintenance of any nuclear facility. - */ - -import com.sun.tools.doclets.Taglet; -import com.sun.javadoc.*; -import java.util.Map; - -/** - * A sample Inline Taglet representing {@underline ...}. This tag can - * be used in any kind of {@link com.sun.javadoc.Doc}. - * The text is underlined. For example, - * "@underline UNDERLINE ME" would be shown as: UNDERLINE ME. - * - * @author Jamie Ho - * @since 1.4 - */ - -public class UnderlineTaglet implements Taglet { - - private static final String NAME = "underline"; - - /** - * Return the name of this custom tag. - */ - public String getName() { - return NAME; - } - - /** - * @return true since this tag can be used in a field - * doc comment - */ - public boolean inField() { - return true; - } - - /** - * @return true since this tag can be used in a constructor - * doc comment - */ - public boolean inConstructor() { - return true; - } - - /** - * @return true since this tag can be used in a method - * doc comment - */ - public boolean inMethod() { - return true; - } - - /** - * @return true since this tag can be used in an overview - * doc comment - */ - public boolean inOverview() { - return true; - } - - /** - * @return true since this tag can be used in a package - * doc comment - */ - public boolean inPackage() { - return true; - } - - /** - * @return true since this - */ - public boolean inType() { - return true; - } - - /** - * Will return true since this is an inline tag. - * @return true since this is an inline tag. - */ - - public boolean isInlineTag() { - return true; - } - - /** - * Register this Taglet. - * @param tagletMap the map to register this tag to. - */ - public static void register(Map tagletMap) { - UnderlineTaglet tag = new UnderlineTaglet(); - Taglet t = (Taglet) tagletMap.get(tag.getName()); - if (t != null) { - tagletMap.remove(tag.getName()); - } - tagletMap.put(tag.getName(), tag); - } - - /** - * Given the Tag representation of this custom - * tag, return its string representation. - * @param tag he Tag representation of this custom tag. - */ - public String toString(Tag tag) { - return "" + tag.text() + ""; - } - - /** - * This method should not be called since arrays of inline tags do not - * exist. Method {@link #tostring(Tag)} should be used to convert this - * inline tag to a string. - * @param tags the array of Tags representing of this custom tag. - */ - public String toString(Tag[] tags) { - return null; - } -} - diff --git a/test/langtools/tools/javadoc/completionFailure/CompletionFailure.java b/test/langtools/tools/javadoc/completionFailure/CompletionFailure.java deleted file mode 100644 index c09e627ba10..00000000000 --- a/test/langtools/tools/javadoc/completionFailure/CompletionFailure.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2002, 2015, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4670772 6328529 - * @summary Completion failures should be ignored in javadoc. - * @author gafter - * @modules jdk.javadoc - */ - -import com.sun.javadoc.*; -import java.util.*; - -public class CompletionFailure extends Doclet -{ - public static void main(String[] args) { - // run javadoc on package pkg - if (com.sun.tools.javadoc.Main.execute("javadoc", - "CompletionFailure", - CompletionFailure.class.getClassLoader(), - new String[]{"pkg"}) != 0) - throw new Error(); - } - - public static boolean start(com.sun.javadoc.RootDoc root) { - ClassDoc[] classes = root.classes(); - if (classes.length != 1) - throw new Error("1 " + Arrays.asList(classes)); - return true; - } -} diff --git a/test/langtools/tools/javadoc/completionFailure/pkg/A.java b/test/langtools/tools/javadoc/completionFailure/pkg/A.java deleted file mode 100644 index 3f0826064e4..00000000000 --- a/test/langtools/tools/javadoc/completionFailure/pkg/A.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2002, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg; - -public class A { -} diff --git a/test/langtools/tools/javadoc/completionFailure/pkg/B.java b/test/langtools/tools/javadoc/completionFailure/pkg/B.java deleted file mode 100644 index 7b4d1645dc1..00000000000 --- a/test/langtools/tools/javadoc/completionFailure/pkg/B.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2002, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import pkg.A; - -public class B { -} diff --git a/test/langtools/tools/javadoc/dupOk/DupOk.java b/test/langtools/tools/javadoc/dupOk/DupOk.java deleted file mode 100644 index bba8242905a..00000000000 --- a/test/langtools/tools/javadoc/dupOk/DupOk.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2002, 2015, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4673477 - * @summary The first definition found for each class should be documented - * @author gafter - * @modules jdk.javadoc - */ - -import com.sun.javadoc.*; -import java.util.*; - -public class DupOk extends Doclet -{ - public static void main(String[] args) { - // run javadoc on package p - if (com.sun.tools.javadoc.Main. - execute("javadoc", "DupOk", DupOk.class.getClassLoader(), - new String[] - {"-sourcepath", - System.getProperty("test.src", ".") + java.io.File.separatorChar + "sp1" + - System.getProperty("path.separator") + - System.getProperty("test.src", ".") + java.io.File.separatorChar + "sp2", - "p" - }) != 0) - throw new Error(); - } - - public static boolean start(com.sun.javadoc.RootDoc root) { - ClassDoc[] classes = root.classes(); - if (classes.length != 2) - throw new Error("1 " + Arrays.asList(classes)); - for (int i=0; i - enum constants: - Thoreau - McLuhan - Pynchon - Mencken - Allen - Vidal - Occam - Groening - Juvenal - Eco - methods: - pkg1.QuotablePerson[] values() - QuotablePerson valueOf(String) diff --git a/test/langtools/tools/javadoc/enum/enumType/pkg1/QuotablePerson.java b/test/langtools/tools/javadoc/enum/enumType/pkg1/QuotablePerson.java deleted file mode 100644 index 311bfda8a40..00000000000 --- a/test/langtools/tools/javadoc/enum/enumType/pkg1/QuotablePerson.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -/** - * Some people we love to quote. - */ -public enum QuotablePerson { - - /** "Beware of all enterprises that require new clothes." */ - Thoreau, - - /** - * "A point of view can be a dangerous luxury when substituted for - * insight and understanding." - */ - McLuhan, - - /** - * "If they can keep you asking the wrong questions, they don't have to - * worry about the answers." - */ - Pynchon, - - /** - * "For every problem, there is a solution that is simple, elegant, - * and wrong." - */ - Mencken, - - /** - * "Formerly unsolvable equations are dealt with by threats of reprisals." - */ - Allen, - - /** "It is not enough to succeed. Others must fail." */ - Vidal, - - /** "Entia non sunt multiplicanda praeter necessitatem." */ - Occam, - - /** - * "Love is a snowmobile racing across the tundra and then suddenly it - * flips over, pinning you underneath. At night, the ice weasels come." - */ - Groening, - - /** "Sed Quis custodiet ipsos custodes?" */ - Juvenal, - - /** - * "The list could surely go on, and there is nothing more wonderful - * than a list, instrument of wondrous hypotyposis." - */ - Eco -} diff --git a/test/langtools/tools/javadoc/generics/genericClass/Main.java b/test/langtools/tools/javadoc/generics/genericClass/Main.java deleted file mode 100644 index a45db3da386..00000000000 --- a/test/langtools/tools/javadoc/generics/genericClass/Main.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4421066 - * @summary Verify the contents of the ClassDoc of a generic class. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - for (ClassDoc cd : root.classes()) { - tester.printClass(cd); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/generics/genericClass/expected.out b/test/langtools/tools/javadoc/generics/genericClass/expected.out deleted file mode 100644 index 968b6ee9dc0..00000000000 --- a/test/langtools/tools/javadoc/generics/genericClass/expected.out +++ /dev/null @@ -1,16 +0,0 @@ -class pkg1.A - name: A / A / pkg1.A - type parameters: - T - superclass: - java.lang.Object - fields: - T t - pkg1.A at - pkg1.A as - constructors: - A() - methods: - void m1(T) - void m2(A) - void m3(A) diff --git a/test/langtools/tools/javadoc/generics/genericClass/pkg1/A.java b/test/langtools/tools/javadoc/generics/genericClass/pkg1/A.java deleted file mode 100644 index 28206a29e4d..00000000000 --- a/test/langtools/tools/javadoc/generics/genericClass/pkg1/A.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -public class A { - public T t; - public A at; - public A as; - - public void m1(T t) {} - public void m2(A at) {} - public void m3(A as) {} -} diff --git a/test/langtools/tools/javadoc/generics/genericInnerAndOuter/Main.java b/test/langtools/tools/javadoc/generics/genericInnerAndOuter/Main.java deleted file mode 100644 index 75b21a72cce..00000000000 --- a/test/langtools/tools/javadoc/generics/genericInnerAndOuter/Main.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4421066 - * @summary Verify the contents of the ClassDoc of - * a generic class with a generic inner class. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import java.util.Arrays; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - ClassDoc[] cds = root.classes(); - Arrays.sort(cds); - for (ClassDoc cd : cds) { - tester.printClass(cd); - tester.println(); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/generics/genericInnerAndOuter/expected.out b/test/langtools/tools/javadoc/generics/genericInnerAndOuter/expected.out deleted file mode 100644 index 1c0040ee6a0..00000000000 --- a/test/langtools/tools/javadoc/generics/genericInnerAndOuter/expected.out +++ /dev/null @@ -1,53 +0,0 @@ -class pkg1.O - name: O / O / pkg1.O - type parameters: - T - superclass: - java.lang.Object - constructors: - O() - -class pkg1.O.I - name: I / O.I / pkg1.O.I - type parameters: - S - nested in: - pkg1.O - superclass: - java.lang.Object - constructors: - I() - methods: - void m1(O.I) - -class pkg1.X - name: X / X / pkg1.X - type parameters: - T - superclass: - java.lang.Object - constructors: - X() - -class pkg1.X.Y - name: Y / X.Y / pkg1.X.Y - nested in: - pkg1.X - superclass: - java.lang.Object - constructors: - Y() - -class pkg1.X.Y.Z - name: Z / X.Y.Z / pkg1.X.Y.Z - type parameters: - S - nested in: - pkg1.X.Y - superclass: - java.lang.Object - constructors: - Z() - methods: - void m1(X.Y.Z) - diff --git a/test/langtools/tools/javadoc/generics/genericInnerAndOuter/pkg1/O.java b/test/langtools/tools/javadoc/generics/genericInnerAndOuter/pkg1/O.java deleted file mode 100644 index 0eb3267c8be..00000000000 --- a/test/langtools/tools/javadoc/generics/genericInnerAndOuter/pkg1/O.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -public class O { - public class I { - public void m1(O.I a) {} - } -} diff --git a/test/langtools/tools/javadoc/generics/genericInnerAndOuter/pkg1/X.java b/test/langtools/tools/javadoc/generics/genericInnerAndOuter/pkg1/X.java deleted file mode 100644 index c3beb828a99..00000000000 --- a/test/langtools/tools/javadoc/generics/genericInnerAndOuter/pkg1/X.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -public class X { - public class Y { - public class Z { - public void m1(X.Y.Z a) {} - } - } -} diff --git a/test/langtools/tools/javadoc/generics/genericInterface/Main.java b/test/langtools/tools/javadoc/generics/genericInterface/Main.java deleted file mode 100644 index 5c73963d633..00000000000 --- a/test/langtools/tools/javadoc/generics/genericInterface/Main.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4421066 - * @summary Verify the contents of the ClassDoc of a generic interface. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - for (ClassDoc cd : root.classes()) { - tester.printClass(cd); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/generics/genericInterface/expected.out b/test/langtools/tools/javadoc/generics/genericInterface/expected.out deleted file mode 100644 index 2332f210b65..00000000000 --- a/test/langtools/tools/javadoc/generics/genericInterface/expected.out +++ /dev/null @@ -1,6 +0,0 @@ -interface pkg1.A - name: A / A / pkg1.A - type parameters: - T - methods: - void m1(T) diff --git a/test/langtools/tools/javadoc/generics/genericInterface/pkg1/A.java b/test/langtools/tools/javadoc/generics/genericInterface/pkg1/A.java deleted file mode 100644 index d20c2435a26..00000000000 --- a/test/langtools/tools/javadoc/generics/genericInterface/pkg1/A.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -public interface A { - void m1(T t); -} diff --git a/test/langtools/tools/javadoc/generics/genericMethod/Main.java b/test/langtools/tools/javadoc/generics/genericMethod/Main.java deleted file mode 100644 index d0b26f3dd7b..00000000000 --- a/test/langtools/tools/javadoc/generics/genericMethod/Main.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4421066 - * @summary Verify the reading of generic methods and constructors. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - for (ClassDoc cd : root.classes()) { - for (ConstructorDoc c : cd.constructors()) - tester.printConstructor(c); - for (MethodDoc m : cd.methods()) - tester.printMethod(m); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/generics/genericMethod/expected.out b/test/langtools/tools/javadoc/generics/genericMethod/expected.out deleted file mode 100644 index 8b051a1e669..00000000000 --- a/test/langtools/tools/javadoc/generics/genericMethod/expected.out +++ /dev/null @@ -1,20 +0,0 @@ -constructor pkg1.A() - signature: () - () - type parameters: - T -method pkg1.A.m1(T) - signature: (T) - (T) - type parameters: - T - returns: - void -method pkg1.A.m2(T, U) - signature: (T, U) - (T, U) - type parameters: - T extends java.lang.Number - U - returns: - void diff --git a/test/langtools/tools/javadoc/generics/genericMethod/pkg1/A.java b/test/langtools/tools/javadoc/generics/genericMethod/pkg1/A.java deleted file mode 100644 index 4a7749c4bf2..00000000000 --- a/test/langtools/tools/javadoc/generics/genericMethod/pkg1/A.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -public class A { - public A() {} - public void m1(T t) {} - public void m2(T t, U u) {} -} diff --git a/test/langtools/tools/javadoc/generics/genericSuper/Main.java b/test/langtools/tools/javadoc/generics/genericSuper/Main.java deleted file mode 100644 index b83df575d89..00000000000 --- a/test/langtools/tools/javadoc/generics/genericSuper/Main.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4421066 - * @summary Verify the contents of the ClassDoc of a generic class. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import java.util.Arrays; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = - new OldToolTester("Main", "pkg1", "-package"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - ClassDoc[] cds = root.classes(); - Arrays.sort(cds); - for (ClassDoc cd : cds) { - tester.printClass(cd); - tester.println(); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/generics/genericSuper/expected.out b/test/langtools/tools/javadoc/generics/genericSuper/expected.out deleted file mode 100644 index 2faad58662d..00000000000 --- a/test/langtools/tools/javadoc/generics/genericSuper/expected.out +++ /dev/null @@ -1,27 +0,0 @@ -class pkg1.A - name: A / A / pkg1.A - type parameters: - V - W - superclass: - pkg1.S - interfaces: - pkg1.I - constructors: - A() - -interface pkg1.I - name: I / I / pkg1.I - type parameters: - R - -class pkg1.S - name: S / S / pkg1.S - type parameters: - T - U - superclass: - java.lang.Object - constructors: - S() - diff --git a/test/langtools/tools/javadoc/generics/genericSuper/pkg1/A.java b/test/langtools/tools/javadoc/generics/genericSuper/pkg1/A.java deleted file mode 100644 index c12caf96f51..00000000000 --- a/test/langtools/tools/javadoc/generics/genericSuper/pkg1/A.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -class S { -} - -interface I { -} - -public class A extends S implements I { -} diff --git a/test/langtools/tools/javadoc/generics/supertypes/Main.java b/test/langtools/tools/javadoc/generics/supertypes/Main.java deleted file mode 100644 index 2c7994556a3..00000000000 --- a/test/langtools/tools/javadoc/generics/supertypes/Main.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4922918 - * @summary Check supertypes and superinterfaces of parameterized types. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import java.util.Comparator; -import java.util.Arrays; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - ClassDoc[] cds = root.classes(); - Arrays.sort(cds); - for (ClassDoc cd : cds) { - ParameterizedType arrayList = - cd.superclassType().asParameterizedType(); - tester.println(arrayList); - tester.println(); - - tester.println(arrayList.superclassType()); - Type[] interfaces = arrayList.interfaceTypes(); - // Sort interfaces by type name, for consistent output. - Arrays.sort(interfaces, - new Comparator() { - public int compare(Type t1, Type t2) { - String name1 = t1.qualifiedTypeName(); - String name2 = t2.qualifiedTypeName(); - return name1.compareTo(name2); - } - }); - for (Type t : interfaces) { - tester.println(t); - } - tester.println(); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/generics/supertypes/expected.out b/test/langtools/tools/javadoc/generics/supertypes/expected.out deleted file mode 100644 index d3dd3ce697d..00000000000 --- a/test/langtools/tools/javadoc/generics/supertypes/expected.out +++ /dev/null @@ -1,16 +0,0 @@ -java.util.ArrayList - -java.util.AbstractList -java.io.Serializable -java.lang.Cloneable -java.util.List -java.util.RandomAccess - -java.util.ArrayList - -java.util.AbstractList -java.io.Serializable -java.lang.Cloneable -java.util.List -java.util.RandomAccess - diff --git a/test/langtools/tools/javadoc/generics/supertypes/pkg1/A.java b/test/langtools/tools/javadoc/generics/supertypes/pkg1/A.java deleted file mode 100644 index 202d8452035..00000000000 --- a/test/langtools/tools/javadoc/generics/supertypes/pkg1/A.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -import java.util.ArrayList; - -public class A extends ArrayList { -} diff --git a/test/langtools/tools/javadoc/generics/supertypes/pkg1/B.java b/test/langtools/tools/javadoc/generics/supertypes/pkg1/B.java deleted file mode 100644 index 3991e7cd3f6..00000000000 --- a/test/langtools/tools/javadoc/generics/supertypes/pkg1/B.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -import java.util.ArrayList; - -public class B extends ArrayList { -} diff --git a/test/langtools/tools/javadoc/generics/throwsGeneric/Main.java b/test/langtools/tools/javadoc/generics/throwsGeneric/Main.java deleted file mode 100644 index b46a4467d31..00000000000 --- a/test/langtools/tools/javadoc/generics/throwsGeneric/Main.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4421066 - * @summary Verify the reading of generic methods and constructors. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - for (ClassDoc cd : root.classes()) { - for (MethodDoc m : cd.methods()) - tester.printMethod(m); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/generics/throwsGeneric/expected.out b/test/langtools/tools/javadoc/generics/throwsGeneric/expected.out deleted file mode 100644 index 99e65992a33..00000000000 --- a/test/langtools/tools/javadoc/generics/throwsGeneric/expected.out +++ /dev/null @@ -1,16 +0,0 @@ -method pkg1.A.m1() - signature: () - () - throws: - T extends java.lang.Throwable - returns: - void -method pkg1.A.m2() - signature: () - () - type parameters: - U extends java.lang.Throwable - throws: - U extends java.lang.Throwable - returns: - void diff --git a/test/langtools/tools/javadoc/generics/throwsGeneric/pkg1/A.java b/test/langtools/tools/javadoc/generics/throwsGeneric/pkg1/A.java deleted file mode 100644 index 083d718d173..00000000000 --- a/test/langtools/tools/javadoc/generics/throwsGeneric/pkg1/A.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -public interface A { - void m1() throws T; - void m2() throws U; -} diff --git a/test/langtools/tools/javadoc/generics/tparamCycle/Main.java b/test/langtools/tools/javadoc/generics/tparamCycle/Main.java deleted file mode 100644 index 777072a91d3..00000000000 --- a/test/langtools/tools/javadoc/generics/tparamCycle/Main.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4421066 - * @summary Check a type parameter whose bound cycles back on itself. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - } - - public static boolean start(RootDoc root) { - ClassDoc cd = root.classes()[0]; - System.out.println("*** " + cd); - TypeVariable E = cd.typeParameters()[0]; - System.out.println("*** " + E); - Type bound = E.bounds()[0]; - System.out.println("*** " + bound); - - // Verify that we have an instantiation of Enum, and not - // the generic interface. - ParameterizedType enumE = (ParameterizedType)bound; - - if (enumE.asClassDoc() != cd) { - throw new Error("Type declaration and type use don't match up."); - } else { - return true; - } - } -} diff --git a/test/langtools/tools/javadoc/generics/tparamCycle/pkg1/LikeEnum.java b/test/langtools/tools/javadoc/generics/tparamCycle/pkg1/LikeEnum.java deleted file mode 100644 index 2369640e650..00000000000 --- a/test/langtools/tools/javadoc/generics/tparamCycle/pkg1/LikeEnum.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -public interface LikeEnum> { -} diff --git a/test/langtools/tools/javadoc/generics/tparamTagOnMethod/Main.java b/test/langtools/tools/javadoc/generics/tparamTagOnMethod/Main.java deleted file mode 100644 index 28df71fd781..00000000000 --- a/test/langtools/tools/javadoc/generics/tparamTagOnMethod/Main.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4421066 - * @summary Verify the reading of type parameter tags on methods. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - for (ClassDoc cd : root.classes()) { - for (MethodDoc m : cd.methods()) { - tester.printMethod(m); - } - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/generics/tparamTagOnMethod/expected.out b/test/langtools/tools/javadoc/generics/tparamTagOnMethod/expected.out deleted file mode 100644 index 1d8c7ec9a55..00000000000 --- a/test/langtools/tools/javadoc/generics/tparamTagOnMethod/expected.out +++ /dev/null @@ -1,12 +0,0 @@ -method pkg1.A.m1(T, U) - signature: (T, U) - (T, U) - @param the kind of thing - @param the other kind of thing - @param t the thing itself - @param u the other thing - type parameters: - T - U - returns: - void diff --git a/test/langtools/tools/javadoc/generics/tparamTagOnMethod/pkg1/A.java b/test/langtools/tools/javadoc/generics/tparamTagOnMethod/pkg1/A.java deleted file mode 100644 index a289efa7bd2..00000000000 --- a/test/langtools/tools/javadoc/generics/tparamTagOnMethod/pkg1/A.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -public interface A { - /** - * @param the kind of thing - * @param the other kind of thing - * @param t the thing itself - * @param u the other thing - */ - public void m1(T t, U u); -} diff --git a/test/langtools/tools/javadoc/generics/tparamTagOnType/Main.java b/test/langtools/tools/javadoc/generics/tparamTagOnType/Main.java deleted file mode 100644 index 970782b1c51..00000000000 --- a/test/langtools/tools/javadoc/generics/tparamTagOnType/Main.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4421066 - * @summary Verify the reading of a type parameter tag on an interface. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - for (ClassDoc cd : root.classes()) { - tester.printClass(cd); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/generics/tparamTagOnType/expected.out b/test/langtools/tools/javadoc/generics/tparamTagOnType/expected.out deleted file mode 100644 index 1b4da64b8cc..00000000000 --- a/test/langtools/tools/javadoc/generics/tparamTagOnType/expected.out +++ /dev/null @@ -1,5 +0,0 @@ -interface pkg1.A - name: A / A / pkg1.A - type parameters: - T - @param the type parameter diff --git a/test/langtools/tools/javadoc/generics/tparamTagOnType/pkg1/A.java b/test/langtools/tools/javadoc/generics/tparamTagOnType/pkg1/A.java deleted file mode 100644 index 22f18693043..00000000000 --- a/test/langtools/tools/javadoc/generics/tparamTagOnType/pkg1/A.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -/** - * @param the type parameter - */ -public interface A { -} diff --git a/test/langtools/tools/javadoc/generics/wildcards/Main.java b/test/langtools/tools/javadoc/generics/wildcards/Main.java deleted file mode 100644 index a45db3da386..00000000000 --- a/test/langtools/tools/javadoc/generics/wildcards/Main.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4421066 - * @summary Verify the contents of the ClassDoc of a generic class. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - for (ClassDoc cd : root.classes()) { - tester.printClass(cd); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/generics/wildcards/expected.out b/test/langtools/tools/javadoc/generics/wildcards/expected.out deleted file mode 100644 index 686997b5a72..00000000000 --- a/test/langtools/tools/javadoc/generics/wildcards/expected.out +++ /dev/null @@ -1,16 +0,0 @@ -class pkg1.A - name: A / A / pkg1.A - type parameters: - T - superclass: - java.lang.Object - fields: - pkg1.A f1 - pkg1.A f2 - pkg1.A f3 - constructors: - A() - methods: - void m1(A) - void m2(A) - void m3(A) diff --git a/test/langtools/tools/javadoc/generics/wildcards/pkg1/A.java b/test/langtools/tools/javadoc/generics/wildcards/pkg1/A.java deleted file mode 100644 index 8c832ad5fef..00000000000 --- a/test/langtools/tools/javadoc/generics/wildcards/pkg1/A.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -public class A { - public A f1; - public A f2; - public A f3; - - public void m1(A p1) {} - public void m2(A p2) {} - public void m3(A p3) {} -} diff --git a/test/langtools/tools/javadoc/imports/I.java b/test/langtools/tools/javadoc/imports/I.java deleted file mode 100644 index 49768d4b916..00000000000 --- a/test/langtools/tools/javadoc/imports/I.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2004, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -// The following imported class is bogus, but should still be returned -// when inquired of. -import bo.o.o.o.Gus; - -public interface I { -} diff --git a/test/langtools/tools/javadoc/imports/MissingImport.java b/test/langtools/tools/javadoc/imports/MissingImport.java deleted file mode 100644 index 15fdc262931..00000000000 --- a/test/langtools/tools/javadoc/imports/MissingImport.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2004, 2015, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 5012972 - * @summary ClassDoc.getImportedClasses should return a class even if - * it's not in the classpath. - * @modules jdk.javadoc - */ - -import com.sun.javadoc.*; - - -public class MissingImport extends Doclet { - - public static void main(String[] args) { - String thisFile = "" + - new java.io.File(System.getProperty("test.src", "."), - "I.java"); - - if (com.sun.tools.javadoc.Main.execute( - "javadoc", - "MissingImport", - MissingImport.class.getClassLoader(), - new String[] {thisFile}) != 0) - throw new Error("Javadoc encountered warnings or errors."); - } - - /* - * The world's simplest doclet. - */ - public static boolean start(RootDoc root) { - ClassDoc c = root.classNamed("I"); - ClassDoc[] imps = c.importedClasses(); - if (imps.length == 0 || - !imps[0].qualifiedName().equals("bo.o.o.o.Gus")) { - throw new Error("Import bo.o.o.o.Gus not found"); - } - return true; - } -} diff --git a/test/langtools/tools/javadoc/lib/OldToolTester.java b/test/langtools/tools/javadoc/lib/OldToolTester.java deleted file mode 100644 index 98bdda499ec..00000000000 --- a/test/langtools/tools/javadoc/lib/OldToolTester.java +++ /dev/null @@ -1,338 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * A utility used to invoke and test the javadoc tool. - * - * @author Scott Seligman - */ - - -import java.io.*; -import java.util.*; -import com.sun.javadoc.*; - - -public class OldToolTester { - - protected final String TEST_SRC = System.getProperty("test.src", "."); - protected final String TEST_CLASSES = System.getProperty("test.classes", - "."); - private final String DEFAULT_ARGS[] = { - "-sourcepath", TEST_SRC, - }; - - private final File outputFile = new File(TEST_CLASSES, "testrun.out"); - private final File expectedOutputFile = new File(TEST_SRC, "expected.out"); -// private final File bootstrapMarkerFile = new File("bootstrap"); - - // True if we should "set expectations" by writing the expected output file - // rather than reading it and comparing. -// private final boolean bootstrap = bootstrapMarkerFile.isFile(); - - private String docletName; - private String[] args; - private Writer out = null; - - - /* - * Individual tests can extend this to create generics-aware doclets. - */ - public static abstract class Doclet extends com.sun.javadoc.Doclet { - public static LanguageVersion languageVersion() { - return LanguageVersion.JAVA_1_5; - } - } - - - public OldToolTester(String docletName) { - this(docletName, new String[0]); - } - - public OldToolTester(String docletName, String... additionalArgs) { - this.docletName = docletName; - - int len = DEFAULT_ARGS.length + additionalArgs.length; - args = new String[len]; - System.arraycopy(DEFAULT_ARGS, 0, args, 0, DEFAULT_ARGS.length); - System.arraycopy(additionalArgs, 0, args, DEFAULT_ARGS.length, - additionalArgs.length); - - try { - out = new BufferedWriter(new FileWriter(outputFile)); - } catch (IOException e) { - throw new Error("Could not open output file " + outputFile); - } - } - - public void run() throws IOException { - try { - if (com.sun.tools.javadoc.Main.execute("javadoc", - docletName, - getClass().getClassLoader(), - args) != 0) { - throw new Error("Javadoc errors encountered."); - } - System.out.println("--> Output written to " + outputFile); - } finally { - out.close(); - } - } - - /* - * Compare output of test run to expected output. - * Throw an Error if they don't match. - */ - public void verify() throws IOException { - BufferedReader thisRun = - new BufferedReader(new FileReader(outputFile)); - BufferedReader expected = - new BufferedReader(new FileReader(expectedOutputFile)); - - for (int lineNum = 1; true; lineNum++) { - String line1 = thisRun.readLine(); - String line2 = expected.readLine(); - if (line1 == null && line2 == null) { - return; // EOF with all lines matching - } - if (line1 == null || !line1.equals(line2)) { - throw new Error(outputFile + ":" + lineNum + - ": output doesn't match"); - } - } - } - - - public void println(Object o) throws IOException { - prln(0, o); - } - - public void println() throws IOException { - prln(); - } - - public void printPackage(PackageDoc p) throws IOException { - prPackage(0, p); - } - - public void printClass(ClassDoc cd) throws IOException { - if (cd.isAnnotationType()) - printAnnotationType((AnnotationTypeDoc)cd); - else - prClass(0, cd); - } - - public void printAnnotationType(AnnotationTypeDoc at) throws IOException { - prAnnotationType(0, at); - } - - public void printField(FieldDoc f) throws IOException { - prField(0, f); - } - - public void printParameter(Parameter p) throws IOException { - prParameter(0, p); - } - - public void printMethod(MethodDoc m) throws IOException { - prln(0, "method " + m); - prMethod(0, m); - } - - public void printAnnotationTypeElement(AnnotationTypeElementDoc e) - throws IOException { - prln(0, "element " + e); - prMethod(0, e); - } - - public void printConstructor(ConstructorDoc c) throws IOException { - prln(0, "constructor " + c); - prExecutable(0, c); - } - - - private void prPackage(int off, PackageDoc p) throws IOException { - prln(off, "package " + p); - prAnnotations(off + 2, p.annotations()); - } - - private void prClass(int off, ClassDoc cd) throws IOException { - prln(off, - (cd.isInterface() ? "interface" : cd.isEnum() ? "enum" : "class") - + " " + cd); - prln(off + 2, "name: " + cd.simpleTypeName() + " / " + - cd.typeName() + " / " + cd.qualifiedTypeName()); - prAnnotations(off + 2, cd.annotations()); - prLabel(off + 2, "type parameters"); - for (Type t : cd.typeParameters()) - prln(off + 4, t); - prParamTags(off + 2, cd.typeParamTags()); - prLabel(off + 2, "nested in"); - prln(off + 4, cd.containingClass()); - prLabel(off + 2, "superclass"); - prln(off + 4, cd.superclassType()); - prLabel(off + 2, "interfaces"); - Type[] ts = cd.interfaceTypes(); - Arrays.sort(ts); - for (Type t : ts) - prln(off + 4, t); - prLabel(off + 2, "enum constants"); - for (FieldDoc f : cd.enumConstants()) - prln(off + 4, f.name()); - prLabel(off + 2, "fields"); - for (FieldDoc f : cd.fields()) - prln(off + 4, f.type() + " " + f.name()); - prLabel(off + 2, "constructors"); - for (ConstructorDoc c : cd.constructors()) - prln(off + 4, c.name() + c.flatSignature()); - prLabel(off + 2, "methods"); - for (MethodDoc m : cd.methods()) - prln(off + 4, typeUseString(m.returnType()) + " " + - m.name() + m.flatSignature()); - } - - private void prAnnotationType(int off, AnnotationTypeDoc at) - throws IOException { - prln(off, "@interface " + at); - prAnnotations(off + 2, at.annotations()); - prLabel(off + 2, "elements"); - for (AnnotationTypeElementDoc e : at.elements()) { - String def = (e.defaultValue() == null) - ? "" - : " default " + e.defaultValue(); - prln(off + 4, typeUseString(e.returnType()) + " " + e.name() + - e.flatSignature() + def); - } - } - - private void prField(int off, FieldDoc f) throws IOException { - prln(off, "field " + typeUseString(f.type()) + " " + f.name()); - prAnnotations(off + 2, f.annotations()); - } - - private void prParameter(int off, Parameter p) throws IOException { - prln(off, "parameter " + p); - prAnnotations(off + 2, p.annotations()); - } - - private void prMethod(int off, MethodDoc m) throws IOException { - prExecutable(off, m); - prLabel(off + 2, "returns"); - prln(off + 4, typeUseString(m.returnType())); - prLabel(off + 2, "overridden type"); - prln(off + 4, m.overriddenType()); - } - - private void prExecutable(int off, ExecutableMemberDoc m) - throws IOException { - if (!m.isAnnotationTypeElement()) { - prln(off + 2, "signature: " + m.flatSignature()); - prln(off + 2, " " + m.signature()); - } - prAnnotations(off + 2, m.annotations()); - prParamTags(off + 2, m.typeParamTags()); - prParamTags(off + 2, m.paramTags()); - prLabel(off + 2, "type parameters"); - for (Type t : m.typeParameters()) - prln(off + 4, t); - prLabel(off + 2, "throws"); - Type[] ts = m.thrownExceptionTypes(); - Arrays.sort(ts); - for (Type t : ts) - prln(off + 4, t); - } - - private void prAnnotations(int off, AnnotationDesc[] as) - throws IOException { - prLabel(off, "annotations"); - for (AnnotationDesc a : as) - prln(off + 2, a.toString()); - } - - private void prParamTags(int off, ParamTag tags[]) throws IOException { - for (ParamTag tag : tags) - prParamTag(off, tag); - } - - private void prParamTag(int off, ParamTag tag) throws IOException { - String name = tag.parameterName(); - if (tag.isTypeParameter()) name = "<" + name + ">"; - prln(off, "@param " + name + " " + tag.parameterComment()); - } - - - private String typeUseString(Type t) { - return (t instanceof ClassDoc || t instanceof TypeVariable) - ? t.typeName() - : t.toString(); - } - - - // Labels queued for possible printing. Innermost is first in list. - List labels = new ArrayList(); - - // Print label if its section is nonempty. - void prLabel(int off, String s) { - while (!labels.isEmpty() && labels.get(0).off >= off) - labels.remove(0); - labels.add(0, new Line(off, s)); - } - - // Print queued labels with offsets less than "off". - void popLabels(int off) throws IOException { - while (!labels.isEmpty()) { - Line label = labels.remove(0); - if (label.off < off) - prln(label.off, label.o + ":"); - } - } - - // Print "o" at given offset. - void pr(int off, Object o) throws IOException { - popLabels(off); - for (int i = 0; i < off; i++) - out.write(' '); - if (o != null) - out.write(o.toString()); - } - - // Print "o" (if non-null) at given offset, then newline. - void prln(int off, Object o) throws IOException { - if (o != null) { - pr(off, o); - prln(); - } - } - - // Print newline. - void prln() throws IOException { - out.write('\n'); // don't want platform-dependent separator - } - - - static class Line { - int off; - Object o; - Line(int off, Object o) { this.off = off; this.o = o; } - } -} diff --git a/test/langtools/tools/javadoc/lib/ToyDoclet.java b/test/langtools/tools/javadoc/lib/ToyDoclet.java deleted file mode 100644 index 66457cfac7f..00000000000 --- a/test/langtools/tools/javadoc/lib/ToyDoclet.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.util.Arrays; - -import com.sun.javadoc.ClassDoc; -import com.sun.javadoc.PackageDoc; -import com.sun.javadoc.ProgramElementDoc; -import com.sun.javadoc.RootDoc; - -@SuppressWarnings("deprecation") -public class ToyDoclet { - - public static boolean start(RootDoc root) { - String whoami = "I am a toy doclet"; - root.printNotice("Notice: " + whoami); - boolean status = false; - for (ClassDoc cls : root.classes()) { - if (!status) status = true; - root.printNotice("Classes: " + cls); - printClassMembers(root, cls); - } - for (ClassDoc cls : root.specifiedClasses()) { - if (!status) status = true; - root.printNotice("Specified-classes: " + cls); - printClassMembers(root, cls); - } - for (PackageDoc pkg : root.specifiedPackages()) { - if (!status) status = true; - root.printNotice("Specified-packages: " + pkg); - } - return status; - } - - static void printClassMembers(RootDoc root, ClassDoc cls) { - root.printNotice("Members for: " + cls); - root.printNotice(" extends " + Arrays.asList(cls.superclass())); - root.printNotice(" Fields: "); - printMembers(root, cls.fields()); - root.printNotice(" Constructor: "); - printMembers(root, cls.constructors()); - root.printNotice(" Method: "); - printMembers(root, cls.methods()); - if (cls.superclass() != null && !cls.superclassType().toString().equals("java.lang.Object")) - printClassMembers(root, cls.superclass()); - } - - static void printMembers(RootDoc root, ProgramElementDoc[] pgmDocs) { - for (ProgramElementDoc pgmDoc : pgmDocs) { - root.printNotice(" " + pgmDoc + ", Comments: " + pgmDoc.getRawCommentText()); - } - } - - public static int optionLength(String option) { - System.out.println("option: " + option); - return 0; // all options are unsupported - } -} diff --git a/test/langtools/tools/javadoc/nestedClass/NestedClass.java b/test/langtools/tools/javadoc/nestedClass/NestedClass.java deleted file mode 100644 index 2fb8f26b314..00000000000 --- a/test/langtools/tools/javadoc/nestedClass/NestedClass.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002, 2015, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4694497 - * @summary BDoclet API: Bad ClassDoc for nested classes when built from .class files - * @author gafter - * @modules jdk.javadoc - * @compile NestedClass.java NestedClassB.java - * @run main NestedClass - */ - -import com.sun.javadoc.*; -import java.util.*; - -public class NestedClass extends Doclet -{ - public NestedClassB b; - - public static void main(String[] args) { - if (com.sun.tools.javadoc.Main. - execute("javadoc", "NestedClass", NestedClass.class.getClassLoader(), - new String[] {System.getProperty("test.src", ".") + - java.io.File.separatorChar + - "NestedClass.java"}) - != 0) - throw new Error(); - } - - public static boolean start(com.sun.javadoc.RootDoc root) { - ClassDoc[] classes = root.classes(); - if (classes.length != 1) - throw new Error("1 " + Arrays.asList(classes)); - ClassDoc self = classes[0]; - FieldDoc B = self.fields()[0]; - ClassDoc[] Binner = B.type().asClassDoc().innerClasses(); - return Binner.length == 1; - } -} diff --git a/test/langtools/tools/javadoc/nestedClass/NestedClassB.java b/test/langtools/tools/javadoc/nestedClass/NestedClassB.java deleted file mode 100644 index 5f1d73a7890..00000000000 --- a/test/langtools/tools/javadoc/nestedClass/NestedClassB.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2002, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -public class NestedClassB { - public static class Inner {} -} diff --git a/test/langtools/tools/javadoc/nonConstExprs/Test.java b/test/langtools/tools/javadoc/nonConstExprs/Test.java deleted file mode 100644 index fbc5062639d..00000000000 --- a/test/langtools/tools/javadoc/nonConstExprs/Test.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2013, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8010310 - * @summary Error processing sources with -private - * @modules jdk.javadoc - */ - -import java.io.File; - -public class Test { - public static void main(String... args) throws Exception { - File testSrc = new File(System.getProperty("test.src")); - String[] jdoc_args = { - new File(testSrc, Test.class.getSimpleName() + ".java").getPath() - }; - int rc = com.sun.tools.javadoc.Main.execute(jdoc_args); - if (rc != 0) - throw new Exception("unexpected return code from javadoc: " + rc); - } - - static int array[] = { 1, 2, 3}; - static int method(int p) { return p; } - static int value = 0; - - public int not_static_not_final = 1; - public static int static_not_final = 2; - public final int not_static_final = 3; - public static final int static_final = 4; - - public static final int array_index = array[0]; - public static final int method_call = method(0); - public static final int inner_class = new Test() { }.method(0); - public static final int new_class = new Test().method(0); - public static final int pre_inc = ++value; - public static final int pre_dec = --value; - public static final int post_inc = value++; - public static final int post_dec = value--; -} - diff --git a/test/langtools/tools/javadoc/outputRedirect/Test.java b/test/langtools/tools/javadoc/outputRedirect/Test.java deleted file mode 100644 index ba03899d4c6..00000000000 --- a/test/langtools/tools/javadoc/outputRedirect/Test.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2002, 2015, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* @test - * @bug 4587487 - * @summary com.sun.tools.javadoc.Main.execute ignores PrintWriters - * @author gafter - * @modules jdk.javadoc - * @compile p/OutputRedirect.java - * @run main p.OutputRedirect - */ - -// jtreg description-only file diff --git a/test/langtools/tools/javadoc/outputRedirect/p/OutputRedirect.java b/test/langtools/tools/javadoc/outputRedirect/p/OutputRedirect.java deleted file mode 100644 index 9f37ddeb55b..00000000000 --- a/test/langtools/tools/javadoc/outputRedirect/p/OutputRedirect.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2002, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package p; - -import java.io.*; -import com.sun.tools.javadoc.Main; - -public class OutputRedirect { - - public static void main(String[] args) { - PrintStream originalOutput = System.out; - try { - doTest(); - } finally { - // restore things - System.setOut(originalOutput); - } - } - - static void doTest() { - ByteArrayOutputStream redirectedOutput = new ByteArrayOutputStream(); - PrintStream originalOutput = System.out; - - // redirect System.out to a buffer - System.setOut(new PrintStream(redirectedOutput)); - - PrintWriter sink = new PrintWriter(new ByteArrayOutputStream()); - - // execute javadoc - int result = Main.execute("javadoc", sink, sink, sink, - "com.sun.tools.doclets.standard.Standard", - new String[] {"p"} - ); - - - // test whether javadoc did any output to System.out - if (redirectedOutput.toByteArray().length > 0) { - originalOutput.println("Test failed; here's what javadoc wrote on its standard output:"); - originalOutput.println(redirectedOutput.toString()); - throw new Error("javadoc output wasn\'t properly redirected"); - } else if (result != 0) { - throw new Error("javadoc run failed"); - } else { - originalOutput.println("OK, good"); - } - } -} diff --git a/test/langtools/tools/javadoc/parser/7091528/T7091528.java b/test/langtools/tools/javadoc/parser/7091528/T7091528.java deleted file mode 100644 index 41d55d9559c..00000000000 --- a/test/langtools/tools/javadoc/parser/7091528/T7091528.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2009, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 7091528 8029145 8037484 - * @summary ensures javadoc parses unique source files and ignores all class files - * @modules jdk.javadoc/com.sun.tools.doclets.standard - * @library /tools/javadoc/lib - * @build ToyDoclet - * @compile p/C1.java p/q/C2.java - * @run main T7091528 - */ - -import java.io.File; -import java.io.PrintWriter; -import java.io.StringWriter; - -public class T7091528 { - public static void main(String... args) { - new T7091528().run(); - } - void run() { - File testSrc = new File(System.getProperty("test.src")); - File testClasses = new File(System.getProperty("test.classes")); - // 7091528, tests if class files are being ignored - runTest( - "-sourcepath", testClasses + File.pathSeparator + testSrc, - "-subpackages", - "p"); - // 8029145, tests if unique source files are parsed - runTest( - "-sourcepath", testSrc.getAbsolutePath(), - "-subpackages", - "p:p.q"); - File testPkgDir = new File(testSrc, "p"); - File testFile = new File(testPkgDir, "C3.java"); - runTest( - "-sourcepath", testSrc.getAbsolutePath(), - testFile.getAbsolutePath(), - "p"); - runTest( - "-classpath", testSrc.getAbsolutePath(), - testFile.getAbsolutePath(), - "p"); - - } - void runTest(String... args) { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - int rc = com.sun.tools.javadoc.Main.execute("example", pw, pw, pw, - "ToyDoclet", getClass().getClassLoader(), args); - pw.close(); - - String out = sw.toString(); - if (!out.isEmpty()) { - System.err.println(out); - } - - if (rc != 0) - throw new Error("javadoc failed: exit code = " + rc); - - if (out.matches("(?s).*p/[^ ]+\\.class.*")) - throw new Error("reading .class files"); - } -} diff --git a/test/langtools/tools/javadoc/parser/7091528/p/C1.java b/test/langtools/tools/javadoc/parser/7091528/p/C1.java deleted file mode 100644 index 7d8ad26643f..00000000000 --- a/test/langtools/tools/javadoc/parser/7091528/p/C1.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2011, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package p1; - -/** This is class C1. */ -public class C1 { } - diff --git a/test/langtools/tools/javadoc/parser/7091528/p/C3.java b/test/langtools/tools/javadoc/parser/7091528/p/C3.java deleted file mode 100644 index 4653b5a6ce0..00000000000 --- a/test/langtools/tools/javadoc/parser/7091528/p/C3.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2014, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** This is class C3, and no package for me please */ -public class C3 {} - diff --git a/test/langtools/tools/javadoc/parser/7091528/p/q/C2.java b/test/langtools/tools/javadoc/parser/7091528/p/q/C2.java deleted file mode 100644 index 91b8d96c2c7..00000000000 --- a/test/langtools/tools/javadoc/parser/7091528/p/q/C2.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2011, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package p.q; - -/** This is class p.q.C2. */ -public class C2 { } - diff --git a/test/langtools/tools/javadoc/sourceOnly/Test.java b/test/langtools/tools/javadoc/sourceOnly/Test.java deleted file mode 100644 index 3a32254ee8a..00000000000 --- a/test/langtools/tools/javadoc/sourceOnly/Test.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4548768 8034258 - * @summary Javadoc in JDK 1.4 uses classpath and not just source dir - * @author gafter - * @modules jdk.javadoc - * @compile p/SourceOnly.java p/NonSource.jasm - * @run main p.SourceOnly - */ - -// this file is just a dummy to get the javadoc started. -// -// NOTE: this test only seems to work in separate JVM mode for -// reasons having something to do with javing tools.jar -// on the classpath. Until that is sorted out, these tests -// must be run in separate VM mode. diff --git a/test/langtools/tools/javadoc/sourceOnly/p/NonSource.jasm b/test/langtools/tools/javadoc/sourceOnly/p/NonSource.jasm deleted file mode 100644 index 2a2be83d031..00000000000 --- a/test/langtools/tools/javadoc/sourceOnly/p/NonSource.jasm +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package p; - -super public class NonSource - version 46:0 -{ - public Method "":"()V" - stack 1 locals 1 - { - aload_0; - invokespecial Method java/lang/Object."":"()V"; - return; - } -} diff --git a/test/langtools/tools/javadoc/sourceOnly/p/SourceOnly.java b/test/langtools/tools/javadoc/sourceOnly/p/SourceOnly.java deleted file mode 100644 index 075fc79cb99..00000000000 --- a/test/langtools/tools/javadoc/sourceOnly/p/SourceOnly.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2008, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package p; - -/** Test that when running javadoc on a package, we only get - * documentation for those classes for which source was provided. - */ -public class SourceOnly extends com.sun.javadoc.Doclet { - NonSource dependency; // force a compilation error if not on classpath. - - public static void main(String[] args) { - // run javadoc on package p - int result = com.sun.tools.javadoc.Main. - execute("javadoc", "p.SourceOnly", SourceOnly.class.getClassLoader(), new String[] {"p"}); - if (result != 0) - throw new Error(); - } - - public static boolean start(com.sun.javadoc.RootDoc root) { - if (root.classes().length != 1) - throw new Error("wrong set of classes documented: " + java.util.Arrays.asList(root.classes())); - return true; - } -} diff --git a/test/langtools/tools/javadoc/sourceOption/SourceOption.java b/test/langtools/tools/javadoc/sourceOption/SourceOption.java deleted file mode 100644 index bcfa3f61d71..00000000000 --- a/test/langtools/tools/javadoc/sourceOption/SourceOption.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2006, 2018, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 6507179 - * @summary Ensure that "-source" option isn't ignored. - * @author Scott Seligman - * @modules jdk.javadoc - * @run main/fail SourceOption 7 - * @run main SourceOption 9 - * @run main SourceOption - */ - -/* - * In order to test whether or not the -source option is working - * correctly, this test tries to parse source code that contains - * a feature that is not available in at least one of the currently - * supported previous versions. - * - * Parsing such code should be expected to fail; if the action - * passes, that means the -source option is (incorrectly) ineffective. - * - * Additional actions are performed to ensure that the source - * provided is valid for the current release of the JDK. - * - * As support for older versions of the platform are dropped, the - * source code (currently p/LambdaConstructTest.java) will need to - * be updated with a more recent feature. - */ - -import com.sun.javadoc.*; - -public class SourceOption extends Doclet { - - public static void main(String[] args) { - String[] params; - if ((args == null) || (args.length==0)) { - params = new String[]{"p"}; - System.out.println("NOTE : -source not provided, default taken"); - } else { - params = new String[]{"-source", args[0], "p"}; - System.out.println("NOTE : -source will be: " + args[0]); - } - - if (com.sun.tools.javadoc.Main.execute( - "javadoc", - "SourceOption", - SourceOption.class.getClassLoader(), - params) != 0) - throw new Error("Javadoc encountered warnings or errors."); - - } - - public static boolean start(RootDoc root) { - root.classes(); // force parser into action - return true; - } -} diff --git a/test/langtools/tools/javadoc/sourceOption/p/LambdaConstructTest.java b/test/langtools/tools/javadoc/sourceOption/p/LambdaConstructTest.java deleted file mode 100644 index b88f5869a3f..00000000000 --- a/test/langtools/tools/javadoc/sourceOption/p/LambdaConstructTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2014, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -public class LambdaConstructTest { - public static void main(String[] args) { - - System.out.println("=== LambdaConstructTest ==="); - - // Lambda Runnable - Runnable lambda = () -> System.out.println("it's a Lambda world!"); - - // Run it! - lambda.run(); - - } -} - diff --git a/test/langtools/tools/javadoc/subpackageIgnore/SubpackageIgnore.java b/test/langtools/tools/javadoc/subpackageIgnore/SubpackageIgnore.java deleted file mode 100644 index 2e766504e4d..00000000000 --- a/test/langtools/tools/javadoc/subpackageIgnore/SubpackageIgnore.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2003, 2015, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4773013 - * @summary When hunting subpackages, silently ignore any directory name that - * can't be part of a subpackage. - * @modules jdk.javadoc - */ - -import com.sun.javadoc.*; - -public class SubpackageIgnore extends Doclet { - - public static void main(String[] args) { - if (com.sun.tools.javadoc.Main.execute( - "javadoc", - "SubpackageIgnore", - SubpackageIgnore.class.getClassLoader(), - new String[] {"-Xwerror", - "-sourcepath", - System.getProperty("test.src", "."), - "-subpackages", - "pkg1"}) != 0) - throw new Error("Javadoc encountered warnings or errors."); - } - - /* - * The world's simplest doclet. - */ - public static boolean start(RootDoc root) { - return true; - } -} diff --git a/test/langtools/tools/javadoc/subpackageIgnore/pkg1/not-subpkg/SomeJavaFile.java b/test/langtools/tools/javadoc/subpackageIgnore/pkg1/not-subpkg/SomeJavaFile.java deleted file mode 100644 index 7d886ce8861..00000000000 --- a/test/langtools/tools/javadoc/subpackageIgnore/pkg1/not-subpkg/SomeJavaFile.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2003, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - diff --git a/test/langtools/tools/javadoc/varArgs/Main.java b/test/langtools/tools/javadoc/varArgs/Main.java deleted file mode 100644 index e934341501b..00000000000 --- a/test/langtools/tools/javadoc/varArgs/Main.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4421066 5006659 - * @summary Verify the contents of a ClassDoc containing a varArgs method. - * Verify that see/link tags can use "..." notation. - * @library ../lib - * @modules jdk.javadoc - * @compile ../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = - new OldToolTester("Main", "-Xwerror", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - for (ClassDoc cd : root.classes()) { - tester.printClass(cd); - - for (SeeTag tag : cd.seeTags()) { - if (tag.referencedMember() != cd.methods()[0]) { - throw new Error("5006659: @see tag meets varArgs"); - } - } - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/varArgs/expected.out b/test/langtools/tools/javadoc/varArgs/expected.out deleted file mode 100644 index 705bb0c3a30..00000000000 --- a/test/langtools/tools/javadoc/varArgs/expected.out +++ /dev/null @@ -1,4 +0,0 @@ -interface pkg1.A - name: A / A / pkg1.A - methods: - void m1(int, String...) diff --git a/test/langtools/tools/javadoc/varArgs/pkg1/A.java b/test/langtools/tools/javadoc/varArgs/pkg1/A.java deleted file mode 100644 index e456e3f6c6e..00000000000 --- a/test/langtools/tools/javadoc/varArgs/pkg1/A.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg1; - -/** - * Interface A. - * - * @see #m1(int, String[]) - * @see #m1(int, String...) - */ -public interface A { - void m1(int i, String... ss); -}