Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
8222091: Javadoc does not handle package annotations correctly on pac…
…kage-info.java Reviewed-by: clanger Backport-of: 4d08dd7
- Loading branch information
1 parent
13bcc23
commit 09d50d9
Showing
9 changed files
with
244 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
test/langtools/jdk/javadoc/doclet/testPackageAnnotation/TestPackageAnnotation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* Copyright (c) 2019, 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 | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
/* | ||
* @test | ||
* @bug 8222091 | ||
* @summary Javadoc does not handle package annotations correctly on package-info.java | ||
* @library ../lib/ | ||
* @modules jdk.javadoc/jdk.javadoc.internal.tool | ||
* @build JavadocTester | ||
* @run main TestPackageAnnotation | ||
*/ | ||
|
||
public class TestPackageAnnotation extends JavadocTester { | ||
|
||
public static void main(String... args) throws Exception { | ||
TestPackageAnnotation tester = new TestPackageAnnotation(); | ||
tester.runTests(); | ||
} | ||
|
||
@Test | ||
public void testPackageInfoAnnotationNoComment() { | ||
javadoc("-d", "out-annotation", | ||
"-sourcepath", testSrc, | ||
"-use", | ||
"pkg1"); | ||
checkExit(Exit.OK); | ||
checkOutput("pkg1/package-summary.html", true, | ||
"<main role=\"main\">\n<div class=\"header\">\n" | ||
+ "<p>@Deprecated(since=\"1<2>3\")\n" | ||
+ "</p>\n" | ||
+ "<h1 title=\"Package\" class=\"title\">Package pkg1</h1>\n" | ||
+ "</div>\n"); | ||
} | ||
|
||
@Test | ||
public void testPackageHtmlTag() { | ||
javadoc("-d", "out-annotation-2", | ||
"-sourcepath", testSrc, | ||
"-use", | ||
"pkg2"); | ||
checkExit(Exit.OK); | ||
checkOutput("pkg2/package-summary.html", true, | ||
"<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span>\n" | ||
+ "<div class=\"deprecationComment\">This package is deprecated.</div>\n" | ||
+ "</div>\n" | ||
+ "<div class=\"block\">This is the description of package pkg2.</div>\n" | ||
+ "</section>"); | ||
} | ||
|
||
@Test | ||
public void testPackageInfoAndHtml() { | ||
javadoc("-d", "out-annotation-3", | ||
"-sourcepath", testSrc, | ||
"-use", | ||
"pkg3"); | ||
checkExit(Exit.OK); | ||
checkOutput("pkg3/package-summary.html", true, | ||
"<main role=\"main\">\n" | ||
+ "<div class=\"header\">\n" | ||
+ "<p>@Deprecated(since=\"1<2>3\")\n" | ||
+ "</p>\n" | ||
+ "<h1 title=\"Package\" class=\"title\">Package pkg3</h1>\n" | ||
+ "</div>\n"); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
test/langtools/jdk/javadoc/doclet/testPackageAnnotation/pkg1/A.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (c) 2019, 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 | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
package pkg1; | ||
|
||
public class A { | ||
} |
27 changes: 27 additions & 0 deletions
27
test/langtools/jdk/javadoc/doclet/testPackageAnnotation/pkg1/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (c) 2019, 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 | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
// Contains no javadoc comment, but should still be honored by javadoc. | ||
|
||
@Deprecated(since="1<2>3") | ||
package pkg1; |
27 changes: 27 additions & 0 deletions
27
test/langtools/jdk/javadoc/doclet/testPackageAnnotation/pkg2/A.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (c) 2019, 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 | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
package pkg2; | ||
|
||
public class A { | ||
} |
9 changes: 9 additions & 0 deletions
9
test/langtools/jdk/javadoc/doclet/testPackageAnnotation/pkg2/package.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<html lang="en"> | ||
<head> | ||
<title>Package Summary</title> | ||
</head> | ||
<body> | ||
This is the description of package pkg2. | ||
@deprecated This package is deprecated. | ||
</body> | ||
</html> |
27 changes: 27 additions & 0 deletions
27
test/langtools/jdk/javadoc/doclet/testPackageAnnotation/pkg3/A.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (c) 2019, 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 | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
package pkg3; | ||
|
||
public class A { | ||
} |
27 changes: 27 additions & 0 deletions
27
test/langtools/jdk/javadoc/doclet/testPackageAnnotation/pkg3/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (c) 2019, 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 | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
// Contains no javadoc comment, but should still be honored by javadoc. | ||
|
||
@Deprecated(since="1<2>3") | ||
package pkg3; |
8 changes: 8 additions & 0 deletions
8
test/langtools/jdk/javadoc/doclet/testPackageAnnotation/pkg3/package.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<html lang="en"> | ||
<head> | ||
<title>Package Summary</title> | ||
</head> | ||
<body> | ||
This file is ignored by javadoc as the package contains a package-info.java file. | ||
</body> | ||
</html> |
09d50d9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review
Issues