# HG changeset patch # User lana # Date 1492745687 0 # Node ID 7d89c9c5d41fd7d5e793f8f3aa575001fad485f7 # Parent 2bd173891dcf9364f01be44f7b0c71efe3dc36a9# Parent 9be30ec2401e7db745c622d928ebf101407f9a0c Merge diff -r 2bd173891dcf -r 7d89c9c5d41f src/java.compiler/share/classes/javax/annotation/processing/Processor.java --- a/src/java.compiler/share/classes/javax/annotation/processing/Processor.java Thu Apr 20 18:14:07 2017 +0000 +++ b/src/java.compiler/share/classes/javax/annotation/processing/Processor.java Fri Apr 21 03:34:47 2017 +0000 @@ -278,14 +278,14 @@ *
* * *
ModulePrefix: - *
TypeName / + *
ModuleName / * *
DotStar: *
. * * * * - * where TypeName is as defined in + * where TypeName and ModuleName are as defined in * The Java™ Language Specification. * * @apiNote When running in an environment which supports modules, @@ -299,7 +299,7 @@ * @return the names of the annotation types supported by this processor * @see javax.annotation.processing.SupportedAnnotationTypes * @jls 3.8 Identifiers - * @jls 6.5.5 Meaning of Type Names + * @jls 6.5 Determining the Meaning of a Name */ Set getSupportedAnnotationTypes(); diff -r 2bd173891dcf -r 7d89c9c5d41f 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 20 18:14:07 2017 +0000 +++ b/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java Fri Apr 21 03:34:47 2017 +0000 @@ -28,13 +28,14 @@ import java.util.List; /** - * Represents a module program element. Provides access to information - * about the module and its members. + * Represents a module program element. Provides access to + * information about the module, its directives, and its members. * * @see javax.lang.model.util.Elements#getModuleOf * @since 9 + * @jls 7.7 Module Declarations * @spec JPMS - */ // TODO: add @jls to module section + */ public interface ModuleElement extends Element, QualifiedNameable { /** @@ -121,12 +122,13 @@ }; /** - * Represents a "module statement" within the declaration of this module. + * Represents a directive within the declaration of this + * module. The directives of a module declaration configure the + * module in the Java Platform Module System. * * @since 9 * @spec JPMS - * - */ // TODO: add jls to Module Statement + */ interface Directive { /** * Returns the {@code kind} of this directive. diff -r 2bd173891dcf -r 7d89c9c5d41f src/jdk.compiler/share/classes/com/sun/source/doctree/package-info.java --- a/src/jdk.compiler/share/classes/com/sun/source/doctree/package-info.java Thu Apr 20 18:14:07 2017 +0000 +++ b/src/jdk.compiler/share/classes/com/sun/source/doctree/package-info.java Fri Apr 21 03:34:47 2017 +0000 @@ -29,6 +29,6 @@ * * @author Jonathan Gibbons * @since 1.8 - * @see http://download.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#javadoctags + * @see http://docs.oracle.com/javase/8/docs/technotes/tools/unix/javadoc.html#CHDJGIJB */ package com.sun.source.doctree; diff -r 2bd173891dcf -r 7d89c9c5d41f src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java Thu Apr 20 18:14:07 2017 +0000 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java Fri Apr 21 03:34:47 2017 +0000 @@ -194,7 +194,13 @@ lintOptions = options.isUnset(Option.XLINT_CUSTOM, "-" + LintCategory.OPTIONS.option); - legacyModuleOverride = options.get(Option.XMODULE); + Collection xmodules = options.keySet() + .stream() + .filter(opt -> opt.startsWith(XMODULES_PREFIX)) + .map(opt -> opt.substring(XMODULES_PREFIX.length())) + .collect(Collectors.toList()); + + legacyModuleOverride = xmodules.size() == 1 ? xmodules.iterator().next() : null; multiModuleMode = fileManager.hasLocation(StandardLocation.MODULE_SOURCE_PATH); ClassWriter classWriter = ClassWriter.instance(context); @@ -211,6 +217,8 @@ limitModsOpt = options.get(Option.LIMIT_MODULES); moduleVersionOpt = options.get(Option.MODULE_VERSION); } + //where + private static final String XMODULES_PREFIX = "-Xmodule:"; int depth = -1; private void dprintln(String msg) { diff -r 2bd173891dcf -r 7d89c9c5d41f src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java Thu Apr 20 18:14:07 2017 +0000 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java Fri Apr 21 03:34:47 2017 +0000 @@ -603,17 +603,6 @@ } }, - XMODULE("-Xmodule:", "opt.arg.module", "opt.module", HIDDEN, BASIC) { - @Override - public void process(OptionHelper helper, String option, String arg) throws InvalidValueException { - String prev = helper.get(XMODULE); - if (prev != null) { - throw helper.newInvalidValueException("err.option.too.many", XMODULE.primaryName); - } - helper.put(XMODULE.primaryName, arg); - } - }, - MODULE("--module -m", "opt.arg.m", "opt.m", STANDARD, BASIC), ADD_MODULES("--add-modules", "opt.arg.addmods", "opt.addmods", STANDARD, BASIC) { diff -r 2bd173891dcf -r 7d89c9c5d41f src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java Thu Apr 20 18:14:07 2017 +0000 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java Fri Apr 21 03:34:47 2017 +0000 @@ -1012,7 +1012,7 @@ } /** - * @see Javadoc Tags + * @see Javadoc Tags */ private void initTagParsers() { TagParser[] parsers = { diff -r 2bd173891dcf -r 7d89c9c5d41f src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties Thu Apr 20 18:14:07 2017 +0000 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties Fri Apr 21 03:34:47 2017 +0000 @@ -312,10 +312,6 @@ in JAR files or directories javac.opt.arg.patch=\ =(:)* -javac.opt.module=\ - Specify a module to which the classes being compiled belong. -javac.opt.arg.module=\ - javac.opt.addmods=\ Root modules to resolve in addition to the initial modules, or all modules\n\ on the module path if is ALL-MODULE-PATH. diff -r 2bd173891dcf -r 7d89c9c5d41f src/jdk.javadoc/share/classes/com/sun/tools/doclets/Taglet.java --- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/Taglet.java Thu Apr 20 18:14:07 2017 +0000 +++ b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/Taglet.java Fri Apr 21 03:34:47 2017 +0000 @@ -53,14 +53,14 @@ *

* Here are two sample taglets:
*

*

* For more information on how to create your own Taglets, please see the - * Taglet Overview. + * Taglet Overview. * * @since 1.4 * @author Jamie Ho diff -r 2bd173891dcf -r 7d89c9c5d41f src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavaScriptScanner.java --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavaScriptScanner.java Thu Apr 20 18:14:07 2017 +0000 +++ b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavaScriptScanner.java Fri Apr 21 03:34:47 2017 +0000 @@ -788,7 +788,7 @@ } /** - * @see Javadoc Tags + * @see Javadoc Tags */ @SuppressWarnings("deprecation") private void initTagParsers() { diff -r 2bd173891dcf -r 7d89c9c5d41f src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Thu Apr 20 18:14:07 2017 +0000 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Fri Apr 21 03:34:47 2017 +0000 @@ -336,26 +336,32 @@ // Get all the exported and opened packages, for the transitive closure of the module, to be displayed in // the indirect packages tables. dependentModules.forEach((module, mod) -> { - SortedSet pkgList = new TreeSet<>(utils.makePackageComparator()); + SortedSet exportPkgList = new TreeSet<>(utils.makePackageComparator()); (ElementFilter.exportsIn(module.getDirectives())).forEach((directive) -> { PackageElement pkg = directive.getPackage(); if (shouldDocument(pkg)) { - pkgList.add(pkg); + // Qualified exports are not displayed in API mode + if (moduleMode == ModuleMode.ALL || directive.getTargetModules() == null) { + exportPkgList.add(pkg); + } } }); - // If none of the transitive modules have exported packages to be displayed, we should not be + // If none of the indirect modules have exported packages to be displayed, we should not be // displaying the table and so it should not be added to the map. - if (!pkgList.isEmpty()) { - indirectPackages.put(module, pkgList); + if (!exportPkgList.isEmpty()) { + indirectPackages.put(module, exportPkgList); } SortedSet openPkgList = new TreeSet<>(utils.makePackageComparator()); (ElementFilter.opensIn(module.getDirectives())).forEach((directive) -> { PackageElement pkg = directive.getPackage(); if (shouldDocument(pkg)) { - openPkgList.add(pkg); + // Qualified opens are not displayed in API mode + if (moduleMode == ModuleMode.ALL || directive.getTargetModules() == null) { + openPkgList.add(pkg); + } } }); - // If none of the transitive modules have opened packages to be displayed, we should not be + // If none of the indirect modules have opened packages to be displayed, we should not be // displaying the table and so it should not be added to the map. if (!openPkgList.isEmpty()) { indirectOpenPackages.put(module, openPkgList); diff -r 2bd173891dcf -r 7d89c9c5d41f src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties Thu Apr 20 18:14:07 2017 +0000 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties Fri Apr 21 03:34:47 2017 +0000 @@ -332,6 +332,9 @@ doclet.usage.charset.description=\ Charset for cross-platform viewing of generated documentation +doclet.usage.javafx.description=\ + Enable javafx functionality + doclet.usage.helpfile.parameters=\ doclet.usage.helpfile.description=\ diff -r 2bd173891dcf -r 7d89c9c5d41f src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java Thu Apr 20 18:14:07 2017 +0000 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java Fri Apr 21 03:34:47 2017 +0000 @@ -523,7 +523,7 @@ return true; } }, - new Hidden(resources, "-javafx") { + new Option(resources, "--javafx -javafx") { @Override public boolean process(String opt, List args) { javafx = true; @@ -1082,11 +1082,14 @@ private final int argCount; protected Option(Resources resources, String name, int argCount) { - this(resources, "doclet.usage." + name.toLowerCase().replaceAll("^-+", ""), name, argCount); + this(resources, null, name, argCount); } protected Option(Resources resources, String keyBase, String name, int argCount) { this.names = name.trim().split("\\s+"); + if (keyBase == null) { + keyBase = "doclet.usage." + names[0].toLowerCase().replaceAll("^-+", ""); + } String desc = getOptionsMessage(resources, keyBase + ".description"); if (desc.isEmpty()) { this.description = ""; diff -r 2bd173891dcf -r 7d89c9c5d41f src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css Thu Apr 20 18:14:07 2017 +0000 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css Fri Apr 21 03:34:47 2017 +0000 @@ -27,21 +27,13 @@ text-decoration:none; color:#4A6782; } -a:hover, a:focus { +a[href]:hover, a[href]:focus { text-decoration:none; color:#bb7a2a; } -a:active { - text-decoration:none; - color:#4A6782; -} a[name] { color:#353833; } -a[name]:hover { - text-decoration:none; - color:#353833; -} a[name]:before, a[name]:target, a[id]:before, a[id]:target { content:""; display:inline-block; @@ -579,15 +571,13 @@ .packagesSummary th.colLast, .packagesSummary td.colLast { white-space:normal; } -td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, -td.colSecond a:link, td.colSecond a:active, td.colSecond a:visited, td.colSecond a:hover, -th.colFirst a:link, th.colFirst a:active, th.colFirst a:visited, th.colFirst a:hover, -th.colSecond a:link, th.colSecond a:active, th.colSecond a:visited, th.colSecond a:hover, -th.colConstructorName a:link, th.colConstructorName a:active, th.colConstructorName a:visited, -th.colConstructorName a:hover, -td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, -.constantValuesContainer td a:link, .constantValuesContainer td a:active, -.constantValuesContainer td a:visited, .constantValuesContainer td a:hover { +td.colFirst a:link, td.colFirst a:visited, +td.colSecond a:link, td.colSecond a:visited, +th.colFirst a:link, th.colFirst a:visited, +th.colSecond a:link, th.colSecond a:visited, +th.colConstructorName a:link, th.colConstructorName a:visited, +td.colLast a:link, td.colLast a:visited, +.constantValuesContainer td a:link, .constantValuesContainer td a:visited { font-weight:bold; } .tableSubHeadingColor { diff -r 2bd173891dcf -r 7d89c9c5d41f test/TEST.ROOT --- a/test/TEST.ROOT Thu Apr 20 18:14:07 2017 +0000 +++ b/test/TEST.ROOT Fri Apr 21 03:34:47 2017 +0000 @@ -19,3 +19,6 @@ # Use new module options useNewOptions=true + +# Use --patch-module instead of -Xmodule: +useNewPatchModule=true diff -r 2bd173891dcf -r 7d89c9c5d41f test/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java --- a/test/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java Thu Apr 20 18:14:07 2017 +0000 +++ b/test/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java Fri Apr 21 03:34:47 2017 +0000 @@ -23,7 +23,8 @@ /* * @test - * @bug 7112427 8012295 8025633 8026567 8061305 8081854 8150130 8162363 8167967 8172528 8175200 + * @bug 7112427 8012295 8025633 8026567 8061305 8081854 8150130 8162363 + * 8167967 8172528 8175200 8178830 * @summary Test of the JavaFX doclet features. * @author jvalenta * @library ../lib @@ -265,12 +266,13 @@ /* * Force the doclet to emit a warning when processing a synthesized, - * DocComment, and ensure that the run succeeds. + * DocComment, and ensure that the run succeeds, using the newer + * --javafx flag. */ @Test void test4() { javadoc("-d", "out4", - "-javafx", + "--javafx", "-Xdoclint:none", "-sourcepath", testSrc, "-package", diff -r 2bd173891dcf -r 7d89c9c5d41f test/jdk/javadoc/doclet/testModules/TestIndirectExportsOpens.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/javadoc/doclet/testModules/TestIndirectExportsOpens.java Fri Apr 21 03:34:47 2017 +0000 @@ -0,0 +1,207 @@ +/* + * 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 8178339 + * @summary Tests indirect exports and opens in the module summary page + * @modules jdk.javadoc/jdk.javadoc.internal.api + * jdk.javadoc/jdk.javadoc.internal.tool + * jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.main + * @library ../lib /tools/lib + * @build toolbox.ToolBox toolbox.ModuleBuilder JavadocTester + * @run main TestIndirectExportsOpens + */ + +import java.nio.file.Path; +import java.nio.file.Paths; + +import toolbox.*; + +public class TestIndirectExportsOpens extends JavadocTester { + + public final ToolBox tb; + public static void main(String... args) throws Exception { + TestIndirectExportsOpens tester = new TestIndirectExportsOpens(); + tester.runTests(m -> new Object[] { Paths.get(m.getName()) }); + } + + public TestIndirectExportsOpens() { + tb = new ToolBox(); + } + + @Test + public void checkNoIndirects(Path base) throws Exception { + + ModuleBuilder mb0 = new ModuleBuilder(tb, "m") + .classes("package pm; public class A {}"); + Path p0 = mb0.write(base); + + ModuleBuilder mb1 = new ModuleBuilder(tb, "a") + .requiresTransitive("m", p0) + .classes("package pa; public class NoOp {}") + .exports("pa"); + mb1.write(base); + + javadoc("-d", base.resolve("out-api").toString(), + "-quiet", + "--module-source-path", base.toString(), + "--expand-requires", "transitive", + "--module", "a"); + checkExit(Exit.OK); + verifyIndirectExports(false); + verifyIndirectOpens(false); + } + + @Test + public void checkExportsOpens(Path base) throws Exception { + + ModuleBuilder mb0 = new ModuleBuilder(tb, "m") + .classes("package pm; public class A {}") + .exports("pm") + .opens("pm"); + + Path p0 = mb0.write(base); + + ModuleBuilder mb1 = new ModuleBuilder(tb, "a") + .requiresTransitive("m", p0) + .classes("package pa ; public class NoOp {}") + .exports("pa"); + mb1.write(base); + + javadoc("-d", base.resolve("out-api").toString(), + "-quiet", + "--module-source-path", base.toString(), + "--expand-requires", "transitive", + "--module", "a"); + checkExit(Exit.OK); + verifyIndirectExports(true); + verifyIndirectOpens(true); + } + + @Test + public void checkExportsToOpensTo(Path base) throws Exception { + + ModuleBuilder mb0 = new ModuleBuilder(tb, "m") + .classes("package pm; public class A {}") + .exportsTo("pm", "x") + .opensTo("pm", "x"); + + Path p0 = mb0.write(base); + + ModuleBuilder mb1 = new ModuleBuilder(tb, "a") + .requiresTransitive("m", p0) + .classes("package pa ; public class NoOp {}") + .exports("pa"); + mb1.write(base); + + javadoc("-d", base.resolve("out-api").toString(), + "-quiet", + "--module-source-path", base.toString(), + "--expand-requires", "transitive", + "--module", "a"); + + checkExit(Exit.OK); + verifyIndirectExports(false); + verifyIndirectOpens(false); + } + + @Test + public void checkExportsToOpensToDetailMode(Path base) throws Exception { + + ModuleBuilder mb0 = new ModuleBuilder(tb, "m") + .classes("package exportsto; public class A {}") + .classes("package opensto; public class A {}") + .exportsTo("exportsto", "x") + .opensTo("opensto", "x"); + + Path p0 = mb0.write(base); + + ModuleBuilder mb1 = new ModuleBuilder(tb, "a") + .requiresTransitive("m", p0) + .classes("package pa ; public class NoOp {}") + .exports("pa"); + mb1.write(base); + + javadoc("-d", base.resolve("out-detail").toString(), + "-quiet", + "--module-source-path", base.toString(), + "--expand-requires", "transitive", + "--show-module-contents", "all", + "--module", "a"); + + checkExit(Exit.OK); + + // In details mode all kinds of packages from java.base, + // could be listed in the indirects section, so just + // check for minimal expected strings. + checkOutput("a-summary.html", true, + "Indirect Exports table", + "m\n" + + "exportsto\n" + + "\n"); + + checkOutput("a-summary.html", true, + "Indirect Opens table", + "m\n" + + "opensto\n" + + "\n"); + } + + void verifyIndirectExports(boolean present) { + verifyIndirects(present, false); + } + + void verifyIndirectOpens(boolean present) { + verifyIndirects(present, true); + } + + void verifyIndirects(boolean present, boolean opens) { + + String typeString = opens ? "Indirect Opens" : "Indirect Exports"; + + // Avoid false positives, just check for primary string absence. + if (!present) { + checkOutput("a-summary.html", false, typeString); + return; + } + + checkOutput("a-summary.html", present, + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "
" + typeString + " 
FromPackages
mpm
\n"); + } + +} + diff -r 2bd173891dcf -r 7d89c9c5d41f test/jdk/javadoc/doclet/testModules/TestModules.java --- a/test/jdk/javadoc/doclet/testModules/TestModules.java Thu Apr 20 18:14:07 2017 +0000 +++ b/test/jdk/javadoc/doclet/testModules/TestModules.java Fri Apr 21 03:34:47 2017 +0000 @@ -752,14 +752,6 @@ checkOutput("moduleA-summary.html", true, "

  • Description | " + "Modules | Packages | Services
  • ", - "\n" - + "", - "
    Indirect Exports 
    \n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n", "\n" + "\n"); checkOutput("moduleB-summary.html", true, diff -r 2bd173891dcf -r 7d89c9c5d41f test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java --- a/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java Thu Apr 20 18:14:07 2017 +0000 +++ b/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java Fri Apr 21 03:34:47 2017 +0000 @@ -24,7 +24,7 @@ /* * @test * @bug 4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363 8160196 8151743 8177417 - * 8175218 + * 8175218 8176452 * @summary Run tests on doclet stylesheet. * @author jamieh * @library ../lib @@ -173,13 +173,36 @@ + "}\n" + ".searchTagResult:before, .searchTagResult:target {\n" + " color:red;\n" + + "}", + "a[href]:hover, a[href]:focus {\n" + + " text-decoration:none;\n" + + " color:#bb7a2a;\n" + + "}", + "td.colFirst a:link, td.colFirst a:visited,\n" + + "td.colSecond a:link, td.colSecond a:visited,\n" + + "th.colFirst a:link, th.colFirst a:visited,\n" + + "th.colSecond a:link, th.colSecond a:visited,\n" + + "th.colConstructorName a:link, th.colConstructorName a:visited,\n" + + "td.colLast a:link, td.colLast a:visited,\n" + + ".constantValuesContainer td a:link, .constantValuesContainer td a:visited {\n" + + " font-weight:bold;\n" + "}"); - // Test whether a link to the stylesheet file is inserted properly - // in the class documentation. checkOutput("pkg/A.html", true, + // Test whether a link to the stylesheet file is inserted properly + // in the class documentation. ""); + + "href=\"../stylesheet.css\" title=\"Style\">", + "
    Test comment for a class which has an " + + "anchor_with_name and\n" + + " an anchor_with_id.
    "); + + checkOutput("pkg/package-summary.html", true, + ""); checkOutput("index.html", true, ""); @@ -188,6 +211,14 @@ "* {\n" + " margin:0;\n" + " padding:0;\n" + + "}", + "a:active {\n" + + " text-decoration:none;\n" + + " color:#4A6782;\n" + + "}", + "a[name]:hover {\n" + + " text-decoration:none;\n" + + " color:#353833;\n" + "}"); } } diff -r 2bd173891dcf -r 7d89c9c5d41f test/jdk/javadoc/doclet/testStylesheet/pkg/A.java --- a/test/jdk/javadoc/doclet/testStylesheet/pkg/A.java Thu Apr 20 18:14:07 2017 +0000 +++ b/test/jdk/javadoc/doclet/testStylesheet/pkg/A.java Fri Apr 21 03:34:47 2017 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -23,4 +23,8 @@ package pkg; +/** + * Test comment for a class which has an anchor_with_name and + * an anchor_with_id. + */ public class A {} diff -r 2bd173891dcf -r 7d89c9c5d41f test/jdk/jshell/CompletionSuggestionTest.java --- a/test/jdk/jshell/CompletionSuggestionTest.java Thu Apr 20 18:14:07 2017 +0000 +++ b/test/jdk/jshell/CompletionSuggestionTest.java Fri Apr 21 03:34:47 2017 +0000 @@ -296,7 +296,7 @@ } public void testImportStart() { - assertCompletion("import c|", "com"); + assertCompletionIncludesExcludes("import c|", Set.of("com"), Set.of()); } public void testBrokenClassFile() throws Exception { diff -r 2bd173891dcf -r 7d89c9c5d41f test/jdk/jshell/HistoryUITest.java --- a/test/jdk/jshell/HistoryUITest.java Thu Apr 20 18:14:07 2017 +0000 +++ b/test/jdk/jshell/HistoryUITest.java Fri Apr 21 03:34:47 2017 +0000 @@ -28,6 +28,7 @@ * @modules * jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main + * jdk.jshell/jdk.internal.jshell.tool.resources:open * jdk.jshell/jdk.jshell:open * @library /tools/lib * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask diff -r 2bd173891dcf -r 7d89c9c5d41f test/jdk/jshell/MergedTabShiftTabCommandTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/jshell/MergedTabShiftTabCommandTest.java Fri Apr 21 03:34:47 2017 +0000 @@ -0,0 +1,124 @@ +/* + * 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 8177076 + * @modules + * jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.main + * jdk.jshell/jdk.internal.jshell.tool.resources:open + * jdk.jshell/jdk.jshell:open + * @library /tools/lib + * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask + * @build Compiler UITesting + * @build MergedTabShiftTabCommandTest + * @run testng MergedTabShiftTabCommandTest + */ + +import java.util.regex.Pattern; + +import org.testng.annotations.Test; + +@Test +public class MergedTabShiftTabCommandTest extends UITesting { + + public void testCommand() throws Exception { + doRunTest((inputSink, out) -> { + inputSink.write("1\n"); + waitOutput(out, "\u0005"); + inputSink.write("/\011"); + waitOutput(out, ".*/edit.*/list.*\n\n" + Pattern.quote(getResource("jshell.console.see.synopsis")) + "\n\r\u0005/"); + inputSink.write("\011"); + waitOutput(out, ".*\n/edit\n" + Pattern.quote(getResource("help.edit.summary")) + + "\n.*\n/list\n" + Pattern.quote(getResource("help.list.summary")) + + ".*\n\n" + Pattern.quote(getResource("jshell.console.see.full.documentation")) + "\n\r\u0005/"); + inputSink.write("\011"); + waitOutput(out, "/!\n" + + Pattern.quote(getResource("help.bang")) + "\n" + + "\n" + + Pattern.quote(getResource("jshell.console.see.next.command.doc")) + "\n" + + "\r\u0005/"); + inputSink.write("\011"); + waitOutput(out, "/-\n" + + Pattern.quote(getResource("help.previous")) + "\n" + + "\n" + + Pattern.quote(getResource("jshell.console.see.next.command.doc")) + "\n" + + "\r\u0005/"); + + inputSink.write("lis\011"); + waitOutput(out, "list $"); + + inputSink.write("\011"); + waitOutput(out, ".*-all.*" + + "\n\n" + Pattern.quote(getResource("jshell.console.see.synopsis")) + "\n\r\u0005/"); + inputSink.write("\011"); + waitOutput(out, Pattern.quote(getResource("help.list.summary")) + "\n\n" + + Pattern.quote(getResource("jshell.console.see.full.documentation")) + "\n\r\u0005/list "); + inputSink.write("\011"); + waitOutput(out, Pattern.quote(getResource("help.list").replaceAll("\t", " "))); + + inputSink.write("\u0003/env \011"); + waitOutput(out, "\u0005/env -\n" + + "-add-exports -add-modules -class-path -module-path \n" + + "\r\u0005/env -"); + + inputSink.write("\011"); + waitOutput(out, "-add-exports -add-modules -class-path -module-path \n" + + "\n" + + Pattern.quote(getResource("jshell.console.see.synopsis")) + "\n" + + "\r\u0005/env -"); + + inputSink.write("\011"); + waitOutput(out, Pattern.quote(getResource("help.env.summary")) + "\n\n" + + Pattern.quote(getResource("jshell.console.see.full.documentation")) + "\n" + + "\r\u0005/env -"); + + inputSink.write("\011"); + waitOutput(out, Pattern.quote(getResource("help.env").replaceAll("\t", " ")) + "\n" + + "\r\u0005/env -"); + + inputSink.write("\011"); + waitOutput(out, "-add-exports -add-modules -class-path -module-path \n" + + "\n" + + Pattern.quote(getResource("jshell.console.see.synopsis")) + "\n" + + "\r\u0005/env -"); + + inputSink.write("\u0003/exit \011"); + waitOutput(out, Pattern.quote(getResource("help.exit.summary")) + "\n\n" + + Pattern.quote(getResource("jshell.console.see.full.documentation")) + "\n\r\u0005/exit "); + inputSink.write("\011"); + waitOutput(out, Pattern.quote(getResource("help.exit")) + "\n" + + "\r\u0005/exit "); + inputSink.write("\011"); + waitOutput(out, Pattern.quote(getResource("help.exit.summary")) + "\n\n" + + Pattern.quote(getResource("jshell.console.see.full.documentation")) + "\n\r\u0005/exit "); + inputSink.write("\u0003/doesnotexist\011"); + waitOutput(out, "\u0005/doesnotexist\n" + + Pattern.quote(getResource("jshell.console.no.such.command")) + "\n" + + "\n" + + "\r\u0005/doesnotexist"); + }); + } + +} diff -r 2bd173891dcf -r 7d89c9c5d41f test/jdk/jshell/MergedTabShiftTabExpressionTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/jshell/MergedTabShiftTabExpressionTest.java Fri Apr 21 03:34:47 2017 +0000 @@ -0,0 +1,250 @@ +/* + * 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 8177076 + * @modules + * jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.main + * jdk.jshell/jdk.internal.jshell.tool.resources:open + * jdk.jshell/jdk.jshell:open + * @library /tools/lib + * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask + * @build Compiler UITesting + * @build MergedTabShiftTabExpressionTest + * @run testng/timeout=300 MergedTabShiftTabExpressionTest + */ + +import java.io.IOException; +import java.lang.reflect.Field; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.jar.JarEntry; +import java.util.jar.JarOutputStream; +import java.util.regex.Pattern; + +import org.testng.annotations.Test; + +@Test +public class MergedTabShiftTabExpressionTest extends UITesting { + + public void testExpression() throws Exception { + Path classes = prepareZip(); + doRunTest((inputSink, out) -> { + inputSink.write("/env -class-path " + classes.toString() + "\n"); + waitOutput(out, Pattern.quote(getResource("jshell.msg.set.restore")) + "\n\u0005"); + inputSink.write("import jshelltest.*;\n"); + waitOutput(out, "\n\u0005"); + + //-> + inputSink.write("\011"); + waitOutput(out, getMessage("jshell.console.completion.all.completions.number", "[0-9]+")); + inputSink.write("\011"); + waitOutput(out, ".*String.*StringBuilder.*\n\r\u0005"); + + //new JShellTes + inputSink.write("new JShellTes\011"); + waitOutput(out, "t\nJShellTest\\( JShellTestAux\\( \n\r\u0005new JShellTest"); + + //new JShellTest + inputSink.write("\011"); + waitOutput(out, "JShellTest\\( JShellTestAux\\( \n" + + "\n" + + Pattern.quote(getResource("jshell.console.completion.current.signatures")) + "\n" + + "jshelltest.JShellTest\n" + + "\n" + + Pattern.quote(getResource("jshell.console.see.documentation")) + "\n" + + "\r\u0005new JShellTest"); + inputSink.write("\011"); + waitOutput(out, "jshelltest.JShellTest\n" + + "JShellTest 0\n" + + "\r\u0005new JShellTest"); + inputSink.write("\011"); + waitOutput(out, "JShellTest\\( JShellTestAux\\( \n" + + "\n" + + Pattern.quote(getResource("jshell.console.completion.current.signatures")) + "\n" + + "jshelltest.JShellTest\n" + + "\n" + + Pattern.quote(getResource("jshell.console.see.documentation")) + "\n" + + "\r\u0005new JShellTest"); + + //new JShellTest( + inputSink.write("(\011"); + waitOutput(out, "\\(\n" + + Pattern.quote(getResource("jshell.console.completion.current.signatures")) + "\n" + + "JShellTest\\(String str\\)\n" + + "JShellTest\\(String str, int i\\)\n" + + "\n" + + Pattern.quote(getResource("jshell.console.see.documentation")) + "\n" + + "\r\u0005new JShellTest\\("); + inputSink.write("\011"); + waitOutput(out, "JShellTest\\(String str\\)\n" + + "JShellTest 1\n" + + "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n" + + "\n" + + Pattern.quote(getResource("jshell.console.see.next.page")) + "\n" + + "\r\u0005new JShellTest\\("); + inputSink.write("\011"); + waitOutput(out, "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n" + + "\n" + + Pattern.quote(getResource("jshell.console.see.next.javadoc")) + "\n" + + "\r\u0005new JShellTest\\("); + inputSink.write("\011"); + waitOutput(out, "JShellTest\\(String str, int i\\)\n" + + "JShellTest 2\n" + + "\n" + + getMessage("jshell.console.completion.all.completions.number", "[0-9]+") + "\n" + + "\r\u0005new JShellTest\\("); + inputSink.write("\011"); + waitOutput(out, ".*String.*StringBuilder.*\n\r\u0005new JShellTest\\("); + + inputSink.write("\u0003String str = \"\";\nnew JShellTest("); + waitOutput(out, "\u0005new JShellTest\\("); + + inputSink.write("\011"); + waitOutput(out, "\n" + + "str \n" + + "\n" + + Pattern.quote(getResource("jshell.console.completion.current.signatures")) + "\n" + + "JShellTest\\(String str\\)\n" + + "JShellTest\\(String str, int i\\)\n" + + "\n" + + Pattern.quote(getResource("jshell.console.see.documentation")) + "\n" + + "\r\u0005new JShellTest\\("); + inputSink.write("\011"); + waitOutput(out, "JShellTest\\(String str\\)\n" + + "JShellTest 1\n" + + "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n" + + "\n" + + Pattern.quote(getResource("jshell.console.see.next.page")) + "\n" + + "\r\u0005new JShellTest\\("); + inputSink.write("\011"); + waitOutput(out, "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n" + + "\n" + + Pattern.quote(getResource("jshell.console.see.next.javadoc")) + "\n" + + "\r\u0005new JShellTest\\("); + inputSink.write("\011"); + waitOutput(out, "JShellTest\\(String str, int i\\)\n" + + "JShellTest 2\n" + + "\n" + + getMessage("jshell.console.completion.all.completions.number", "[0-9]+") + "\n" + + "\r\u0005new JShellTest\\("); + inputSink.write("\011"); + waitOutput(out, ".*String.*StringBuilder.*\n\r\u0005new JShellTest\\("); + + inputSink.write("\u0003JShellTest t = new JShellTest\011"); + waitOutput(out, "\u0005JShellTest t = new JShellTest\n" + + "JShellTest\\( \n" + + "\n" + + Pattern.quote(getResource("jshell.console.completion.current.signatures")) + "\n" + + "jshelltest.JShellTest\n" + + "\n" + + Pattern.quote(getResource("jshell.console.completion.all.completions")) + "\n" + + "\r\u0005JShellTest t = new JShellTest"); + inputSink.write("\011"); + waitOutput(out, "JShellTest\\( JShellTestAux\\( \n" + + "\n" + + Pattern.quote(getResource("jshell.console.see.documentation")) + "\n" + + "\r\u0005JShellTest t = new JShellTest"); + + inputSink.write("\u0003JShellTest t = new \011"); + waitOutput(out, "\u0005JShellTest t = new \n" + + "JShellTest\\( \n" + + "\n" + + getMessage("jshell.console.completion.all.completions.number", "[0-9]+") + "\n" + + "\r\u0005JShellTest t = new "); + inputSink.write("\011"); + waitOutput(out, ".*String.*StringBuilder.*\n\r\u0005JShellTest t = new "); + + inputSink.write("\u0003class JShelX{}\n"); + inputSink.write("new JShel\011"); + waitOutput(out, "\u0005new JShel\n" + + "JShelX\\(\\) JShellTest\\( JShellTestAux\\( \n" + + "\r\u0005new JShel"); + + //no crash: + inputSink.write("\u0003new Stringbuil\011"); + waitOutput(out, "\u0005new Stringbuil\u0007"); + }); + } + + private Path prepareZip() { + String clazz1 = + "package jshelltest;\n" + + "/**JShellTest 0" + + " */\n" + + "public class JShellTest {\n" + + " /**JShellTest 1\n" + + " *

    1

    1

    1

    1

    1

    1

    1

    1

    1

    1\n" + + " *

    1

    1

    1

    1

    1

    1

    1

    1

    1

    1\n" + + " *

    1

    1

    1

    1

    1

    1

    1

    1

    1

    1\n" + + " */\n" + + " public JShellTest(String str) {}\n" + + " /**JShellTest 2" + + " */\n" + + " public JShellTest(String str, int i) {}\n" + + "}\n"; + + String clazz2 = + "package jshelltest;\n" + + "/**JShellTestAux 0" + + " */\n" + + "public class JShellTestAux {\n" + + " /**JShellTest 1" + + " */\n" + + " public JShellTestAux(String str) { }\n" + + " /**JShellTest 2" + + " */\n" + + " public JShellTestAux(String str, int i) { }\n" + + "}\n"; + + Path srcZip = Paths.get("src.zip"); + + try (JarOutputStream out = new JarOutputStream(Files.newOutputStream(srcZip))) { + out.putNextEntry(new JarEntry("jshelltest/JShellTest.java")); + out.write(clazz1.getBytes()); + out.putNextEntry(new JarEntry("jshelltest/JShellTestAux.java")); + out.write(clazz2.getBytes()); + } catch (IOException ex) { + throw new IllegalStateException(ex); + } + + compiler.compile(clazz1, clazz2); + + try { + Field availableSources = Class.forName("jdk.jshell.SourceCodeAnalysisImpl").getDeclaredField("availableSourcesOverride"); + availableSources.setAccessible(true); + availableSources.set(null, Arrays.asList(srcZip)); + } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException | ClassNotFoundException ex) { + throw new IllegalStateException(ex); + } + + return compiler.getClassDir(); + } + //where: + private final Compiler compiler = new Compiler(); + +} diff -r 2bd173891dcf -r 7d89c9c5d41f test/jdk/jshell/MergedTabShiftTabTest.java --- a/test/jdk/jshell/MergedTabShiftTabTest.java Thu Apr 20 18:14:07 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,345 +0,0 @@ -/* - * 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 8177076 - * @modules - * jdk.compiler/com.sun.tools.javac.api - * jdk.compiler/com.sun.tools.javac.main - * jdk.jshell/jdk.internal.jshell.tool.resources:open - * jdk.jshell/jdk.jshell:open - * @library /tools/lib - * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask - * @build Compiler UITesting - * @build MergedTabShiftTabTest - * @run testng MergedTabShiftTabTest - */ - -import java.io.IOException; -import java.lang.reflect.Field; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.text.MessageFormat; -import java.util.Arrays; -import java.util.Locale; -import java.util.ResourceBundle; -import java.util.jar.JarEntry; -import java.util.jar.JarOutputStream; -import java.util.regex.Pattern; - -import jdk.jshell.JShell; -import org.testng.annotations.Test; - -@Test -public class MergedTabShiftTabTest extends UITesting { - - public void testCommand() throws Exception { - doRunTest((inputSink, out) -> { - inputSink.write("1\n"); - waitOutput(out, "\u0005"); - inputSink.write("/\011"); - waitOutput(out, ".*/edit.*/list.*\n\n" + Pattern.quote(getResource("jshell.console.see.synopsis")) + "\n\r\u0005/"); - inputSink.write("\011"); - waitOutput(out, ".*\n/edit\n" + Pattern.quote(getResource("help.edit.summary")) + - "\n.*\n/list\n" + Pattern.quote(getResource("help.list.summary")) + - ".*\n\n" + Pattern.quote(getResource("jshell.console.see.full.documentation")) + "\n\r\u0005/"); - inputSink.write("\011"); - waitOutput(out, "/!\n" + - Pattern.quote(getResource("help.bang")) + "\n" + - "\n" + - Pattern.quote(getResource("jshell.console.see.next.command.doc")) + "\n" + - "\r\u0005/"); - inputSink.write("\011"); - waitOutput(out, "/-\n" + - Pattern.quote(getResource("help.previous")) + "\n" + - "\n" + - Pattern.quote(getResource("jshell.console.see.next.command.doc")) + "\n" + - "\r\u0005/"); - - inputSink.write("lis\011"); - waitOutput(out, "list $"); - - inputSink.write("\011"); - waitOutput(out, ".*-all.*" + - "\n\n" + Pattern.quote(getResource("jshell.console.see.synopsis")) + "\n\r\u0005/"); - inputSink.write("\011"); - waitOutput(out, Pattern.quote(getResource("help.list.summary")) + "\n\n" + - Pattern.quote(getResource("jshell.console.see.full.documentation")) + "\n\r\u0005/list "); - inputSink.write("\011"); - waitOutput(out, Pattern.quote(getResource("help.list").replaceAll("\t", " "))); - - inputSink.write("\u0003/env \011"); - waitOutput(out, "\u0005/env -\n" + - "-add-exports -add-modules -class-path -module-path \n" + - "\r\u0005/env -"); - - inputSink.write("\011"); - waitOutput(out, "-add-exports -add-modules -class-path -module-path \n" + - "\n" + - Pattern.quote(getResource("jshell.console.see.synopsis")) + "\n" + - "\r\u0005/env -"); - - inputSink.write("\011"); - waitOutput(out, Pattern.quote(getResource("help.env.summary")) + "\n\n" + - Pattern.quote(getResource("jshell.console.see.full.documentation")) + "\n" + - "\r\u0005/env -"); - - inputSink.write("\011"); - waitOutput(out, Pattern.quote(getResource("help.env").replaceAll("\t", " ")) + "\n" + - "\r\u0005/env -"); - - inputSink.write("\011"); - waitOutput(out, "-add-exports -add-modules -class-path -module-path \n" + - "\n" + - Pattern.quote(getResource("jshell.console.see.synopsis")) + "\n" + - "\r\u0005/env -"); - - inputSink.write("\u0003/exit \011"); - waitOutput(out, Pattern.quote(getResource("help.exit.summary")) + "\n\n" + - Pattern.quote(getResource("jshell.console.see.full.documentation")) + "\n\r\u0005/exit "); - inputSink.write("\011"); - waitOutput(out, Pattern.quote(getResource("help.exit")) + "\n" + - "\r\u0005/exit "); - inputSink.write("\011"); - waitOutput(out, Pattern.quote(getResource("help.exit.summary")) + "\n\n" + - Pattern.quote(getResource("jshell.console.see.full.documentation")) + "\n\r\u0005/exit "); - inputSink.write("\u0003/doesnotexist\011"); - waitOutput(out, "\u0005/doesnotexist\n" + - Pattern.quote(getResource("jshell.console.no.such.command")) + "\n" + - "\n" + - "\r\u0005/doesnotexist"); - }); - } - - public void testExpression() throws Exception { - Path classes = prepareZip(); - doRunTest((inputSink, out) -> { - inputSink.write("/env -class-path " + classes.toString() + "\n"); - waitOutput(out, Pattern.quote(getResource("jshell.msg.set.restore")) + "\n\u0005"); - inputSink.write("import jshelltest.*;\n"); - waitOutput(out, "\n\u0005"); - - //-> - inputSink.write("\011"); - waitOutput(out, getMessage("jshell.console.completion.all.completions.number", "[0-9]+")); - inputSink.write("\011"); - waitOutput(out, ".*String.*StringBuilder.*\n\r\u0005"); - - //new JShellTes - inputSink.write("new JShellTes\011"); - waitOutput(out, "t\nJShellTest\\( JShellTestAux\\( \n\r\u0005new JShellTest"); - - //new JShellTest - inputSink.write("\011"); - waitOutput(out, "JShellTest\\( JShellTestAux\\( \n" + - "\n" + - Pattern.quote(getResource("jshell.console.completion.current.signatures")) + "\n" + - "jshelltest.JShellTest\n" + - "\n" + - Pattern.quote(getResource("jshell.console.see.documentation")) + "\n" + - "\r\u0005new JShellTest"); - inputSink.write("\011"); - waitOutput(out, "jshelltest.JShellTest\n" + - "JShellTest 0\n" + - "\r\u0005new JShellTest"); - inputSink.write("\011"); - waitOutput(out, "JShellTest\\( JShellTestAux\\( \n" + - "\n" + - Pattern.quote(getResource("jshell.console.completion.current.signatures")) + "\n" + - "jshelltest.JShellTest\n" + - "\n" + - Pattern.quote(getResource("jshell.console.see.documentation")) + "\n" + - "\r\u0005new JShellTest"); - - //new JShellTest( - inputSink.write("(\011"); - waitOutput(out, "\\(\n" + - Pattern.quote(getResource("jshell.console.completion.current.signatures")) + "\n" + - "JShellTest\\(String str\\)\n" + - "JShellTest\\(String str, int i\\)\n" + - "\n" + - Pattern.quote(getResource("jshell.console.see.documentation")) + "\n" + - "\r\u0005new JShellTest\\("); - inputSink.write("\011"); - waitOutput(out, "JShellTest\\(String str\\)\n" + - "JShellTest 1\n" + - "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n" + - "\n" + - Pattern.quote(getResource("jshell.console.see.next.page")) + "\n" + - "\r\u0005new JShellTest\\("); - inputSink.write("\011"); - waitOutput(out, "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n" + - "\n" + - Pattern.quote(getResource("jshell.console.see.next.javadoc")) + "\n" + - "\r\u0005new JShellTest\\("); - inputSink.write("\011"); - waitOutput(out, "JShellTest\\(String str, int i\\)\n" + - "JShellTest 2\n" + - "\n" + - getMessage("jshell.console.completion.all.completions.number", "[0-9]+") + "\n" + - "\r\u0005new JShellTest\\("); - inputSink.write("\011"); - waitOutput(out, ".*String.*StringBuilder.*\n\r\u0005new JShellTest\\("); - - inputSink.write("\u0003String str = \"\";\nnew JShellTest("); - waitOutput(out, "\u0005new JShellTest\\("); - - inputSink.write("\011"); - waitOutput(out, "\n" + - "str \n" + - "\n" + - Pattern.quote(getResource("jshell.console.completion.current.signatures")) + "\n" + - "JShellTest\\(String str\\)\n" + - "JShellTest\\(String str, int i\\)\n" + - "\n" + - Pattern.quote(getResource("jshell.console.see.documentation")) + "\n" + - "\r\u0005new JShellTest\\("); - inputSink.write("\011"); - waitOutput(out, "JShellTest\\(String str\\)\n" + - "JShellTest 1\n" + - "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n" + - "\n" + - Pattern.quote(getResource("jshell.console.see.next.page")) + "\n" + - "\r\u0005new JShellTest\\("); - inputSink.write("\011"); - waitOutput(out, "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n" + - "\n" + - Pattern.quote(getResource("jshell.console.see.next.javadoc")) + "\n" + - "\r\u0005new JShellTest\\("); - inputSink.write("\011"); - waitOutput(out, "JShellTest\\(String str, int i\\)\n" + - "JShellTest 2\n" + - "\n" + - getMessage("jshell.console.completion.all.completions.number", "[0-9]+") + "\n" + - "\r\u0005new JShellTest\\("); - inputSink.write("\011"); - waitOutput(out, ".*String.*StringBuilder.*\n\r\u0005new JShellTest\\("); - - inputSink.write("\u0003JShellTest t = new JShellTest\011"); - waitOutput(out, "\u0005JShellTest t = new JShellTest\n" + - "JShellTest\\( \n" + - "\n" + - Pattern.quote(getResource("jshell.console.completion.current.signatures")) + "\n" + - "jshelltest.JShellTest\n" + - "\n" + - Pattern.quote(getResource("jshell.console.completion.all.completions")) + "\n" + - "\r\u0005JShellTest t = new JShellTest"); - inputSink.write("\011"); - waitOutput(out, "JShellTest\\( JShellTestAux\\( \n" + - "\n" + - Pattern.quote(getResource("jshell.console.see.documentation")) + "\n" + - "\r\u0005JShellTest t = new JShellTest"); - - inputSink.write("\u0003JShellTest t = new \011"); - waitOutput(out, "\u0005JShellTest t = new \n" + - "JShellTest\\( \n" + - "\n" + - getMessage("jshell.console.completion.all.completions.number", "[0-9]+") + "\n" + - "\r\u0005JShellTest t = new "); - inputSink.write("\011"); - waitOutput(out, ".*String.*StringBuilder.*\n\r\u0005JShellTest t = new "); - - inputSink.write("\u0003class JShelX{}\n"); - inputSink.write("new JShel\011"); - waitOutput(out, "\u0005new JShel\n" + - "JShelX\\(\\) JShellTest\\( JShellTestAux\\( \n" + - "\r\u0005new JShel"); - - //no crash: - inputSink.write("\u0003new Stringbuil\011"); - waitOutput(out, "\u0005new Stringbuil\u0007"); - }); - } - - private Path prepareZip() { - String clazz1 = - "package jshelltest;\n" + - "/**JShellTest 0" + - " */\n" + - "public class JShellTest {\n" + - " /**JShellTest 1\n" + - " *

    1

    1

    1

    1

    1

    1

    1

    1

    1

    1\n" + - " *

    1

    1

    1

    1

    1

    1

    1

    1

    1

    1\n" + - " *

    1

    1

    1

    1

    1

    1

    1

    1

    1

    1\n" + - " */\n" + - " public JShellTest(String str) {}\n" + - " /**JShellTest 2" + - " */\n" + - " public JShellTest(String str, int i) {}\n" + - "}\n"; - - String clazz2 = - "package jshelltest;\n" + - "/**JShellTestAux 0" + - " */\n" + - "public class JShellTestAux {\n" + - " /**JShellTest 1" + - " */\n" + - " public JShellTestAux(String str) { }\n" + - " /**JShellTest 2" + - " */\n" + - " public JShellTestAux(String str, int i) { }\n" + - "}\n"; - - Path srcZip = Paths.get("src.zip"); - - try (JarOutputStream out = new JarOutputStream(Files.newOutputStream(srcZip))) { - out.putNextEntry(new JarEntry("jshelltest/JShellTest.java")); - out.write(clazz1.getBytes()); - out.putNextEntry(new JarEntry("jshelltest/JShellTestAux.java")); - out.write(clazz2.getBytes()); - } catch (IOException ex) { - throw new IllegalStateException(ex); - } - - compiler.compile(clazz1, clazz2); - - try { - Field availableSources = Class.forName("jdk.jshell.SourceCodeAnalysisImpl").getDeclaredField("availableSourcesOverride"); - availableSources.setAccessible(true); - availableSources.set(null, Arrays.asList(srcZip)); - } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException | ClassNotFoundException ex) { - throw new IllegalStateException(ex); - } - - return compiler.getClassDir(); - } - //where: - private final Compiler compiler = new Compiler(); - - private final ResourceBundle resources; - { - resources = ResourceBundle.getBundle("jdk.internal.jshell.tool.resources.l10n", Locale.US, JShell.class.getModule()); - } - - private String getResource(String key) { - return resources.getString(key); - } - - private String getMessage(String key, Object... args) { - return MessageFormat.format(resources.getString(key), args); - } - -} diff -r 2bd173891dcf -r 7d89c9c5d41f test/jdk/jshell/UITesting.java --- a/test/jdk/jshell/UITesting.java Thu Apr 20 18:14:07 2017 +0000 +++ b/test/jdk/jshell/UITesting.java Fri Apr 21 03:34:47 2017 +0000 @@ -27,13 +27,16 @@ import java.io.OutputStreamWriter; import java.io.PrintStream; import java.io.Writer; +import java.text.MessageFormat; import java.util.HashMap; import java.util.Locale; +import java.util.ResourceBundle; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; +import jdk.jshell.JShell; import jdk.jshell.tool.JavaShellToolBuilder; public class UITesting { @@ -168,6 +171,18 @@ return result.toString(); } + private final ResourceBundle resources; + { + resources = ResourceBundle.getBundle("jdk.internal.jshell.tool.resources.l10n", Locale.US, JShell.class.getModule()); + } + + protected String getResource(String key) { + return resources.getString(key); + } + + protected String getMessage(String key, Object... args) { + return MessageFormat.format(resources.getString(key), args); + } private static class PipeInputStream extends InputStream { private static final int INITIAL_SIZE = 128; diff -r 2bd173891dcf -r 7d89c9c5d41f test/tools/javac/modules/LegacyXModuleTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/modules/LegacyXModuleTest.java Fri Apr 21 03:34:47 2017 +0000 @@ -0,0 +1,85 @@ +/* + * 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 8178012 + * @summary tests for multi-module mode compilation + * @library /tools/lib + * @modules + * jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.main + * @build toolbox.ToolBox toolbox.JavacTask toolbox.ModuleBuilder ModuleTestBase + * @run main LegacyXModuleTest + */ + +import java.nio.file.Path; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; + +import toolbox.JavacTask; +import toolbox.Task; + +public class LegacyXModuleTest extends ModuleTestBase { + + public static void main(String... args) throws Exception { + new LegacyXModuleTest().runTests(); + } + + @Test + public void testLegacyXModule(Path base) throws Exception { + //note: avoiding use of java.base, as that gets special handling on some places: + Path src = base.resolve("src"); + tb.writeJavaFiles(src, "package com.sun.tools.javac.comp; public class Extra { Modules modules; }"); + Path classes = base.resolve("classes"); + tb.createDirectories(classes); + + new JavacTask(tb) + .options("-XD-Xmodule:jdk.compiler") + .outdir(classes) + .files(findJavaFiles(src)) + .run() + .writeAll() + .getOutput(Task.OutputKind.DIRECT); + + List log = new JavacTask(tb) + .options("-XD-Xmodule:java.compiler", + "-XD-Xmodule:jdk.compiler", + "-XDrawDiagnostics") + .outdir(classes) + .files(findJavaFiles(src)) + .run(Task.Expect.FAIL) + .writeAll() + .getOutputLines(Task.OutputKind.DIRECT); + + List actual = + Arrays.asList("Extra.java:1:56: compiler.err.cant.resolve.location: kindname.class, Modules, , , " + + "(compiler.misc.location: kindname.class, com.sun.tools.javac.comp.Extra, null)", + "1 error"); + + if (!Objects.equals(actual, log)) + throw new Exception("expected output not found: " + log); + } + +} diff -r 2bd173891dcf -r 7d89c9c5d41f test/tools/javadoc/CompletionError.java --- a/test/tools/javadoc/CompletionError.java Thu Apr 20 18:14:07 2017 +0000 +++ b/test/tools/javadoc/CompletionError.java Fri Apr 21 03:34:47 2017 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -27,8 +27,10 @@ * @summary Check that CompletionFailures for missing classes are not incorrectly passed to * the javadoc API clients. * @library /tools/lib - * @modules jdk.javadoc com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.main * jdk.jdeps/com.sun.tools.javap + * @build toolbox.JavacTask toolbox.ToolBox * @run main CompletionError */ @@ -37,6 +39,9 @@ import com.sun.javadoc.*; import com.sun.tools.javadoc.Main; +import toolbox.JavacTask; +import toolbox.ToolBox; + public class CompletionError extends Doclet { private static final String template = @@ -49,6 +54,9 @@ " public String toString() { return null; }" + "}"; + private static final String testSrc = System.getProperty("test.src"); + private static final String testClassPath = System.getProperty("test.class.path"); + public static void main(String[] args) throws Exception { String[] templateParts = template.split("#"); int sources = templateParts.length / 2; @@ -75,8 +83,8 @@ tb.deleteFiles("CompletionErrorMissing.class", "CompletionErrorIntfMissing.class", "CompletionErrorExcMissing.class"); // run javadoc: if (Main.execute("javadoc", "CompletionError", CompletionError.class.getClassLoader(), - "-classpath", ".", - System.getProperty("test.src", ".") + File.separatorChar + "CompletionError.java") != 0) + "-classpath", "." + File.pathSeparator + testClassPath, + new File(testSrc, "CompletionError.java").getPath()) != 0) throw new Error(); } } diff -r 2bd173891dcf -r 7d89c9c5d41f test/tools/lib/toolbox/ModuleBuilder.java --- a/test/tools/lib/toolbox/ModuleBuilder.java Thu Apr 20 18:14:07 2017 +0000 +++ b/test/tools/lib/toolbox/ModuleBuilder.java Fri Apr 21 03:34:47 2017 +0000 @@ -45,6 +45,7 @@ private String comment = ""; private List requires = new ArrayList<>(); private List exports = new ArrayList<>(); + private List opens = new ArrayList<>(); private List uses = new ArrayList<>(); private List provides = new ArrayList<>(); private List content = new ArrayList<>(); @@ -134,33 +135,6 @@ } /** - * Adds an unqualified "exports dynamic" directive to the declaration. - * @param pkg the name of the package to be exported - * @return this builder - */ - public ModuleBuilder exportsDynamic(String pkg) { - return addDirective(exports, "exports dynamic " + pkg + ";"); - } - - /** - * Adds an unqualified "exports private" directive to the declaration. - * @param pkg the name of the package to be exported - * @return this builder - */ - public ModuleBuilder exportsPrivate(String pkg) { - return addDirective(exports, "exports private " + pkg + ";"); - } - - /** - * Adds an unqualified "exports dynamic private" directive to the declaration. - * @param pkg the name of the package to be exported - * @return this builder - */ - public ModuleBuilder exportsDynamicPrivate(String pkg) { - return addDirective(exports, "exports dynamic private " + pkg + ";"); - } - - /** * Adds a qualified "exports" directive to the declaration. * @param pkg the name of the package to be exported * @param module the name of the module to which it is to be exported @@ -171,33 +145,22 @@ } /** - * Adds a qualified "exports dynamic" directive to the declaration. - * @param pkg the name of the package to be exported - * @param module the name of the module to which it is to be exported + * Adds an unqualified "opens" directive to the declaration. + * @param pkg the name of the package to be opened * @return this builder */ - public ModuleBuilder exportsDynamicTo(String pkg, String module) { - return addDirective(exports, "exports dynamic " + pkg + " to " + module + ";"); + public ModuleBuilder opens(String pkg) { + return addDirective(opens, "opens " + pkg + ";"); } /** - * Adds a qualified "exports private" directive to the declaration. - * @param pkg the name of the package to be exported - * @param module the name of the module to which it is to be exported + * Adds a qualified "opens" directive to the declaration. + * @param pkg the name of the package to be opened + * @param module the name of the module to which it is to be opened * @return this builder */ - public ModuleBuilder exportsPrivateTo(String pkg, String module) { - return addDirective(exports, "exports private " + pkg + " to " + module + ";"); - } - - /** - * Adds a qualified "exports dynamic private" directive to the declaration. - * @param pkg the name of the package to be exported - * @param module the name of the module to which it is to be exported - * @return this builder - */ - public ModuleBuilder exportsDynamicPrivateTo(String pkg, String module) { - return addDirective(exports, "exports dynamic private " + pkg + " to " + module + ";"); + public ModuleBuilder opensTo(String pkg, String module) { + return addDirective(opens, "opens " + pkg + " to " + module + ";"); } /** @@ -254,6 +217,7 @@ sb.append("module ").append(name).append(" {\n"); requires.forEach(r -> sb.append(" " + r + "\n")); exports.forEach(e -> sb.append(" " + e + "\n")); + opens.forEach(o -> sb.append(" " + o + "\n")); uses.forEach(u -> sb.append(" " + u + "\n")); provides.forEach(p -> sb.append(" " + p + "\n")); sb.append("}");

    Indirect Opens 
    FromPackages
    moduleBtestpkgmdlB\n" + + "
    Test comment for a class which has an " + + "anchor_with_name and\n" + + " an anchor_with_id.
    \n" + + "