8211901: javadoc generates broken links on deprecated items page

Reviewed-by: jjg
This commit is contained in:
Priya Lakshmi Muthuswamy 2018-10-17 15:28:36 +05:30
parent 05f0d11553
commit 4e1c510215
5 changed files with 103 additions and 3 deletions

View File

@ -1485,7 +1485,7 @@ public class Utils {
return false;
}
if (!getBlockTags(m).isEmpty())
if (!getBlockTags(m).isEmpty() || isDeprecated(m))
return false;
List<? extends DocTree> fullBody = getFullBody(m);

View File

@ -248,7 +248,7 @@ public class VisibleMemberTable {
* @param e the method to check
* @return the overridden method or null
*/
public ExecutableElement getsimplyOverriddenMethod(ExecutableElement e) {
public ExecutableElement getSimplyOverriddenMethod(ExecutableElement e) {
ensureInitialized();
OverridingMethodInfo found = overriddenMethodTable.get(e);
@ -869,7 +869,7 @@ public class VisibleMemberTable {
public List<ExecutableElement> getImplementedMethods(ExecutableElement method) {
ImplementedMethods imf = getImplementedMethodsFinder(method);
return imf.getImplementedMethods().stream()
.filter(m -> getsimplyOverriddenMethod(m) == null)
.filter(m -> getSimplyOverriddenMethod(m) == null)
.collect(Collectors.toList());
}

View File

@ -0,0 +1,64 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8211901
* @summary javadoc generates broken links on deprecated items page
* @library ../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
* @build JavadocTester
* @run main TestOverriddenDeprecatedMethods
*/
public class TestOverriddenDeprecatedMethods extends JavadocTester {
public static void main(String args[]) throws Exception {
TestOverriddenDeprecatedMethods tester = new TestOverriddenDeprecatedMethods();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out-deprecated",
"-sourcepath", testSrc,
"--override-methods","summary",
"pkg1");
checkExit(Exit.OK);
checkOrder("pkg1/SubClass.html",
"Method Summary",
"Methods declared in class&nbsp;pkg1.<a href=\"BaseClass.html\" title=\"class in pkg1\">"
+ "BaseClass</a>",
"<a href=\"BaseClass.html#func3()\">func3</a>");
checkOrder("pkg1/SubClass.html",
"Method Detail",
"@Deprecated\npublic&nbsp;void&nbsp;func1()",
"<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span></div>",
"@Deprecated\npublic&nbsp;void&nbsp;func2()",
"<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span></div>",
"<div class=\"block\">deprecated with comments</div>");
}
}

View File

@ -50,4 +50,22 @@ public class BaseClass {
*/
public void overridenMethodWithDocsToCopy() {}
/**
* @deprecated func1 deprecated
*/
@Deprecated
public void func1() {}
/**
* @deprecated func2 deprecated
*/
@Deprecated
public void func2() {}
/**
* @deprecated func3 deprecated
*/
@Deprecated
public void func3() {}
}

View File

@ -48,4 +48,22 @@ public class SubClass extends BaseClass {
public void privateMethod() {}
public void overridenMethodWithDocsToCopy() {}
/**
* {@inheritDoc}
*/
@Deprecated
public void func1() {}
/**
* deprecated with comments
*/
@Deprecated
public void func2() {}
/**
* {@inheritDoc}
*/
public void func3() {}
}