Skip to content

Commit 2cf3524

Browse files
liachpavelrappo
authored andcommitted
8325433: Type annotations on primitive types are not linked
Reviewed-by: gli, prappo
1 parent 5056902 commit 2cf3524

File tree

5 files changed

+53
-9
lines changed

5 files changed

+53
-9
lines changed

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlLinkFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ public Content getLink(HtmlLinkInfo linkInfo) {
9696
// handles primitives, no types and error types
9797
@Override
9898
protected Content defaultAction(TypeMirror type, HtmlLinkInfo linkInfo) {
99-
link.add(utils.getTypeName(type, false));
99+
link.add(getTypeAnnotationLinks(linkInfo));
100+
link.add(utils.getTypeSignature(type, false, false));
100101
return link;
101102
}
102103

test/langtools/jdk/javadoc/doclet/testTypeAnnotations/TestTypeAnnotations.java

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
2424
/*
2525
* @test
2626
* @bug 8005091 8009686 8025633 8026567 6469562 8071982 8071984 8162363 8175200 8186332 8182765
27-
* 8187288 8241969 8259216
27+
* 8187288 8241969 8259216 8325433
2828
* @summary Make sure that type annotations are displayed correctly
2929
* @library ../../lib
3030
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@@ -144,7 +144,17 @@ annotation interface in typeannos">@FldA</a> java.lang.String,<wbr><a href="FldB
144144
le="annotation interface in typeannos">@FldB</a> [] <a href="FldC.html" title="a\
145145
nnotation interface in typeannos">@FldC</a> <a href="FldA.html" title="annotatio\
146146
n interface in typeannos">@FldA</a> []</span>&nbsp;<span class="element-name">ar\
147-
ray2Deep</span></div>""");
147+
ray2Deep</span></div>""",
148+
149+
"""
150+
<div class="member-signature"><span class="return-type"><a href="FldA.html" titl\
151+
e="annotation interface in typeannos">@FldA</a> int</span>&nbsp;<span cl\
152+
ass="element-name">primitive</span></div>""",
153+
"""
154+
<div class="member-signature"><span class="return-type"><a href="FldA.html" titl\
155+
e="annotation interface in typeannos">@FldA</a> int <a href="FldB.h\
156+
tml" title="annotation interface in typeannos">@FldB</a> []</span>&nbsp;<span cl\
157+
ass="element-name">primitiveArray1Deep</span></div>""");
148158

149159
checkOutput("typeannos/ModifiedScoped.html", true,
150160
"""
@@ -182,7 +192,18 @@ interface in typeannos">@FldB</a> java.lang.String&gt;</span>&nbsp;<span class=\
182192
"""
183193
<div class="member-signature"><span class="return-type"><a href="MRtnA.html" tit\
184194
le="annotation interface in typeannos">@MRtnA</a> java.lang.String[][]</span>&nb\
185-
sp;<span class="element-name">array2</span>()</div>""");
195+
sp;<span class="element-name">array2</span>()</div>""",
196+
197+
"""
198+
<div class="member-signature"><span class="return-type"><a href="MRtnA.html" tit\
199+
le="annotation interface in typeannos">@MRtnA</a> int</span>&nbsp;\
200+
<span class="element-name">primitive</span>()</div>""",
201+
202+
"""
203+
<div class="member-signature"><span class="return-type"><a href="MRtnA.html" tit\
204+
le="annotation interface in typeannos">@MRtnA</a> int <a href="MRtn\
205+
B.html" title="annotation interface in typeannos">@MRtnB</a> []</span>&nbsp;<spa\
206+
n class="element-name">primitiveArray1Deep</span>()</div>""");
186207

187208
checkOutput("typeannos/MtdModifiedScoped.html", true,
188209
"""
@@ -255,7 +276,20 @@ tation interface in typeannos">@ParamB</a> java.lang.String&gt;&nbsp;a)</span></
255276
amA.html" title="annotation interface in typeannos">@ParamA</a> java.lang.String\
256277
<a href="ParamB.html" title="annotation interface in typeannos">@ParamB</a> [] \
257278
<a href="ParamA.html" title="annotation interface in typeannos">@ParamA</a> []&n\
258-
bsp;a)</span></div>""");
279+
bsp;a)</span></div>""",
280+
281+
"""
282+
<div class="member-signature"><span class="return-type">void</span>&nbsp;<span c\
283+
lass="element-name">primitive</span><wbr><span class="parameters">(<a href="Par\
284+
amA.html" title="annotation interface in typeannos">@ParamA</a> int&nbsp;a)</sp\
285+
an></div>""",
286+
287+
"""
288+
<div class="member-signature"><span class="return-type">void</span>&nbsp;<span c\
289+
lass="element-name">primitiveArray1Deep</span><wbr><span class="parameters">(<a \
290+
href="ParamA.html" title="annotation interface in typeannos">@ParamA</a> int <a \
291+
href="ParamB.html" title="annotation interface in typeannos">@ParamB</a> []&nbsp\
292+
;a)</span></div>""");
259293

260294
// Test for type annotations on throws (Throws.java).
261295
checkOutput("typeannos/ThrDefaultUnmodified.html", true,

test/langtools/jdk/javadoc/doclet/testTypeAnnotations/typeannos/Fields.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,9 @@ class DefaultScope {
4747
// Old-style array syntax
4848
String array2FirstOld @FldA [];
4949
String array2SecondOld [] @FldB [];
50+
51+
@FldA int primitive;
52+
@FldA int @FldB [] primitiveArray1Deep;
5053
}
5154

5255
class ModifiedScoped {

test/langtools/jdk/javadoc/doclet/testTypeAnnotations/typeannos/MethodReturnType.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -49,6 +49,9 @@ class MtdDefaultScope {
4949
// Old-style array syntax
5050
String array2FirstOld() @MRtnA [] { return null; }
5151
String array2SecondOld() [] @MRtnB [] { return null; }
52+
53+
@MRtnA int primitive() { return 0; }
54+
@MRtnA int @MRtnB [] primitiveArray1Deep() { return null; }
5255
}
5356

5457
class MtdModifiedScoped {

test/langtools/jdk/javadoc/doclet/testTypeAnnotations/typeannos/Parameters.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,9 @@ void array2(@ParamA String [] [] a) {}
4242
void array2Deep(@ParamA String @ParamA [] @ParamB [] a) {}
4343
void array2First(String @ParamA [] [] a) {}
4444
void array2Second(String [] @ParamB [] a) {}
45+
46+
void primitive(@ParamA int a) {}
47+
void primitiveArray1Deep(@ParamA int @ParamB [] a) {}
4548
}
4649

4750
class ParaParameterized<K, V> { }

0 commit comments

Comments
 (0)