--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/source/util/DocTreePath.java Wed May 08 23:54:45 2013 -0700
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2006, 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.source.util;
+
+import com.sun.source.doctree.DocCommentTree;
+import com.sun.source.doctree.DocTree;
+import java.util.Iterator;
+
+/**
+ * A path of tree nodes, typically used to represent the sequence of ancestor
+ * nodes of a tree node up to the top level DocCommentTree node.
+ *
+ * @since 1.8
+ */
+@jdk.Supported
+public class DocTreePath implements Iterable<DocTree> {
+ /**
+ * Gets a documentation tree path for a tree node within a compilation unit.
+ * @return null if the node is not found
+ */
+ public static DocTreePath getPath(TreePath treePath, DocCommentTree doc, DocTree target) {
+ return getPath(new DocTreePath(treePath, doc), target);
+ }
+
+ /**
+ * Gets a documentation tree path for a tree node within a subtree identified by a DocTreePath object.
+ * @return null if the node is not found
+ */
+ public static DocTreePath getPath(DocTreePath path, DocTree target) {
+ path.getClass();
+ target.getClass();
+
+ class Result extends Error {
+ static final long serialVersionUID = -5942088234594905625L;
+ DocTreePath path;
+ Result(DocTreePath path) {
+ this.path = path;
+ }
+ }
+
+ class PathFinder extends DocTreePathScanner<DocTreePath,DocTree> {
+ public DocTreePath scan(DocTree tree, DocTree target) {
+ if (tree == target) {
+ throw new Result(new DocTreePath(getCurrentPath(), target));
+ }
+ return super.scan(tree, target);
+ }
+ }
+
+ if (path.getLeaf() == target) {
+ return path;
+ }
+
+ try {
+ new PathFinder().scan(path, target);
+ } catch (Result result) {
+ return result.path;
+ }
+ return null;
+ }
+
+ /**
+ * Creates a DocTreePath for a root node.
+ *
+ * @param treePath the TreePath from which the root node was created.
+ * @param t the DocCommentTree to create the path for.
+ */
+ public DocTreePath(TreePath treePath, DocCommentTree t) {
+ treePath.getClass();
+ t.getClass();
+
+ this.treePath = treePath;
+ this.docComment = t;
+ this.parent = null;
+ this.leaf = t;
+ }
+
+ /**
+ * Creates a DocTreePath for a child node.
+ */
+ public DocTreePath(DocTreePath p, DocTree t) {
+ if (t.getKind() == DocTree.Kind.DOC_COMMENT) {
+ throw new IllegalArgumentException("Use DocTreePath(TreePath, DocCommentTree) to construct DocTreePath for a DocCommentTree.");
+ } else {
+ treePath = p.treePath;
+ docComment = p.docComment;
+ parent = p;
+ }
+ leaf = t;
+ }
+
+ /**
+ * Get the TreePath associated with this path.
+ * @return TreePath for this DocTreePath
+ */
+ public TreePath getTreePath() {
+ return treePath;
+ }
+
+ /**
+ * Get the DocCommentTree associated with this path.
+ * @return DocCommentTree for this DocTreePath
+ */
+ public DocCommentTree getDocComment() {
+ return docComment;
+ }
+
+ /**
+ * Get the leaf node for this path.
+ * @return DocTree for this DocTreePath
+ */
+ public DocTree getLeaf() {
+ return leaf;
+ }
+
+ /**
+ * Get the path for the enclosing node, or null if there is no enclosing node.
+ * @return DocTreePath of parent
+ */
+ public DocTreePath getParentPath() {
+ return parent;
+ }
+
+ public Iterator<DocTree> iterator() {
+ return new Iterator<DocTree>() {
+ public boolean hasNext() {
+ return next != null;
+ }
+
+ public DocTree next() {
+ DocTree t = next.leaf;
+ next = next.parent;
+ return t;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ private DocTreePath next = DocTreePath.this;
+ };
+ }
+
+ private final TreePath treePath;
+ private final DocCommentTree docComment;
+ private final DocTree leaf;
+ private final DocTreePath parent;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/source/util/DocTreePathScanner.java Wed May 08 23:54:45 2013 -0700
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2006, 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.source.util;
+
+import com.sun.source.doctree.DocTree;
+
+/**
+ * A DocTreeVisitor that visits all the child tree nodes, and provides
+ * support for maintaining a path for the parent nodes.
+ * To visit nodes of a particular type, just override the
+ * corresponding visitorXYZ method.
+ * Inside your method, call super.visitXYZ to visit descendant
+ * nodes.
+ *
+ * @since 1.8
+ */
+@jdk.Supported
+public class DocTreePathScanner<R, P> extends DocTreeScanner<R, P> {
+ /**
+ * Scan a tree from a position identified by a TreePath.
+ */
+ public R scan(DocTreePath path, P p) {
+ this.path = path;
+ try {
+ return path.getLeaf().accept(this, p);
+ } finally {
+ this.path = null;
+ }
+ }
+
+ /**
+ * Scan a single node.
+ * The current path is updated for the duration of the scan.
+ */
+ @Override
+ public R scan(DocTree tree, P p) {
+ if (tree == null)
+ return null;
+
+ DocTreePath prev = path;
+ path = new DocTreePath(path, tree);
+ try {
+ return tree.accept(this, p);
+ } finally {
+ path = prev;
+ }
+ }
+
+ /**
+ * Get the current path for the node, as built up by the currently
+ * active set of scan calls.
+ */
+ public DocTreePath getCurrentPath() {
+ return path;
+ }
+
+ private DocTreePath path;
+}
--- a/langtools/src/share/classes/com/sun/source/util/DocTrees.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/com/sun/source/util/DocTrees.java Wed May 08 23:54:45 2013 -0700
@@ -67,10 +67,10 @@
public abstract DocCommentTree getDocCommentTree(TreePath path);
/**
- * Gets the language model element referred to by a ReferenceTree that
- * appears on the declaration identified by the given path.
+ * Gets the language model element referred to by the leaf node of the given
+ * {@link DocTreePath}, or null if unknown.
*/
- public abstract Element getElement(TreePath path, ReferenceTree reference);
+ public abstract Element getElement(DocTreePath path);
public abstract DocSourcePositions getSourcePositions();
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Wed May 08 23:54:45 2013 -0700
@@ -1497,7 +1497,7 @@
* @param htmltree the content tree to which the comment will be added
*/
public void addInlineComment(Doc doc, Tag tag, Content htmltree) {
- addCommentTags(doc, tag.inlineTags(), false, false, htmltree);
+ addCommentTags(doc, tag, tag.inlineTags(), false, false, htmltree);
}
/**
@@ -1557,11 +1557,26 @@
*/
private void addCommentTags(Doc doc, Tag[] tags, boolean depr,
boolean first, Content htmltree) {
+ addCommentTags(doc, null, tags, depr, first, htmltree);
+ }
+
+ /**
+ * Adds the comment tags.
+ *
+ * @param doc the doc for which the comment tags will be generated
+ * @param holderTag the block tag context for the inline tags
+ * @param tags the first sentence tags for the doc
+ * @param depr true if it is deprecated
+ * @param first true if the first sentence tags should be added
+ * @param htmltree the documentation tree to which the comment tags will be added
+ */
+ private void addCommentTags(Doc doc, Tag holderTag, Tag[] tags, boolean depr,
+ boolean first, Content htmltree) {
if(configuration.nocomment){
return;
}
Content div;
- Content result = new RawHtml(commentTagsToString(null, doc, tags, first));
+ Content result = new RawHtml(commentTagsToString(holderTag, doc, tags, first));
if (depr) {
Content italic = HtmlTree.I(result);
div = HtmlTree.DIV(HtmlStyle.block, italic);
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/InheritDocTaglet.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/InheritDocTaglet.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -60,8 +60,8 @@
/**
* Will return false because this inline tag may
- * only appear in Methods.
- * @return false since this is not a method.
+ * not appear in Fields.
+ * @return false
*/
public boolean inField() {
return false;
@@ -69,8 +69,8 @@
/**
* Will return false because this inline tag may
- * only appear in Methods.
- * @return false since this is not a method.
+ * not appear in Constructors.
+ * @return false
*/
public boolean inConstructor() {
return false;
@@ -78,8 +78,8 @@
/**
* Will return false because this inline tag may
- * only appear in Methods.
- * @return false since this is not a method.
+ * not appear in Overview.
+ * @return false
*/
public boolean inOverview() {
return false;
@@ -87,20 +87,20 @@
/**
* Will return false because this inline tag may
- * only appear in Methods.
- * @return false since this is not a method.
+ * not appear in Packages.
+ * @return false
*/
public boolean inPackage() {
return false;
}
/**
- * Will return false because this inline tag may
- * only appear in Methods.
- * @return false since this is not a method.
+ * Will return true because this inline tag may
+ * appear in Type (Class).
+ * @return true
*/
public boolean inType() {
- return false;
+ return true;
}
/**
@@ -109,12 +109,13 @@
* of @inheritDoc with documentation from it's superclass or superinterface.
*
* @param writer the writer that is writing the output.
- * @param md the {@link MethodDoc} that we are documenting.
- * @param holderTag the tag that holds the inheritDoc tag.
+ * @param ped the {@link ProgramElementDoc} that we are documenting.
+ * @param holderTag the tag that holds the inheritDoc tag or null for type
+ * (class) docs.
* @param isFirstSentence true if we only want to inherit the first sentence.
*/
private TagletOutput retrieveInheritedDocumentation(TagletWriter writer,
- MethodDoc md, Tag holderTag, boolean isFirstSentence) {
+ ProgramElementDoc ped, Tag holderTag, boolean isFirstSentence) {
TagletOutput replacement = writer.getTagletOutputInstance();
Configuration configuration = writer.configuration();
@@ -122,20 +123,30 @@
null : configuration.tagletManager.getTaglet(holderTag.name());
if (inheritableTaglet != null &&
!(inheritableTaglet instanceof InheritableTaglet)) {
+ String message = ped.name() +
+ ((ped instanceof ExecutableMemberDoc)
+ ? ((ExecutableMemberDoc)ped).flatSignature()
+ : "");
//This tag does not support inheritence.
- configuration.message.warning(md.position(),
- "doclet.noInheritedDoc", md.name() + md.flatSignature());
+ configuration.message.warning(ped.position(),
+ "doclet.noInheritedDoc", message);
}
DocFinder.Output inheritedDoc =
- DocFinder.search(new DocFinder.Input(md,
+ DocFinder.search(new DocFinder.Input(ped,
(InheritableTaglet) inheritableTaglet, holderTag,
isFirstSentence, true));
- if (inheritedDoc.isValidInheritDocTag == false) {
- configuration.message.warning(md.position(),
- "doclet.noInheritedDoc", md.name() + md.flatSignature());
- } else if (inheritedDoc.inlineTags.length > 0) {
- replacement = writer.commentTagsToOutput(inheritedDoc.holderTag,
- inheritedDoc.holder, inheritedDoc.inlineTags, isFirstSentence);
+ if (inheritedDoc.isValidInheritDocTag) {
+ if (inheritedDoc.inlineTags.length > 0) {
+ replacement = writer.commentTagsToOutput(inheritedDoc.holderTag,
+ inheritedDoc.holder, inheritedDoc.inlineTags, isFirstSentence);
+ }
+ } else {
+ String message = ped.name() +
+ ((ped instanceof ExecutableMemberDoc)
+ ? ((ExecutableMemberDoc)ped).flatSignature()
+ : "");
+ configuration.message.warning(ped.position(),
+ "doclet.noInheritedDoc", message);
}
return replacement;
}
@@ -149,11 +160,11 @@
* @return the TagletOutput representation of this <code>Tag</code>.
*/
public TagletOutput getTagletOutput(Tag tag, TagletWriter tagletWriter) {
- if (! (tag.holder() instanceof MethodDoc)) {
+ if (! (tag.holder() instanceof ProgramElementDoc)) {
return tagletWriter.getOutputInstance();
}
return tag.name().equals("@inheritDoc") ?
- retrieveInheritedDocumentation(tagletWriter, (MethodDoc) tag.holder(), null, tagletWriter.isFirstSentence) :
- retrieveInheritedDocumentation(tagletWriter, (MethodDoc) tag.holder(), tag, tagletWriter.isFirstSentence);
+ retrieveInheritedDocumentation(tagletWriter, (ProgramElementDoc) tag.holder(), null, tagletWriter.isFirstSentence) :
+ retrieveInheritedDocumentation(tagletWriter, (ProgramElementDoc) tag.holder(), tag, tagletWriter.isFirstSentence);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -101,14 +101,14 @@
}
}
ParamTag[] tags = input.isTypeVariableParamTag ?
- input.method.typeParamTags() : input.method.paramTags();
+ ((MethodDoc)input.element).typeParamTags() : ((MethodDoc)input.element).paramTags();
Map<String, String> rankMap = getRankMap(input.isTypeVariableParamTag ?
- (Object[]) input.method.typeParameters() :
- (Object[]) input.method.parameters());
+ (Object[]) ((MethodDoc)input.element).typeParameters() :
+ (Object[]) ((MethodDoc)input.element).parameters());
for (int i = 0; i < tags.length; i++) {
if (rankMap.containsKey(tags[i].parameterName()) &&
rankMap.get(tags[i].parameterName()).equals((input.tagId))) {
- output.holder = input.method;
+ output.holder = input.element;
output.holderTag = tags[i];
output.inlineTags = input.isFirstSentence ?
tags[i].firstSentenceTags() : tags[i].inlineTags();
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ReturnTaglet.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ReturnTaglet.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -50,9 +50,9 @@
* {@inheritDoc}
*/
public void inherit(DocFinder.Input input, DocFinder.Output output) {
- Tag[] tags = input.method.tags("return");
+ Tag[] tags = input.element.tags("return");
if (tags.length > 0) {
- output.holder = input.method;
+ output.holder = input.element;
output.holderTag = tags[0];
output.inlineTags = input.isFirstSentence ?
tags[0].firstSentenceTags() : tags[0].inlineTags();
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/SeeTaglet.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/SeeTaglet.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -49,9 +49,9 @@
* {@inheritDoc}
*/
public void inherit(DocFinder.Input input, DocFinder.Output output) {
- Tag[] tags = input.method.seeTags();
+ Tag[] tags = input.element.seeTags();
if (tags.length > 0) {
- output.holder = input.method;
+ output.holder = input.element;
output.holderTag = tags[0];
output.inlineTags = input.isFirstSentence ?
tags[0].firstSentenceTags() : tags[0].inlineTags();
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/SimpleTaglet.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/SimpleTaglet.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -26,6 +26,7 @@
package com.sun.tools.doclets.internal.toolkit.taglets;
import com.sun.javadoc.*;
+import com.sun.tools.doclets.internal.toolkit.util.DocFinder;
/**
* A simple single argument custom tag.
@@ -38,7 +39,7 @@
* @author Jamie Ho
*/
-public class SimpleTaglet extends BaseTaglet {
+public class SimpleTaglet extends BaseTaglet implements InheritableTaglet {
/**
* The marker in the location string for excluded tags.
@@ -199,6 +200,17 @@
return false;
}
+ @Override
+ public void inherit(DocFinder.Input input, DocFinder.Output output) {
+ Tag[] tags = input.element.tags(tagName);
+ if (tags.length > 0) {
+ output.holder = input.element;
+ output.holderTag = tags[0];
+ output.inlineTags = input.isFirstSentence
+ ? tags[0].firstSentenceTags() : tags[0].inlineTags();
+ }
+ }
+
/**
* {@inheritDoc}
*/
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ThrowsTaglet.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ThrowsTaglet.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -60,15 +60,15 @@
throwsTag.exceptionName() :
throwsTag.exception().qualifiedName();
} else {
- exception = input.method.containingClass().findClass(input.tagId);
+ exception = input.element.containingClass().findClass(input.tagId);
}
- ThrowsTag[] tags = input.method.throwsTags();
+ ThrowsTag[] tags = ((MethodDoc)input.element).throwsTags();
for (int i = 0; i < tags.length; i++) {
if (input.tagId.equals(tags[i].exceptionName()) ||
(tags[i].exception() != null &&
(input.tagId.equals(tags[i].exception().qualifiedName())))) {
- output.holder = input.method;
+ output.holder = input.element;
output.holderTag = tags[i];
output.inlineTags = input.isFirstSentence ?
tags[i].firstSentenceTags() : tags[i].inlineTags();
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFinder.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFinder.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -48,9 +48,9 @@
*/
public static class Input {
/**
- * The method to search documentation from.
+ * The element to search documentation from.
*/
- public MethodDoc method = null;
+ public ProgramElementDoc element;
/**
* The taglet to search for documentation on behalf of. Null if we want
* to search for overall documentation.
@@ -84,54 +84,55 @@
*/
public boolean isTypeVariableParamTag = false;
- public Input() {}
-
- public Input(MethodDoc method, InheritableTaglet taglet, Tag tag,
+ public Input(ProgramElementDoc element, InheritableTaglet taglet, Tag tag,
boolean isFirstSentence, boolean isInheritDocTag) {
- this.method = method;
+ this(element);
this.taglet = taglet;
this.tag = tag;
this.isFirstSentence = isFirstSentence;
this.isInheritDocTag = isInheritDocTag;
}
- public Input(MethodDoc method, InheritableTaglet taglet, String tagId) {
- this.method = method;
+ public Input(ProgramElementDoc element, InheritableTaglet taglet, String tagId) {
+ this(element);
this.taglet = taglet;
this.tagId = tagId;
}
- public Input(MethodDoc method, InheritableTaglet taglet, String tagId,
+ public Input(ProgramElementDoc element, InheritableTaglet taglet, String tagId,
boolean isTypeVariableParamTag) {
- this.method = method;
+ this(element);
this.taglet = taglet;
this.tagId = tagId;
this.isTypeVariableParamTag = isTypeVariableParamTag;
}
- public Input(MethodDoc method, InheritableTaglet taglet) {
- this.method = method;
+ public Input(ProgramElementDoc element, InheritableTaglet taglet) {
+ this(element);
this.taglet = taglet;
}
- public Input(MethodDoc method) {
- this.method = method;
+ public Input(ProgramElementDoc element) {
+ if (element == null)
+ throw new NullPointerException();
+ this.element = element;
}
- public Input(MethodDoc method, boolean isFirstSentence) {
- this.method = method;
+ public Input(ProgramElementDoc element, boolean isFirstSentence) {
+ this(element);
this.isFirstSentence = isFirstSentence;
}
public Input copy() {
- Input clone = new Input();
- clone.method = this.method;
+ Input clone = new Input(this.element);
clone.taglet = this.taglet;
clone.tagId = this.tagId;
clone.tag = this.tag;
clone.isFirstSentence = this.isFirstSentence;
clone.isInheritDocTag = this.isInheritDocTag;
clone.isTypeVariableParamTag = this.isTypeVariableParamTag;
+ if (clone.element == null)
+ throw new NullPointerException();
return clone;
}
@@ -164,8 +165,8 @@
/**
* When automatically inheriting throws tags, you sometime must inherit
- * more than one tag. For example if the method declares that it throws
- * IOException and the overidden method has throws tags for IOException and
+ * more than one tag. For example if the element declares that it throws
+ * IOException and the overridden element has throws tags for IOException and
* ZipException, both tags would be inherited because ZipException is a
* subclass of IOException. This subclass of DocFinder.Output allows
* multiple tag inheritence.
@@ -174,9 +175,9 @@
}
/**
- * Search for the requested comments in the given method. If it does not
- * have comments, return documentation from the overriden method if possible.
- * If the overriden method does not exist or does not have documentation to
+ * Search for the requested comments in the given element. If it does not
+ * have comments, return documentation from the overriden element if possible.
+ * If the overriden element does not exist or does not have documentation to
* inherit, search for documentation to inherit from implemented methods.
*
* @param input the input object used to perform the search.
@@ -186,14 +187,14 @@
public static Output search(Input input) {
Output output = new Output();
if (input.isInheritDocTag) {
- //Do nothing because "method" does not have any documentation.
+ //Do nothing because "element" does not have any documentation.
//All it has it {@inheritDoc}.
} else if (input.taglet == null) {
//We want overall documentation.
output.inlineTags = input.isFirstSentence ?
- input.method.firstSentenceTags() :
- input.method.inlineTags();
- output.holder = input.method;
+ input.element.firstSentenceTags() :
+ input.element.inlineTags();
+ output.holder = input.element;
} else {
input.taglet.inherit(input, output);
}
@@ -204,25 +205,38 @@
output.isValidInheritDocTag = false;
Input inheritedSearchInput = input.copy();
inheritedSearchInput.isInheritDocTag = false;
- if (input.method.overriddenMethod() != null) {
- inheritedSearchInput.method = input.method.overriddenMethod();
- output = search(inheritedSearchInput);
- output.isValidInheritDocTag = true;
- if (output != null && output.inlineTags.length > 0) {
- return output;
+ if (input.element instanceof MethodDoc) {
+ MethodDoc overriddenMethod = ((MethodDoc) input.element).overriddenMethod();
+ if (overriddenMethod != null) {
+ inheritedSearchInput.element = overriddenMethod;
+ output = search(inheritedSearchInput);
+ output.isValidInheritDocTag = true;
+ if (output.inlineTags.length > 0) {
+ return output;
+ }
}
- }
- //NOTE: When we fix the bug where ClassDoc.interfaceTypes() does
- // not pass all implemented interfaces, we will use the
- // appropriate method here.
- MethodDoc[] implementedMethods =
- (new ImplementedMethods(input.method, null)).build(false);
- for (int i = 0; i < implementedMethods.length; i++) {
- inheritedSearchInput.method = implementedMethods[i];
- output = search(inheritedSearchInput);
- output.isValidInheritDocTag = true;
- if (output != null && output.inlineTags.length > 0) {
- return output;
+ //NOTE: When we fix the bug where ClassDoc.interfaceTypes() does
+ // not pass all implemented interfaces, we will use the
+ // appropriate element here.
+ MethodDoc[] implementedMethods =
+ (new ImplementedMethods((MethodDoc) input.element, null)).build(false);
+ for (int i = 0; i < implementedMethods.length; i++) {
+ inheritedSearchInput.element = implementedMethods[i];
+ output = search(inheritedSearchInput);
+ output.isValidInheritDocTag = true;
+ if (output.inlineTags.length > 0) {
+ return output;
+ }
+ }
+ } else if (input.element instanceof ClassDoc) {
+ ProgramElementDoc superclass = ((ClassDoc) input.element).superclass();
+ if (superclass != null) {
+ inheritedSearchInput.element = superclass;
+ output = search(inheritedSearchInput);
+ output.isValidInheritDocTag = true;
+ if (output.inlineTags.length > 0) {
+ return output;
+ }
}
}
return output;
--- a/langtools/src/share/classes/com/sun/tools/doclint/Checker.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclint/Checker.java Wed May 08 23:54:45 2013 -0700
@@ -42,7 +42,6 @@
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Name;
-import javax.lang.model.element.TypeElement;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
import javax.tools.Diagnostic.Kind;
@@ -70,7 +69,8 @@
import com.sun.source.doctree.ThrowsTree;
import com.sun.source.doctree.ValueTree;
import com.sun.source.doctree.VersionTree;
-import com.sun.source.util.DocTreeScanner;
+import com.sun.source.util.DocTreePath;
+import com.sun.source.util.DocTreePathScanner;
import com.sun.source.util.TreePath;
import com.sun.tools.doclint.HtmlTag.AttrKind;
import com.sun.tools.javac.tree.DocPretty;
@@ -85,7 +85,7 @@
* risk. This code and its internal interfaces are subject to change
* or deletion without notice.</b></p>
*/
-public class Checker extends DocTreeScanner<Void, Void> {
+public class Checker extends DocTreePathScanner<Void, Void> {
final Env env;
Set<Element> foundParams = new HashSet<Element>();
@@ -152,7 +152,7 @@
foundInheritDoc = false;
foundReturn = false;
- scan(tree, (Void) null);
+ scan(new DocTreePath(p, tree), null);
if (!isOverridingMethod) {
switch (env.currElement.getKind()) {
@@ -620,47 +620,36 @@
}
@Override
+ @SuppressWarnings("fallthrough")
public Void visitParam(ParamTree tree, Void ignore) {
boolean typaram = tree.isTypeParameter();
IdentifierTree nameTree = tree.getName();
- Element e = env.currElement;
- switch (e.getKind()) {
- case METHOD: case CONSTRUCTOR: {
- ExecutableElement ee = (ExecutableElement) e;
- checkParamDeclared(nameTree, typaram ? ee.getTypeParameters() : ee.getParameters());
- break;
- }
+ Element paramElement = nameTree != null ? env.trees.getElement(new DocTreePath(getCurrentPath(), nameTree)) : null;
- case CLASS: case INTERFACE: {
- TypeElement te = (TypeElement) e;
- if (typaram) {
- checkParamDeclared(nameTree, te.getTypeParameters());
- } else {
- env.messages.error(REFERENCE, tree, "dc.invalid.param");
+ if (paramElement == null) {
+ switch (env.currElement.getKind()) {
+ case CLASS: case INTERFACE: {
+ if (!typaram) {
+ env.messages.error(REFERENCE, tree, "dc.invalid.param");
+ break;
+ }
}
- break;
- }
+ case METHOD: case CONSTRUCTOR: {
+ env.messages.error(REFERENCE, nameTree, "dc.param.name.not.found");
+ break;
+ }
- default:
- env.messages.error(REFERENCE, tree, "dc.invalid.param");
- break;
+ default:
+ env.messages.error(REFERENCE, tree, "dc.invalid.param");
+ break;
+ }
+ } else {
+ foundParams.add(paramElement);
}
+
warnIfEmpty(tree, tree.getDescription());
return super.visitParam(tree, ignore);
}
- // where
- private void checkParamDeclared(IdentifierTree nameTree, List<? extends Element> list) {
- Name name = nameTree.getName();
- boolean found = false;
- for (Element e: list) {
- if (name.equals(e.getSimpleName())) {
- foundParams.add(e);
- found = true;
- }
- }
- if (!found)
- env.messages.error(REFERENCE, nameTree, "dc.param.name.not.found");
- }
private void checkParamsDocumented(List<? extends Element> list) {
if (foundInheritDoc)
@@ -678,7 +667,7 @@
@Override
public Void visitReference(ReferenceTree tree, Void ignore) {
- Element e = env.trees.getElement(env.currPath, tree);
+ Element e = env.trees.getElement(getCurrentPath());
if (e == null)
env.messages.error(REFERENCE, tree, "dc.ref.not.found");
return super.visitReference(tree, ignore);
@@ -716,7 +705,7 @@
@Override
public Void visitThrows(ThrowsTree tree, Void ignore) {
ReferenceTree exName = tree.getExceptionName();
- Element ex = env.trees.getElement(env.currPath, exName);
+ Element ex = env.trees.getElement(new DocTreePath(getCurrentPath(), exName));
if (ex == null) {
env.messages.error(REFERENCE, tree, "dc.ref.not.found");
} else if (ex.asType().getKind() == TypeKind.DECLARED
--- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java Wed May 08 23:54:45 2013 -0700
@@ -33,6 +33,7 @@
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.AnnotationValue;
import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.DeclaredType;
@@ -44,12 +45,12 @@
import com.sun.source.doctree.DocCommentTree;
import com.sun.source.doctree.DocTree;
-import com.sun.source.doctree.ReferenceTree;
import com.sun.source.tree.CatchTree;
import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.tree.Scope;
import com.sun.source.tree.Tree;
import com.sun.source.util.DocSourcePositions;
+import com.sun.source.util.DocTreePath;
import com.sun.source.util.DocTreeScanner;
import com.sun.source.util.DocTrees;
import com.sun.source.util.JavacTask;
@@ -314,7 +315,7 @@
return TreePath.getPath(treeTopLevel.snd, treeTopLevel.fst);
}
- public Element getElement(TreePath path) {
+ public Symbol getElement(TreePath path) {
JCTree tree = (JCTree) path.getLeaf();
Symbol sym = TreeInfo.symbolFor(tree);
if (sym == null) {
@@ -343,11 +344,19 @@
}
@Override
- public Element getElement(TreePath path, ReferenceTree reference) {
- if (!(reference instanceof DCReference))
- return null;
- DCReference ref = (DCReference) reference;
+ public Element getElement(DocTreePath path) {
+ DocTree forTree = path.getLeaf();
+ if (forTree instanceof DCReference)
+ return attributeDocReference(path.getTreePath(), ((DCReference) forTree));
+ if (forTree instanceof DCIdentifier) {
+ if (path.getParentPath().getLeaf() instanceof DCParam) {
+ return attributeParamIdentifier(path.getTreePath(), (DCParam) path.getParentPath().getLeaf());
+ }
+ }
+ return null;
+ }
+ private Symbol attributeDocReference(TreePath path, DCReference ref) {
Env<AttrContext> env = getAttrContext(path);
Log.DeferredDiagnosticHandler deferredDiagnosticHandler =
@@ -427,6 +436,30 @@
}
}
+ private Symbol attributeParamIdentifier(TreePath path, DCParam ptag) {
+ Symbol javadocSymbol = getElement(path);
+ if (javadocSymbol == null)
+ return null;
+ ElementKind kind = javadocSymbol.getKind();
+ List<? extends Symbol> params = List.nil();
+ if (kind == ElementKind.METHOD || kind == ElementKind.CONSTRUCTOR) {
+ MethodSymbol ee = (MethodSymbol) javadocSymbol;
+ params = ptag.isTypeParameter()
+ ? ee.getTypeParameters()
+ : ee.getParameters();
+ } else if (kind.isClass() || kind.isInterface()) {
+ ClassSymbol te = (ClassSymbol) javadocSymbol;
+ params = te.getTypeParameters();
+ }
+
+ for (Symbol param : params) {
+ if (param.getSimpleName() == ptag.getName().getName()) {
+ return param;
+ }
+ }
+ return null;
+ }
+
/** @see com.sun.tools.javadoc.ClassDocImpl#findField */
private VarSymbol findField(ClassSymbol tsym, Name fieldName) {
return searchField(tsym, fieldName, new HashSet<ClassSymbol>());
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java Wed May 08 23:54:45 2013 -0700
@@ -131,7 +131,6 @@
public final Type methodHandleLookupType;
public final Type methodTypeType;
public final Type nativeHeaderType;
- public final Type nativeHeaderType_old;
public final Type throwableType;
public final Type errorType;
public final Type interruptedExceptionType;
@@ -526,7 +525,6 @@
autoCloseableType.tsym);
trustMeType = enterClass("java.lang.SafeVarargs");
nativeHeaderType = enterClass("java.lang.annotation.Native");
- nativeHeaderType_old = enterClass("javax.tools.annotation.GenerateNativeHeader");
lambdaMetafactory = enterClass("java.lang.invoke.LambdaMetafactory");
functionalInterfaceType = enterClass("java.lang.FunctionalInterface");
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Wed May 08 23:54:45 2013 -0700
@@ -3024,9 +3024,9 @@
// collect an inventory of the annotation elements
Set<MethodSymbol> members = new LinkedHashSet<MethodSymbol>();
for (Scope.Entry e = a.annotationType.type.tsym.members().elems;
- e != null;
- e = e.sibling)
- if (e.sym.kind == MTH)
+ e != null;
+ e = e.sibling)
+ if (e.sym.kind == MTH && e.sym.name != names.clinit)
members.add((MethodSymbol) e.sym);
// remove the ones that are assigned values
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Wed May 08 23:54:45 2013 -0700
@@ -1252,8 +1252,17 @@
List<Type> ptypes = ((MethodType) consSym.type).getParameterTypes();
Type classType = consSym.owner.type;
+ // Build lambda parameters
+ // partially cloned from TreeMaker.Params until 8014021 is fixed
+ Symbol owner = owner();
+ ListBuffer<JCVariableDecl> paramBuff = new ListBuffer<JCVariableDecl>();
+ int i = 0;
+ for (List<Type> l = ptypes; l.nonEmpty(); l = l.tail) {
+ paramBuff.append(make.Param(make.paramName(i++), l.head, owner));
+ }
+ List<JCVariableDecl> params = paramBuff.toList();
+
// Make new-class call
- List<JCVariableDecl> params = make.Params(ptypes, owner());
JCNewClass nc = makeNewClass(classType, make.Idents(params));
nc.pos = tree.pos;
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java Wed May 08 23:54:45 2013 -0700
@@ -157,13 +157,6 @@
if (c.isLocal() || (c.flags() & Flags.SYNTHETIC) != 0)
return false;
- /* temporary code for backwards compatibility */
- for (Attribute.Compound a: c.annotations.getDeclarationAttributes()) {
- if (a.type.tsym == syms.nativeHeaderType_old.tsym)
- return true;
- }
- /* end of temporary code for backwards compatibility */
-
for (Scope.Entry i = c.members_field.elems; i != null; i = i.sibling) {
if (i.sym.kind == Kinds.MTH && (i.sym.flags() & Flags.NATIVE) != 0)
return true;
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Wed May 08 23:54:45 2013 -0700
@@ -1666,6 +1666,7 @@
throw new FatalError(msg, e);
}
}
+ closeables = List.nil();
}
}
--- a/langtools/src/share/classes/com/sun/tools/javac/main/Main.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/Main.java Wed May 08 23:54:45 2013 -0700
@@ -35,7 +35,6 @@
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashSet;
-import java.util.ServiceLoader;
import java.util.Set;
import javax.annotation.processing.Processor;
@@ -56,6 +55,7 @@
import com.sun.tools.javac.util.*;
import com.sun.tools.javac.util.Log.PrefixKind;
import com.sun.tools.javac.util.Log.WriterKind;
+import com.sun.tools.javac.util.ServiceLoader;
import static com.sun.tools.javac.main.Option.*;
/** This class provides a command line interface to the javac compiler.
@@ -469,7 +469,6 @@
pluginMessage(ex);
return Result.SYSERR;
}
-
}
}
}
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Wed May 08 23:54:45 2013 -0700
@@ -76,6 +76,7 @@
import com.sun.tools.javac.util.Name;
import com.sun.tools.javac.util.Names;
import com.sun.tools.javac.util.Options;
+import com.sun.tools.javac.util.ServiceLoader;
import static com.sun.tools.javac.code.Lint.LintCategory.PROCESSING;
import static com.sun.tools.javac.main.Option.*;
import static com.sun.tools.javac.comp.CompileStates.CompileState;
@@ -166,6 +167,7 @@
protected JavacProcessingEnvironment(Context context) {
this.context = context;
+ context.put(JavacProcessingEnvironment.class, this);
log = Log.instance(context);
source = Source.instance(context);
diags = JCDiagnostic.Factory.instance(context);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/ServiceLoader.java Wed May 08 23:54:45 2013 -0700
@@ -0,0 +1,437 @@
+/*
+ * Copyright (c) 2005, 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.javac.util;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Objects;
+import java.util.ServiceConfigurationError;
+
+
+/**
+ * This is a temporary, modified copy of java.util.ServiceLoader, for use by
+ * javac, to work around bug JDK-8004082.
+ *
+ * The bug describes problems in the interaction between ServiceLoader and
+ * URLClassLoader, such that references to a jar file passed to URLClassLoader
+ * may be retained after calling URLClassLoader.close(), preventing the jar
+ * file from being deleted on Windows.
+ *
+ * <p><b>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.</b>
+ */
+
+public final class ServiceLoader<S>
+ implements Iterable<S>
+{
+
+ private static final String PREFIX = "META-INF/services/";
+
+ // The class or interface representing the service being loaded
+ private Class<S> service;
+
+ // The class loader used to locate, load, and instantiate providers
+ private ClassLoader loader;
+
+ // Cached providers, in instantiation order
+ private LinkedHashMap<String,S> providers = new LinkedHashMap<>();
+
+ // The current lazy-lookup iterator
+ private LazyIterator lookupIterator;
+
+ /**
+ * Clear this loader's provider cache so that all providers will be
+ * reloaded.
+ *
+ * <p> After invoking this method, subsequent invocations of the {@link
+ * #iterator() iterator} method will lazily look up and instantiate
+ * providers from scratch, just as is done by a newly-created loader.
+ *
+ * <p> This method is intended for use in situations in which new providers
+ * can be installed into a running Java virtual machine.
+ */
+ public void reload() {
+ providers.clear();
+ lookupIterator = new LazyIterator(service, loader);
+ }
+
+ private ServiceLoader(Class<S> svc, ClassLoader cl) {
+ service = Objects.requireNonNull(svc, "Service interface cannot be null");
+ loader = (cl == null) ? ClassLoader.getSystemClassLoader() : cl;
+ reload();
+ }
+
+ private static void fail(Class<?> service, String msg, Throwable cause)
+ throws ServiceConfigurationError
+ {
+ throw new ServiceConfigurationError(service.getName() + ": " + msg,
+ cause);
+ }
+
+ private static void fail(Class<?> service, String msg)
+ throws ServiceConfigurationError
+ {
+ throw new ServiceConfigurationError(service.getName() + ": " + msg);
+ }
+
+ private static void fail(Class<?> service, URL u, int line, String msg)
+ throws ServiceConfigurationError
+ {
+ fail(service, u + ":" + line + ": " + msg);
+ }
+
+ // Parse a single line from the given configuration file, adding the name
+ // on the line to the names list.
+ //
+ private int parseLine(Class<?> service, URL u, BufferedReader r, int lc,
+ List<String> names)
+ throws IOException, ServiceConfigurationError
+ {
+ String ln = r.readLine();
+ if (ln == null) {
+ return -1;
+ }
+ int ci = ln.indexOf('#');
+ if (ci >= 0) ln = ln.substring(0, ci);
+ ln = ln.trim();
+ int n = ln.length();
+ if (n != 0) {
+ if ((ln.indexOf(' ') >= 0) || (ln.indexOf('\t') >= 0))
+ fail(service, u, lc, "Illegal configuration-file syntax");
+ int cp = ln.codePointAt(0);
+ if (!Character.isJavaIdentifierStart(cp))
+ fail(service, u, lc, "Illegal provider-class name: " + ln);
+ for (int i = Character.charCount(cp); i < n; i += Character.charCount(cp)) {
+ cp = ln.codePointAt(i);
+ if (!Character.isJavaIdentifierPart(cp) && (cp != '.'))
+ fail(service, u, lc, "Illegal provider-class name: " + ln);
+ }
+ if (!providers.containsKey(ln) && !names.contains(ln))
+ names.add(ln);
+ }
+ return lc + 1;
+ }
+
+ // Parse the content of the given URL as a provider-configuration file.
+ //
+ // @param service
+ // The service type for which providers are being sought;
+ // used to construct error detail strings
+ //
+ // @param u
+ // The URL naming the configuration file to be parsed
+ //
+ // @return A (possibly empty) iterator that will yield the provider-class
+ // names in the given configuration file that are not yet members
+ // of the returned set
+ //
+ // @throws ServiceConfigurationError
+ // If an I/O error occurs while reading from the given URL, or
+ // if a configuration-file format error is detected
+ //
+ private Iterator<String> parse(Class<?> service, URL u)
+ throws ServiceConfigurationError
+ {
+ InputStream in = null;
+ BufferedReader r = null;
+ ArrayList<String> names = new ArrayList<>();
+ try {
+ // The problem is that by default, streams opened with
+ // u.openInputStream use a cached reference to a JarFile, which
+ // is separate from the reference used by URLClassLoader, and
+ // which is not closed by URLClassLoader.close().
+ // The workaround is to disable caching for this specific jar file,
+ // so that the reference to the jar file can be closed when the
+ // file has been read.
+ // Original code:
+ // in = u.openStream();
+ // Workaround ...
+ URLConnection uc = u.openConnection();
+ uc.setUseCaches(false);
+ in = uc.getInputStream();
+ // ... end of workaround.
+ r = new BufferedReader(new InputStreamReader(in, "utf-8"));
+ int lc = 1;
+ while ((lc = parseLine(service, u, r, lc, names)) >= 0);
+ } catch (IOException x) {
+ fail(service, "Error reading configuration file", x);
+ } finally {
+ try {
+ if (r != null) r.close();
+ if (in != null) in.close();
+ } catch (IOException y) {
+ fail(service, "Error closing configuration file", y);
+ }
+ }
+ return names.iterator();
+ }
+
+ // Private inner class implementing fully-lazy provider lookup
+ //
+ private class LazyIterator
+ implements Iterator<S>
+ {
+
+ Class<S> service;
+ ClassLoader loader;
+ Enumeration<URL> configs = null;
+ Iterator<String> pending = null;
+ String nextName = null;
+
+ private LazyIterator(Class<S> service, ClassLoader loader) {
+ this.service = service;
+ this.loader = loader;
+ }
+
+ public boolean hasNext() {
+ if (nextName != null) {
+ return true;
+ }
+ if (configs == null) {
+ try {
+ String fullName = PREFIX + service.getName();
+ if (loader == null)
+ configs = ClassLoader.getSystemResources(fullName);
+ else
+ configs = loader.getResources(fullName);
+ } catch (IOException x) {
+ fail(service, "Error locating configuration files", x);
+ }
+ }
+ while ((pending == null) || !pending.hasNext()) {
+ if (!configs.hasMoreElements()) {
+ return false;
+ }
+ pending = parse(service, configs.nextElement());
+ }
+ nextName = pending.next();
+ return true;
+ }
+
+ public S next() {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ String cn = nextName;
+ nextName = null;
+ Class<?> c = null;
+ try {
+ c = Class.forName(cn, false, loader);
+ } catch (ClassNotFoundException x) {
+ fail(service,
+ "Provider " + cn + " not found");
+ }
+ if (!service.isAssignableFrom(c)) {
+ fail(service,
+ "Provider " + cn + " not a subtype");
+ }
+ try {
+ S p = service.cast(c.newInstance());
+ providers.put(cn, p);
+ return p;
+ } catch (Throwable x) {
+ fail(service,
+ "Provider " + cn + " could not be instantiated: " + x,
+ x);
+ }
+ throw new Error(); // This cannot happen
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ }
+
+ /**
+ * Lazily loads the available providers of this loader's service.
+ *
+ * <p> The iterator returned by this method first yields all of the
+ * elements of the provider cache, in instantiation order. It then lazily
+ * loads and instantiates any remaining providers, adding each one to the
+ * cache in turn.
+ *
+ * <p> To achieve laziness the actual work of parsing the available
+ * provider-configuration files and instantiating providers must be done by
+ * the iterator itself. Its {@link java.util.Iterator#hasNext hasNext} and
+ * {@link java.util.Iterator#next next} methods can therefore throw a
+ * {@link ServiceConfigurationError} if a provider-configuration file
+ * violates the specified format, or if it names a provider class that
+ * cannot be found and instantiated, or if the result of instantiating the
+ * class is not assignable to the service type, or if any other kind of
+ * exception or error is thrown as the next provider is located and
+ * instantiated. To write robust code it is only necessary to catch {@link
+ * ServiceConfigurationError} when using a service iterator.
+ *
+ * <p> If such an error is thrown then subsequent invocations of the
+ * iterator will make a best effort to locate and instantiate the next
+ * available provider, but in general such recovery cannot be guaranteed.
+ *
+ * <blockquote style="font-size: smaller; line-height: 1.2"><span
+ * style="padding-right: 1em; font-weight: bold">Design Note</span>
+ * Throwing an error in these cases may seem extreme. The rationale for
+ * this behavior is that a malformed provider-configuration file, like a
+ * malformed class file, indicates a serious problem with the way the Java
+ * virtual machine is configured or is being used. As such it is
+ * preferable to throw an error rather than try to recover or, even worse,
+ * fail silently.</blockquote>
+ *
+ * <p> The iterator returned by this method does not support removal.
+ * Invoking its {@link java.util.Iterator#remove() remove} method will
+ * cause an {@link UnsupportedOperationException} to be thrown.
+ *
+ * @return An iterator that lazily loads providers for this loader's
+ * service
+ */
+ public Iterator<S> iterator() {
+ return new Iterator<S>() {
+
+ Iterator<Map.Entry<String,S>> knownProviders
+ = providers.entrySet().iterator();
+
+ public boolean hasNext() {
+ if (knownProviders.hasNext())
+ return true;
+ return lookupIterator.hasNext();
+ }
+
+ public S next() {
+ if (knownProviders.hasNext())
+ return knownProviders.next().getValue();
+ return lookupIterator.next();
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ };
+ }
+
+ /**
+ * Creates a new service loader for the given service type and class
+ * loader.
+ *
+ * @param service
+ * The interface or abstract class representing the service
+ *
+ * @param loader
+ * The class loader to be used to load provider-configuration files
+ * and provider classes, or <tt>null</tt> if the system class
+ * loader (or, failing that, the bootstrap class loader) is to be
+ * used
+ *
+ * @return A new service loader
+ */
+ public static <S> ServiceLoader<S> load(Class<S> service,
+ ClassLoader loader)
+ {
+ return new ServiceLoader<>(service, loader);
+ }
+
+ /**
+ * Creates a new service loader for the given service type, using the
+ * current thread's {@linkplain java.lang.Thread#getContextClassLoader
+ * context class loader}.
+ *
+ * <p> An invocation of this convenience method of the form
+ *
+ * <blockquote><pre>
+ * ServiceLoader.load(<i>service</i>)</pre></blockquote>
+ *
+ * is equivalent to
+ *
+ * <blockquote><pre>
+ * ServiceLoader.load(<i>service</i>,
+ * Thread.currentThread().getContextClassLoader())</pre></blockquote>
+ *
+ * @param service
+ * The interface or abstract class representing the service
+ *
+ * @return A new service loader
+ */
+ public static <S> ServiceLoader<S> load(Class<S> service) {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ return ServiceLoader.load(service, cl);
+ }
+
+ /**
+ * Creates a new service loader for the given service type, using the
+ * extension class loader.
+ *
+ * <p> This convenience method simply locates the extension class loader,
+ * call it <tt><i>extClassLoader</i></tt>, and then returns
+ *
+ * <blockquote><pre>
+ * ServiceLoader.load(<i>service</i>, <i>extClassLoader</i>)</pre></blockquote>
+ *
+ * <p> If the extension class loader cannot be found then the system class
+ * loader is used; if there is no system class loader then the bootstrap
+ * class loader is used.
+ *
+ * <p> This method is intended for use when only installed providers are
+ * desired. The resulting service will only find and load providers that
+ * have been installed into the current Java virtual machine; providers on
+ * the application's class path will be ignored.
+ *
+ * @param service
+ * The interface or abstract class representing the service
+ *
+ * @return A new service loader
+ */
+ public static <S> ServiceLoader<S> loadInstalled(Class<S> service) {
+ ClassLoader cl = ClassLoader.getSystemClassLoader();
+ ClassLoader prev = null;
+ while (cl != null) {
+ prev = cl;
+ cl = cl.getParent();
+ }
+ return ServiceLoader.load(service, prev);
+ }
+
+ /**
+ * Returns a string describing this service.
+ *
+ * @return A descriptive string
+ */
+ public String toString() {
+ return "java.util.ServiceLoader[" + service.getName() + "]";
+ }
+
+}
--- a/langtools/src/share/classes/com/sun/tools/javadoc/Comment.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/Comment.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -25,6 +25,8 @@
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;
@@ -296,6 +298,7 @@
static Tag[] getInlineTags(DocImpl holder, String inlinetext) {
ListBuffer<Tag> taglist = new ListBuffer<Tag>();
int delimend = 0, textstart = 0, len = inlinetext.length();
+ boolean inPre = false;
DocEnv docenv = holder.env;
if (len == 0) {
@@ -309,6 +312,7 @@
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);
@@ -319,18 +323,20 @@
}
}
String linkName = inlinetext.substring(linkstart+2, seetextstart);
- //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++;
+ 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",
@@ -366,6 +372,17 @@
return taglist.toArray(new Tag[taglist.length()]);
}
+ /** regex for case-insensitive match for {@literal <pre> } and {@literal </pre> }. */
+ 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.
--- a/langtools/src/share/classes/javax/annotation/processing/SupportedAnnotationTypes.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/javax/annotation/processing/SupportedAnnotationTypes.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -47,5 +47,9 @@
@Target(TYPE)
@Retention(RUNTIME)
public @interface SupportedAnnotationTypes {
- String [] value();
+ /**
+ * Returns the names of the supported annotation types.
+ * @return the names of the supported annotation types
+ */
+ String [] value();
}
--- a/langtools/src/share/classes/javax/annotation/processing/SupportedOptions.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/javax/annotation/processing/SupportedOptions.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -46,5 +46,9 @@
@Target(TYPE)
@Retention(RUNTIME)
public @interface SupportedOptions {
- String [] value();
+ /**
+ * Returns the supported options.
+ * @return the supported options
+ */
+ String [] value();
}
--- a/langtools/src/share/classes/javax/annotation/processing/SupportedSourceVersion.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/javax/annotation/processing/SupportedSourceVersion.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -47,5 +47,9 @@
@Target(TYPE)
@Retention(RUNTIME)
public @interface SupportedSourceVersion {
+ /**
+ * Returns the latest supported source version.
+ * @return the latest supported source version
+ */
SourceVersion value();
}
--- a/langtools/src/share/classes/javax/lang/model/AnnotatedConstruct.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/javax/lang/model/AnnotatedConstruct.java Wed May 08 23:54:45 2013 -0700
@@ -51,7 +51,7 @@
* <li> for an invocation of {@code getAnnotation(Class<T>)} or
* {@code getAnnotationMirrors()}, <i>E</i>'s annotations contain <i>A</i>.
*
- * <li> for an invocation of getAnnotationsByType(Class<T>),
+ * <li> for an invocation of {@code getAnnotationsByType(Class<T>)},
* <i>E</i>'s annotations either contain <i>A</i> or, if the type of
* <i>A</i> is repeatable, contain exactly one annotation whose value
* element contains <i>A</i> and whose type is the containing
--- a/langtools/src/share/classes/javax/lang/model/element/NestingKind.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/javax/lang/model/element/NestingKind.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -82,9 +82,24 @@
* @since 1.6
*/
public enum NestingKind {
+ /**
+ * A top-level type, not contained within another type.
+ */
TOP_LEVEL,
+
+ /**
+ * A type that is a named member of another type.
+ */
MEMBER,
+
+ /**
+ * A named type declared within a construct other than a type.
+ */
LOCAL,
+
+ /**
+ * A type without a name.
+ */
ANONYMOUS;
/**
@@ -92,6 +107,7 @@
* A <i>nested</i> type element is any that is not top-level.
* An <i>inner</i> type element is any nested type element that
* is not {@linkplain Modifier#STATIC static}.
+ * @return whether or not the constant is nested
*/
public boolean isNested() {
return this != TOP_LEVEL;
--- a/langtools/src/share/classes/javax/lang/model/util/ElementScanner6.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/javax/lang/model/util/ElementScanner6.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -135,6 +135,9 @@
/**
* Processes an element by calling {@code e.accept(this, p)};
* this method may be overridden by subclasses.
+ *
+ * @param e the element to scan
+ * @param p a scanner-specified parameter
* @return the result of visiting {@code e}.
*/
public R scan(Element e, P p) {
@@ -143,6 +146,8 @@
/**
* Convenience method equivalent to {@code v.scan(e, null)}.
+ *
+ * @param e the element to scan
* @return the result of scanning {@code e}.
*/
public final R scan(Element e) {
--- a/langtools/src/share/classes/javax/lang/model/util/Elements.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/javax/lang/model/util/Elements.java Wed May 08 23:54:45 2013 -0700
@@ -247,6 +247,7 @@
* argument.
*
* @param cs the character sequence to return as a name
+ * @return a name with the same sequence of characters as the argument
*/
Name getName(CharSequence cs);
--- a/langtools/src/share/classes/javax/lang/model/util/Types.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/src/share/classes/javax/lang/model/util/Types.java Wed May 08 23:54:45 2013 -0700
@@ -52,6 +52,7 @@
* Returns {@code null} if the type is not one with a
* corresponding element.
*
+ * @param t the type to map to an element
* @return the element corresponding to the given type
*/
Element asElement(TypeMirror t);
--- a/langtools/src/share/classes/javax/tools/annotation/GenerateNativeHeader.java Wed Jul 05 18:54:28 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +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. 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 javax.tools.annotation;
-
-import java.lang.annotation.*;
-import static java.lang.annotation.RetentionPolicy.*;
-import static java.lang.annotation.ElementType.*;
-
-/**
- * An annotation used to indicate that a native header file
- * should be generated for this class.
- *
- * Normally, the presence of native methods is a sufficient
- * indication of the need for a native header file. However,
- * in some cases, a class may contain constants of interest to
- * native code, without containing any native methods.
- *
- * @since 1.8
- */
-@Documented
-@Target(TYPE)
-@Retention(SOURCE)
-public @interface GenerateNativeHeader {
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/InheritDocForUserTags/DocTest.java Wed May 08 23:54:45 2013 -0700
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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 8008768
+ * @summary Using {@inheritDoc} in simple tag defined via -tag fails
+ * @author Mike Duigou
+ * @run main DocTest
+ */
+
+import java.io.*;
+
+/**
+ * DocTest documentation.
+ *
+ * @apiNote DocTest API note.
+ * @implSpec DocTest implementation spec.
+ * @implNote DocTest implementation note.
+ */
+public class DocTest {
+ public static void main(String... args) throws Exception {
+ String[] javadoc_args = {
+ "-verbose",
+ "-d", "DocTest",
+ "-tag", "apiNote:optcm:<em>API Note</em>",
+ "-tag", "implSpec:optcm:<em>Implementation Requirements</em>:",
+ "-tag", "implNote:optcm:<em>Implementation Note</em>:",
+ "-package",
+ new File(System.getProperty("test.src"), "DocTest.java").getPath()
+ };
+
+ // javadoc does not report an exit code for an internal exception (!)
+ // so monitor stderr for stack dumps.
+ PrintStream prevErr = System.err;
+ ByteArrayOutputStream err_baos = new ByteArrayOutputStream();
+ PrintStream err_ps = new PrintStream(err_baos);
+ System.setErr(err_ps);
+
+ int rc;
+ try {
+ rc = com.sun.tools.javadoc.Main.execute(javadoc_args);
+ } finally {
+ err_ps.close();
+ System.setErr(prevErr);
+ }
+
+ String err = err_baos.toString();
+ System.err.println(err);
+
+ if (rc != 0)
+ throw new Exception("javadoc exited with rc=" + rc);
+
+ if (err.contains("at com.sun."))
+ throw new Exception("javadoc output contains stack trace");
+ }
+
+ /**
+ * DocTest() documentation.
+ *
+ * @apiNote DocTest() API note.
+ * @implSpec DocTest() implementation spec.
+ * @implNote DocTest() implementation note.
+ */
+ public DocTest() {
+ }
+
+ /**
+ * DocTest.testMethod() documentation.
+ *
+ * @apiNote DocTest.testMethod() API note.
+ * @implSpec DocTest.testMethod() implementation spec.
+ * @implNote DocTest.testMethod() implementation note.
+ */
+ public void testMethod() {
+ }
+}
+
+/**
+ * DocTestWithTags documentation.
+ *
+ * @apiNote DocTestWithTags API note.
+ * <pre>
+ * DocTestWithTags API note code sample.
+ * </pre>
+ * @implSpec DocTestWithTags implementation spec.
+ * <pre>
+ * DocTestWithTags implementation spec code sample.
+ * </pre>
+ * @implNote DocTestWithTags implementation note.
+ * <pre>
+ * DocTestWithTags implementation note code sample.
+ * </pre>
+ */
+class DocTestWithTags {
+
+ /**
+ * DocTestWithTags() documentation.
+ *
+ * @apiNote DocTestWithTags() API note.
+ * <pre>
+ * DocTestWithTags() API note code sample.
+ * </pre>
+ * @implSpec DocTestWithTags() implementation spec.
+ * <pre>
+ * DocTestWithTags() implementation spec code sample.
+ * </pre>
+ * @implNote DocTest() implementation note.
+ * <pre>
+ * DocTest() implementation note code sample.
+ * </pre>
+ */
+ public DocTestWithTags() {
+ }
+
+ /**
+ * DocTest.testMethod() documentation.
+ *
+ * @apiNote DocTestWithTags.testMethod() API note.
+ * <pre>
+ * DocTestWithTags.testMethod() API note code sample.
+ * </pre>
+ * @implSpec DocTestWithTags.testMethod() implementation spec.
+ * <pre>
+ * DocTestWithTags.testMethod() API implementation spec code sample.
+ * </pre>
+ * @implNote DocTest.testMethod() implementation note.
+ * <pre>
+ * DocTest.testMethod() API implementation code sample.
+ * </pre>
+ */
+ public void testMethod() {
+ }
+}
+
+class MinimallyExtendsDocTest extends DocTest {
+}
+
+/**
+ * SimpleExtendsDocTest documentation.
+ */
+class SimpleExtendsDocTest extends DocTest {
+
+ /**
+ * SimpleExtendsDocTest() documentation.
+ */
+ public SimpleExtendsDocTest() {
+
+ }
+
+ /**
+ * SimpleExtendsDocTest.testMethod() documenation.
+ */
+ @java.lang.Override
+ public void testMethod() {
+ }
+}
+
+/**
+ * {@inheritDoc}
+ */
+class SimpleInheritDocDocTest extends DocTest {
+
+ /**
+ * {@inheritDoc}
+ */
+ public SimpleInheritDocDocTest() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @java.lang.Override
+ public void testMethod() {
+ }
+}
+
+/**
+ * {@inheritDoc}
+ *
+ * @apiNote {@inheritDoc}
+ * @implSpec {@inheritDoc}
+ * @implNote {@inheritDoc}
+ */
+class FullInheritDocDocTest extends DocTest {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @apiNote {@inheritDoc}
+ * @implSpec {@inheritDoc}
+ * @implNote {@inheritDoc}
+ */
+ public FullInheritDocDocTest() {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @apiNote {@inheritDoc}
+ * @implSpec {@inheritDoc}
+ * @implNote {@inheritDoc}
+ */
+ @java.lang.Override
+ public void testMethod() {
+ }
+}
+
+/**
+ * {@inheritDoc} and FullInheritDocPlusDocTest documentation.
+ *
+ * @implSpec {@inheritDoc} and FullInheritDocPlusDocTest API note.
+ * @implNote {@inheritDoc} and FullInheritDocPlusDocTest implementation specification.
+ * @apiNote {@inheritDoc} and FullInheritDocPlusDocTest implementation note.
+ */
+class FullInheritDocPlusDocTest extends DocTest {
+
+ /**
+ * {@inheritDoc} and FullInheritDocPlusDocTest() documentation.
+ *
+ * @implSpec {@inheritDoc} and FullInheritDocPlusDocTest() API note.
+ * @implNote {@inheritDoc} and FullInheritDocPlusDocTest() implementation specification.
+ * @apiNote {@inheritDoc} and FullInheritDocPlusDocTest() implementation note.
+ */
+ public FullInheritDocPlusDocTest() {
+
+ }
+
+ /**
+ * {@inheritDoc} and FullInheritDocPlusDocTest.testMethod() documentation.
+ *
+ * @implSpec {@inheritDoc} and FullInheritDocPlusDocTest.testMethod() API note.
+ * @implNote {@inheritDoc} and FullInheritDocPlusDocTest.testMethod() implementation specification.
+ * @apiNote {@inheritDoc} and FullInheritDocPlusDocTest.testMethod() implementation note.
+ */
+ @java.lang.Override
+ public void testMethod() {
+ }
+}
+
--- a/langtools/test/com/sun/javadoc/_template/Template.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/com/sun/javadoc/_template/Template.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -22,15 +22,13 @@
*/
/*
- * test
- * @bug 0000000
- * @summary <DESC>
- * @author jamieh
- * @library ../lib/
- * @ignore This is a template for regression tests.
- * @build JavadocTester
- * @build <CLASS NAME>
- * @run main <CLASS NAME>
+ * @ test
+ * @ bug <BUG-ID>
+ * @ summary <BUG-SYNOPSIS>
+ * @ author <AUTHOR> or delete
+ * @ library ../lib/
+ * @ build JavadocTester <CLASS NAME>
+ * @ run main <CLASS NAME>
*/
public class Template extends JavadocTester {
--- a/langtools/test/com/sun/javadoc/_template/TemplateComplete.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/com/sun/javadoc/_template/TemplateComplete.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -22,15 +22,13 @@
*/
/*
- * test
- * @bug 0000000
- * @summary <DESC>
- * @author jamieh
- * @library ../lib/
- * @ignore This is a template for regression tests.
- * @build JavadocTester
- * @build <CLASS NAME>
- * @run main <CLASS NAME>
+ * @ test
+ * @ bug <BUG-ID>
+ * @ summary <BUG-SYNOPSIS>
+ * @ author <AUTHOR> or delete
+ * @ library ../lib/
+ * @ build JavadocTester <CLASS NAME>
+ * @ run main <CLASS NAME>
*/
public class TemplateComplete extends JavadocTester {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testLiteralCodeInPre/TestLiteralCodeInPre.java Wed May 08 23:54:45 2013 -0700
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2002, 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.
+ *
+ * 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 8002387
+ * @summary Improve rendered HTML formatting for {@code}
+ * @library ../lib/
+ * @build JavadocTester TestLiteralCodeInPre
+ * @run main TestLiteralCodeInPre
+ */
+
+public class TestLiteralCodeInPre extends JavadocTester {
+
+ //Test information.
+ private static final String BUG_ID = "8002387";
+ private static final String OUTPUT_DIR = BUG_ID;
+
+ //Javadoc arguments.
+ private static final String[] ARGS = new String[] {
+ "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-Xdoclint:none", "pkg"
+ };
+
+ //Input for string search tests.
+ private static final String[][] TEST = {
+ { BUG_ID + FS + "pkg" + FS + "Test.html",
+ "no_pre()</pre>" + NL +
+ "<div class=\"block\">abc<code>def</code>ghi</div>" },
+ { BUG_ID + FS + "pkg" + FS + "Test.html",
+ "no_pre_extra_whitespace()</pre>" + NL +
+ "<div class=\"block\">abc<code>def </code>ghi</div>" },
+ { BUG_ID + FS + "pkg" + FS + "Test.html",
+ "in_pre()</pre>" + NL +
+ "<div class=\"block\"><pre> abc<code> def </code>ghi</pre></div>" },
+ { BUG_ID + FS + "pkg" + FS + "Test.html",
+ "pre_after_text()</pre>" + NL +
+ "<div class=\"block\">xyz <pre> abc<code> def </code>ghi</pre></div>" },
+ { BUG_ID + FS + "pkg" + FS + "Test.html",
+ "after_pre()</pre>" + NL +
+ "<div class=\"block\">xyz <pre> pqr </pre> abc<code>def </code>ghi</div>" },
+ { BUG_ID + FS + "pkg" + FS + "Test.html",
+ "back_in_pre()</pre>" + NL +
+ "<div class=\"block\">xyz <pre> pqr </pre> mno <pre> abc<code> def </code>ghi</pre></div>" },
+ { BUG_ID + FS + "pkg" + FS + "Test.html",
+ "typical_usage_code()</pre>" + NL +
+ "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit." + NL +
+ " Example: <pre><code>" + NL +
+ " line 1 <T> void m(T t) {" + NL +
+ " line 2 // do something with T" + NL +
+ " line 3 }" + NL +
+ " </code></pre>" + NL +
+ " and so it goes.</div>" },
+ { BUG_ID + FS + "pkg" + FS + "Test.html",
+ "typical_usage_literal()</pre>" + NL +
+ "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit." + NL +
+ " Example: <pre>" + NL +
+ " line 1 <T> void m(T t) {" + NL +
+ " line 2 // do something with T" + NL +
+ " line 3 }" + NL +
+ " </pre>" + NL +
+ " and so it goes.</div>" },
+ { BUG_ID + FS + "pkg" + FS + "Test.html",
+ "recommended_usage_literal()</pre>" + NL +
+ "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit." + NL +
+ " Example: <pre>" + NL +
+ " line 1 <T> void m(T t) {" + NL +
+ " line 2 // do something with T" + NL +
+ " line 3 } </pre>" + NL +
+ " and so it goes.</div>" }
+ };
+
+ private static final String[][] NEGATED_TEST = NO_TEST;
+
+ /**
+ * The entry point of the test.
+ * @param args the array of command line arguments.
+ */
+ public static void main(String[] args) {
+ TestLiteralCodeInPre tester = new TestLiteralCodeInPre();
+ run(tester, ARGS, TEST, NEGATED_TEST);
+ tester.printSummary();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getBugId() {
+ return BUG_ID;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getBugName() {
+ return getClass().getName();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testLiteralCodeInPre/pkg/Test.java Wed May 08 23:54:45 2013 -0700
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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 Test {
+ /**
+ * abc{@code def}ghi
+ */
+ public void no_pre() { }
+
+ /**
+ * abc{@code def }ghi
+ */
+ public void no_pre_extra_whitespace() { }
+
+ /**
+ * <pre> abc{@code def }ghi</pre>
+ */
+ public void in_pre() { }
+
+ /**
+ * xyz <pre> abc{@code def }ghi</pre>
+ */
+ public void pre_after_text() { }
+
+ /**
+ * xyz <pre> pqr </pre> abc{@code def }ghi
+ */
+ public void after_pre() { }
+
+ /**
+ * xyz <pre> pqr </pre> mno <pre> abc{@code def }ghi</pre>
+ */
+ public void back_in_pre() { }
+
+ /**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ * Example: <pre>{@code
+ * line 1 <T> void m(T t) {
+ * line 2 // do something with T
+ * line 3 }
+ * }</pre>
+ * and so it goes.
+ */
+ public void typical_usage_code() { }
+
+ /**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ * Example: <pre>{@literal
+ * line 1 <T> void m(T t) {
+ * line 2 // do something with T
+ * line 3 }
+ * }</pre>
+ * and so it goes.
+ */
+ public void typical_usage_literal() { }
+
+ /**
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ * Example: <pre>{@literal
+ * line 1 <T> void m(T t) {
+ * line 2 // do something with T
+ * line 3 } }</pre>
+ * and so it goes.
+ */
+ public void recommended_usage_literal() { }
+
+ /**
+ * abc {@code
+ */
+ public void bad_code_no_content() { }
+
+ /**
+ * abc {@code abc
+ */
+ public void bad_code_content() { }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testSimpleTagInherit/TestSimpleTagInherit.java Wed May 08 23:54:45 2013 -0700
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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 8008768
+ * @summary Using {@inheritDoc} in simple tag defined via -tag fails
+ * @library ../lib/
+ * @build JavadocTester TestSimpleTagInherit
+ * @run main TestSimpleTagInherit
+ */
+
+public class TestSimpleTagInherit extends JavadocTester {
+
+ //Test information.
+ private static final String BUG_ID = "8008768";
+ private static final String OUTPUT_DIR = BUG_ID;
+
+ //Javadoc arguments.
+ private static final String[] ARGS = new String[] {
+ "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
+ "-tag", "custom:optcm:<em>Custom:</em>",
+ "p"
+ };
+
+ //Input for string search tests.
+ private static final String[][] TEST = {
+ { BUG_ID + FS + "p" + FS + "TestClass.html",
+ "<dt><span class=\"strong\"><em>Custom:</em></span></dt>" + NL +
+ " <dd>doc for BaseClass class</dd>" },
+ { BUG_ID + FS + "p" + FS + "TestClass.html",
+ "<dt><span class=\"strong\"><em>Custom:</em></span></dt>" + NL +
+ " <dd>doc for BaseClass method</dd>" }
+ };
+ private static final String[][] NEGATED_TEST = NO_TEST;
+
+ /**
+ * The entry point of the test.
+ * @param args the array of command line arguments.
+ */
+ public static void main(String[] args) {
+ TestSimpleTagInherit tester = new TestSimpleTagInherit();
+ run(tester, ARGS, TEST, NEGATED_TEST);
+ tester.printSummary();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getBugId() {
+ return BUG_ID;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getBugName() {
+ return getClass().getName();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testSimpleTagInherit/p/BaseClass.java Wed May 08 23:54:45 2013 -0700
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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;
+
+/**
+ * @custom doc for BaseClass class
+ */
+public class BaseClass {
+ /**
+ * @custom doc for BaseClass method
+ */
+ public void m() { }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testSimpleTagInherit/p/TestClass.java Wed May 08 23:54:45 2013 -0700
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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;
+
+/**
+ * @custom {@inheritDoc}
+ */
+public class TestClass extends BaseClass {
+ /**
+ * @custom {@inheritDoc}
+ */
+ public void m() { }
+}
--- a/langtools/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java Wed May 08 23:54:45 2013 -0700
@@ -45,7 +45,7 @@
private static final String[][] NEGATED_TEST = NO_TEST;
private static final String[][] TEST = {
// Test for type annotations on Class Extends (ClassExtends.java).
- /* @ignore 8012173
+ /* @ignore 8012173: javadoc does not receive all type annotations information from javac
{BUG_ID + FS + "typeannos" + FS + "MyClass.html",
"extends <a href=\"../typeannos/ClassExtA.html\" title=\"annotation " +
"in typeannos\">@ClassExtA</a> <a href=\"../typeannos/ParameterizedClass.html\" " +
@@ -54,7 +54,7 @@
"@ClassExtB</a> java.lang.String>"
},
*/
- /* @ignore 8012173
+ /* @ignore 8012173: javadoc does not receive all type annotations information from javac
{BUG_ID + FS + "typeannos" + FS + "MyClass.html",
"implements <a href=\"../typeannos/ClassExtB.html\" title=\"" +
"annotation in typeannos\">@ClassExtB</a> java.lang.CharSequence, " +
@@ -65,7 +65,7 @@
"typeannos\">@ClassExtB</a> java.lang.String></pre>"
},
*/
- /* @ignore 8012173
+ /* @ignore 8012173: javadoc does not receive all type annotations information from javac
{BUG_ID + FS + "typeannos" + FS + "MyInterface.html",
"extends <a href=\"../typeannos/ClassExtA.html\" title=\"annotation " +
"in typeannos\">@ClassExtA</a> <a href=\"../typeannos/" +
@@ -83,7 +83,7 @@
"href=\"../typeannos/ClassParamA.html\" title=\"annotation in " +
"typeannos\">@ClassParamA</a> java.lang.String></span>"
},
- /* @ignore 8012173
+ /* @ignore 8012173: javadoc does not receive all type annotations information from javac
{BUG_ID + FS + "typeannos" + FS + "ExtendsGeneric.html",
"<pre> class <span class=\"strong\">ExtendsGeneric<K extends " +
"<a href=\"../typeannos/ClassParamA.html\" title=\"annotation in " +
@@ -119,7 +119,7 @@
},
// Test for type annotations on fields (Fields.java).
- /* @ignore 8012173
+ /* @ignore 8012173: javadoc does not receive all type annotations information from javac
{BUG_ID + FS + "typeannos" + FS + "DefaultScope.html",
"<pre><a href=\"../typeannos/Parameterized.html\" title=\"class in " +
"typeannos\">Parameterized</a><<a href=\"../typeannos/FldA.html\" " +
@@ -147,7 +147,7 @@
"typeannos\">@FldC</a> <a href=\"../typeannos/FldB.html\" title=\"" +
"annotation in typeannos\">@FldB</a> [] array2Deep</pre>"
},
- /* @ignore 8012173
+ /* @ignore 8012173: javadoc does not receive all type annotations information from javac
{BUG_ID + FS + "typeannos" + FS + "ModifiedScoped.html",
"<pre>public final <a href=\"../typeannos/Parameterized.html\" " +
"title=\"class in typeannos\">Parameterized</a><<a href=\"../" +
@@ -184,7 +184,7 @@
"<pre><a href=\"../typeannos/MRtnA.html\" title=\"annotation in " +
"typeannos\">@MRtnA</a> java.lang.String[][] array2()</pre>"
},
- /* @ignore 8012173
+ /* @ignore 8012173: javadoc does not receive all type annotations information from javac
{BUG_ID + FS + "typeannos" + FS + "MtdModifiedScoped.html",
"<pre>public final <a href=\"../typeannos/MtdParameterized.html\" " +
"title=\"class in typeannos\">MtdParameterized</a><<a href=\"../" +
@@ -205,7 +205,7 @@
"annotation in typeannos\">@MTyParamA</a> java.lang.String>" +
" void methodExtends()</pre>"
},
- /* @ignore 8012173
+ /* @ignore 8012173: javadoc does not receive all type annotations information from javac
{BUG_ID + FS + "typeannos" + FS + "UnscopedUnmodified.html",
"<pre><K extends <a href=\"../typeannos/MTyParamA.html\" title=\"" +
"annotation in typeannos\">@MTyParamA</a> <a href=\"../typeannos/" +
@@ -220,7 +220,7 @@
"MTyParamA.html\" title=\"annotation in typeannos\">@MTyParamA</a> " +
"java.lang.String> void methodExtends()</pre>"
},
- /* @ignore 8012173
+ /* @ignore 8012173: javadoc does not receive all type annotations information from javac
{BUG_ID + FS + "typeannos" + FS + "PublicModifiedMethods.html",
"<pre>public final <K extends <a href=\"../typeannos/" +
"MTyParamA.html\" title=\"annotation in typeannos\">@MTyParamA</a> " +
@@ -240,7 +240,7 @@
"ParaParameterized</a><java.lang.String,java.lang.String>" +
" a)</pre>"
},
- /* @ignore 8012173
+ /* @ignore 8012173: javadoc does not receive all type annotations information from javac
{BUG_ID + FS + "typeannos" + FS + "Parameters.html",
"<pre>void nestedParaParameterized(<a href=\"../typeannos/" +
"ParaParameterized.html\" title=\"class in typeannos\">" +
--- a/langtools/test/com/sun/javadoc/typeAnnotations/smoke/TestSmoke.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/com/sun/javadoc/typeAnnotations/smoke/TestSmoke.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -24,7 +24,6 @@
/*
* @test
* @bug 8006735
- * @ignore
* @summary Smoke test for ensuring that annotations are emited to javadoc
*
* @author Mahmood Ali <mali>
@@ -37,7 +36,7 @@
public class TestSmoke extends JavadocTester {
//Test information.
- private static final String BUG_ID = "NOT_SPECIFIED_YET";
+ private static final String BUG_ID = "8006735";
//Javadoc arguments.
private static final String[] ARGS = new String[] {
@@ -47,19 +46,37 @@
//Input for string search tests.
private static final String[][] TEST = {
{BUG_ID + FS + "pkg" + FS + "T0x1C.html", "@DA"},
+ /* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java
{BUG_ID + FS + "pkg" + FS + "T0x1D.html", "@DA"},
+ */
+ /* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java
{BUG_ID + FS + "pkg" + FS + "T0x0D.html", "@DA"},
+ */
{BUG_ID + FS + "pkg" + FS + "T0x06.html", "@DA"},
+ /* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java
{BUG_ID + FS + "pkg" + FS + "T0x0B.html", "@DA"},
+ */
+ /* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java
{BUG_ID + FS + "pkg" + FS + "T0x0F.html", "@DA"},
+ */
+ /* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java
{BUG_ID + FS + "pkg" + FS + "T0x20.html", "@DA"},
+ */
+ /* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java
{BUG_ID + FS + "pkg" + FS + "T0x22.html", "@DA"},
+ */
{BUG_ID + FS + "pkg" + FS + "T0x10.html", "@DA"},
{BUG_ID + FS + "pkg" + FS + "T0x10A.html", "@DA"},
{BUG_ID + FS + "pkg" + FS + "T0x12.html", "@DA"},
+ /* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java
{BUG_ID + FS + "pkg" + FS + "T0x11.html", "@DA"},
+ */
+ /* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java
{BUG_ID + FS + "pkg" + FS + "T0x13.html", "@DA"},
+ */
+ /* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java
{BUG_ID + FS + "pkg" + FS + "T0x15.html", "@DA"},
+ */
{BUG_ID + FS + "pkg" + FS + "T0x14.html", "@DA"},
{BUG_ID + FS + "pkg" + FS + "T0x16.html", "@DA"}
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/clinit/AnnoWithClinit1.java Wed May 08 23:54:45 2013 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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 8013485
+ * @summary Annotations that gets a clinit can't be verified for correct elements in a second compilation unit
+ * @compile AnnoWithClinit1.java
+ */
+
+public @interface AnnoWithClinit1 {
+ Foo f = new Foo();
+
+ @AnnoWithClinit1
+ static class C {} // this is in the same CU so there wont be a
+ // <clinit> when the this anno instance is checked
+
+ class Foo {}
+}
+
+
+@AnnoWithClinit1
+class BarAnnoClinit1 {}
+
+@interface AAnnoClinit1 {
+ Runnable r2 = new Runnable() { public void run() { }};
+ String str1();
+ String str2withdefault() default "bar";
+}
+
+@AAnnoClinit1(str1="value")
+class TestAnnoClinit1 { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/clinit/AnnoWithClinitFail.java Wed May 08 23:54:45 2013 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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 8013485
+ * @summary Annotations that gets a clinit can't be verified for correct elements in a second compilation unit
+ * @compile/fail/ref=AnnoWithClinitFail.out -XDrawDiagnostics AnnoWithClinitFail.java
+ */
+
+public @interface AnnoWithClinitFail {
+ Foo f = new Foo();
+
+ String foo();
+ String bar() default "bar";
+
+ @AnnoWithClinitFail
+ static class C {} // this is in the same CU so there wont be a
+ // <clinit> when the this anno instance is checked
+
+ class Foo {}
+}
+
+@AnnoWithClinitFail
+class TestAnnoWithClinitFail { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/clinit/AnnoWithClinitFail.out Wed May 08 23:54:45 2013 -0700
@@ -0,0 +1,3 @@
+AnnoWithClinitFail.java:37:5: compiler.err.annotation.missing.default.value: AnnoWithClinitFail, foo
+AnnoWithClinitFail.java:44:1: compiler.err.annotation.missing.default.value: AnnoWithClinitFail, foo
+2 errors
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest1.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest1.java Wed May 08 23:54:45 2013 -0700
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8005085 8005877 8004829 8005681 8006734 8006775
- * @ignore
+ * @ignore 8013409: test failures for type annotations
* @summary Combinations of Target ElementTypes on (repeated)type annotations.
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java Wed May 08 23:54:45 2013 -0700
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8005085 8005877 8004829 8005681 8006734 8006775
- * @ignore
+ * @ignore 8013409: test failures for type annotations
* @summary Combinations of Target ElementTypes on (repeated)type annotations.
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.java Wed May 08 23:54:45 2013 -0700
@@ -1,7 +1,7 @@
/*
* @test /nodynamiccopyright/
* @bug 8006733 8006775
- * @ignore
+ * @ignore 8013409: test failures for type annotations
* @summary A static outer class cannot be annotated.
* @author Werner Dietl
* @compile/fail/ref=CantAnnotateStaticClass.out -XDrawDiagnostics CantAnnotateStaticClass.java
--- a/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/MultiCatch.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/MultiCatch.java Wed May 08 23:54:45 2013 -0700
@@ -25,7 +25,7 @@
/*
* @test
- * @ignore // syntax not sure yet.
+ * @ignore 8013408: Need specification for type exceptions on multicatch
* @bug 8006775
* @summary new type annotation location: multicatch
* @author Werner Dietl
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java Wed May 08 23:54:45 2013 -0700
@@ -26,7 +26,7 @@
/*
* @test
* @bug 8006732 8006775
- * @ignore
+ * @ignore 8013408: Need specification for type exceptions on multicatch
* @summary Test population of reference info for multicatch exception parameters
* @author Werner Dietl
* @compile -g Driver.java ReferenceInfoUtil.java MultiCatch.java
--- a/langtools/test/tools/javac/defaultMethods/defaultMethodExecution/DefaultMethodRegressionTests.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/defaultMethods/defaultMethodExecution/DefaultMethodRegressionTests.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -25,7 +25,7 @@
/**
* @test
- * @ignore 8004360
+ * @ignore 8007517: DefaultMethodRegressionTests.java fail in TL
* @bug 8003639
* @summary convert lambda testng tests to jtreg and add them
* @run testng DefaultMethodRegressionTests
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/doctree/DocTreePathScannerTest.java Wed May 08 23:54:45 2013 -0700
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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 8009724
+ * @summary adding DocTreePath and DocTreePathScanner
+ */
+
+import com.sun.source.doctree.DocCommentTree;
+import com.sun.source.doctree.DocTree;
+import com.sun.source.doctree.DocTree.Kind;
+import com.sun.source.doctree.DocTreeVisitor;
+import com.sun.source.tree.ClassTree;
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.tree.MethodTree;
+import com.sun.source.tree.Tree;
+import com.sun.source.tree.VariableTree;
+import com.sun.source.util.DocTreePath;
+import com.sun.source.util.DocTreePathScanner;
+import com.sun.source.util.DocTreeScanner;
+import com.sun.source.util.DocTrees;
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TreePath;
+import com.sun.source.util.TreePathScanner;
+import com.sun.tools.javac.api.JavacTool;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import javax.lang.model.element.Name;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+
+public class DocTreePathScannerTest {
+ public static void main(String... args) throws Exception {
+ DocTreePathScannerTest t = new DocTreePathScannerTest();
+ t.run();
+ }
+
+ void run() throws Exception {
+ List<File> files = new ArrayList<File>();
+ File testSrc = new File(System.getProperty("test.src"));
+ for (File f: testSrc.listFiles()) {
+ if (f.isFile() && f.getName().endsWith(".java"))
+ files.add(f);
+ }
+
+ JavacTool javac = JavacTool.create();
+ StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null);
+
+ Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);
+
+ JavacTask t = javac.getTask(null, fm, null, null, null, fos);
+ DocTrees trees = DocTrees.instance(t);
+
+ Iterable<? extends CompilationUnitTree> units = t.parse();
+
+ DeclScanner ds = new DeclScanner(trees);
+ for (CompilationUnitTree unit: units) {
+ ds.scan(unit, null);
+ }
+
+ if (errors > 0)
+ throw new Exception(errors + " errors occurred");
+ }
+
+ void error(String msg) {
+ System.err.println("Error: " + msg);
+ errors++;
+ }
+
+ int errors;
+
+ class DeclScanner extends TreePathScanner<Void, Void> {
+ DocTrees trees;
+ DocTreePathScanner<Void,Void> cs;
+
+ DeclScanner(DocTrees trees) {
+ this.trees = trees;
+ cs = new CommentPathScanner();
+ }
+
+ @Override
+ public Void visitClass(ClassTree tree, Void ignore) {
+ super.visitClass(tree, ignore);
+ visitDecl(tree, tree.getSimpleName());
+ return null;
+ }
+
+ @Override
+ public Void visitMethod(MethodTree tree, Void ignore) {
+ super.visitMethod(tree, ignore);
+ visitDecl(tree, tree.getName());
+ return null;
+ }
+
+ @Override
+ public Void visitVariable(VariableTree tree, Void ignore) {
+ super.visitVariable(tree, ignore);
+ visitDecl(tree, tree.getName());
+ return null;
+ }
+
+ void visitDecl(Tree tree, Name name) {
+ TreePath path = getCurrentPath();
+ DocCommentTree dc = trees.getDocCommentTree(path);
+ if (dc != null)
+ cs.scan(new DocTreePath(path, dc), null);
+ }
+ }
+
+ class CommentPathScanner extends DocTreePathScanner<Void, Void> {
+ CommentPathScanner() {}
+
+ @Override
+ public Void scan(final DocTree tree, Void ignore) {
+ if (tree != null) {
+ DocTree previous = null;
+ for (DocTree current : getCurrentPath()) {
+ if (previous != null) {
+ final List<DocTree> children = new ArrayList<>();
+ current.accept(new DocTreeScanner<Void, Void>() {
+ @Override public Void scan(DocTree node, Void p) {
+ children.add(node);
+ return null;
+ }
+ }, null);
+
+ if (!children.contains(previous)) {
+ error("Invalid DocTreePath for: " + tree);
+ }
+ }
+
+ previous = current;
+ }
+ }
+ return super.scan(tree, ignore);
+ }
+ }
+
+}
--- a/langtools/test/tools/javac/doctree/ReferenceTest.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/doctree/ReferenceTest.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -36,6 +36,8 @@
import com.sun.source.doctree.ReferenceTree;
import com.sun.source.doctree.SeeTree;
import com.sun.source.doctree.TextTree;
+import com.sun.source.util.DocTreePath;
+import com.sun.source.util.DocTreePathScanner;
import com.sun.source.util.DocTreeScanner;
import com.sun.source.util.DocTrees;
import com.sun.source.util.TreePath;
@@ -125,7 +127,7 @@
return true;
}
- class DocCommentScanner extends DocTreeScanner<Void, Void> {
+ class DocCommentScanner extends DocTreePathScanner<Void, Void> {
TreePath path;
DocCommentTree dc;
@@ -135,7 +137,7 @@
void scan() {
dc = trees.getDocCommentTree(path);
- scan(dc, null);
+ scan(new DocTreePath(path, dc), null);
}
@Override
@@ -158,7 +160,7 @@
void checkReference(ReferenceTree tree, List<? extends DocTree> label) {
String sig = tree.getSignature();
- Element found = trees.getElement(path, tree);
+ Element found = trees.getElement(new DocTreePath(getCurrentPath(), tree));
if (found == null) {
System.err.println(sig + " NOT FOUND");
} else {
--- a/langtools/test/tools/javac/generics/7034511/T7034511a.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/generics/7034511/T7034511a.java Wed May 08 23:54:45 2013 -0700
@@ -1,11 +1,13 @@
/*
* @test /nodynamiccopyright/
- * @ignore backing out 7034511, see 7040883
+ * @ignore 7041019 Bogus type-variable substitution with array types with dependencies on accessibility check
* @bug 7034511 7040883
* @summary Loophole in typesafety
* @compile/fail/ref=T7034511a.out -XDrawDiagnostics T7034511a.java
*/
+// backing out 7034511, see 7040883
+
class T7034511a {
interface A<T> {
--- a/langtools/test/tools/javac/generics/7034511/T7034511b.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/generics/7034511/T7034511b.java Wed May 08 23:54:45 2013 -0700
@@ -1,11 +1,13 @@
/*
* @test /nodynamiccopyright/
- * @ignore backing out 7034511, see 7040883
+ * @ignore 7041019 Bogus type-variable substitution with array types with dependencies on accessibility check
* @bug 7034511 7040883
* @summary Loophole in typesafety
* @compile/fail/ref=T7034511b.out -XDrawDiagnostics T7034511b.java
*/
+// backing out 7034511, see 7040883
+
class T7034511b {
static class MyList<E> {
E toArray(E[] e) { return null; }
--- a/langtools/test/tools/javac/generics/OverrideBridge.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/generics/OverrideBridge.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -24,11 +24,13 @@
/*
* @test
* @bug 6337171 6996415
- * @ignore fix has been disabled as a consequence of 6996415
+ * @ignore 6996758: Investigate better override bridges strategy
* @summary javac should create bridge methods when type variable bounds restricted
* @run main OverrideBridge
*/
+// fix, and test, has been disabled as a consequence of 6996415
+
import java.io.*;
import java.net.URI;
import java.util.ArrayList;
--- a/langtools/test/tools/javac/lambda/TargetType36.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/lambda/TargetType36.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -23,7 +23,7 @@
/*
* @test
- * @ignore
+ * @ignore 8013404: Test awaits spec clarification
* @bug 8003280
* @summary Add lambda tests
* check that target type of cast is propagated to conditional subexpressions
--- a/langtools/test/tools/javac/lambda/TargetType53.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/lambda/TargetType53.java Wed May 08 23:54:45 2013 -0700
@@ -26,7 +26,7 @@
* @bug 8007464
* @summary Add graph inference support
* smoke test for graph inference
- * @ignore awaits stream API: 800NNNN
+ * @ignore 8008682: Core stream API classes
* @compile TargetType53.java
*/
import java.util.*;
--- a/langtools/test/tools/javac/lambda/TargetType54.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/lambda/TargetType54.java Wed May 08 23:54:45 2013 -0700
@@ -26,7 +26,7 @@
* @bug 8007464
* @summary Add graph inference support
* smoke test for graph inference
- * @ignore awaits stream API: 800NNNN
+ * @ignore 8008682: Core stream API classes
* @compile TargetType54.java
*/
import java.util.stream.*;
--- a/langtools/test/tools/javac/lambda/TargetType58.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/lambda/TargetType58.java Wed May 08 23:54:45 2013 -0700
@@ -26,7 +26,7 @@
* @bug 8007464
* @summary Add graph inference support
* more smoke tests for graph inference
- * @ignore awaits stream API: 800NNNN
+ * @ignore 8008682: Core stream API classes
* @compile TargetType58.java
*/
import java.util.*;
--- a/langtools/test/tools/javac/lambda/TargetType59.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/lambda/TargetType59.java Wed May 08 23:54:45 2013 -0700
@@ -26,7 +26,7 @@
* @bug 8007464
* @summary Add graph inference support
* more smoke tests for graph inference
- * @ignore awaits stream API: 800NNNN
+ * @ignore 8008682: Core stream API classes
* @compile TargetType59.java
*/
import java.util.*;
--- a/langtools/test/tools/javac/lambda/TargetType62.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/lambda/TargetType62.java Wed May 08 23:54:45 2013 -0700
@@ -26,7 +26,7 @@
* @bug 8007464
* @summary Add graph inference support
* check that new wildcards inference strategy doesn't run into 7190296
- * @ignore awaits stream API: 800NNNN
+ * @ignore 8008682: Core stream API classes
* @compile TargetType62.java
*/
import java.util.*;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/methodReference/TreeMakerParamsIsGoofy.java Wed May 08 23:54:45 2013 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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 8014023
+ * @summary When a method reference to a local class constructor is contained
+ * in a method whose number of parameters matches the number of
+ * constructor parameters compilation fails
+ * @compile TreeMakerParamsIsGoofy.java
+ * @run main TreeMakerParamsIsGoofy
+ */
+
+public class TreeMakerParamsIsGoofy {
+
+ interface III { }
+
+ interface UO {
+ III m(III x);
+ }
+
+ public static void main(String[] args) {
+ class BA implements III {
+ BA(III b) {
+ }
+ }
+
+ ts(BA::new);
+ }
+
+ static void ts(UO ba) {
+ }
+}
--- a/langtools/test/tools/javac/nativeHeaders/NativeHeaderTest.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/nativeHeaders/NativeHeaderTest.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 7150368 8003412
+ * @bug 7150368 8003412 8000407
* @summary javac should include basic ability to generate native headers
*/
@@ -125,17 +125,6 @@
}
@Test
- void oldAnnoTest(RunKind rk, GenKind gk) throws Exception {
- List<File> files = new ArrayList<File>();
- files.add(createFile("p/C.java",
- "@javax.tools.annotation.GenerateNativeHeader class C { }"));
-
- Set<String> expect = createSet("C.h");
-
- test(rk, gk, files, expect);
- }
-
- @Test
void annoTest(RunKind rk, GenKind gk) throws Exception {
List<File> files = new ArrayList<File>();
files.add(createFile("p/C.java",
@@ -147,18 +136,6 @@
}
@Test
- void oldAnnoNestedClassTest(RunKind rk, GenKind gk) throws Exception {
- List<File> files = new ArrayList<File>();
- files.add(createFile("p/C.java",
- "class C { @javax.tools.annotation.GenerateNativeHeader class Inner { } }"));
-
- Set<String> expect = createSet("C_Inner.h");
- if (gk == GenKind.FULL) expect.add("C.h");
-
- test(rk, gk, files, expect);
- }
-
- @Test
void annoNestedClassTest(RunKind rk, GenKind gk) throws Exception {
List<File> files = new ArrayList<File>();
files.add(createFile("p/C.java",
--- a/langtools/test/tools/javac/nativeHeaders/javahComparison/CompareTest.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/nativeHeaders/javahComparison/CompareTest.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 7150368 8003412
+ * @bug 7150368 8003412 8000407
* @summary javac should include basic ability to generate native headers
*/
--- a/langtools/test/tools/javac/nativeHeaders/javahComparison/TestClass2.java Wed Jul 05 18:54:28 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2007, 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.
- */
-
-import javax.tools.annotation.GenerateNativeHeader;
-
-@GenerateNativeHeader
-public class TestClass2 {
- byte b;
- short s;
- int i;
- long l;
- float f;
- double d;
- Object o;
- String t;
-}
--- a/langtools/test/tools/javac/nativeHeaders/javahComparison/TestClass3.java Wed Jul 05 18:54:28 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2007, 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.
- */
-
-import javax.tools.annotation.GenerateNativeHeader;
-
-@GenerateNativeHeader
-public class TestClass3 {
- public int tc3;
-
- public class Inner1 {
- public int tc3i1;
-
- public class Inner1A {
- public int tc3i1i1a;
- }
-
- public class Inner1B {
- public int tc3i1i1b;
- }
- }
-
- public class Inner2 {
- public int tc321;
-
- public class Inner2A {
- public int tc3i2i2a;
- }
-
- public class Inner2B {
- public int tc3i2i2b;
- }
- }
-}
-
--- a/langtools/test/tools/javac/plugin/showtype/Test.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/plugin/showtype/Test.java Wed May 08 23:54:45 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -23,7 +23,7 @@
/**
* @test
- * @bug 8001098 8004961
+ * @bug 8001098 8004961 8004082
* @summary Provide a simple light-weight "plug-in" mechanism for javac
*/
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA1Test.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA1Test.java Wed May 08 23:54:45 2013 -0700
@@ -22,13 +22,13 @@
*/
/*
- * @ignore
* @test
* @bug 8004822
* @author mnunez
* @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib
* @library supportingAnnotations
+ * @ignore 8013407: test failures for repeating annotations
* @build JavacTestingAbstractProcessor ElementRepAnnoTester
* @compile -processor ElementRepAnnoTester -proc:only
* MixRepeatableAndOfficialContainerInheritedA1Test.java
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB1Test.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB1Test.java Wed May 08 23:54:45 2013 -0700
@@ -22,13 +22,13 @@
*/
/*
- * @ignore
* @test
* @bug 8004822
* @author mnunez
* @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib
* @library supportingAnnotations
+ * @ignore 8013407: test failures for repeating annotations
* @build JavacTestingAbstractProcessor ElementRepAnnoTester
* @compile -processor ElementRepAnnoTester -proc:only
* MixRepeatableAndOfficialContainerInheritedB1Test.java
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB2Test.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB2Test.java Wed May 08 23:54:45 2013 -0700
@@ -22,13 +22,13 @@
*/
/*
- * @ignore
* @test
* @bug 8004822
* @author mnunez
* @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib
* @library supportingAnnotations
+ * @ignore 8013407: test failures for repeating annotations
* @build JavacTestingAbstractProcessor ElementRepAnnoTester
* @compile -processor ElementRepAnnoTester -proc:only
* MixRepeatableAndOfficialContainerInheritedB2Test.java
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideATest.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideATest.java Wed May 08 23:54:45 2013 -0700
@@ -22,13 +22,13 @@
*/
/*
- * @ignore
* @test
* @bug 8004822
* @author mnunez
* @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib
* @library supportingAnnotations
+ * @ignore 8013407: test failures for repeating annotations
* @build JavacTestingAbstractProcessor ElementRepAnnoTester
* @compile -processor ElementRepAnnoTester -proc:only RepeatableOverrideATest.java
*/
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideBTest.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideBTest.java Wed May 08 23:54:45 2013 -0700
@@ -22,13 +22,13 @@
*/
/*
- * @ignore
* @test
* @bug 8004822
* @author mnunez
* @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib
* @library supportingAnnotations
+ * @ignore 8013407: test failures for repeating annotations
* @build JavacTestingAbstractProcessor ElementRepAnnoTester
* @compile -processor ElementRepAnnoTester -proc:only RepeatableOverrideBTest.java
*/
--- a/langtools/test/tools/javap/output/RepeatingTypeAnnotations.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javap/output/RepeatingTypeAnnotations.java Wed May 08 23:54:45 2013 -0700
@@ -121,7 +121,7 @@
*/
@TestCase
- @ignore // 8008082:missing type annotation for cast
+ @ignore // 8008082: missing type annotation for cast
public static class TC1 extends RepeatingTypeAnnotations {
public TC1() {
setSrc(" static String so = \"hello world\";",
@@ -176,7 +176,7 @@
}
@TestCase
- @ignore // 8008082:missing type annotation for cast
+ @ignore // 8008082: missing type annotation for cast
public static class TC5 extends RepeatingTypeAnnotations {
public TC5() {
setSrc(" static String so = \"hello world\";",
@@ -231,7 +231,7 @@
}
@TestCase
- @ignore // 8008082:missing type annotation for cast
+ @ignore // 8008082: missing type annotation for cast
public static class TC9 extends RepeatingTypeAnnotations {
public TC9() {
setSrc(" public Test(@A @A @A Object o, @A int i, long l) {",
@@ -305,7 +305,7 @@
}
@TestCase
- @ignore // 8008082:missing type annotation for cast
+ @ignore // 8008082: missing type annotation for cast
public static class TC13 extends RepeatingTypeAnnotations {
public TC13() {
setSrc(" public @A @A @A String foo(@A @A @A Object o, @A int i, long l) {",
--- a/langtools/test/tools/javap/output/Tester.java Wed Jul 05 18:54:28 2017 +0200
+++ b/langtools/test/tools/javap/output/Tester.java Wed May 08 23:54:45 2013 -0700
@@ -128,8 +128,8 @@
/**
* Individual test-cases failing due to product bugs, may temporarily
- * be excluded by marking them like this:
- * @ignore // 1234567:bug synopsis
+ * be excluded by marking them like this, (where "at-" is replaced by "@")
+ * at-ignore // 1234567: bug synopsis
*/
@Retention(RetentionPolicy.RUNTIME)
@interface ignore { }