8187288: bad (no) wrapping for modifier and type column
Reviewed-by: jjg
This commit is contained in:
parent
aaf546777f
commit
6dca162699
@ -25,11 +25,13 @@
|
||||
|
||||
package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.lang.model.element.AnnotationMirror;
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.type.DeclaredType;
|
||||
import javax.lang.model.type.TypeMirror;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
@ -131,6 +133,52 @@ public class LinkFactoryImpl extends LinkFactory {
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected Content getTypeParameterLinks(LinkInfo linkInfo, boolean isClassLabel){
|
||||
Content links = newContent();
|
||||
List<TypeMirror> vars = new ArrayList<>();
|
||||
TypeMirror ctype = linkInfo.type != null
|
||||
? utils.getComponentType(linkInfo.type)
|
||||
: null;
|
||||
if (linkInfo.executableElement != null) {
|
||||
linkInfo.executableElement.getTypeParameters().stream().forEach((t) -> {
|
||||
vars.add(t.asType());
|
||||
});
|
||||
} else if (linkInfo.type != null && utils.isDeclaredType(linkInfo.type)) {
|
||||
((DeclaredType)linkInfo.type).getTypeArguments().stream().forEach(vars::add);
|
||||
} else if (ctype != null && utils.isDeclaredType(ctype)) {
|
||||
((DeclaredType)ctype).getTypeArguments().stream().forEach(vars::add);
|
||||
} else if (linkInfo.typeElement != null) {
|
||||
linkInfo.typeElement.getTypeParameters().stream().forEach((t) -> {
|
||||
vars.add(t.asType());
|
||||
});
|
||||
} else {
|
||||
// Nothing to document.
|
||||
return links;
|
||||
}
|
||||
if (((linkInfo.includeTypeInClassLinkLabel && isClassLabel)
|
||||
|| (linkInfo.includeTypeAsSepLink && !isClassLabel)) && !vars.isEmpty()) {
|
||||
links.addContent("<");
|
||||
boolean many = false;
|
||||
for (TypeMirror t : vars) {
|
||||
if (many) {
|
||||
links.addContent(",");
|
||||
links.addContent(Contents.ZERO_WIDTH_SPACE);
|
||||
}
|
||||
links.addContent(getTypeParameterLink(linkInfo, t));
|
||||
many = true;
|
||||
}
|
||||
links.addContent(">");
|
||||
}
|
||||
return links;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a link to the given type parameter.
|
||||
*
|
||||
* @param linkInfo the information about the link to construct
|
||||
* @param typeParam the type parameter to link to
|
||||
* @return the link
|
||||
*/
|
||||
protected Content getTypeParameterLink(LinkInfo linkInfo, TypeMirror typeParam) {
|
||||
LinkInfoImpl typeLinkInfo = new LinkInfoImpl(m_writer.configuration,
|
||||
((LinkInfoImpl) linkInfo).getContext(), typeParam);
|
||||
|
@ -566,7 +566,6 @@ th.colFirst, th.colSecond, th.colLast, th.colConstructorName, th.colDeprecatedIt
|
||||
padding:8px 3px 3px 7px;
|
||||
}
|
||||
td.colFirst, th.colFirst {
|
||||
white-space:nowrap;
|
||||
font-size:13px;
|
||||
}
|
||||
td.colSecond, th.colSecond, td.colLast, th.colConstructorName, th.colDeprecatedItemName, th.colLast {
|
||||
@ -823,6 +822,9 @@ ul.ui-autocomplete li {
|
||||
margin: -100px 0 0 100px;
|
||||
z-index: 1;
|
||||
}
|
||||
.details pre {
|
||||
white-space:normal;
|
||||
}
|
||||
|
||||
/*
|
||||
* Styles for user-provided tables.
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package jdk.javadoc.internal.doclets.toolkit.util.links;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.lang.model.element.Element;
|
||||
@ -218,13 +217,14 @@ public abstract class LinkFactory {
|
||||
protected abstract Content getClassLink(LinkInfo linkInfo);
|
||||
|
||||
/**
|
||||
* Returns a link to the given type parameter.
|
||||
* Returns links to the type parameters.
|
||||
*
|
||||
* @param linkInfo the information about the link to construct
|
||||
* @param typeParam the type parameter to link to
|
||||
* @return the link
|
||||
* @param isClassLabel true if this is a class label, or false if it is
|
||||
* the type parameters portion of the link
|
||||
* @return the links to the type parameters
|
||||
*/
|
||||
protected abstract Content getTypeParameterLink(LinkInfo linkInfo, TypeMirror typeParam);
|
||||
protected abstract Content getTypeParameterLinks(LinkInfo linkInfo, boolean isClassLabel);
|
||||
|
||||
/**
|
||||
* Returns links to the type parameters.
|
||||
@ -236,51 +236,5 @@ public abstract class LinkFactory {
|
||||
return getTypeParameterLinks(linkInfo, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns links to the type parameters.
|
||||
*
|
||||
* @param linkInfo the information about the link to construct
|
||||
* @param isClassLabel true if this is a class label, or false if it is
|
||||
* the type parameters portion of the link
|
||||
* @return the links to the type parameters
|
||||
*/
|
||||
public Content getTypeParameterLinks(LinkInfo linkInfo, boolean isClassLabel) {
|
||||
Content links = newContent();
|
||||
List<TypeMirror> vars = new ArrayList<>();
|
||||
TypeMirror ctype = linkInfo.type != null
|
||||
? utils.getComponentType(linkInfo.type)
|
||||
: null;
|
||||
if (linkInfo.executableElement != null) {
|
||||
linkInfo.executableElement.getTypeParameters().stream().forEach((t) -> {
|
||||
vars.add(t.asType());
|
||||
});
|
||||
} else if (linkInfo.type != null && utils.isDeclaredType(linkInfo.type)) {
|
||||
((DeclaredType)linkInfo.type).getTypeArguments().stream().forEach(vars::add);
|
||||
} else if (ctype != null && utils.isDeclaredType(ctype)) {
|
||||
((DeclaredType)ctype).getTypeArguments().stream().forEach(vars::add);
|
||||
} else if (linkInfo.typeElement != null) {
|
||||
linkInfo.typeElement.getTypeParameters().stream().forEach((t) -> {
|
||||
vars.add(t.asType());
|
||||
});
|
||||
} else {
|
||||
// Nothing to document.
|
||||
return links;
|
||||
}
|
||||
if (((linkInfo.includeTypeInClassLinkLabel && isClassLabel)
|
||||
|| (linkInfo.includeTypeAsSepLink && !isClassLabel)) && !vars.isEmpty()) {
|
||||
links.addContent("<");
|
||||
boolean many = false;
|
||||
for (TypeMirror t : vars) {
|
||||
if (many) {
|
||||
links.addContent(",");
|
||||
}
|
||||
links.addContent(getTypeParameterLink(linkInfo, t));
|
||||
many = true;
|
||||
}
|
||||
links.addContent(">");
|
||||
}
|
||||
return links;
|
||||
}
|
||||
|
||||
public abstract Content getTypeAnnotationLinks(LinkInfo linkInfo);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 4682448 4947464 5029946 8025633 8026567 8035473 8139101 8175200
|
||||
8186332 8186703 8182765
|
||||
8186332 8186703 8182765 8187288
|
||||
* @summary Verify that the public modifier does not show up in the
|
||||
* documentation for public methods, as recommended by the JLS.
|
||||
* If A implements I and B extends A, B should be in the list of
|
||||
@ -249,14 +249,14 @@ public class TestInterface extends JavadocTester {
|
||||
+ "<a href=\"Spliterator.OfInt.html\" title=\"type parameter in Spliterator.OfInt\">"
|
||||
+ "Integer</a>>, <a href=\"Spliterator.OfPrimitive.html\" title=\"interface in pkg2\">"
|
||||
+ "Spliterator.OfPrimitive</a><<a href=\"Spliterator.OfPrimitive.html\" "
|
||||
+ "title=\"type parameter in Spliterator.OfPrimitive\">T</a>,<a href=\"Spliterator.OfPrimitive.html\" "
|
||||
+ "title=\"type parameter in Spliterator.OfPrimitive\">T_CONS</a>,"
|
||||
+ "title=\"type parameter in Spliterator.OfPrimitive\">T</a>,​<a href=\"Spliterator.OfPrimitive.html\" "
|
||||
+ "title=\"type parameter in Spliterator.OfPrimitive\">T_CONS</a>,​"
|
||||
+ "<a href=\"Spliterator.OfPrimitive.html\" title=\"type parameter in Spliterator.OfPrimitive\">"
|
||||
+ "T_SPLITR</a> extends <a href=\"Spliterator.OfPrimitive.html\" title=\"interface in pkg2\">"
|
||||
+ "Spliterator.OfPrimitive</a><<a href=\"Spliterator.OfPrimitive.html\" "
|
||||
+ "title=\"type parameter in Spliterator.OfPrimitive\">T</a>,"
|
||||
+ "title=\"type parameter in Spliterator.OfPrimitive\">T</a>,​"
|
||||
+ "<a href=\"Spliterator.OfPrimitive.html\" title=\"type parameter in Spliterator.OfPrimitive\">"
|
||||
+ "T_CONS</a>,<a href=\"Spliterator.OfPrimitive.html\" title=\"type parameter in Spliterator.OfPrimitive\">"
|
||||
+ "T_CONS</a>,​<a href=\"Spliterator.OfPrimitive.html\" title=\"type parameter in Spliterator.OfPrimitive\">"
|
||||
+ "T_SPLITR</a>>></code>");
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344 8025633 8026567 8162363
|
||||
* 8175200 8186332 8182765 8196202
|
||||
* 8175200 8186332 8182765 8196202 8187288
|
||||
* @summary Run Javadoc on a set of source files that demonstrate new
|
||||
* language features. Check the output to ensure that the new
|
||||
* language features are properly documented.
|
||||
@ -146,7 +146,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
|
||||
+ "<dd><code>V</code> - This is the second type "
|
||||
+ "parameter.",
|
||||
// Signature of method with type parameters
|
||||
"public <T extends java.util.List,V> "
|
||||
"public <T extends java.util.List,​V> "
|
||||
+ "java.lang.String[] methodThatHasTypeParameters",
|
||||
// Method that returns TypeParameters
|
||||
"<td class=\"colFirst\"><code><a href=\"TypeParameters.html\" "
|
||||
|
@ -24,6 +24,7 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 8005091 8009686 8025633 8026567 6469562 8071982 8071984 8162363 8175200 8186332 8182765
|
||||
* 8187288
|
||||
* @summary Make sure that type annotations are displayed correctly
|
||||
* @author Bhavesh Patel
|
||||
* @library ../lib
|
||||
@ -89,7 +90,7 @@ public class TestTypeAnnotations extends JavadocTester {
|
||||
checkOutput("typeannos/TwoBounds.html", true,
|
||||
"<pre>class <span class=\"typeNameLabel\">TwoBounds<K extends <a href=\""
|
||||
+ "ClassParamA.html\" title=\"annotation in typeannos\">"
|
||||
+ "@ClassParamA</a> java.lang.String,V extends <a href=\""
|
||||
+ "@ClassParamA</a> java.lang.String,​V extends <a href=\""
|
||||
+ "ClassParamB.html\" title=\"annotation in typeannos\">@ClassParamB"
|
||||
+ "</a> java.lang.String></span>");
|
||||
|
||||
@ -114,7 +115,7 @@ public class TestTypeAnnotations extends JavadocTester {
|
||||
checkOutput("typeannos/DefaultScope.html", true,
|
||||
"<pre><a href=\"Parameterized.html\" title=\"class in "
|
||||
+ "typeannos\">Parameterized</a><<a href=\"FldA.html\" "
|
||||
+ "title=\"annotation in typeannos\">@FldA</a> java.lang.String,<a "
|
||||
+ "title=\"annotation in typeannos\">@FldA</a> java.lang.String,​<a "
|
||||
+ "href=\"FldB.html\" title=\"annotation in typeannos\">"
|
||||
+ "@FldB</a> java.lang.String> bothTypeArgs</pre>",
|
||||
|
||||
@ -141,9 +142,9 @@ public class TestTypeAnnotations extends JavadocTester {
|
||||
+ "FldA.html\" title=\"annotation in typeannos\">@FldA</a> "
|
||||
+ "<a href=\"Parameterized.html\" title=\"class in "
|
||||
+ "typeannos\">Parameterized</a><<a href=\"FldA.html\" "
|
||||
+ "title=\"annotation in typeannos\">@FldA</a> java.lang.String,<a "
|
||||
+ "title=\"annotation in typeannos\">@FldA</a> java.lang.String,​<a "
|
||||
+ "href=\"FldB.html\" title=\"annotation in typeannos\">"
|
||||
+ "@FldB</a> java.lang.String>,<a href=\"FldB.html\" "
|
||||
+ "@FldB</a> java.lang.String>,​<a href=\"FldB.html\" "
|
||||
+ "title=\"annotation in typeannos\">@FldB</a> java.lang.String> "
|
||||
+ "nestedParameterized</pre>",
|
||||
|
||||
@ -174,8 +175,8 @@ public class TestTypeAnnotations extends JavadocTester {
|
||||
+ "<a href=\"MtdParameterized.html\" title=\"class in "
|
||||
+ "typeannos\">MtdParameterized</a><<a href=\"MRtnA."
|
||||
+ "html\" title=\"annotation in typeannos\">@MRtnA</a> java.lang."
|
||||
+ "String,<a href=\"MRtnB.html\" title=\"annotation in "
|
||||
+ "typeannos\">@MRtnB</a> java.lang.String>,<a href=\""
|
||||
+ "String,​<a href=\"MRtnB.html\" title=\"annotation in "
|
||||
+ "typeannos\">@MRtnB</a> java.lang.String>,​<a href=\""
|
||||
+ "MRtnB.html\" title=\"annotation in typeannos\">@MRtnB</a> java."
|
||||
+ "lang.String> nestedMtdParameterized()</pre>");
|
||||
|
||||
@ -199,7 +200,7 @@ public class TestTypeAnnotations extends JavadocTester {
|
||||
|
||||
"<pre>public final <K extends <a href=\""
|
||||
+ "MTyParamA.html\" title=\"annotation in typeannos\">@MTyParamA</a> "
|
||||
+ "java.lang.String,V extends <a href=\"MTyParamA.html\" "
|
||||
+ "java.lang.String,​V extends <a href=\"MTyParamA.html\" "
|
||||
+ "title=\"annotation in typeannos\">@MTyParamA</a> <a href=\""
|
||||
+ "MtdTyParameterized.html\" title=\"class in typeannos\">"
|
||||
+ "MtdTyParameterized</a><<a href=\"MTyParamB.html\" "
|
||||
@ -210,7 +211,7 @@ public class TestTypeAnnotations extends JavadocTester {
|
||||
checkOutput("typeannos/Parameters.html", true,
|
||||
"<pre>void unannotated​(<a href=\""
|
||||
+ "ParaParameterized.html\" title=\"class in typeannos\">"
|
||||
+ "ParaParameterized</a><java.lang.String,java.lang.String>"
|
||||
+ "ParaParameterized</a><java.lang.String,​java.lang.String>"
|
||||
+ " a)</pre>",
|
||||
|
||||
"<pre>void nestedParaParameterized​(<a href=\""
|
||||
@ -219,9 +220,9 @@ public class TestTypeAnnotations extends JavadocTester {
|
||||
+ "title=\"annotation in typeannos\">@ParamA</a> <a href=\""
|
||||
+ "ParaParameterized.html\" title=\"class in typeannos\">"
|
||||
+ "ParaParameterized</a><<a href=\"ParamA.html\" "
|
||||
+ "title=\"annotation in typeannos\">@ParamA</a> java.lang.String,"
|
||||
+ "title=\"annotation in typeannos\">@ParamA</a> java.lang.String,​"
|
||||
+ "<a href=\"ParamB.html\" title=\"annotation in "
|
||||
+ "typeannos\">@ParamB</a> java.lang.String>,<a href=\""
|
||||
+ "typeannos\">@ParamB</a> java.lang.String>,​<a href=\""
|
||||
+ "ParamB.html\" title=\"annotation in typeannos\">@ParamB"
|
||||
+ "</a> java.lang.String> a)</pre>",
|
||||
|
||||
@ -272,7 +273,7 @@ public class TestTypeAnnotations extends JavadocTester {
|
||||
|
||||
// Test for type annotations on type parameters (TypeParameters.java).
|
||||
checkOutput("typeannos/TestMethods.html", true,
|
||||
"<pre><K,<a href=\"TyParaA.html\" title=\"annotation in typeannos\">"
|
||||
"<pre><K,​<a href=\"TyParaA.html\" title=\"annotation in typeannos\">"
|
||||
+ "@TyParaA</a> V extends <a href=\"TyParaA.html\" "
|
||||
+ "title=\"annotation in typeannos\">@TyParaA</a> "
|
||||
+ "java.lang.String> void secondAnnotated()</pre>"
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 4927167 4974929 7010344 8025633 8081854 8182765
|
||||
* @bug 4927167 4974929 7010344 8025633 8081854 8182765 8187288
|
||||
* @summary When the type parameters are more than 10 characters in length,
|
||||
* make sure there is a line break between type params and return type
|
||||
* in member summary. Also, test for type parameter links in package-summary and
|
||||
@ -52,7 +52,7 @@ public class TestTypeParameters extends JavadocTester {
|
||||
checkExit(Exit.OK);
|
||||
|
||||
checkOutput("pkg/C.html", true,
|
||||
"<td class=\"colFirst\"><code><W extends java.lang.String,V extends "
|
||||
"<td class=\"colFirst\"><code><W extends java.lang.String,​V extends "
|
||||
+ "java.util.List><br>java.lang.Object</code></td>",
|
||||
"<code><T> java.lang.Object</code>");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user