# HG changeset patch
# User lana
# Date 1493327767 0
# Node ID af62fa3a3a89b65349c4a2194806655910043e95
# Parent 7e0ac3c3eaba1028c978b52d9605767b2a79f493# Parent 29001eb39fd8f5b0f5773053838a166d037a4773
Merge
diff -r 7e0ac3c3eaba -r af62fa3a3a89 src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java
--- a/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java Thu Apr 27 16:07:59 2017 +0000
+++ b/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java Thu Apr 27 21:16:07 2017 +0000
@@ -154,7 +154,7 @@
* pattern. Classes implementing this interface are used to operate
* on a directive when the kind of directive is unknown at compile time.
* When a visitor is passed to a directive's {@link Directive#accept
- * accept} method, the visitXyz method applicable
+ * accept} method, the visitXyz
method applicable
* to that directive is invoked.
*
*
Classes implementing this interface may or may not throw a diff -r 7e0ac3c3eaba -r af62fa3a3a89 src/java.compiler/share/classes/javax/tools/JavaFileManager.java --- a/src/java.compiler/share/classes/javax/tools/JavaFileManager.java Thu Apr 27 16:07:59 2017 +0000 +++ b/src/java.compiler/share/classes/javax/tools/JavaFileManager.java Thu Apr 27 21:16:07 2017 +0000 @@ -70,7 +70,7 @@ * java.io.File#getCanonicalFile} or similar means. If the system is * not case-aware, file objects must use other means to preserve case. * - *
Relative names: some + *
Relative names: some
* methods in this interface use relative names. A relative name is a
* non-null, non-empty sequence of path segments separated by '/'.
* '.' or '..' are invalid path segments. A valid relative name must
diff -r 7e0ac3c3eaba -r af62fa3a3a89 src/jdk.compiler/share/classes/com/sun/source/doctree/DocTreeVisitor.java
--- a/src/jdk.compiler/share/classes/com/sun/source/doctree/DocTreeVisitor.java Thu Apr 27 16:07:59 2017 +0000
+++ b/src/jdk.compiler/share/classes/com/sun/source/doctree/DocTreeVisitor.java Thu Apr 27 21:16:07 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -31,7 +31,7 @@
* Classes implementing this interface are used to operate
* on a tree when the kind of tree is unknown at compile time.
* When a visitor is passed to an tree's {@link DocTree#accept
- * accept} method, the visitXYZ method most applicable
+ * accept} method, the visitXyz
method most applicable
* to that tree is invoked.
*
*
Classes implementing this interface may or may not throw a diff -r 7e0ac3c3eaba -r af62fa3a3a89 src/jdk.compiler/share/classes/com/sun/source/tree/LambdaExpressionTree.java --- a/src/jdk.compiler/share/classes/com/sun/source/tree/LambdaExpressionTree.java Thu Apr 27 16:07:59 2017 +0000 +++ b/src/jdk.compiler/share/classes/com/sun/source/tree/LambdaExpressionTree.java Thu Apr 27 21:16:07 2017 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -41,7 +41,7 @@ /** * Lambda expressions come in two forms: - *
visitXyz
method most applicable
* to that tree is invoked.
*
* Classes implementing this interface may or may not throw a diff -r 7e0ac3c3eaba -r af62fa3a3a89 src/jdk.javadoc/share/classes/com/sun/javadoc/FieldDoc.java --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/FieldDoc.java Thu Apr 27 16:07:59 2017 +0000 +++ b/src/jdk.javadoc/share/classes/com/sun/javadoc/FieldDoc.java Thu Apr 27 21:16:07 2017 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -65,7 +65,7 @@ /** * Return the serialField tags in this FieldDoc item. * - * @return an array of SerialFieldTag objects containing + * @return an array of {@code SerialFieldTag} objects containing * all {@code @serialField} tags. */ SerialFieldTag[] serialFieldTags(); diff -r 7e0ac3c3eaba -r af62fa3a3a89 src/jdk.javadoc/share/classes/com/sun/javadoc/MethodDoc.java --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/MethodDoc.java Thu Apr 27 16:07:59 2017 +0000 +++ b/src/jdk.javadoc/share/classes/com/sun/javadoc/MethodDoc.java Thu Apr 27 21:16:07 2017 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -102,7 +102,7 @@ * also said to implement the other. * * @param meth the other method to examine - * @return true if this method overrides the other + * @return {@code true} if this method overrides the other * @since 1.5 */ boolean overrides(MethodDoc meth); diff -r 7e0ac3c3eaba -r af62fa3a3a89 src/jdk.javadoc/share/classes/com/sun/javadoc/Tag.java --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/Tag.java Thu Apr 27 16:07:59 2017 +0000 +++ b/src/jdk.javadoc/share/classes/com/sun/javadoc/Tag.java Thu Apr 27 21:16:07 2017 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -78,7 +78,8 @@ * the following table lists those cases where there is more * than one tag of a given kind: * - *
{@code kind() } | {@code name() } | |||
---|---|---|---|---|
{@code @throws } | {@code @throws } | |||
{@code @throws } | {@code @exception } | |||
{@code -private} | private | private | all | all |
- * + * * A qualified element name is one that has its package * name prepended to it, such as {@code java.lang.String}. A non-qualified * name has no package name, such as {@code String}. *
Many of the types in the old {@code com.sun.javadoc} API do not have equivalents in this
* package. Instead, types in the {@code javax.lang.model} and {@code com.sun.source} APIs
diff -r 7e0ac3c3eaba -r af62fa3a3a89 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java Thu Apr 27 16:07:59 2017 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java Thu Apr 27 21:16:07 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -160,7 +160,7 @@
htmlTree.addStyle(HtmlStyle.indexNav);
HtmlTree ul = new HtmlTree(HtmlTag.UL);
addAllClassesLink(ul);
- if (configuration.showModules) {
+ if (configuration.showModules && configuration.modules.size() > 1) {
addAllModulesLink(ul);
}
htmlTree.addContent(ul);
diff -r 7e0ac3c3eaba -r af62fa3a3a89 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java Thu Apr 27 16:07:59 2017 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java Thu Apr 27 21:16:07 2017 +0000
@@ -271,14 +271,14 @@
@Override // defined by AbstractDoclet
protected void generateModuleFiles() throws DocletException {
if (configuration.showModules) {
- if (configuration.frames) {
+ if (configuration.frames && configuration.modules.size() > 1) {
ModuleIndexFrameWriter.generate(configuration);
}
ModuleElement prevModule = null, nextModule;
List
+ *
+ *
* Parameter
* Description
diff -r 7e0ac3c3eaba -r af62fa3a3a89 test/jdk/javadoc/doclet/testModules/TestModules.java
--- a/test/jdk/javadoc/doclet/testModules/TestModules.java Thu Apr 27 16:07:59 2017 +0000
+++ b/test/jdk/javadoc/doclet/testModules/TestModules.java Thu Apr 27 21:16:07 2017 +0000
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363
- * 8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218 8175823
+ * 8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218 8175823 8166306
* @summary Test modules support in javadoc.
* @author bpatel
* @library ../lib
@@ -251,6 +251,8 @@
checkModuleModeCommon();
checkModuleModeApi(true);
checkModuleModeAll(false);
+ checkModuleFrameFiles(true);
+ checkAllModulesLink(true);
}
/**
@@ -268,6 +270,8 @@
checkModuleModeCommon();
checkModuleModeApi(false);
checkModuleModeAll(true);
+ checkModuleFrameFiles(true);
+ checkAllModulesLink(true);
}
/**
@@ -296,6 +300,32 @@
checkModuleSummaryNoExported(false);
}
+ /**
+ * Test generated module pages for javadoc run for a single module having a single package.
+ */
+ @Test
+ void testSingleModuleSinglePkg() {
+ javadoc("-d", "out-singlemod",
+ "--module-source-path", testSrc,
+ "--module", "moduleC",
+ "testpkgmdlC");
+ checkExit(Exit.OK);
+ checkModuleFrameFiles(false);
+ }
+
+ /**
+ * Test generated module pages for javadoc run for a single module having multiple packages.
+ */
+ @Test
+ void testSingleModuleMultiplePkg() {
+ javadoc("-d", "out-singlemodmultiplepkg", "--show-module-contents=all",
+ "--module-source-path", testSrc,
+ "--module", "moduleB",
+ "testpkg2mdlB", "testpkgmdlB");
+ checkExit(Exit.OK);
+ checkAllModulesLink(false);
+ }
+
void checkDescription(boolean found) {
checkOutput("moduleA-summary.html", found,
"\n"
@@ -710,6 +740,22 @@
"module-overview-frame.html");
}
+ void checkModuleFrameFiles(boolean found) {
+ checkFiles(found,
+ "moduleC-frame.html",
+ "moduleC-type-frame.html",
+ "module-overview-frame.html");
+ checkFiles(true,
+ "moduleC-summary.html",
+ "allclasses-frame.html",
+ "allclasses-noframe.html");
+ }
+
+ void checkAllModulesLink(boolean found) {
+ checkOutput("overview-frame.html", found,
+ "\n"
diff -r 7e0ac3c3eaba -r af62fa3a3a89 test/tools/jdeprscan/tests/jdk/jdeprscan/TestLoadExpected.csv
--- a/test/tools/jdeprscan/tests/jdk/jdeprscan/TestLoadExpected.csv Thu Apr 27 16:07:59 2017 +0000
+++ b/test/tools/jdeprscan/tests/jdk/jdeprscan/TestLoadExpected.csv Thu Apr 27 21:16:07 2017 +0000
@@ -1,4 +1,4 @@
-#jdepr 1
+#jdepr1
METHOD,jdk/deprcases/members/ExampleAnnotation,name()Ljava/lang/String;,,false
FIELD,jdk/deprcases/members/ExampleClass,field1,,false
FIELD,jdk/deprcases/members/ExampleClass,field2,,false
diff -r 7e0ac3c3eaba -r af62fa3a3a89 test/tools/jdeprscan/tests/jdk/jdeprscan/TestNotFound.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/jdeprscan/tests/jdk/jdeprscan/TestNotFound.java Thu Apr 27 21:16:07 2017 +0000
@@ -0,0 +1,111 @@
+/*
+ * 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 8168444
+ * @summary Test of jdeprscan handling of primitives and primitive arrays.
+ * @modules jdk.jdeps/com.sun.tools.jdeprscan
+ * @run main jdk.jdeprscan.TestNotFound
+ */
+
+package jdk.jdeprscan;
+
+import com.sun.tools.jdeprscan.Main;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.Scanner;
+
+public class TestNotFound {
+
+ public static void main(String[] args) throws IOException {
+ final String SEP = File.separator;
+ final String TESTCLASSES = System.getProperty("test.classes");
+ final String THISCLASS =
+ TESTCLASSES + SEP + "jdk" + SEP + "jdeprscan" + SEP + "TestNotFound.class";
+
+ ByteArrayOutputStream outBaos = new ByteArrayOutputStream();
+ ByteArrayOutputStream errBaos = new ByteArrayOutputStream();
+ boolean mainResult;
+
+ // Causes 5 Methodrefs to be generated, thus 5 occurrences
+ // of the Target class not being found. But only one message
+ // should be emitted.
+
+ Target.method1();
+ Target.method2();
+ Target.method3();
+ Target.method4();
+ Target.method5();
+
+ try (PrintStream out = new PrintStream(outBaos, false, "UTF-8");
+ PrintStream err = new PrintStream(errBaos, false, "UTF-8")) {
+ // Call jdeprscan without the proper classpath, so Target isn't found.
+ // Result is checked below after output is dumped.
+ mainResult = Main.call(out, err, THISCLASS);
+ }
+
+ byte[] outBytes = outBaos.toByteArray();
+ byte[] errBytes = errBaos.toByteArray();
+ ByteArrayInputStream outbais = new ByteArrayInputStream(outBytes);
+ ByteArrayInputStream errbais = new ByteArrayInputStream(errBytes);
+
+ System.out.println("--- stdout ---");
+ outbais.transferTo(System.out);
+ System.out.println("--- end stdout ---");
+
+ System.out.println("--- stderr ---");
+ errbais.transferTo(System.out);
+ System.out.println("--- end stderr ---");
+
+ long errCount = new Scanner(new String(errBytes, "UTF-8")).findAll("error:").count();
+
+ System.out.println("mainResult = " + mainResult);
+ System.out.println("errCount = " + errCount);
+
+ if (!mainResult) {
+ System.out.println("FAIL: mainResult should be true");
+ }
+
+ if (errCount != 1L) {
+ System.out.println("FAIL: errCount should equal 1");
+ }
+
+ if (!mainResult || errCount != 1L) {
+ throw new AssertionError("Test failed.");
+ } else {
+ System.out.println("Test passed.");
+ }
+ }
+
+ static class Target {
+ static void method1() { }
+ static void method2() { }
+ static void method3() { }
+ static void method4() { }
+ static void method5() { }
+ }
+}
diff -r 7e0ac3c3eaba -r af62fa3a3a89 test/tools/jdeprscan/tests/jdk/jdeprscan/TestPrims.csv
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/jdeprscan/tests/jdk/jdeprscan/TestPrims.csv Thu Apr 27 21:16:07 2017 +0000
@@ -0,0 +1,18 @@
+#jdepr1
+CLASS,V,,,false
+CLASS,Z,,,false
+CLASS,B,,,false
+CLASS,S,,,false
+CLASS,C,,,false
+CLASS,I,,,false
+CLASS,J,,,false
+CLASS,F,,,false
+CLASS,D,,,false
+CLASS,[Z,,,false
+CLASS,[B,,,false
+CLASS,[S,,,false
+CLASS,[C,,,false
+CLASS,[I,,,false
+CLASS,[J,,,false
+CLASS,[F,,,false
+CLASS,[D,,,false
diff -r 7e0ac3c3eaba -r af62fa3a3a89 test/tools/jdeprscan/tests/jdk/jdeprscan/TestPrims.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/jdeprscan/tests/jdk/jdeprscan/TestPrims.java Thu Apr 27 21:16:07 2017 +0000
@@ -0,0 +1,145 @@
+/*
+ * 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 8168444
+ * @summary Test of jdeprscan handling of primitives and primitive arrays.
+ * @modules jdk.jdeps/com.sun.tools.jdeprscan
+ * @build jdk.jdeprscan.TestPrims
+ * @run testng jdk.jdeprscan.TestPrims
+ */
+
+package jdk.jdeprscan;
+
+import com.sun.tools.jdeprscan.Main;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.regex.Pattern;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+public class TestPrims {
+
+ @Test
+ public void test() throws IOException {
+ final String TESTSRC = System.getProperty("test.src");
+ final String TESTCLASSPATH = System.getProperty("test.class.path");
+ String CSV_FILE = TESTSRC + File.separator + "TestPrims.csv";
+
+ ByteArrayOutputStream outBaos = new ByteArrayOutputStream();
+ ByteArrayOutputStream errBaos = new ByteArrayOutputStream();
+ boolean mainResult;
+
+ try (PrintStream out = new PrintStream(outBaos, false, "UTF-8");
+ PrintStream err = new PrintStream(errBaos, false, "UTF-8")) {
+ mainResult = Main.call(
+ out, err,
+ "--class-path", TESTCLASSPATH,
+ "--Xload-csv", CSV_FILE,
+ "jdk.jdeprscan.TestPrims$Usage");
+ // assertion is checked below after output is dumped
+ }
+
+ byte[] outBytes = outBaos.toByteArray();
+ byte[] errBytes = errBaos.toByteArray();
+ ByteArrayInputStream outbais = new ByteArrayInputStream(outBytes);
+ ByteArrayInputStream errbais = new ByteArrayInputStream(errBytes);
+
+ System.out.println("--- stdout ---");
+ outbais.transferTo(System.out);
+ System.out.println("--- end stdout ---");
+
+ System.out.println("--- stderr ---");
+ errbais.transferTo(System.out);
+ System.out.println("--- end stderr ---");
+
+ String outString = new String(outBytes, "UTF-8");
+ String errString = new String(errBytes, "UTF-8");
+
+ // matches message "class