8345664: Use simple parameter type names in @link and @see tags

Reviewed-by: liach
This commit is contained in:
Hannes Wallnöfer 2024-12-06 16:39:08 +00:00
parent 4966419550
commit 573bcb6180
6 changed files with 28 additions and 16 deletions

View File

@ -271,7 +271,7 @@ public class LinkTaglet extends BaseTaglet {
}
if (utils.isExecutableElement(refMem)) {
if (refMemName.indexOf('(') < 0) {
refMemName += utils.makeSignature((ExecutableElement) refMem, null, true);
refMemName += utils.makeSignature((ExecutableElement) refMem, null, false, true);
}
if (overriddenMethod != null) {
// The method to actually link.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2024, 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,7 @@
/*
* @test
* @bug 4732864 6280605 7064544 8014636 8016328 8025633 8071982 8182765
* 8274781
* 8274781 8345664
* @summary Make sure that you can link from one member to another using
* non-qualified name, furthermore, ensure the right one is linked.
* @library ../../lib
@ -50,6 +50,17 @@ public class TestLinkTaglet extends JavadocTester {
"pkg", testSrc("checkPkg/B.java"));
checkExit(Exit.OK);
checkOutput("pkg/package-summary.html", true,
"""
Qualified Link: <a href="C.InnerC.html" title="class in pkg"><code>C.InnerC</code></a>.<br/>
Unqualified Link1: <a href="C.InnerC.html" title="class in pkg"><code>C.InnerC</code></a>.<br/>
Unqualified Link2: <a href="C.InnerC.html" title="class in pkg"><code>C.InnerC</code></a>.<br/>
Qualified Link: <a href="C.html#method(pkg.C.InnerC,pkg.C.InnerC2)"><code>C.method(pkg.\
C.InnerC, pkg.C.InnerC2)</code></a>.<br/>
Unqualified Link: <a href="C.html#method(pkg.C.InnerC,pkg.C.InnerC2)"><code>C.method(C.InnerC, C.InnerC2)</code></a>.<br/>
Unqualified Link: <a href="C.html#method(pkg.C.InnerC,pkg.C.InnerC2)"><code>C.method(InnerC, InnerC2)</code></a>.<br/>
Link w/o Signature: <a href="C.html#method(pkg.C.InnerC,pkg.C.InnerC2)"><code>C.method(C.InnerC, C.InnerC2)</code></a>.<br/>
Package Link: <a href="package-summary.html"><code>pkg</code></a>.<br/>""");
checkOutput("pkg/C.html", true,
"""
Qualified Link: <a href="C.InnerC.html" title="class in pkg"><code>C.InnerC</code></a>.<br/>
@ -59,6 +70,7 @@ public class TestLinkTaglet extends JavadocTester {
C.InnerC, pkg.C.InnerC2)</code></a>.<br/>
Unqualified Link: <a href="#method(pkg.C.InnerC,pkg.C.InnerC2)"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>
Unqualified Link: <a href="#method(pkg.C.InnerC,pkg.C.InnerC2)"><code>method(InnerC, InnerC2)</code></a>.<br/>
Link w/o Signature: <a href="#method(pkg.C.InnerC,pkg.C.InnerC2)"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>
Package Link: <a href="package-summary.html"><code>pkg</code></a>.<br/>""");
checkOutput("pkg/C.InnerC.html", true,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, 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
@ -76,7 +76,7 @@ public class TestLinkTagletWithModule extends JavadocTester {
<a href="../../../../m1/module-summary.html"><code>m1</code></a>
<a href="../../../../m1/com/m1/lib/package-summary.html"><code>package link</code></a>
<a href="../../../../m1/com/m1/lib/Lib.html" title="class in com.m1.lib"><code>Lib</code></a>
<a href="../../../../m1/com/m1/lib/Lib.html#method(java.lang.String)"><code>Lib.method(java.lang.String)</code></a>
<a href="../../../../m1/com/m1/lib/Lib.html#method(java.lang.String)"><code>Lib.method(String)</code></a>
<a href="../../../../m1/com/m1/lib/Lib.html#method(java.lang.String)"><code>Lib.method(String)</code></a>
<a href="../../../../m2/module-summary.html">m2</a>
<a href="../../../../m2/module-summary.html">m2</a>
@ -110,7 +110,7 @@ public class TestLinkTagletWithModule extends JavadocTester {
<a href="../../../../../out1/m1/com/m1/lib/Lib.html" title="class or interface in com.m1.lib"\
class="external-link"><code>Lib</code></a>
<a href="../../../../../out1/m1/com/m1/lib/Lib.html#method(java.lang.String)" title="class or\
interface in com.m1.lib" class="external-link"><code>Lib.method(java.lang.String)</code></a>
interface in com.m1.lib" class="external-link"><code>Lib.method(String)</code></a>
<a href="../../../../../out1/m1/com/m1/lib/Lib.html#method(java.lang.String)" title="class or\
interface in com.m1.lib" class="external-link"><code>Lib.method(String)</code></a>
<a href="../../../../../out1/m2/module-summary.html" class="external-link">m2</a>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2024, 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
@ -30,6 +30,7 @@ package pkg;
* Qualified Link: {@link #method(pkg.C.InnerC, pkg.C.InnerC2)}.<br/>
* Unqualified Link: {@link #method(C.InnerC, C.InnerC2)}.<br/>
* Unqualified Link: {@link #method(InnerC, InnerC2)}.<br/>
* Link w/o Signature: {@link #method}.<br/>
* Package Link: {@link pkg}.<br/>
*
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2024, 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 6758050 8025633 8182765
* @bug 6758050 8025633 8182765 8345664
* @summary Test HTML output for nested generic types.
* @library ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -49,7 +49,6 @@ public class TestNestedGenerics extends JavadocTester {
checkOutput("pkg/NestedGenerics.html", true,
"""
<div class="block">Contains <a href="#foo(java.util.Map)"><code>foo(java.util.Ma\
p&lt;A, java.util.Map&lt;A, A&gt;&gt;)</code></a></div>""");
<div class="block">Contains <a href="#foo(java.util.Map)"><code>foo(Map)</code></a></div>""");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, 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
@ -79,13 +79,13 @@ public class TestSeeTagWithModule extends JavadocTester {
<li><a href="../../../../m1/module-summary.html"><code>m1</code></a></li>
<li><a href="../../../../m1/com/m1/lib/package-summary.html"><code>com.m1.lib</code></a></li>
<li><a href="../../../../m1/com/m1/lib/Lib.html" title="class in com.m1.lib"><code>Lib</code></a></li>
<li><a href="../../../../m1/com/m1/lib/Lib.html#method(java.lang.String)"><code>Lib.method(java.lang.String)</code></a></li>
<li><a href="../../../../m1/com/m1/lib/Lib.html#method(java.lang.String)"><code>Lib.method(String)</code></a></li>
<li><a href="../../../../m1/com/m1/lib/Lib.html#method(java.lang.String)"><code>Lib.method(String)</code></a></li>
<li><a href="../../../../m2/module-summary.html"><code>m2</code></a></li>
<li><a href="../../../../m2/module-summary.html"><code>m2</code></a></li>
<li><a href="../../../../m2/com/m2/lib/package-summary.html"><code>com.m2.lib</code></a></li>
<li><a href="../../../../m2/com/m2/lib/Lib.html" title="class in com.m2.lib"><code>Lib</code></a></li>
<li><a href="../../../../m2/com/m2/lib/Lib.html#method(java.lang.String)"><code>Lib.method(java.lang.String)</code></a></li>
<li><a href="../../../../m2/com/m2/lib/Lib.html#method(java.lang.String)"><code>Lib.method(String)</code></a></li>
<li><a href="../../../../m2/com/m2/lib/Lib.html#method(java.lang.String)"><code>Lib.method(String)</code></a></li>
""");
}
@ -115,7 +115,7 @@ public class TestSeeTagWithModule extends JavadocTester {
<li><a href="../../../../../out1/m1/com/m1/lib/package-summary.html" class="external-link"><code>m1/com.m1.lib</code></a></li>
<li><a href="../../../../../out1/m1/com/m1/lib/Lib.html" title="class or interface in com.m1.lib" class="external-link"><code>Lib</code></a></li>
<li><a href="../../../../../out1/m1/com/m1/lib/Lib.html#method(java.lang.String)" title="class or \
interface in com.m1.lib" class="external-link"><code>Lib.method(java.lang.String)</code></a></li>
interface in com.m1.lib" class="external-link"><code>Lib.method(String)</code></a></li>
<li><a href="../../../../../out1/m1/com/m1/lib/Lib.html#method(java.lang.String)" title="class or \
interface in com.m1.lib" class="external-link"><code>Lib.method(String)</code></a></li>
<li><a href="../../../../../out1/m2/module-summary.html" class="external-link"><code>m2</code></a></li>
@ -123,7 +123,7 @@ public class TestSeeTagWithModule extends JavadocTester {
<li><a href="../../../../../out1/m2/com/m2/lib/package-summary.html" class="external-link"><code>m2/com.m2.lib</code></a></li>
<li><a href="../../../../../out1/m2/com/m2/lib/Lib.html" title="class or interface in com.m2.lib" class="external-link"><code>Lib</code></a></li>
<li><a href="../../../../../out1/m2/com/m2/lib/Lib.html#method(java.lang.String)" title="class or \
interface in com.m2.lib" class="external-link"><code>Lib.method(java.lang.String)</code></a></li>
interface in com.m2.lib" class="external-link"><code>Lib.method(String)</code></a></li>
<li><a href="../../../../../out1/m2/com/m2/lib/Lib.html#method(java.lang.String)" title="class or \
interface in com.m2.lib" class="external-link"><code>Lib.method(String)</code></a></li>
""");