8241969: Type annotation is not shown for wildcard type in Javadoc

Reviewed-by: jjg
This commit is contained in:
Hannes Wallnöfer 2020-06-19 17:24:46 +02:00
parent ffbee17d8a
commit 983e012c9f
2 changed files with 32 additions and 2 deletions
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links
test/langtools/jdk/javadoc/doclet/testTypeAnnotations

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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
@ -109,6 +109,7 @@ public abstract class LinkFactory {
@Override
public Content visitWildcard(WildcardType type, LinkInfo linkInfo) {
linkInfo.isTypeBound = true;
link.add(getTypeAnnotationLinks(linkInfo));
link.add("?");
TypeMirror extendsBound = type.getExtendsBound();
if (extendsBound != null) {

@ -24,7 +24,7 @@
/*
* @test
* @bug 8005091 8009686 8025633 8026567 6469562 8071982 8071984 8162363 8175200 8186332 8182765
* 8187288
* 8187288 8241969
* @summary Make sure that type annotations are displayed correctly
* @library ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -335,6 +335,35 @@ public class TestTypeAnnotations extends JavadocTester {
tation in typeannos">@WldB</a>("m") java.lang.String&gt;</span>&nbsp;<span class\
="member-name">returnWcExtends</span>()</div>""");
checkOutput("typeannos/SelfTest.html", true,
"""
<div class="member-signature"><span class="return-type"><a href="MyList.html" ti\
tle="class in typeannos">MyList</a>&lt;<a href="WldA.html" title="annotation in \
typeannos">@WldA</a> ?&gt;</span>&nbsp;<span class="member-name">returnWcExtends\
</span>()</div>""",
"""
<div class="member-signature"><span class="return-type"><a href="MyList.html" ti\
tle="class in typeannos">MyList</a>&lt;<a href="WldA.html" title="annotation in \
typeannos">@WldA</a> ? extends <a href="WldA.html" title="annotation in typeanno\
s">@WldA</a> <a href="MyList.html" title="class in typeannos">MyList</a>&lt;<a h\
ref="WldB.html" title="annotation in typeannos">@WldB</a>("m") ?&gt;&gt;</span>&\
nbsp;<span class="member-name">complex</span>()</div>""");
checkOutput("typeannos/SelfWithValue.html", true,
"""
<div class="member-signature"><span class="return-type"><a href="MyList.html" ti\
tle="class in typeannos">MyList</a>&lt;<a href="WldB.html" title="annotation in \
typeannos">@WldB</a>("m") ?&gt;</span>&nbsp;<span class="member-name">returnWcEx\
tends</span>()</div>""",
"""
<div class="member-signature"><span class="return-type"><a href="MyList.html" ti\
tle="class in typeannos">MyList</a>&lt;<a href="WldB.html" title="annotation in \
typeannos">@WldB</a>("m") ? extends <a href="MyList.html" title="class in typean\
nos">MyList</a>&lt;<a href="WldB.html" title="annotation in typeannos">@WldB</a>\
("m") ? super java.lang.String&gt;&gt;</span>&nbsp;<span class="member-name">com\
plex</span>()</div>""");
// Test for receiver annotations (Receivers.java).
checkOutput("typeannos/DefaultUnmodified.html", true,
"""