From 501573119878c4909acaacd162b7d1e363770d51 Mon Sep 17 00:00:00 2001 From: goetz Date: Wed, 27 Dec 2017 11:31:09 +0100 Subject: [PATCH 01/29] 8194232: Container memory not properly recognized. Reviewed-by: bobv, mdoerr, acorn --- src/hotspot/os/linux/osContainer_linux.cpp | 33 ++++++++++------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/hotspot/os/linux/osContainer_linux.cpp b/src/hotspot/os/linux/osContainer_linux.cpp index dacd53b27dc..f32b5417af2 100644 --- a/src/hotspot/os/linux/osContainer_linux.cpp +++ b/src/hotspot/os/linux/osContainer_linux.cpp @@ -31,16 +31,11 @@ #include "logging/log.hpp" #include "osContainer_linux.hpp" -/* - * Warning: Some linux distros use 0x7FFFFFFFFFFFF000 - * and others use 0x7FFFFFFFFFFFFFFF for unlimited. - */ -#define UNLIMITED_MEM CONST64(0x7FFFFFFFFFFFF000) - #define PER_CPU_SHARES 1024 bool OSContainer::_is_initialized = false; bool OSContainer::_is_containerized = false; +julong _unlimited_memory; class CgroupSubsystem: CHeapObj { friend class OSContainer; @@ -217,6 +212,8 @@ void OSContainer::init() { _is_initialized = true; _is_containerized = false; + _unlimited_memory = (LONG_MAX / os::vm_page_size()) * os::vm_page_size(); + log_trace(os, container)("OSContainer::init: Initializing Container Support"); if (!UseContainerSupport) { log_trace(os, container)("Container Support not enabled"); @@ -419,37 +416,37 @@ char * OSContainer::container_type() { * OSCONTAINER_ERROR for not supported */ jlong OSContainer::memory_limit_in_bytes() { - GET_CONTAINER_INFO(jlong, memory, "/memory.limit_in_bytes", - "Memory Limit is: " JLONG_FORMAT, JLONG_FORMAT, memlimit); + GET_CONTAINER_INFO(julong, memory, "/memory.limit_in_bytes", + "Memory Limit is: " JULONG_FORMAT, JULONG_FORMAT, memlimit); - if (memlimit >= UNLIMITED_MEM) { + if (memlimit >= _unlimited_memory) { log_trace(os, container)("Memory Limit is: Unlimited"); return (jlong)-1; } else { - return memlimit; + return (jlong)memlimit; } } jlong OSContainer::memory_and_swap_limit_in_bytes() { - GET_CONTAINER_INFO(jlong, memory, "/memory.memsw.limit_in_bytes", - "Memory and Swap Limit is: " JLONG_FORMAT, JLONG_FORMAT, memswlimit); - if (memswlimit >= UNLIMITED_MEM) { + GET_CONTAINER_INFO(julong, memory, "/memory.memsw.limit_in_bytes", + "Memory and Swap Limit is: " JULONG_FORMAT, JULONG_FORMAT, memswlimit); + if (memswlimit >= _unlimited_memory) { log_trace(os, container)("Memory and Swap Limit is: Unlimited"); return (jlong)-1; } else { - return memswlimit; + return (jlong)memswlimit; } } jlong OSContainer::memory_soft_limit_in_bytes() { - GET_CONTAINER_INFO(jlong, memory, "/memory.soft_limit_in_bytes", - "Memory Soft Limit is: " JLONG_FORMAT, JLONG_FORMAT, memsoftlimit); - if (memsoftlimit >= UNLIMITED_MEM) { + GET_CONTAINER_INFO(julong, memory, "/memory.soft_limit_in_bytes", + "Memory Soft Limit is: " JULONG_FORMAT, JULONG_FORMAT, memsoftlimit); + if (memsoftlimit >= _unlimited_memory) { log_trace(os, container)("Memory Soft Limit is: Unlimited"); return (jlong)-1; } else { - return memsoftlimit; + return (jlong)memsoftlimit; } } From c4a8c91467cb6ec27ef12213934e3e61aa136ff6 Mon Sep 17 00:00:00 2001 From: joehw Date: Wed, 3 Jan 2018 18:21:10 -0800 Subject: [PATCH 02/29] 8189704: broken links in the javax/xml/namespace package Reviewed-by: darcy --- src/java.xml/share/classes/javax/xml/XMLConstants.java | 6 +----- .../classes/javax/xml/namespace/NamespaceContext.java | 6 ++---- src/java.xml/share/classes/javax/xml/namespace/QName.java | 8 ++------ 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/java.xml/share/classes/javax/xml/XMLConstants.java b/src/java.xml/share/classes/javax/xml/XMLConstants.java index b8a22af61a6..7de589087e7 100644 --- a/src/java.xml/share/classes/javax/xml/XMLConstants.java +++ b/src/java.xml/share/classes/javax/xml/XMLConstants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, 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 @@ -34,7 +34,6 @@ * @see XML 1.0 Second Edition Specification Errata * @see Namespaces in XML 1.1 * @see Namespaces in XML - * @see Namespaces in XML Errata * @see XML Schema Part 1: Structures * @since 1.5 **/ @@ -103,9 +102,6 @@ private XMLConstants() { * @see * Namespaces in XML, 3. Qualified Names - * @see - * Namespaces in XML Errata */ public static final String XMLNS_ATTRIBUTE_NS_URI = "http://www.w3.org/2000/xmlns/"; diff --git a/src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java b/src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java index 596775392fb..b978973541e 100644 --- a/src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java +++ b/src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, 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 @@ -72,10 +72,8 @@ * javax.xml.XMLConstants for declarations of common XML values * @see * XML Schema Part2: Datatypes - * @see + * @see * Namespaces in XML - * @see - * Namespaces in XML Errata * @since 1.5 */ diff --git a/src/java.xml/share/classes/javax/xml/namespace/QName.java b/src/java.xml/share/classes/javax/xml/namespace/QName.java index 88cfe3328c6..94121d0d334 100644 --- a/src/java.xml/share/classes/javax/xml/namespace/QName.java +++ b/src/java.xml/share/classes/javax/xml/namespace/QName.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, 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 @@ -35,9 +35,7 @@ * href="http://www.w3.org/TR/xmlschema-2/#QName">XML Schema Part2: * Datatypes specification, Namespaces - * in XML, Namespaces - * in XML Errata.

+ * in XML. * *

The value of a QName contains a Namespace * URI, local part and @@ -64,8 +62,6 @@ * XML Schema Part2: Datatypes specification * @see * Namespaces in XML - * @see - * Namespaces in XML Errata * @since 1.5 */ From 4b3eac93be1658ccd767f45eba3657e8c7cbc2f5 Mon Sep 17 00:00:00 2001 From: bpatel Date: Thu, 4 Jan 2018 09:22:17 -0800 Subject: [PATCH 03/29] 8192007: javadoc @uses and @provides tags in the modules documentation appears before the first-sentence summary of the service type. Reviewed-by: jjg, ksrini --- .../formats/html/ModuleWriterImpl.java | 18 +-- .../testModules/TestModuleServices.java | 112 +++++++++++++++++- .../doclet/testModules/TestModules.java | 8 +- 3 files changed, 124 insertions(+), 14 deletions(-) diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java index a8579ec8ccd..f5283fb4062 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java @@ -820,11 +820,14 @@ public void addUsesList(Table table) { Content summary = new ContentBuilder(); if (display(usesTrees)) { description = usesTrees.get(t); - if (description != null) { - summary.addContent(description); + if (description != null && !description.isEmpty()) { + summary.addContent(HtmlTree.DIV(HtmlStyle.block, description)); + } else { + addSummaryComment(t, summary); } + } else { + summary.addContent(Contents.SPACE); } - addSummaryComment(t, summary); table.addRow(typeLinkContent, summary); } } @@ -847,11 +850,12 @@ public void addProvidesList(Table table) { Content desc = new ContentBuilder(); if (display(providesTrees)) { description = providesTrees.get(srv); - if (description != null) { - desc.addContent(description); + desc.addContent((description != null && !description.isEmpty()) + ? HtmlTree.DIV(HtmlStyle.block, description) + : Contents.SPACE); + } else { + desc.addContent(Contents.SPACE); } - } - addSummaryComment(srv, desc); // Only display the implementation details in the "all" mode. if (moduleMode == ModuleMode.ALL && !implSet.isEmpty()) { desc.addContent(new HtmlTree(HtmlTag.BR)); diff --git a/test/langtools/jdk/javadoc/doclet/testModules/TestModuleServices.java b/test/langtools/jdk/javadoc/doclet/testModules/TestModuleServices.java index 2d31c056316..552f27edb43 100644 --- a/test/langtools/jdk/javadoc/doclet/testModules/TestModuleServices.java +++ b/test/langtools/jdk/javadoc/doclet/testModules/TestModuleServices.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8178067 + * @bug 8178067 8192007 * @summary tests the module's services, such as provides and uses * @modules jdk.javadoc/jdk.javadoc.internal.api * jdk.javadoc/jdk.javadoc.internal.tool @@ -34,6 +34,7 @@ * @run main TestModuleServices */ +import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -51,6 +52,106 @@ public TestModuleServices() { tb = new ToolBox(); } + @Test + public void checkModuleServicesDescription(Path base) throws Exception { + Path src = Files.createDirectories(base.resolve("src")); + ModuleBuilder mb = new ModuleBuilder(tb, "moduleService") + .comment("This module exports a package containing the declaration of a service type.") + .exports("pkgService") + .classes("/**A Package that has a service.*/ package pkgService;") + .classes("package pkgService; /**A service Interface for service providers.*/ " + + "public interface Service {\n" + + " /**\n" + + " * A test method for the service.\n" + + " */\n" + + " void testMethod1();\n" + + " /**\n" + + " * Another test method for the service.\n" + + " */\n" + + " void testMethod2();\n" + + "}"); + mb.write(src); + mb = new ModuleBuilder(tb, "moduleServiceProvider") + .comment("This module provides an implementation of a service.\n" + + "@provides pkgService.Service Provides a service whose name is ServiceProvider.") + .requires("moduleService") + .provides("pkgService.Service", "pkgServiceProvider.ServiceProvider") + .classes("/**A Package that has a service provider.*/ package pkgServiceProvider;") + .classes("package pkgServiceProvider;\n" + + "public class ServiceProvider implements pkgService.Service {\n" + + " /**\n" + + " * {@inheritDoc}\n" + + " */\n" + + " public void testMethod1() {}\n" + + " /**\n" + + " * This is an internal implementation so the documentation will not be seen.\n" + + " */\n" + + " public void testMethod2() {}\n" + + "}"); + mb.write(src); + mb = new ModuleBuilder(tb, "moduleServiceUser") + .comment("This module uses a service defined in another module.\n" + + "@uses pkgService.Service If no other provider is found, a default internal implementation will be used.") + .requires("moduleService") + .uses("pkgService.Service") + .classes("/**A Package that has a service user.*/ package pkgServiceUser;") + .classes("package pkgServiceUser;\n" + + "/**\n" + + " * A service user class.\n" + + " */\n" + + "public class ServiceUser {\n" + + "}"); + mb.write(src); + mb = new ModuleBuilder(tb, "moduleServiceUserNoDescription") + .comment("This is another module that uses a service defined in another module.\n" + + "@uses pkgService.Service") + .requires("moduleService") + .uses("pkgService.Service") + .classes("/**A Package that has a service user with no description.*/ package pkgServiceUserNoDescription;") + .classes("package pkgServiceUserNoDescription;\n" + + "/**\n" + + " * A service user class.\n" + + " */\n" + + "public class ServiceUserNoDescription {\n" + + "}"); + mb.write(src); + + javadoc("-d", base.resolve("out").toString(), + "-quiet", "-noindex", + "--module-source-path", src.toString(), + "--module", "moduleService,moduleServiceProvider,moduleServiceUser,moduleServiceUserNoDescription", + "pkgService", "moduleServiceProvider/pkgServiceProvider", "moduleServiceUser/pkgServiceUser", + "moduleServiceUserNoDescription/pkgServiceUserNoDescription"); + checkExit(Exit.OK); + + checkOutput("moduleServiceProvider-summary.html", true, + "\n" + + "Service\n" + + "\n" + + "

Provides a service whose name is ServiceProvider.
\n" + + "\n" + + ""); + checkOutput("moduleServiceUser-summary.html", true, + "\n" + + "Service\n" + + "\n" + + "
If no other provider is found, a default internal implementation will be used.
\n" + + "\n" + + ""); + checkOutput("moduleServiceUserNoDescription-summary.html", true, + "\n" + + "Service\n" + + "\n" + + "
A service Interface for service providers.
\n" + + "\n" + + ""); + checkOutput("moduleServiceProvider-summary.html", false, + "A service Interface for service providers."); + checkOutput("moduleServiceUser-summary.html", false, + "A service Interface for service providers."); + } + @Test public void checkUsesNoApiTagModuleModeDefault(Path base) throws Exception { ModuleBuilder mb = new ModuleBuilder(tb, "m") @@ -251,7 +352,8 @@ public void checkProvidesWithApiTagModuleModeDefault(Path base) throws Exception "\n" + "\n" + "A\n" + - "abc \n" + + "\n" + + "
abc
\n\n" + "\n" + "\n" + "\n"); @@ -292,7 +394,8 @@ public void checkUsesProvidesWithApiTagsModeDefault(Path base) throws Exception "\n" + "\n" + "A\n" + - "abc \n" + + "\n" + + "
abc
\n\n" + "\n" + "\n" + "", @@ -305,7 +408,8 @@ public void checkUsesProvidesWithApiTagsModeDefault(Path base) throws Exception "\n" + "\n" + "B\n" + - "def \n" + + "\n" + + "
def
\n\n" + "\n" + "\n" + "\n"); diff --git a/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java b/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java index f3d0c18cc94..f73fac14942 100644 --- a/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java +++ b/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java @@ -26,7 +26,7 @@ * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 * 8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218 * 8175823 8166306 8178043 8181622 8183511 8169819 8074407 8183037 8191464 - 8164407 + 8164407 8192007 * @summary Test modules support in javadoc. * @author bpatel * @library ../lib @@ -764,7 +764,8 @@ void checkModuleSummary() { + "", "\n" + "TestClassInModuleB\n" - + "With a test description for uses. \n" + + "\n" + + "
With a test description for uses.
\n\n" + "", "Opens \n" + "\n" @@ -931,7 +932,8 @@ void checkModuleModeCommon() { + "testpkgmdlB\n"); checkOutput("moduleB-summary.html", true, "TestClassInModuleB\n" - + "With a test description for uses. "); + + "\n" + + "
With a test description for uses.
\n\n"); checkOutput("moduletags-summary.html", true, "
  • Description | Modules" + " | Packages | Services
  • ", From d70bea896076d7f2353f09b441bc0c9991ceba0f Mon Sep 17 00:00:00 2001 From: rfield Date: Thu, 4 Jan 2018 12:24:56 -0800 Subject: [PATCH 04/29] 8179858: jshell tool: sync nomenclature from reference to online /help Reviewed-by: dlsmith, jjg --- .../jdk/internal/jshell/tool/JShellTool.java | 5 +- .../jshell/tool/resources/l10n.properties | 365 ++++++++++-------- .../jdk/jshell/CommandCompletionTest.java | 4 +- test/langtools/jdk/jshell/EditorTestBase.java | 2 +- test/langtools/jdk/jshell/ToolBasicTest.java | 10 +- test/langtools/jdk/jshell/ToolSimpleTest.java | 2 +- 6 files changed, 214 insertions(+), 174 deletions(-) diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java index 79a0a1f71f8..8fc94b1b47b 100644 --- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java +++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java @@ -1817,7 +1817,7 @@ Stream allTypeSnippets() { // Documentation pseudo-commands registerCommand(new Command("/", - "help.id", + "help.slashID", arg -> cmdHelp("rerun"), EMPTY_COMPLETION_PROVIDER, CommandKind.HELP_ONLY)); @@ -1829,6 +1829,9 @@ Stream allTypeSnippets() { registerCommand(new Command("intro", "help.intro", CommandKind.HELP_SUBJECT)); + registerCommand(new Command("id", + "help.id", + CommandKind.HELP_SUBJECT)); registerCommand(new Command("shortcuts", "help.shortcuts", CommandKind.HELP_SUBJECT)); diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties index 0d7e517f185..5c405b6e821 100644 --- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties +++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties @@ -46,7 +46,7 @@ jshell.err.file.not.found = File ''{1}'' for ''{0}'' is not found. jshell.err.file.exception = File ''{1}'' for ''{0}'' threw exception: {2} jshell.err.file.filename = ''{0}'' requires a filename argument. -jshell.err.startup.unexpected.exception = Unexpected exception reading start-up: {0} +jshell.err.startup.unexpected.exception = Unexpected exception reading startup: {0} jshell.err.unexpected.exception = Unexpected exception: {0} jshell.err.invalid.command = Invalid command: {0} @@ -104,9 +104,9 @@ For example ''/help /list'' or ''/help intro''.\n\ Subjects:\n\ \n -jshell.err.no.snippet.with.id = No snippet with id: {0} +jshell.err.no.snippet.with.id = No snippet with ID: {0} jshell.err.end.snippet.range.less.than.start = End of snippet range less than start: {0} - {1} -jshell.err.range.requires.id = Snippet ranges require snippet ids: {0} +jshell.err.range.requires.id = Snippet ranges require snippet IDs: {0} jshell.err.exit.not.expression = The argument to /exit must be a valid integer expression, it is not an expression: {0} jshell.err.exit.bad.type = The argument to /exit must be a valid integer expression. The type is {1} : {0} @@ -114,7 +114,7 @@ jshell.err.exit.bad.value = The argument to /exit has bad value is {1} : {0} jshell.err.drop.arg =\ In the /drop argument, please specify an import, variable, method, or class to drop.\n\ -Specify by id or name. Use /list to see ids. Use /reset to reset all state. +Specify by ID or name. Use /list to see IDs. Use /reset to reset all state. jshell.err.failed = Failed. jshell.msg.native.method = Native Method jshell.msg.unknown.source = Unknown Source @@ -193,15 +193,15 @@ For more information see:\n\ /help shortcuts help.usage = \ -Usage: jshell