# HG changeset patch
# User jjg
# Date 1462837935 25200
# Node ID 42baa89d2156c657a4fb657413be5bb29719c571
# Parent 7c04fcb12bd4a31570a238e663fa846dfa5ec3b8
8075703: jdk.javadoc module exports com.sun.tools.javadoc package which contains a lot of internal API.
Reviewed-by: ksrini
diff -r 7c04fcb12bd4 -r 42baa89d2156 langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Wed Jul 05 21:41:01 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Mon May 09 16:52:15 2016 -0700
@@ -28,7 +28,7 @@
import java.util.*;
import com.sun.javadoc.*;
-import com.sun.tools.javadoc.RootDocImpl;
+import com.sun.tools.javadoc.main.RootDocImpl;
import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.builders.*;
diff -r 7c04fcb12bd4 -r 42baa89d2156 langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java Wed Jul 05 21:41:01 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java Mon May 09 16:52:15 2016 -0700
@@ -40,7 +40,7 @@
import com.sun.tools.javac.file.JavacFileManager;
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.StringUtils;
-import com.sun.tools.javadoc.RootDocImpl;
+import com.sun.tools.javadoc.main.RootDocImpl;
/**
* Configure the output based on the command line options.
diff -r 7c04fcb12bd4 -r 42baa89d2156 langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java Wed Jul 05 21:41:01 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java Mon May 09 16:52:15 2016 -0700
@@ -149,8 +149,8 @@
return;
Reader r;
// temp hack until we can update SourcePosition API.
- if (sp instanceof com.sun.tools.javadoc.SourcePositionImpl) {
- FileObject fo = ((com.sun.tools.javadoc.SourcePositionImpl) sp).fileObject();
+ if (sp instanceof com.sun.tools.javadoc.main.SourcePositionImpl) {
+ FileObject fo = ((com.sun.tools.javadoc.main.SourcePositionImpl) sp).fileObject();
if (fo == null)
return;
r = fo.openReader(true);
diff -r 7c04fcb12bd4 -r 42baa89d2156 langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AbstractTypeImpl.java
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AbstractTypeImpl.java Wed Jul 05 21:41:01 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2003, 2013, 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 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
- */
-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 -r 7c04fcb12bd4 -r 42baa89d2156 langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AnnotatedTypeImpl.java
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AnnotatedTypeImpl.java Wed Jul 05 21:41:01 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 2003, 2013, 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 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
- */
-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 extends TypeCompound> 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 -r 7c04fcb12bd4 -r 42baa89d2156 langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AnnotationDescImpl.java
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AnnotationDescImpl.java Wed Jul 05 21:41:01 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-/*
- * Copyright (c) 2003, 2013, 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 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
- */
-
-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 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
- */
-
-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 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
- */
-
-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 -r 7c04fcb12bd4 -r 42baa89d2156 langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AnnotationValueImpl.java
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AnnotationValueImpl.java Wed Jul 05 21:41:01 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,176 +0,0 @@
-/*
- * Copyright (c) 2003, 2013, 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 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
- */
-
-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:
- * 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)
- */
-
-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.
- *
- * 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.equals("") ? "" : ".") + 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
- *
- *
- * Return either a list of default fields documented by
- *
- * 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 -r 7c04fcb12bd4 -r 42baa89d2156 langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Comment.java
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Comment.java Wed Jul 05 21:41:01 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,460 +0,0 @@
-/*
- * Copyright (c) 1997, 2013, 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.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)
- */
-class Comment {
-
- /**
- * sorted comments with different tags.
- */
- private final ListBuffer 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)
- */
-
-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 -r 7c04fcb12bd4 -r 42baa89d2156 langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocEnv.java
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocEnv.java Wed Jul 05 21:41:01 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,869 +0,0 @@
-/*
- * Copyright (c) 2000, 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. 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.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)
- */
-public class DocEnv {
- protected static final Context.Key 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)
- */
-public abstract class DocImpl implements Doc, Comparable
- * {@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 -r 7c04fcb12bd4 -r 42baa89d2156 langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AnnotationTypeDocImpl.java
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AnnotationTypeDocImpl.java Wed Jul 05 21:41:01 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2003, 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. 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 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.
- *
- *
- */
- 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 = "String
- * Type
(representing a class literal)
- * FieldDoc
(representing an enum constant)
- * AnnotationDesc
- * AnnotationValue[]
- *
- * 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.
- * 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() {
- ListBufferjava.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.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.
- *
- * 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 } 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 -r 7c04fcb12bd4 -r 42baa89d2156 langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ConstructorDocImpl.java
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ConstructorDocImpl.java Wed Jul 05 21:41:01 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 1997, 2013, 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 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.
- *
- *