diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java
index c7d5833212ed2d91cf2e7f51bb355d99af3d52f5..f10f2d52f795bb4574678e0266650959080f1c59 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java
@@ -292,11 +292,11 @@ public class PackageWriterImpl extends HtmlDocletWriter
Content tbody = new HtmlTree(HtmlTag.TBODY);
boolean altColor = false;
for (TypeElement klass : classes) {
- altColor = !altColor;
if (!utils.isCoreClass(klass) ||
!configuration.isGeneratedDoc(klass)) {
continue;
}
+ altColor = !altColor;
Content classContent = getLink(new LinkInfoImpl(
configuration, LinkInfoImpl.Kind.PACKAGE, klass));
Content thClass = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, classContent);
diff --git a/test/langtools/jdk/javadoc/doclet/testGroupName/TestGroupName.java b/test/langtools/jdk/javadoc/doclet/testGroupName/TestGroupName.java
new file mode 100644
index 0000000000000000000000000000000000000000..31b350993c11a181a47e482efd70ec60662d1f28
--- /dev/null
+++ b/test/langtools/jdk/javadoc/doclet/testGroupName/TestGroupName.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2017, 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 8190003
+ * @summary Special characters in group names should be escaped
+ * @library /tools/lib ../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build toolbox.ToolBox JavadocTester
+ * @run main TestGroupName
+ */
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import toolbox.*;
+
+public class TestGroupName extends JavadocTester {
+
+ public final ToolBox tb;
+ public static void main(String... args) throws Exception {
+ TestGroupName tester = new TestGroupName();
+ tester.runTests(m -> new Object[] { Paths.get(m.getName()) });
+ }
+
+ public TestGroupName() {
+ tb = new ToolBox();
+ }
+
+ @Test
+ public void testPackageGroups(Path base) throws IOException {
+ Path src = base.resolve("src");
+ tb.writeJavaFiles(src,
+ "package p1; public class C1 { }",
+ "package p2; public class C2 { }",
+ "package p3; public class C3 { }");
+
+ javadoc("-d", base.resolve("out").toString(),
+ "-sourcepath", src.toString(),
+ "-group", "abc < & > def", "p1",
+ "p1", "p2", "p3");
+ checkExit(Exit.OK);
+
+ checkOutput("overview-summary.html", true,
+ "summary=\"abc < & > def table",
+ "abc < & > def");
+
+ checkOutput("overview-summary.html", false,
+ "abc < & > def");The name should be wrapped in a StringContent node instead.
+ }
+
+ @Test
+ public void testModuleGroups(Path base) throws IOException {
+ Path src = base.resolve("src");
+ tb.writeJavaFiles(src.resolve("ma"),
+ "module ma { exports pa1; }",
+ "package pa1; public class CA1 { }",
+ "package pa2; public class CA2 { }",
+ "package pa3; public class CA3 { }");
+
+ tb.writeJavaFiles(src.resolve("mb"),
+ "module mb { exports pb1; }",
+ "package pb1; public class CB1 { }",
+ "package pb2; public class CB2 { }",
+ "package pb3; public class CB3 { }");
+
+ tb.writeJavaFiles(src.resolve("mc"),
+ "module mc { exports pc1; }",
+ "package pc1; public class CC1 { }",
+ "package pc2; public class CC2 { }",
+ "package pc3; public class CC3 { }");
+
+ javadoc("-d", base.resolve("out").toString(),
+ "--module-source-path", src.toString(),
+ "-group", "abc < & > def", "ma",
+ "--module", "ma,mb,mc");
+
+ checkExit(Exit.OK);
+
+ checkOutput("overview-summary.html", true,
+ "summary=\"abc < & > def table",
+ "abc < & > def");
+
+ checkOutput("overview-summary.html", false,
+ "abc < & > def");
+ }
+}
+
diff --git a/test/langtools/jdk/javadoc/doclet/testPackageSummary/TestPackageSummary.java b/test/langtools/jdk/javadoc/doclet/testPackageSummary/TestPackageSummary.java
new file mode 100644
index 0000000000000000000000000000000000000000..df43f2bd31613d15cd176d7199e6d32d7270d5c5
--- /dev/null
+++ b/test/langtools/jdk/javadoc/doclet/testPackageSummary/TestPackageSummary.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2017, 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 8189841
+ * @summary Error in alternate row coloring in package-summary files
+ * @library ../lib/
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build JavadocTester TestPackageSummary
+ * @run main TestPackageSummary
+ */
+
+public class TestPackageSummary extends JavadocTester {
+
+ public static void main(String... args) throws Exception {
+ TestPackageSummary tester = new TestPackageSummary();
+ tester.runTests();
+ }
+
+ @Test
+ void testStripes() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg/package-summary.html", true,
+ "
\n"
+ + "\n"
+ + "C0 | \n"
+ + " | \n"
+ + "
\n"
+ + "\n"
+ + "C1 | \n"
+ + " | \n"
+ + "
\n"
+ + "\n"
+ + "C2 | \n"
+ + " | \n"
+ + "
\n"
+ + "\n"
+ + "C3 | \n"
+ + " | \n"
+ + "
\n"
+ + "\n"
+ + "C4 | \n"
+ + " | \n"
+ + "
\n"
+ + "\n"
+ );
+ }
+}
+
diff --git a/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C0.java b/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C0.java
new file mode 100644
index 0000000000000000000000000000000000000000..7284ea1a8c57af972aa3b869562ee827dbdbd221
--- /dev/null
+++ b/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C0.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, 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 pkg;
+
+public class C0 {
+ // no inner classes
+}
+
diff --git a/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C1.java b/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C1.java
new file mode 100644
index 0000000000000000000000000000000000000000..48dc0ff59495e9e7546bb264644ae921c6ca7bea
--- /dev/null
+++ b/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C1.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, 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 pkg;
+
+public class C1 {
+ public class Inner1 { }
+}
+
diff --git a/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C2.java b/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C2.java
new file mode 100644
index 0000000000000000000000000000000000000000..b7937355f4c845f33f65aace7f5119937860753c
--- /dev/null
+++ b/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C2.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2017, 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 pkg;
+
+public class C2 {
+ public class Inner1 { }
+ public class Inner2 { }
+}
+
diff --git a/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C3.java b/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C3.java
new file mode 100644
index 0000000000000000000000000000000000000000..b6b0e0383119f09ce42d1d9fa15812b1f7ec5df7
--- /dev/null
+++ b/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C3.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017, 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 pkg;
+
+public class C3 {
+ public class Inner1 { }
+ public class Inner2 { }
+ public class Inner3 { }
+}
+
diff --git a/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C4.java b/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C4.java
new file mode 100644
index 0000000000000000000000000000000000000000..2d711cdef52c55505d251e62a08d9c7460d21e2b
--- /dev/null
+++ b/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C4.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2017, 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 pkg;
+
+public class C4 {
+ public class Inner1 { }
+ public class Inner2 { }
+ public class Inner3 { }
+ public class Inner4 { }
+}
+