6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
6469562: Use compact notation to display annotation values Reviewed-by: jjg
This commit is contained in:
parent
88a8d4719e
commit
f14d43a22b
@ -261,10 +261,13 @@ public abstract class AbstractMemberWriter {
|
||||
// According to JLS, we should not be showing public modifier for
|
||||
// interface methods.
|
||||
if ((utils.isField(member) || utils.isMethod(member))
|
||||
&& writer instanceof ClassWriterImpl
|
||||
&& utils.isInterface(((ClassWriterImpl) writer).getTypeElement())) {
|
||||
&& ((writer instanceof ClassWriterImpl
|
||||
&& utils.isInterface(((ClassWriterImpl) writer).getTypeElement()) ||
|
||||
writer instanceof AnnotationTypeWriterImpl) )) {
|
||||
// Remove the implicit abstract and public modifiers
|
||||
if (utils.isMethod(member) && utils.isInterface(member.getEnclosingElement())) {
|
||||
if (utils.isMethod(member) &&
|
||||
(utils.isInterface(member.getEnclosingElement()) ||
|
||||
utils.isAnnotationType(member.getEnclosingElement()))) {
|
||||
set.remove(ABSTRACT);
|
||||
set.remove(PUBLIC);
|
||||
}
|
||||
|
@ -2363,7 +2363,9 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
if (!map.isEmpty()) {
|
||||
annotation.addContent("(");
|
||||
boolean isFirst = true;
|
||||
for (ExecutableElement element : map.keySet()) {
|
||||
Set<? extends ExecutableElement> keys = map.keySet();
|
||||
boolean multipleValues = keys.size() > 1;
|
||||
for (ExecutableElement element : keys) {
|
||||
if (isFirst) {
|
||||
isFirst = false;
|
||||
} else {
|
||||
@ -2376,9 +2378,12 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
}
|
||||
}
|
||||
}
|
||||
annotation.addContent(getDocLink(LinkInfoImpl.Kind.ANNOTATION,
|
||||
element, element.getSimpleName().toString(), false));
|
||||
annotation.addContent("=");
|
||||
String simpleName = element.getSimpleName().toString();
|
||||
if (multipleValues || !"value".equals(simpleName)) { // Omit "value=" where unnecessary
|
||||
annotation.addContent(getDocLink(LinkInfoImpl.Kind.ANNOTATION,
|
||||
element, simpleName, false));
|
||||
annotation.addContent("=");
|
||||
}
|
||||
AnnotationValue annotationValue = map.get(element);
|
||||
List<AnnotationValue> annotationTypeValues = new ArrayList<>();
|
||||
new SimpleAnnotationValueVisitor9<Void, AnnotationValue>() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2016, 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 4973609 8015249 8025633 8026567
|
||||
* @bug 4973609 8015249 8025633 8026567 6469561
|
||||
* @summary Make sure that annotation types with 0 members does not have
|
||||
* extra HR tags.
|
||||
* @author jamieh
|
||||
@ -61,7 +61,7 @@ public class TestAnnotationTypes extends JavadocTester {
|
||||
+ "</code> </td>",
|
||||
"<!-- ============ ANNOTATION TYPE FIELD DETAIL =========== -->",
|
||||
"<h4>DEFAULT_NAME</h4>\n"
|
||||
+ "<pre>public static final java."
|
||||
+ "<pre>static final java."
|
||||
+ "lang.String DEFAULT_NAME</pre>");
|
||||
|
||||
checkOutput("pkg/AnnotationType.html", true,
|
||||
@ -70,6 +70,21 @@ public class TestAnnotationTypes extends JavadocTester {
|
||||
"<li>Detail: </li>\n"
|
||||
+ "<li>Field | </li>");
|
||||
|
||||
checkOutput("pkg/AnnotationType.html", true,
|
||||
"<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->",
|
||||
"<ul class=\"blockList\">",
|
||||
"<li class=\"blockList\"><a name=\"annotation.type.element.detail\">",
|
||||
"<!-- -->",
|
||||
"</a>",
|
||||
"<h3>Element Detail</h3>",
|
||||
"<a name=\"value--\">",
|
||||
"<!-- -->",
|
||||
"</a>",
|
||||
"<ul class=\"blockListLast\">",
|
||||
"<li class=\"blockList\">",
|
||||
"<h4>value</h4>",
|
||||
"<pre>int value</pre>" );
|
||||
|
||||
checkOutput("pkg/AnnotationType.html", false,
|
||||
"<HR>\n\n"
|
||||
+ "<P>\n\n"
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2016, 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
|
||||
@ -32,5 +32,5 @@ import java.lang.annotation.*;
|
||||
* @since 1.5
|
||||
*/
|
||||
@Documented public @interface AnnotationType {
|
||||
|
||||
int value();
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8005092
|
||||
* @bug 8005092 6469562
|
||||
* @summary Test repeated annotations output.
|
||||
* @author bpatel
|
||||
* @library ../lib
|
||||
@ -57,7 +57,7 @@ public class TestRepeatedAnnotations extends JavadocTester {
|
||||
+ "title=\"annotation in pkg\">@ContaineeRegDoc</a>",
|
||||
"<a href=\"../pkg/RegContainerDoc.html\" "
|
||||
+ "title=\"annotation in pkg\">@RegContainerDoc</a>"
|
||||
+ "(<a href=\"../pkg/RegContainerDoc.html#value--\">value</a>={"
|
||||
+ "({"
|
||||
+ "<a href=\"../pkg/RegContaineeNotDoc.html\" "
|
||||
+ "title=\"annotation in pkg\">@RegContaineeNotDoc</a>,"
|
||||
+ "<a href=\"../pkg/RegContaineeNotDoc.html\" "
|
||||
@ -70,7 +70,7 @@ public class TestRepeatedAnnotations extends JavadocTester {
|
||||
+ "title=\"annotation in pkg\">@ContaineeSynthDoc</a>",
|
||||
"<a href=\"../pkg/ContainerSynthDoc.html\" "
|
||||
+ "title=\"annotation in pkg\">@ContainerSynthDoc</a>("
|
||||
+ "<a href=\"../pkg/ContainerSynthDoc.html#value--\">value</a>="
|
||||
+ ""
|
||||
+ "<a href=\"../pkg/ContaineeSynthDoc.html\" "
|
||||
+ "title=\"annotation in pkg\">@ContaineeSynthDoc</a>)",
|
||||
"<a href=\"../pkg/ContaineeSynthDoc.html\" "
|
||||
@ -87,7 +87,7 @@ public class TestRepeatedAnnotations extends JavadocTester {
|
||||
+ "(<a href=\"../pkg/RegArryDoc.html#y--\">y</a>={1,2})",
|
||||
"<a href=\"../pkg/NonSynthDocContainer.html\" "
|
||||
+ "title=\"annotation in pkg\">@NonSynthDocContainer</a>"
|
||||
+ "(<a href=\"../pkg/NonSynthDocContainer.html#value--\">value</a>="
|
||||
+ "("
|
||||
+ "<a href=\"../pkg/RegArryDoc.html\" title=\"annotation in pkg\">@RegArryDoc</a>)");
|
||||
|
||||
checkOutput("pkg1/C.html", true,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2016, 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,15 +23,15 @@
|
||||
|
||||
package pkg;
|
||||
|
||||
@ContainerSynthDoc(value={@ContaineeSynthDoc,@ContaineeSynthDoc})
|
||||
@ContainerRegDoc(value={@ContaineeRegDoc,@ContaineeRegDoc})
|
||||
@RegContainerDoc(value={@RegContaineeNotDoc,@RegContaineeNotDoc})
|
||||
@ContainerRegNotDoc(value={@RegContaineeDoc,@RegContaineeDoc})
|
||||
@RegContainerNotDoc(value={@RegContaineeNotDoc,@RegContaineeNotDoc})
|
||||
@ContainerSynthDoc({@ContaineeSynthDoc,@ContaineeSynthDoc})
|
||||
@ContainerRegDoc({@ContaineeRegDoc,@ContaineeRegDoc})
|
||||
@RegContainerDoc({@RegContaineeNotDoc,@RegContaineeNotDoc})
|
||||
@ContainerRegNotDoc({@RegContaineeDoc,@RegContaineeDoc})
|
||||
@RegContainerNotDoc({@RegContaineeNotDoc,@RegContaineeNotDoc})
|
||||
@ContaineeSynthDoc @ContaineeSynthDoc @ContaineeSynthDoc
|
||||
public class C {
|
||||
|
||||
@ContainerSynthDoc(value={@ContaineeSynthDoc})
|
||||
@ContainerSynthDoc({@ContaineeSynthDoc})
|
||||
public void test1() {}
|
||||
|
||||
@ContaineeSynthDoc @ContaineeSynthDoc
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2016, 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
|
||||
@ -32,6 +32,6 @@ public class D {
|
||||
@RegArryDoc(y={1,2})
|
||||
public void test2() {}
|
||||
|
||||
@NonSynthDocContainer(value={@RegArryDoc})
|
||||
@NonSynthDocContainer({@RegArryDoc})
|
||||
public void test3() {}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8005091 8009686 8025633 8026567
|
||||
* @bug 8005091 8009686 8025633 8026567 6469562
|
||||
* @summary Make sure that type annotations are displayed correctly
|
||||
* @author Bhavesh Patel
|
||||
* @library ../lib
|
||||
@ -260,13 +260,13 @@ public class TestTypeAnnotations extends JavadocTester {
|
||||
checkOutput("typeannos/ThrWithValue.html", true,
|
||||
"<pre>void oneException()\n"
|
||||
+ " throws <a href=\"../typeannos/ThrB.html\" title=\""
|
||||
+ "annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/"
|
||||
+ "ThrB.html#value--\">value</a>=\"m\") java.lang.Exception</pre>",
|
||||
+ "annotation in typeannos\">@ThrB</a>("
|
||||
+ "\"m\") java.lang.Exception</pre>",
|
||||
|
||||
"<pre>void twoExceptions()\n"
|
||||
+ " throws <a href=\"../typeannos/ThrB.html\" title=\""
|
||||
+ "annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/"
|
||||
+ "ThrB.html#value--\">value</a>=\"m\") java.lang.RuntimeException,\n"
|
||||
+ "annotation in typeannos\">@ThrB</a>("
|
||||
+ "\"m\") java.lang.RuntimeException,\n"
|
||||
+ " <a href=\"../typeannos/ThrA.html\" title=\""
|
||||
+ "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>");
|
||||
|
||||
@ -293,14 +293,14 @@ public class TestTypeAnnotations extends JavadocTester {
|
||||
checkOutput("typeannos/BoundWithValue.html", true,
|
||||
"<pre>void wcSuper(<a href=\"../typeannos/MyList.html\" title=\""
|
||||
+ "class in typeannos\">MyList</a><? super <a href=\"../typeannos/"
|
||||
+ "WldB.html\" title=\"annotation in typeannos\">@WldB</a>(<a href=\""
|
||||
+ "../typeannos/WldB.html#value--\">value</a>=\"m\") java.lang."
|
||||
+ "WldB.html\" title=\"annotation in typeannos\">@WldB</a>("
|
||||
+ "\"m\") java.lang."
|
||||
+ "String> l)</pre>",
|
||||
|
||||
"<pre><a href=\"../typeannos/MyList.html\" title=\"class in "
|
||||
+ "typeannos\">MyList</a><? extends <a href=\"../typeannos/WldB."
|
||||
+ "html\" title=\"annotation in typeannos\">@WldB</a>(<a href=\"../"
|
||||
+ "typeannos/WldB.html#value--\">value</a>=\"m\") java.lang.String"
|
||||
+ "html\" title=\"annotation in typeannos\">@WldB</a>("
|
||||
+ "\"m\") java.lang.String"
|
||||
+ "> returnWcExtends()</pre>");
|
||||
|
||||
// Test for receiver annotations (Receivers.java).
|
||||
@ -314,7 +314,7 @@ public class TestTypeAnnotations extends JavadocTester {
|
||||
"<pre>java.lang.String nonVoid(<a href=\"../typeannos/RcvrA."
|
||||
+ "html\" title=\"annotation in typeannos\">@RcvrA</a> <a href=\"../"
|
||||
+ "typeannos/RcvrB.html\" title=\"annotation in typeannos\">@RcvrB"
|
||||
+ "</a>(<a href=\"../typeannos/RcvrB.html#value--\">value</a>=\"m\")"
|
||||
+ "</a>(\"m\")"
|
||||
+ " DefaultUnmodified this)</pre>",
|
||||
|
||||
"<pre><T extends java.lang.Runnable> void accept("
|
||||
@ -337,15 +337,15 @@ public class TestTypeAnnotations extends JavadocTester {
|
||||
checkOutput("typeannos/WithValue.html", true,
|
||||
"<pre><T extends java.lang.Runnable> void accept("
|
||||
+ "<a href=\"../typeannos/RcvrB.html\" title=\"annotation in "
|
||||
+ "typeannos\">@RcvrB</a>(<a href=\"../typeannos/RcvrB.html#value--\">"
|
||||
+ "value</a>=\"m\") WithValue this,\n"
|
||||
+ "typeannos\">@RcvrB</a>("
|
||||
+ "\"m\") WithValue this,\n"
|
||||
+ " T r)\n"
|
||||
+ " throws java.lang.Exception</pre>");
|
||||
|
||||
checkOutput("typeannos/WithFinal.html", true,
|
||||
"<pre>java.lang.String nonVoid(<a href=\"../typeannos/RcvrB."
|
||||
+ "html\" title=\"annotation in typeannos\">@RcvrB</a>(<a href=\"../"
|
||||
+ "typeannos/RcvrB.html#value--\">value</a>=\"m\") WithFinal"
|
||||
+ "html\" title=\"annotation in typeannos\">@RcvrB</a>("
|
||||
+ "\"m\") WithFinal"
|
||||
+ " this)</pre>");
|
||||
|
||||
checkOutput("typeannos/WithBody.html", true,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2016, 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
|
||||
@ -40,7 +40,7 @@ class ThrPublicModified {
|
||||
|
||||
class ThrWithValue {
|
||||
void oneException() throws @ThrB("m") Exception {}
|
||||
void twoExceptions() throws @ThrB(value="m") RuntimeException, @ThrA Exception {}
|
||||
void twoExceptions() throws @ThrB("m") RuntimeException, @ThrA Exception {}
|
||||
}
|
||||
|
||||
@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2016, 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
|
||||
@ -39,10 +39,10 @@ class BoundTest {
|
||||
|
||||
class BoundWithValue {
|
||||
void wcExtends(MyList<? extends @WldB("m") String> l) { }
|
||||
void wcSuper(MyList<? super @WldB(value="m") String> l) { }
|
||||
void wcSuper(MyList<? super @WldB("m") String> l) { }
|
||||
|
||||
MyList<? extends @WldB("m") String> returnWcExtends() { return null; }
|
||||
MyList<? super @WldB(value="m") String> returnWcSuper() { return null; }
|
||||
MyList<? super @WldB("m") String> returnWcSuper() { return null; }
|
||||
MyList<? extends @WldB("m") MyList<? super @WldB("m") String>> complex() { return null; }
|
||||
}
|
||||
|
||||
@ -57,10 +57,10 @@ class SelfTest {
|
||||
|
||||
class SelfWithValue {
|
||||
void wcExtends(MyList<@WldB("m") ?> l) { }
|
||||
void wcSuper(MyList<@WldB(value="m") ?> l) { }
|
||||
void wcSuper(MyList<@WldB("m") ?> l) { }
|
||||
|
||||
MyList<@WldB("m") ?> returnWcExtends() { return null; }
|
||||
MyList<@WldB(value="m") ?> returnWcSuper() { return null; }
|
||||
MyList<@WldB("m") ?> returnWcSuper() { return null; }
|
||||
MyList<@WldB("m") ? extends MyList<@WldB("m") ? super String>> complex() { return null; }
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user