Mercurial > hg > openjdk > jdk8 > langtools
changeset 1949:14faef2b51eb
8017191: Javadoc is confused by @link to imported classes outside of the set of generated packages
Reviewed-by: bpatel
author | jjg |
---|---|
date | Wed, 14 Aug 2013 16:41:01 -0700 |
parents | 3ab468194f11 |
children | fac0d1bb87f2 |
files | src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java src/share/classes/com/sun/tools/doclets/formats/html/markup/StringContent.java test/com/sun/javadoc/testSeeTag/TestSeeTag.java test/com/sun/javadoc/testSeeTag/pkg/Test.java |
diffstat | 4 files changed, 115 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java Wed Aug 14 07:07:55 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java Wed Aug 14 16:41:01 2013 -0700 @@ -109,7 +109,7 @@ } } // Can't link so just write label. - link.addContent(label.toString()); + link.addContent(label); if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { link.addContent(getTypeParameterLinks(linkInfo)); }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/StringContent.java Wed Aug 14 07:07:55 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/StringContent.java Wed Aug 14 16:41:01 2013 -0700 @@ -70,6 +70,7 @@ * DocletAbortException because it * is not supported. */ + @Override public void addContent(Content content) { throw new DocletAbortException(); } @@ -80,6 +81,7 @@ * * @param strContent string content to be added */ + @Override public void addContent(String strContent) { appendChars(strContent); } @@ -87,10 +89,12 @@ /** * {@inheritDoc} */ + @Override public boolean isEmpty() { return (stringContent.length() == 0); } + @Override public int charCount() { return RawHtml.charCount(stringContent.toString()); } @@ -98,6 +102,7 @@ /** * {@inheritDoc} */ + @Override public String toString() { return stringContent.toString(); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/javadoc/testSeeTag/TestSeeTag.java Wed Aug 14 16:41:01 2013 -0700 @@ -0,0 +1,80 @@ +/* + * 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 8017191 + * @summary Javadoc is confused by at-link to imported classes outside of the set of generated packages + * @author jjg + * @library ../lib/ + * @build JavadocTester TestSeeTag + * @run main TestSeeTag + */ + +public class TestSeeTag extends JavadocTester { + + //Test information. + private static final String BUG_ID = "8017191"; + private static final String OUTPUT_DIR = BUG_ID; + + //Javadoc arguments. + private static final String[] ARGS = new String[] { + "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg" + }; + + //Input for string search tests. + private static final String[][] TEST = { + { OUTPUT_DIR + FS + "pkg" + FS + "Test.html", + "<code>List</code>" + } + }; + private static final String[][] NEGATED_TEST = { + { OUTPUT_DIR + FS + "pkg" + FS + "Test.html", + "<code>List</code>" + } + }; + + /** + * The entry point of the test. + * @param args the array of command line arguments. + */ + public static void main(String[] args) { + TestSeeTag tester = new TestSeeTag(); + 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/test/com/sun/javadoc/testSeeTag/pkg/Test.java Wed Aug 14 16:41:01 2013 -0700 @@ -0,0 +1,29 @@ +/* + * 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; +import java.util.List; + +/** @see List */ +public class Test { } +