# HG changeset patch
# User prr
# Date 1462303520 25200
# Node ID 74cd426ebb3d13c69be87b4ecf1e04da8dcac454
# Parent 8ff4232c93c227b328ac89a534f1ddd7a1fa21fa# Parent c6aca850d1626712dfa70be931133ea976a5b37b
Merge
diff -r 8ff4232c93c2 -r 74cd426ebb3d .hgtags
--- a/.hgtags Tue May 03 09:48:02 2016 -0700
+++ b/.hgtags Tue May 03 12:25:20 2016 -0700
@@ -358,3 +358,4 @@
6072af7a98be3922f26bdce71b53bb3646cb2ac9 jdk-9+113
c84d0cce090e161d736de69e941830adf8c2f87a jdk-9+114
8d78fb40648dd221ce4ef19f9d5aa41ee1a3a884 jdk-9+115
+84aba7335005a3a47751dcf1f37935f97df9f99a jdk-9+116
diff -r 8ff4232c93c2 -r 74cd426ebb3d .hgtags-top-repo
--- a/.hgtags-top-repo Tue May 03 09:48:02 2016 -0700
+++ b/.hgtags-top-repo Tue May 03 12:25:20 2016 -0700
@@ -358,3 +358,4 @@
55b6d550828d1223b364e6ead4a56e56411c56df jdk-9+113
1d992540870ff33fe6cc550443388588df9b9e4f jdk-9+114
09617ce980b99d49abfd54dacfed353c47e2a115 jdk-9+115
+6743a8e0cab7b5f6f4a0575f6664892f0ab740af jdk-9+116
diff -r 8ff4232c93c2 -r 74cd426ebb3d common/autoconf/boot-jdk.m4
--- a/common/autoconf/boot-jdk.m4 Tue May 03 09:48:02 2016 -0700
+++ b/common/autoconf/boot-jdk.m4 Tue May 03 12:25:20 2016 -0700
@@ -397,6 +397,7 @@
ADD_JVM_ARG_IF_OK([-XX:+UseSerialGC],boot_jdk_jvmargs_small,[$JAVA])
ADD_JVM_ARG_IF_OK([-Xms32M],boot_jdk_jvmargs_small,[$JAVA])
ADD_JVM_ARG_IF_OK([-Xmx512M],boot_jdk_jvmargs_small,[$JAVA])
+ ADD_JVM_ARG_IF_OK([-XX:TieredStopAtLevel=1],boot_jdk_jvmargs_small,[$JAVA])
AC_MSG_RESULT([$boot_jdk_jvmargs_small])
diff -r 8ff4232c93c2 -r 74cd426ebb3d common/autoconf/compare.sh.in
--- a/common/autoconf/compare.sh.in Tue May 03 09:48:02 2016 -0700
+++ b/common/autoconf/compare.sh.in Tue May 03 12:25:20 2016 -0700
@@ -31,7 +31,7 @@
export LEGACY_BUILD_DIR=@OPENJDK_TARGET_OS@-@OPENJDK_TARGET_CPU_LEGACY@
-sexport OPENJDK_TARGET_OS="@OPENJDK_TARGET_OS@"
+export OPENJDK_TARGET_OS="@OPENJDK_TARGET_OS@"
export OPENJDK_TARGET_CPU="@OPENJDK_TARGET_CPU@"
export OPENJDK_TARGET_CPU_LIBDIR="@OPENJDK_TARGET_CPU_LIBDIR@"
export DEBUG_LEVEL="@DEBUG_LEVEL@"
diff -r 8ff4232c93c2 -r 74cd426ebb3d common/autoconf/generated-configure.sh
--- a/common/autoconf/generated-configure.sh Tue May 03 09:48:02 2016 -0700
+++ b/common/autoconf/generated-configure.sh Tue May 03 12:25:20 2016 -0700
@@ -1224,9 +1224,9 @@
with_dxsdk
with_dxsdk_lib
with_dxsdk_include
-enable_jtreg_failure_handler
enable_new_hotspot_build
enable_hotspot_test_in_build
+enable_jtreg_failure_handler
with_num_cores
with_memory_size
with_jobs
@@ -5070,7 +5070,7 @@
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1460963400
+DATE_WHEN_GENERATED=1462204427
###############################################################################
#
@@ -15492,7 +15492,7 @@
HOTSPOT_TARGET_CPU_DEFINE=PPC32
elif test "x$OPENJDK_TARGET_CPU" = xs390; then
HOTSPOT_TARGET_CPU_DEFINE=S390
- elif test "x$OPENJDK_TARGET_CPU" = ss390x; then
+ elif test "x$OPENJDK_TARGET_CPU" = xs390x; then
HOTSPOT_TARGET_CPU_DEFINE=S390
fi
@@ -15648,7 +15648,7 @@
HOTSPOT_BUILD_CPU_DEFINE=PPC32
elif test "x$OPENJDK_BUILD_CPU" = xs390; then
HOTSPOT_BUILD_CPU_DEFINE=S390
- elif test "x$OPENJDK_BUILD_CPU" = ss390x; then
+ elif test "x$OPENJDK_BUILD_CPU" = xs390x; then
HOTSPOT_BUILD_CPU_DEFINE=S390
fi
@@ -64282,6 +64282,21 @@
fi
+ $ECHO "Check if jvm arg is ok: -XX:TieredStopAtLevel=1" >&5
+ $ECHO "Command: $JAVA -XX:TieredStopAtLevel=1 -version" >&5
+ OUTPUT=`$JAVA -XX:TieredStopAtLevel=1 -version 2>&1`
+ FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
+ FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+ if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
+ boot_jdk_jvmargs_small="$boot_jdk_jvmargs_small -XX:TieredStopAtLevel=1"
+ JVM_ARG_OK=true
+ else
+ $ECHO "Arg failed:" >&5
+ $ECHO "$OUTPUT" >&5
+ JVM_ARG_OK=false
+ fi
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $boot_jdk_jvmargs_small" >&5
$as_echo "$boot_jdk_jvmargs_small" >&6; }
diff -r 8ff4232c93c2 -r 74cd426ebb3d common/autoconf/platform.m4
--- a/common/autoconf/platform.m4 Tue May 03 09:48:02 2016 -0700
+++ b/common/autoconf/platform.m4 Tue May 03 12:25:20 2016 -0700
@@ -435,7 +435,7 @@
HOTSPOT_$1_CPU_DEFINE=PPC32
elif test "x$OPENJDK_$1_CPU" = xs390; then
HOTSPOT_$1_CPU_DEFINE=S390
- elif test "x$OPENJDK_$1_CPU" = ss390x; then
+ elif test "x$OPENJDK_$1_CPU" = xs390x; then
HOTSPOT_$1_CPU_DEFINE=S390
fi
AC_SUBST(HOTSPOT_$1_CPU_DEFINE)
diff -r 8ff4232c93c2 -r 74cd426ebb3d common/conf/jib-profiles.js
--- a/common/conf/jib-profiles.js Tue May 03 09:48:02 2016 -0700
+++ b/common/conf/jib-profiles.js Tue May 03 12:25:20 2016 -0700
@@ -212,14 +212,17 @@
* @returns Common values
*/
var getJibProfilesCommon = function (input) {
- var common = {
- dependencies: ["boot_jdk", "gnumake", "jtreg"],
- configure_args: ["--with-default-make-target=all", "--enable-jtreg-failure-handler"],
- configure_args_32bit: ["--with-target-bits=32", "--with-jvm-variants=client,server"],
- configure_args_debug: ["--enable-debug"],
- configure_args_slowdebug: ["--with-debug-level=slowdebug"],
- organization: "jpg.infra.builddeps"
- };
+ var common = {};
+
+ common.dependencies = ["boot_jdk", "gnumake", "jtreg"],
+ common.default_make_targets = ["product-images", "test-image"],
+ common.default_make_targets_debug = common.default_make_targets;
+ common.default_make_targets_slowdebug = common.default_make_targets;
+ common.configure_args = ["--enable-jtreg-failure-handler"],
+ common.configure_args_32bit = ["--with-target-bits=32", "--with-jvm-variants=client,server"],
+ common.configure_args_debug = ["--enable-debug"],
+ common.configure_args_slowdebug = ["--with-debug-level=slowdebug"],
+ common.organization = "jpg.infra.builddeps"
return common;
};
@@ -241,8 +244,8 @@
target_os: "linux",
target_cpu: "x64",
dependencies: concat(common.dependencies, "devkit"),
- configure_args: concat(common.configure_args, "--with-zlib=system"),
- make_args: common.make_args
+ configure_args: concat(common.configure_args, "--with-zlib=system"),
+ default_make_targets: concat(common.default_make_targets, "docs-image")
},
"linux-x86": {
@@ -252,39 +255,39 @@
dependencies: concat(common.dependencies, "devkit"),
configure_args: concat(common.configure_args, common.configure_args_32bit,
"--with-zlib=system"),
- make_args: common.make_args
+ default_make_targets: common.default_make_targets
},
"macosx-x64": {
target_os: "macosx",
target_cpu: "x64",
dependencies: concat(common.dependencies, "devkit"),
- configure_args: concat(common.configure_args, "--with-zlib=system"),
- make_args: common.make_args
+ configure_args: concat(common.configure_args, "--with-zlib=system"),
+ default_make_targets: common.default_make_targets
},
"solaris-x64": {
target_os: "solaris",
target_cpu: "x64",
dependencies: concat(common.dependencies, "devkit", "cups"),
- configure_args: concat(common.configure_args, "--with-zlib=system"),
- make_args: common.make_args
+ configure_args: concat(common.configure_args, "--with-zlib=system"),
+ default_make_targets: common.default_make_targets
},
"solaris-sparcv9": {
target_os: "solaris",
target_cpu: "sparcv9",
dependencies: concat(common.dependencies, "devkit", "cups"),
- configure_args: concat(common.configure_args, "--with-zlib=system"),
- make_args: common.make_args
+ configure_args: concat(common.configure_args, "--with-zlib=system"),
+ default_make_targets: common.default_make_targets
},
"windows-x64": {
target_os: "windows",
target_cpu: "x64",
dependencies: concat(common.dependencies, "devkit", "freetype"),
- configure_args: common.configure_args,
- make_args: common.make_args
+ configure_args: concat(common.configure_args),
+ default_make_targets: common.default_make_targets
},
"windows-x86": {
@@ -293,7 +296,7 @@
build_cpu: "x64",
dependencies: concat(common.dependencies, "devkit", "freetype"),
configure_args: concat(common.configure_args, common.configure_args_32bit),
- make_args: common.make_args
+ default_make_targets: common.default_make_targets
}
};
profiles = concatObjects(profiles, mainProfiles);
@@ -306,14 +309,15 @@
// implementation builds.
var openOnlyProfiles = generateOpenOnlyProfiles(common, mainProfiles);
// The open only profiles on linux are used for reference builds and should
- // produce the compact profile images by default.
+ // produce the compact profile images by default. This adds "profiles" as an
+ // extra default target.
var openOnlyProfilesExtra = {
"linux-x64-open": {
- configure_args: ["--with-default-make-target=all profiles"],
+ default_make_targets: "profiles"
},
"linux-x86-open": {
- configure_args: ["--with-default-make-target=all profiles"],
+ default_make_targets: "profiles"
}
};
var openOnlyProfiles = concatObjects(openOnlyProfiles, openOnlyProfilesExtra);
@@ -336,6 +340,7 @@
// Generate the missing platform attributes
profiles = generatePlatformAttributes(profiles);
+ profiles = generateDefaultMakeTargetsConfigureArg(common, profiles);
return profiles;
};
@@ -469,6 +474,8 @@
var debugProfile = profile + "-debug";
newProfiles[debugProfile] = clone(profiles[profile]);
newProfiles[debugProfile].debug_level = "fastdebug";
+ newProfiles[debugProfile].default_make_targets
+ = common.default_make_targets_debug;
newProfiles[debugProfile].labels
= concat(newProfiles[debugProfile].labels || [], "debug"),
newProfiles[debugProfile].configure_args
@@ -492,6 +499,8 @@
var debugProfile = profile + "-slowdebug";
newProfiles[debugProfile] = clone(profiles[profile]);
newProfiles[debugProfile].debug_level = "slowdebug";
+ newProfiles[debugProfile].default_make_targets
+ = common.default_make_targets_slowdebug;
newProfiles[debugProfile].labels
= concat(newProfiles[debugProfile].labels || [], "slowdebug"),
newProfiles[debugProfile].configure_args
@@ -524,6 +533,39 @@
};
/**
+ * The default_make_targets attribute on a profile is not a real Jib attribute.
+ * This function rewrites that attribute into the corresponding configure arg.
+ * Calling this function multiple times on the same profiles object is safe.
+ *
+ * @param common Common values
+ * @param profiles Profiles map to rewrite profiles for
+ * @returns {{}} New map of profiles with the make targets converted
+ */
+var generateDefaultMakeTargetsConfigureArg = function (common, profiles) {
+ var ret = concatObjects(profiles, {});
+ for (var profile in ret) {
+ if (ret[profile]["default_make_targets"] != null) {
+ var targetsString = concat(ret[profile].default_make_targets).join(" ");
+ // Iterate over all configure args and see if --with-default-make-target
+ // is already there and change it, otherwise add it.
+ var found = false;
+ for (var arg in ret[profile].configure_args) {
+ if (arg.startsWith("--with-default-make-target")) {
+ found = true;
+ arg.replace(/=.*/, "=" + targetsString);
+ }
+ }
+ if (!found) {
+ ret[profile].configure_args = concat(
+ ret[profile].configure_args,
+ "--with-default-make-target=" + targetsString);
+ }
+ }
+ }
+ return ret;
+}
+
+/**
* Deep clones an object tree.
*
* @param o Object to clone
diff -r 8ff4232c93c2 -r 74cd426ebb3d corba/.hgtags
--- a/corba/.hgtags Tue May 03 09:48:02 2016 -0700
+++ b/corba/.hgtags Tue May 03 12:25:20 2016 -0700
@@ -358,3 +358,4 @@
cc30faa2da498c478e89ab062ff160653ca1b170 jdk-9+113
10d175b0368c30f54350fc648adc41b94ce357ee jdk-9+114
7bab1b1b36824924b1c657a8419369ba93d198d3 jdk-9+115
+7dfa7377a5e601b8f740741a9a80e04c72dd04d6 jdk-9+116
diff -r 8ff4232c93c2 -r 74cd426ebb3d hotspot/.hgtags
--- a/hotspot/.hgtags Tue May 03 09:48:02 2016 -0700
+++ b/hotspot/.hgtags Tue May 03 12:25:20 2016 -0700
@@ -518,3 +518,4 @@
c569f8d89269fb6205b90f727581eb8cc04132f9 jdk-9+113
b64432bae5271735fd53300b2005b713e98ef411 jdk-9+114
88dd08d7be0fe7fb9f1914b1628f0aae9bf56e25 jdk-9+115
+61a214186dae6811dd989e9165e42f7dbf02acde jdk-9+116
diff -r 8ff4232c93c2 -r 74cd426ebb3d jaxp/.hgtags
--- a/jaxp/.hgtags Tue May 03 09:48:02 2016 -0700
+++ b/jaxp/.hgtags Tue May 03 12:25:20 2016 -0700
@@ -358,3 +358,4 @@
28626780e245fccbfb9bad8e3b05f62357958038 jdk-9+113
147114dd0641cd7c9fe6e81642eb993a7b9c6f0b jdk-9+114
1902a5bda18e794b31fc5f520f5e7d827714b50d jdk-9+115
+9d71d20e614777cd23c1a43b38b5c08a9094d27a jdk-9+116
diff -r 8ff4232c93c2 -r 74cd426ebb3d jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java Tue May 03 09:48:02 2016 -0700
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java Tue May 03 12:25:20 2016 -0700
@@ -444,13 +444,15 @@
}
} else if (index == Feature.FILES.ordinal()) {
try {
- if (Util.verifyAndGetURI(value, null) == null) {
- CatalogMessages.reportIAE(new Object[]{value, Feature.FILES.name()}, null);
+ String[] catalogFile = value.split(";[ ]*");
+ for (String temp : catalogFile) {
+ if (Util.verifyAndGetURI(temp, null) == null) {
+ CatalogMessages.reportIAE(new Object[]{value, Feature.FILES.name()}, null);
+ }
}
}catch (MalformedURLException | URISyntaxException | IllegalArgumentException ex) {
CatalogMessages.reportIAE(new Object[]{value, Feature.FILES.name()}, ex);
}
-
}
if (states[index] == null || state.compareTo(states[index]) >= 0) {
values[index] = value;
diff -r 8ff4232c93c2 -r 74cd426ebb3d jaxp/test/javax/xml/jaxp/libs/jaxp/library/TestPolicy.java
--- a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/TestPolicy.java Tue May 03 09:48:02 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/TestPolicy.java Tue May 03 12:25:20 2016 -0700
@@ -91,6 +91,7 @@
permissions.add(new PropertyPermission("line.separator", "read"));
permissions.add(new PropertyPermission("fileStringBuffer", "read"));
permissions.add(new PropertyPermission("dataproviderthreadcount", "read"));
+ permissions.add(new RuntimePermission("charsetProvider"));
}
/*
diff -r 8ff4232c93c2 -r 74cd426ebb3d jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java Tue May 03 09:48:02 2016 -0700
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java Tue May 03 12:25:20 2016 -0700
@@ -23,6 +23,7 @@
package catalog;
import java.io.IOException;
+import java.nio.file.Paths;
import javax.xml.catalog.Catalog;
import javax.xml.catalog.CatalogException;
import javax.xml.catalog.CatalogFeatures;
@@ -34,6 +35,7 @@
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.xml.sax.Attributes;
@@ -44,10 +46,49 @@
import org.xml.sax.ext.DefaultHandler2;
/*
- * @bug 8081248, 8144966, 8146606, 8146237, 8151154, 8150969, 8151162, 8152527
+ * @bug 8081248, 8144966, 8146606, 8146237, 8151154, 8150969, 8151162, 8152527, 8154220
* @summary Tests basic Catalog functions.
*/
public class CatalogTest {
+ static final String KEY_FILES = "javax.xml.catalog.files";
+
+ public String filepath;
+
+ /*
+ * Initializing fields
+ */
+ @BeforeClass
+ public void setUpClass() throws Exception {
+ String file1 = getClass().getResource("first_cat.xml").getFile();
+ if (System.getProperty("os.name").contains("Windows")) {
+ filepath = file1.substring(1, file1.lastIndexOf("/") + 1);
+ } else {
+ filepath = file1.substring(0, file1.lastIndexOf("/") + 1);
+ }
+ }
+
+ /*
+ * @bug 8154220
+ * Verifies that the file input is validated properly. Valid input includes
+ * multiple file paths separated by semicolon.
+ */
+ @Test(dataProvider = "hierarchyOfCatFilesData")
+ public void hierarchyOfCatFiles2(String systemId, String expectedUri) {
+ String file1 = getClass().getResource("first_cat.xml").getFile();
+ String file2 = getClass().getResource("second_cat.xml").getFile();
+ String files = file1 + ";" + file2;
+
+ try {
+ System.setProperty(KEY_FILES, files);
+ CatalogResolver catalogResolver = CatalogManager.catalogResolver(CatalogFeatures.defaults());
+ String sysId = catalogResolver.resolveEntity(null, systemId).getSystemId();
+ Assert.assertEquals(sysId, Paths.get(filepath + expectedUri).toUri().toString().replace("///", "/"), "System ID match not right");
+ } finally {
+ System.clearProperty(KEY_FILES);
+ }
+
+ }
+
/*
* @bug 8152527
* This test is the same as the JDK test ResolveEntityTests:testMatch1.
@@ -289,6 +330,19 @@
}
/*
+ DataProvider: used to verify hierarchical catalogs. Refer to JCK test
+ hierarchyOfCatFiles2.
+ */
+ @DataProvider(name = "hierarchyOfCatFilesData")
+ Object[][] getHierarchyOfCatFilesData() {
+ return new Object[][]{
+ {"http://www.oracle.com/sequence.dtd", "first.dtd"},
+ {"http://www.oracle.com/sequence_next.dtd", "next.dtd"},
+ {"http://www.oracle.com/sequence_second.dtd", "second.dtd"}
+ };
+ }
+
+ /*
DataProvider: used to verify CatalogResolver's resolveEntity function.
Data columns:
catalog, prefer, systemId, publicId, expectedUri, expectedFile, msg
@@ -300,6 +354,7 @@
{"rewriteSystem_id.xml", "system", "http://www.sys00test.com/rewrite.dtd", "PUB-404", expected, expected, "Relative rewriteSystem with xml:base at group level failed"},
};
}
+
static String id = "http://openjdk.java.net/xml/catalog/dtd/system.dtd";
/*
DataProvider: used to verify how prefer settings affect the result of the
diff -r 8ff4232c93c2 -r 74cd426ebb3d jaxp/test/javax/xml/jaxp/unittest/catalog/first_cat.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/first_cat.xml Tue May 03 12:25:20 2016 -0700
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff -r 8ff4232c93c2 -r 74cd426ebb3d jaxp/test/javax/xml/jaxp/unittest/catalog/next_cat.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/next_cat.xml Tue May 03 12:25:20 2016 -0700
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff -r 8ff4232c93c2 -r 74cd426ebb3d jaxp/test/javax/xml/jaxp/unittest/catalog/second_cat.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/second_cat.xml Tue May 03 12:25:20 2016 -0700
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff -r 8ff4232c93c2 -r 74cd426ebb3d jaxws/.hgtags
--- a/jaxws/.hgtags Tue May 03 09:48:02 2016 -0700
+++ b/jaxws/.hgtags Tue May 03 12:25:20 2016 -0700
@@ -361,3 +361,4 @@
e980062475c10d21137051045bf95ee229db9b27 jdk-9+113
b314bb02182b9ca94708a91f312c377f5435f740 jdk-9+114
4ff86e5489e4c0513dadfa69def8601c110ca5cd jdk-9+115
+529f0bf896e58525614d863e283ad155531941cb jdk-9+116
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/make/Tools.gmk
--- a/jdk/make/Tools.gmk Tue May 03 09:48:02 2016 -0700
+++ b/jdk/make/Tools.gmk Tue May 03 12:25:20 2016 -0700
@@ -96,7 +96,13 @@
TOOL_SPP = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes build.tools.spp.Spp
# Nimbus is used somewhere in the swing build.
+
+ifeq ($(BOOT_JDK_MODULAR), true)
+ COMPILENIMBUS_ADD_MODS := -addmods java.xml.bind
+endif
+
TOOL_GENERATENIMBUS = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
+ $(COMPILENIMBUS_ADD_MODS) \
build.tools.generatenimbus.Generator
TOOL_WRAPPERGENERATOR = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/make/gendata/Gendata-java.base.gmk
--- a/jdk/make/gendata/Gendata-java.base.gmk Tue May 03 09:48:02 2016 -0700
+++ b/jdk/make/gendata/Gendata-java.base.gmk Tue May 03 12:25:20 2016 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, 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 @@
GENDATA_UNINAME := $(JDK_OUTPUTDIR)/modules/java.base/java/lang/uniName.dat
$(GENDATA_UNINAME): $(JDK_TOPDIR)/make/data/unicodedata/UnicodeData.txt $(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(@D)
+ $(call MakeDir, $(@D))
$(TOOL_CHARACTERNAME) $< $@
TARGETS += $(GENDATA_UNINAME)
@@ -51,7 +51,7 @@
GENDATA_CURDATA := $(JDK_OUTPUTDIR)/modules/java.base/java/util/currency.data
$(GENDATA_CURDATA): $(JDK_TOPDIR)/make/data/currency/CurrencyData.properties $(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(@D)
+ $(call MakeDir, $(@D))
$(RM) $@
$(TOOL_GENERATECURRENCYDATA) -o $@.tmp < $<
$(MV) $@.tmp $@
@@ -67,10 +67,10 @@
# RESTRICTED_PKGS_SRC is optionally set in custom extension for this makefile
$(GENDATA_JAVA_SECURITY): $(BUILD_TOOLS) $(GENDATA_JAVA_SECURITY_SRC) $(RESTRICTED_PKGS_SRC)
- $(ECHO) "Generating java.security"
- $(MKDIR) -p $(@D)
+ $(call LogInfo, Generating java.security)
+ $(call MakeDir, $(@D))
$(TOOL_MAKEJAVASECURITY) $(GENDATA_JAVA_SECURITY_SRC) $@ $(OPENJDK_TARGET_OS) \
- $(OPENJDK_TARGET_CPU_ARCH) $(RESTRICTED_PKGS_SRC) || exit 1
+ $(OPENJDK_TARGET_CPU_ARCH) $(RESTRICTED_PKGS_SRC)
TARGETS += $(GENDATA_JAVA_SECURITY)
@@ -78,7 +78,7 @@
$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist: \
$(JDK_TOPDIR)/make/data/classlist/classlist.$(OPENJDK_TARGET_OS)
- $(MKDIR) -p $(@D)
+ $(call MakeDir, $(@D))
$(RM) $@ $@.tmp
$(TOOL_ADDJSUM) $< $@.tmp
$(MV) $@.tmp $@
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/make/gendata/GendataBreakIterator.gmk
--- a/jdk/make/gendata/GendataBreakIterator.gmk Tue May 03 09:48:02 2016 -0700
+++ b/jdk/make/gendata/GendataBreakIterator.gmk Tue May 03 12:25:20 2016 -0700
@@ -62,10 +62,13 @@
BIN := $(BREAK_ITERATOR_CLASSES)/jdk.localedata))
ifeq ($(BOOT_JDK_MODULAR), true)
- BREAK_ITERATOR_BOOTCLASSPATH := -Xpatch:$(BREAK_ITERATOR_CLASSES) \
- -XaddExports:java.base/sun.text=ALL-UNNAMED \
- -XaddExports:java.base/sun.text.resources=ALL-UNNAMED \
- -XaddExports:jdk.localedata/sun.text.resources.ext=ALL-UNNAMED
+ BREAK_ITERATOR_BOOTCLASSPATH := \
+ -Xpatch:java.base=$(BREAK_ITERATOR_CLASSES)/java.base \
+ -Xpatch:jdk.localedata=$(BREAK_ITERATOR_CLASSES)/jdk.localedata \
+ -XaddExports:java.base/sun.text=ALL-UNNAMED \
+ -XaddExports:java.base/sun.text.resources=ALL-UNNAMED \
+ -XaddExports:jdk.localedata/sun.text.resources.ext=ALL-UNNAMED \
+ #
else
BREAK_ITERATOR_BOOTCLASSPATH := -Xbootclasspath/p:$(call PathList, \
$(BREAK_ITERATOR_CLASSES)/java.base \
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/make/launcher/Launcher-java.desktop.gmk
--- a/jdk/make/launcher/Launcher-java.desktop.gmk Tue May 03 09:48:02 2016 -0700
+++ b/jdk/make/launcher/Launcher-java.desktop.gmk Tue May 03 12:25:20 2016 -0700
@@ -31,7 +31,7 @@
ifndef BUILD_HEADLESS_ONLY
$(eval $(call SetupBuildLauncher, appletviewer, \
MAIN_CLASS := sun.applet.Main, \
- JAVA_ARGS := -addmods ALL-SYSTEM, \
+ JAVA_ARGS := -addmods ALL-DEFAULT, \
LIBS_unix := $(X_LIBS), \
))
endif
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/make/launcher/Launcher-java.scripting.gmk
--- a/jdk/make/launcher/Launcher-java.scripting.gmk Tue May 03 09:48:02 2016 -0700
+++ b/jdk/make/launcher/Launcher-java.scripting.gmk Tue May 03 12:25:20 2016 -0700
@@ -27,4 +27,5 @@
$(eval $(call SetupBuildLauncher, jrunscript, \
MAIN_CLASS := com.sun.tools.script.shell.Main, \
+ JAVA_ARGS := -addmods ALL-DEFAULT, \
))
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/make/launcher/Launcher-jdk.compiler.gmk
--- a/jdk/make/launcher/Launcher-jdk.compiler.gmk Tue May 03 09:48:02 2016 -0700
+++ b/jdk/make/launcher/Launcher-jdk.compiler.gmk Tue May 03 12:25:20 2016 -0700
@@ -27,7 +27,8 @@
$(eval $(call SetupBuildLauncher, javac, \
MAIN_CLASS := com.sun.tools.javac.Main, \
- CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \
+ JAVA_ARGS := -addmods ALL-DEFAULT, \
+ CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \
-DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \
))
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/make/launcher/Launcher-jdk.javadoc.gmk
--- a/jdk/make/launcher/Launcher-jdk.javadoc.gmk Tue May 03 09:48:02 2016 -0700
+++ b/jdk/make/launcher/Launcher-jdk.javadoc.gmk Tue May 03 12:25:20 2016 -0700
@@ -27,6 +27,7 @@
$(eval $(call SetupBuildLauncher, javadoc, \
MAIN_CLASS := jdk.javadoc.internal.tool.Main, \
+ JAVA_ARGS := -addmods ALL-DEFAULT, \
CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \
-DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \
))
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/make/launcher/Launcher-jdk.jlink.gmk
--- a/jdk/make/launcher/Launcher-jdk.jlink.gmk Tue May 03 09:48:02 2016 -0700
+++ b/jdk/make/launcher/Launcher-jdk.jlink.gmk Tue May 03 12:25:20 2016 -0700
@@ -32,6 +32,7 @@
$(eval $(call SetupBuildLauncher, jlink,\
MAIN_CLASS := jdk.tools.jlink.internal.Main, \
+ JAVA_ARGS := -addmods ALL-DEFAULT, \
CFLAGS := -DENABLE_ARG_FILES \
-DEXPAND_CLASSPATH_WILDCARDS \
-DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/make/launcher/Launcher-jdk.scripting.nashorn.shell.gmk
--- a/jdk/make/launcher/Launcher-jdk.scripting.nashorn.shell.gmk Tue May 03 09:48:02 2016 -0700
+++ b/jdk/make/launcher/Launcher-jdk.scripting.nashorn.shell.gmk Tue May 03 12:25:20 2016 -0700
@@ -27,6 +27,6 @@
$(eval $(call SetupBuildLauncher, jjs, \
MAIN_CLASS := jdk.nashorn.tools.jjs.Main, \
- JAVA_ARGS := -addmods ALL-SYSTEM, \
+ JAVA_ARGS := -addmods ALL-DEFAULT, \
CFLAGS := -DENABLE_ARG_FILES, \
))
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystemProvider.java
--- a/jdk/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystemProvider.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystemProvider.java Tue May 03 12:25:20 2016 -0700
@@ -102,7 +102,7 @@
@Override
FileTypeDetector getFileTypeDetector() {
- String userHome = GetPropertyAction.getProperty("user.home");
+ String userHome = GetPropertyAction.privilegedGetProperty("user.home");
Path userMimeTypes = Paths.get(userHome, ".mime.types");
Path etcMimeTypes = Paths.get("/etc/mime.types");
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/macosx/classes/sun/nio/ch/KQueueArrayWrapper.java
--- a/jdk/src/java.base/macosx/classes/sun/nio/ch/KQueueArrayWrapper.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/macosx/classes/sun/nio/ch/KQueueArrayWrapper.java Tue May 03 12:25:20 2016 -0700
@@ -84,7 +84,8 @@
static {
IOUtil.load();
initStructSizes();
- String datamodel = GetPropertyAction.getProperty("sun.arch.data.model");
+ String datamodel =
+ GetPropertyAction.privilegedGetProperty("sun.arch.data.model");
is64bit = "64".equals(datamodel);
}
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/macosx/classes/sun/nio/fs/MacOSXFileSystem.java
--- a/jdk/src/java.base/macosx/classes/sun/nio/fs/MacOSXFileSystem.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/macosx/classes/sun/nio/fs/MacOSXFileSystem.java Tue May 03 12:25:20 2016 -0700
@@ -29,8 +29,6 @@
import java.io.IOException;
import java.util.*;
import java.util.regex.Pattern;
-import java.security.AccessController;
-import sun.security.action.GetPropertyAction;
import static sun.nio.fs.MacOSXNativeDispatcher.*;
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/macosx/classes/sun/nio/fs/MacOSXFileSystemProvider.java
--- a/jdk/src/java.base/macosx/classes/sun/nio/fs/MacOSXFileSystemProvider.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/macosx/classes/sun/nio/fs/MacOSXFileSystemProvider.java Tue May 03 12:25:20 2016 -0700
@@ -46,8 +46,8 @@
@Override
FileTypeDetector getFileTypeDetector() {
- Path userMimeTypes = Paths.get(
- GetPropertyAction.getProperty("user.home"), ".mime.types");
+ Path userMimeTypes = Paths.get(GetPropertyAction
+ .privilegedGetProperty("user.home"), ".mime.types");
return chain(new MimeTypesFileTypeDetector(userMimeTypes),
new UTIFileTypeDetector());
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/io/File.java
--- a/jdk/src/java.base/share/classes/java/io/File.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/io/File.java Tue May 03 12:25:20 2016 -0700
@@ -1896,7 +1896,7 @@
// temporary directory location
private static final File tmpdir = new File(
- GetPropertyAction.getProperty("java.io.tmpdir"));
+ GetPropertyAction.privilegedGetProperty("java.io.tmpdir"));
static File location() {
return tmpdir;
}
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/Class.java
--- a/jdk/src/java.base/share/classes/java/lang/Class.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/Class.java Tue May 03 12:25:20 2016 -0700
@@ -470,7 +470,7 @@
* expression with an empty argument list. The class is initialized if it
* has not already been initialized.
*
- *
Note that this method propagates any exception thrown by the
+ * @deprecated This method propagates any exception thrown by the
* nullary constructor, including a checked exception. Use of
* this method effectively bypasses the compile-time exception
* checking that would otherwise be performed by the compiler.
@@ -500,6 +500,7 @@
* of this class.
*/
@CallerSensitive
+ @Deprecated(since="9")
public T newInstance()
throws InstantiationException, IllegalAccessException
{
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/ClassLoader.java
--- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java Tue May 03 12:25:20 2016 -0700
@@ -2615,7 +2615,7 @@
ServicesCatalog createOrGetServicesCatalog() {
ServicesCatalog catalog = servicesCatalog;
if (catalog == null) {
- catalog = new ServicesCatalog();
+ catalog = ServicesCatalog.create();
boolean set = trySetObjectField("servicesCatalog", catalog);
if (!set) {
// beaten by someone else
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java
--- a/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java Tue May 03 12:25:20 2016 -0700
@@ -468,7 +468,7 @@
*/
public abstract static class Redirect {
private static final File NULL_FILE = new File(
- (GetPropertyAction.getProperty("os.name")
+ (GetPropertyAction.privilegedGetProperty("os.name")
.startsWith("Windows") ? "NUL" : "/dev/null")
);
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java
--- a/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java Tue May 03 12:25:20 2016 -0700
@@ -78,7 +78,8 @@
* Performance work and extensive testing is needed to replace the
* VM built-in backtrace filled in Throwable with the StackWalker.
*/
- final static boolean isDebug = getProperty("stackwalk.debug", false);
+ final static boolean isDebug =
+ "true".equals(GetPropertyAction.privilegedGetProperty("stackwalk.debug"));
static StackFrameTraverser
makeStackTraverser(StackWalker walker, Function super Stream, ? extends T> function)
@@ -988,11 +989,4 @@
c.getName().startsWith("java.lang.invoke.LambdaForm");
}
- private static boolean getProperty(String key, boolean value) {
- String s = GetPropertyAction.getProperty(key);
- if (s != null) {
- return Boolean.parseBoolean(s);
- }
- return value;
- }
}
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/String.java
--- a/jdk/src/java.base/share/classes/java/lang/String.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/String.java Tue May 03 12:25:20 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2016, 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,14 +78,8 @@
*
* The Java language provides special support for the string
* concatenation operator ( + ), and for conversion of
- * other objects to strings. String concatenation is implemented
- * through the {@code StringBuilder}(or {@code StringBuffer})
- * class and its {@code append} method.
- * String conversions are implemented through the method
- * {@code toString}, defined by {@code Object} and
- * inherited by all classes in Java. For additional information on
- * string concatenation and conversion, see Gosling, Joy, and Steele,
- * The Java Language Specification.
+ * other objects to strings. For additional information on string
+ * concatenation and conversion, see The Java™ Language Specification.
*
*
Unless otherwise noted, passing a {@code null} argument to a constructor
* or method in this class will cause a {@link NullPointerException} to be
@@ -106,6 +100,14 @@
* into account. The {@link java.text.Collator} class provides methods for
* finer-grain, locale-sensitive String comparison.
*
+ * @implNote The implementation of the string concatenation operator is left to
+ * the discretion of a Java compiler, as long as the compiler ultimately conforms
+ * to The Java™ Language Specification. For example, the {@code javac} compiler
+ * may implement the operator with {@code StringBuffer}, {@code StringBuilder},
+ * or {@code java.lang.invoke.StringConcatFactory} depending on the JDK version. The
+ * implementation of string conversion is typically through the method {@code toString},
+ * defined by {@code Object} and inherited by all classes in Java.
+ *
* @author Lee Boynton
* @author Arthur van Hoff
* @author Martin Buchholz
@@ -115,6 +117,7 @@
* @see java.lang.StringBuilder
* @see java.nio.charset.Charset
* @since 1.0
+ * @jls 15.18.1 String Concatenation Operator +
*/
public final class String
@@ -2977,6 +2980,7 @@
*
* @return a string that has the same contents as this string, but is
* guaranteed to be from a pool of unique strings.
+ * @jls 3.10.5 String Literals
*/
public native String intern();
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/System.java
--- a/jdk/src/java.base/share/classes/java/lang/System.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/System.java Tue May 03 12:25:20 2016 -0700
@@ -69,7 +69,6 @@
import jdk.internal.logger.LocalizedLoggerWrapper;
import jdk.internal.module.ModuleBootstrap;
-import jdk.internal.module.Modules;
import jdk.internal.module.ServicesCatalog;
/**
@@ -1924,10 +1923,6 @@
// initialize the module system
System.bootLayer = ModuleBootstrap.boot();
- // base module needs to be loose (CODETOOLS-7901619)
- Module base = Object.class.getModule();
- Modules.addReads(base, null);
-
// module system initialized
VM.initLevel(2);
}
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java Tue May 03 12:25:20 2016 -0700
@@ -88,7 +88,7 @@
static {
final String key = "jdk.internal.lambda.dumpProxyClasses";
- String path = GetPropertyAction.getProperty(key);
+ String path = GetPropertyAction.privilegedGetProperty(key);
dumper = (null == path) ? null : ProxyClassesDumper.getInstance(path);
}
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java Tue May 03 12:25:20 2016 -0700
@@ -53,7 +53,7 @@
static final boolean VAR_HANDLE_GUARDS;
static {
- Properties props = GetPropertyAction.getProperties();
+ Properties props = GetPropertyAction.privilegedGetProperties();
DEBUG_METHOD_HANDLE_NAMES = Boolean.parseBoolean(
props.getProperty("java.lang.invoke.MethodHandle.DEBUG_NAMES"));
DUMP_CLASS_FILES = Boolean.parseBoolean(
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java
--- a/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java Tue May 03 12:25:20 2016 -0700
@@ -197,7 +197,7 @@
// DEBUG = false; // implied
// DUMPER = null; // implied
- Properties props = GetPropertyAction.getProperties();
+ Properties props = GetPropertyAction.privilegedGetProperties();
final String strategy =
props.getProperty("java.lang.invoke.stringConcat");
CACHE_ENABLE = Boolean.parseBoolean(
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java
--- a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java Tue May 03 12:25:20 2016 -0700
@@ -136,6 +136,7 @@
* consists of the methods
* {@link #compareAndSet compareAndSet},
* {@link #weakCompareAndSet weakCompareAndSet},
+ * {@link #weakCompareAndSetVolatile weakCompareAndSetVolatile},
* {@link #weakCompareAndSetAcquire weakCompareAndSetAcquire},
* {@link #weakCompareAndSetRelease weakCompareAndSetRelease},
* {@link #compareAndExchangeAcquire compareAndExchangeAcquire},
@@ -458,7 +459,7 @@
*
*
The symbolic type descriptor at the call site of {@code get}
* must match the access mode type that is the result of calling
- * {@code accessModeType(VarHandle.AccessMode.get)} on this VarHandle.
+ * {@code accessModeType(VarHandle.AccessMode.GET)} on this VarHandle.
*
*
This access mode is supported by all VarHandle instances and never
* throws {@code UnsupportedOperationException}.
@@ -488,7 +489,7 @@
*
*
The symbolic type descriptor at the call site of {@code set}
* must match the access mode type that is the result of calling
- * {@code accessModeType(VarHandle.AccessMode.set)} on this VarHandle.
+ * {@code accessModeType(VarHandle.AccessMode.SET)} on this VarHandle.
*
* @param args the signature-polymorphic parameter list of the form
* {@code (CT, T newValue)}
@@ -516,7 +517,8 @@
*
*
The symbolic type descriptor at the call site of {@code getVolatile}
* must match the access mode type that is the result of calling
- * {@code accessModeType(VarHandle.AccessMode.getVolatile)} on this VarHandle.
+ * {@code accessModeType(VarHandle.AccessMode.GET_VOLATILE)} on this
+ * VarHandle.
*
* @param args the signature-polymorphic parameter list of the form
* {@code (CT)}
@@ -544,7 +546,8 @@
*
*
The symbolic type descriptor at the call site of {@code setVolatile}
* must match the access mode type that is the result of calling
- * {@code accessModeType(VarHandle.AccessMode.setVolatile)} on this VarHandle.
+ * {@code accessModeType(VarHandle.AccessMode.SET_VOLATILE)} on this
+ * VarHandle.
*
* @apiNote
* Ignoring the many semantic differences from C and C++, this method has
@@ -574,7 +577,8 @@
*
*
The symbolic type descriptor at the call site of {@code getOpaque}
* must match the access mode type that is the result of calling
- * {@code accessModeType(VarHandle.AccessMode.getOpaque)} on this VarHandle.
+ * {@code accessModeType(VarHandle.AccessMode.GET_OPAQUE)} on this
+ * VarHandle.
*
* @param args the signature-polymorphic parameter list of the form
* {@code (CT)}
@@ -603,7 +607,8 @@
*
*
The symbolic type descriptor at the call site of {@code setOpaque}
* must match the access mode type that is the result of calling
- * {@code accessModeType(VarHandle.AccessMode.setOpaque)} on this VarHandle.
+ * {@code accessModeType(VarHandle.AccessMode.SET_OPAQUE)} on this
+ * VarHandle.
*
* @param args the signature-polymorphic parameter list of the form
* {@code (CT, T newValue)}
@@ -631,7 +636,8 @@
*
*
The symbolic type descriptor at the call site of {@code getAcquire}
* must match the access mode type that is the result of calling
- * {@code accessModeType(VarHandle.AccessMode.getAcquire)} on this VarHandle.
+ * {@code accessModeType(VarHandle.AccessMode.GET_ACQUIRE)} on this
+ * VarHandle.
*
* @apiNote
* Ignoring the many semantic differences from C and C++, this method has
@@ -664,7 +670,8 @@
*
*
The symbolic type descriptor at the call site of {@code setRelease}
* must match the access mode type that is the result of calling
- * {@code accessModeType(VarHandle.AccessMode.setRelease)} on this VarHandle.
+ * {@code accessModeType(VarHandle.AccessMode.SET_RELEASE)} on this
+ * VarHandle.
*
* @apiNote
* Ignoring the many semantic differences from C and C++, this method has
@@ -700,7 +707,7 @@
*
*
The symbolic type descriptor at the call site of {@code
* compareAndSet} must match the access mode type that is the result of
- * calling {@code accessModeType(VarHandle.AccessMode.compareAndSet)} on
+ * calling {@code accessModeType(VarHandle.AccessMode.COMPARE_AND_SET)} on
* this VarHandle.
*
* @param args the signature-polymorphic parameter list of the form
@@ -734,7 +741,7 @@
*
The symbolic type descriptor at the call site of {@code
* compareAndExchangeVolatile}
* must match the access mode type that is the result of calling
- * {@code accessModeType(VarHandle.AccessMode.compareAndExchangeVolatile)}
+ * {@code accessModeType(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE)}
* on this VarHandle.
*
* @param args the signature-polymorphic parameter list of the form
@@ -769,7 +776,7 @@
*
The symbolic type descriptor at the call site of {@code
* compareAndExchangeAcquire}
* must match the access mode type that is the result of calling
- * {@code accessModeType(VarHandle.AccessMode.compareAndExchangeAcquire)} on
+ * {@code accessModeType(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)} on
* this VarHandle.
*
* @param args the signature-polymorphic parameter list of the form
@@ -804,7 +811,8 @@
*
The symbolic type descriptor at the call site of {@code
* compareAndExchangeRelease}
* must match the access mode type that is the result of calling
- * {@code accessModeType(VarHandle.AccessMode.compareAndExchangeRelease)} on this VarHandle.
+ * {@code accessModeType(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)}
+ * on this VarHandle.
*
* @param args the signature-polymorphic parameter list of the form
* {@code (CT, T expectedValue, T newValue)}
@@ -836,14 +844,14 @@
* {@link #get}.
*
*
This operation may fail spuriously (typically, due to memory
- * contention) even if the current value does match the expected value.
+ * contention) even if the witness value does match the expected value.
*
*
The method signature is of the form {@code (CT, T expectedValue, T newValue)boolean}.
*
*
The symbolic type descriptor at the call site of {@code
* weakCompareAndSet} must match the access mode type that is the result of
- * calling {@code accessModeType(VarHandle.AccessMode.weakCompareAndSet)} on
- * this VarHandle.
+ * calling {@code accessModeType(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)}
+ * on this VarHandle.
*
* @param args the signature-polymorphic parameter list of the form
* {@code (CT, T expectedValue, T newValue)}
@@ -867,20 +875,58 @@
/**
* Possibly atomically sets the value of a variable to the {@code newValue}
+ * with the memory semantics of {@link #setVolatile} if the variable's
+ * current value, referred to as the witness value, {@code ==} the
+ * {@code expectedValue}, as accessed with the memory semantics of
+ * {@link #getVolatile}.
+ *
+ *
This operation may fail spuriously (typically, due to memory
+ * contention) even if the witness value does match the expected value.
+ *
+ *
The method signature is of the form {@code (CT, T expectedValue, T newValue)boolean}.
+ *
+ *
The symbolic type descriptor at the call site of {@code
+ * weakCompareAndSetVolatile} must match the access mode type that is the
+ * result of calling {@code accessModeType(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)}
+ * on this VarHandle.
+ *
+ * @param args the signature-polymorphic parameter list of the form
+ * {@code (CT, T expectedValue, T newValue)}
+ * , statically represented using varargs.
+ * @return {@code true} if successful, otherwise {@code false} if the
+ * witness value was not the same as the {@code expectedValue} or if this
+ * operation spuriously failed.
+ * @throws UnsupportedOperationException if the access mode is unsupported
+ * for this VarHandle.
+ * @throws WrongMethodTypeException if the access mode type is not
+ * compatible with the caller's symbolic type descriptor.
+ * @throws ClassCastException if the access mode type is compatible with the
+ * caller's symbolic type descriptor, but a reference cast fails.
+ * @see #setVolatile(Object...)
+ * @see #getVolatile(Object...)
+ */
+ public final native
+ @MethodHandle.PolymorphicSignature
+ @HotSpotIntrinsicCandidate
+ boolean weakCompareAndSetVolatile(Object... args);
+
+ /**
+ * Possibly atomically sets the value of a variable to the {@code newValue}
* with the semantics of {@link #set} if the variable's current value,
* referred to as the witness value, {@code ==} the
* {@code expectedValue}, as accessed with the memory semantics of
* {@link #getAcquire}.
*
*
This operation may fail spuriously (typically, due to memory
- * contention) even if the current value does match the expected value.
+ * contention) even if the witness value does match the expected value.
*
*
The method signature is of the form {@code (CT, T expectedValue, T newValue)boolean}.
*
*
The symbolic type descriptor at the call site of {@code
* weakCompareAndSetAcquire}
* must match the access mode type that is the result of calling
- * {@code accessModeType(VarHandle.AccessMode.weakCompareAndSetAcquire)} on this VarHandle.
+ * {@code accessModeType(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)}
+ * on this VarHandle.
*
* @param args the signature-polymorphic parameter list of the form
* {@code (CT, T expectedValue, T newValue)}
@@ -910,14 +956,15 @@
* {@link #get}.
*
*
This operation may fail spuriously (typically, due to memory
- * contention) even if the current value does match the expected value.
+ * contention) even if the witness value does match the expected value.
*
*
The method signature is of the form {@code (CT, T expectedValue, T newValue)boolean}.
*
*
The symbolic type descriptor at the call site of {@code
* weakCompareAndSetRelease}
* must match the access mode type that is the result of calling
- * {@code accessModeType(VarHandle.AccessMode.weakCompareAndSetRelease)} on this VarHandle.
+ * {@code accessModeType(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)}
+ * on this VarHandle.
*
* @param args the signature-polymorphic parameter list of the form
* {@code (CT, T expectedValue, T newValue)}
@@ -949,7 +996,8 @@
*
*
The symbolic type descriptor at the call site of {@code getAndSet}
* must match the access mode type that is the result of calling
- * {@code accessModeType(VarHandle.AccessMode.getAndSet)} on this VarHandle.
+ * {@code accessModeType(VarHandle.AccessMode.GET_AND_SET)} on this
+ * VarHandle.
*
* @param args the signature-polymorphic parameter list of the form
* {@code (CT, T newValue)}
@@ -985,7 +1033,8 @@
*
*
The symbolic type descriptor at the call site of {@code getAndAdd}
* must match the access mode type that is the result of calling
- * {@code accessModeType(VarHandle.AccessMode.getAndAdd)} on this VarHandle.
+ * {@code accessModeType(VarHandle.AccessMode.GET_AND_ADD)} on this
+ * VarHandle.
*
* @param args the signature-polymorphic parameter list of the form
* {@code (CT, T value)}
@@ -1017,7 +1066,8 @@
*
*
The symbolic type descriptor at the call site of {@code addAndGet}
* must match the access mode type that is the result of calling
- * {@code accessModeType(VarHandle.AccessMode.addAndGet)} on this VarHandle.
+ * {@code accessModeType(VarHandle.AccessMode.ADD_AND_GET)} on this
+ * VarHandle.
*
* @param args the signature-polymorphic parameter list of the form
* {@code (CT, T value)}
@@ -1083,109 +1133,115 @@
* method
* {@link VarHandle#get VarHandle.get}
*/
- GET("get", AccessType.GET, Object.class), // 0
+ GET("get", AccessType.GET, Object.class),
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#set VarHandle.set}
*/
- SET("set", AccessType.SET, void.class), // 1
+ SET("set", AccessType.SET, void.class),
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#getVolatile VarHandle.getVolatile}
*/
- GET_VOLATILE("getVolatile", AccessType.GET, Object.class), // 2
+ GET_VOLATILE("getVolatile", AccessType.GET, Object.class),
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#setVolatile VarHandle.setVolatile}
*/
- SET_VOLATILE("setVolatile", AccessType.SET, void.class), // 3
+ SET_VOLATILE("setVolatile", AccessType.SET, void.class),
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#getAcquire VarHandle.getAcquire}
*/
- GET_ACQUIRE("getAcquire", AccessType.GET, Object.class), // 4
+ GET_ACQUIRE("getAcquire", AccessType.GET, Object.class),
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#setRelease VarHandle.setRelease}
*/
- SET_RELEASE("setRelease", AccessType.SET, void.class), // 5
+ SET_RELEASE("setRelease", AccessType.SET, void.class),
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#getOpaque VarHandle.getOpaque}
*/
- GET_OPAQUE("getOpaque", AccessType.GET, Object.class), // 6
+ GET_OPAQUE("getOpaque", AccessType.GET, Object.class),
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#setOpaque VarHandle.setOpaque}
*/
- SET_OPAQUE("setOpaque", AccessType.SET, void.class), // 7
+ SET_OPAQUE("setOpaque", AccessType.SET, void.class),
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#compareAndSet VarHandle.compareAndSet}
*/
- COMPARE_AND_SET("compareAndSet", AccessType.COMPARE_AND_SWAP, boolean.class), // 8
+ COMPARE_AND_SET("compareAndSet", AccessType.COMPARE_AND_SWAP, boolean.class),
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#compareAndExchangeVolatile VarHandle.compareAndExchangeVolatile}
*/
- COMPARE_AND_EXCHANGE_VOLATILE("compareAndExchangeVolatile", AccessType.COMPARE_AND_EXCHANGE, Object.class), // 9
+ COMPARE_AND_EXCHANGE_VOLATILE("compareAndExchangeVolatile", AccessType.COMPARE_AND_EXCHANGE, Object.class),
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#compareAndExchangeAcquire VarHandle.compareAndExchangeAcquire}
*/
- COMPARE_AND_EXCHANGE_ACQUIRE("compareAndExchangeAcquire", AccessType.COMPARE_AND_EXCHANGE, Object.class), // 10
+ COMPARE_AND_EXCHANGE_ACQUIRE("compareAndExchangeAcquire", AccessType.COMPARE_AND_EXCHANGE, Object.class),
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#compareAndExchangeRelease VarHandle.compareAndExchangeRelease}
*/
- COMPARE_AND_EXCHANGE_RELEASE("compareAndExchangeRelease", AccessType.COMPARE_AND_EXCHANGE, Object.class), // 11
+ COMPARE_AND_EXCHANGE_RELEASE("compareAndExchangeRelease", AccessType.COMPARE_AND_EXCHANGE, Object.class),
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#weakCompareAndSet VarHandle.weakCompareAndSet}
*/
- WEAK_COMPARE_AND_SET("weakCompareAndSet", AccessType.COMPARE_AND_SWAP, boolean.class), // 12
+ WEAK_COMPARE_AND_SET("weakCompareAndSet", AccessType.COMPARE_AND_SWAP, boolean.class),
+ /**
+ * The access mode whose access is specified by the corresponding
+ * method
+ * {@link VarHandle#weakCompareAndSetVolatile VarHandle.weakCompareAndSetVolatile}
+ */
+ WEAK_COMPARE_AND_SET_VOLATILE("weakCompareAndSetVolatile", AccessType.COMPARE_AND_SWAP, boolean.class),
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#weakCompareAndSetAcquire VarHandle.weakCompareAndSetAcquire}
*/
- WEAK_COMPARE_AND_SET_ACQUIRE("weakCompareAndSetAcquire", AccessType.COMPARE_AND_SWAP, boolean.class), // 13
+ WEAK_COMPARE_AND_SET_ACQUIRE("weakCompareAndSetAcquire", AccessType.COMPARE_AND_SWAP, boolean.class),
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#weakCompareAndSetRelease VarHandle.weakCompareAndSetRelease}
*/
- WEAK_COMPARE_AND_SET_RELEASE("weakCompareAndSetRelease", AccessType.COMPARE_AND_SWAP, boolean.class), // 14
+ WEAK_COMPARE_AND_SET_RELEASE("weakCompareAndSetRelease", AccessType.COMPARE_AND_SWAP, boolean.class),
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#getAndSet VarHandle.getAndSet}
*/
- GET_AND_SET("getAndSet", AccessType.GET_AND_UPDATE, Object.class), // 15
+ GET_AND_SET("getAndSet", AccessType.GET_AND_UPDATE, Object.class),
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#getAndAdd VarHandle.getAndAdd}
*/
- GET_AND_ADD("getAndAdd", AccessType.GET_AND_UPDATE, Object.class), // 16
+ GET_AND_ADD("getAndAdd", AccessType.GET_AND_UPDATE, Object.class),
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#addAndGet VarHandle.addAndGet}
*/
- ADD_AND_GET("addAndGet", AccessType.GET_AND_UPDATE, Object.class), // 17
+ ADD_AND_GET("addAndGet", AccessType.GET_AND_UPDATE, Object.class),
;
static final Map methodNameToAccessMode;
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template
--- a/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template Tue May 03 12:25:20 2016 -0700
@@ -155,6 +155,15 @@
}
@ForceInline
+ static boolean weakCompareAndSetVolatile(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) {
+ // TODO defer to strong form until new Unsafe method is added
+ return UNSAFE.compareAndSwap$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)),
+ handle.fieldOffset,
+ {#if[Object]?handle.fieldType.cast(expected):expected},
+ {#if[Object]?handle.fieldType.cast(value):value});
+ }
+
+ @ForceInline
static boolean weakCompareAndSetAcquire(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) {
return UNSAFE.weakCompareAndSwap$Type$Acquire(Objects.requireNonNull(handle.receiverType.cast(holder)),
handle.fieldOffset,
@@ -319,6 +328,15 @@
}
@ForceInline
+ static boolean weakCompareAndSetVolatile(FieldStaticReadWrite handle, $type$ expected, $type$ value) {
+ // TODO defer to strong form until new Unsafe method is added
+ return UNSAFE.compareAndSwap$Type$(handle.base,
+ handle.fieldOffset,
+ {#if[Object]?handle.fieldType.cast(expected):expected},
+ {#if[Object]?handle.fieldType.cast(value):value});
+ }
+
+ @ForceInline
static boolean weakCompareAndSetAcquire(FieldStaticReadWrite handle, $type$ expected, $type$ value) {
return UNSAFE.weakCompareAndSwap$Type$Acquire(handle.base,
handle.fieldOffset,
@@ -535,6 +553,20 @@
}
@ForceInline
+ static boolean weakCompareAndSetVolatile(Array handle, Object oarray, int index, $type$ expected, $type$ value) {
+#if[Object]
+ Object[] array = (Object[]) handle.arrayType.cast(oarray);
+#else[Object]
+ $type$[] array = ($type$[]) oarray;
+#end[Object]
+ // TODO defer to strong form until new Unsafe method is added
+ return UNSAFE.compareAndSwap$Type$(array,
+ (((long) Objects.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
+ {#if[Object]?handle.componentType.cast(expected):expected},
+ {#if[Object]?handle.componentType.cast(value):value});
+ }
+
+ @ForceInline
static boolean weakCompareAndSetAcquire(Array handle, Object oarray, int index, $type$ expected, $type$ value) {
#if[Object]
Object[] array = (Object[]) handle.arrayType.cast(oarray);
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template
--- a/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template Tue May 03 12:25:20 2016 -0700
@@ -228,6 +228,16 @@
}
@ForceInline
+ static boolean weakCompareAndSetVolatile(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
+ byte[] ba = (byte[]) oba;
+ // TODO defer to strong form until new Unsafe method is added
+ return UNSAFE.compareAndSwap$RawType$(
+ ba,
+ address(ba, index(ba, index)),
+ convEndian(handle.be, expected), convEndian(handle.be, value));
+ }
+
+ @ForceInline
static boolean weakCompareAndSetAcquire(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
byte[] ba = (byte[]) oba;
return UNSAFE.weakCompareAndSwap$RawType$Acquire(
@@ -444,6 +454,16 @@
}
@ForceInline
+ static boolean weakCompareAndSetVolatile(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
+ ByteBuffer bb = (ByteBuffer) obb;
+ // TODO defer to strong form until new Unsafe method is added
+ return UNSAFE.compareAndSwap$RawType$(
+ UNSAFE.getObject(bb, BYTE_BUFFER_HB),
+ address(bb, indexRO(bb, index)),
+ convEndian(handle.be, expected), convEndian(handle.be, value));
+ }
+
+ @ForceInline
static boolean weakCompareAndSetAcquire(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
ByteBuffer bb = (ByteBuffer) obb;
return UNSAFE.weakCompareAndSwap$RawType$Acquire(
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/module/Configuration.java
--- a/jdk/src/java.base/share/classes/java/lang/module/Configuration.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/module/Configuration.java Tue May 03 12:25:20 2016 -0700
@@ -25,6 +25,7 @@
package java.lang.module;
+import java.io.PrintStream;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@@ -183,17 +184,20 @@
this.nameToModule = Collections.emptyMap();
}
- private Configuration(Configuration parent, Resolver resolver) {
- Map> graph = resolver.finish(this);
+ private Configuration(Configuration parent,
+ Resolver resolver,
+ boolean check)
+ {
+ Map> g = resolver.finish(this, check);
Map nameToModule = new HashMap<>();
- for (ResolvedModule resolvedModule : graph.keySet()) {
+ for (ResolvedModule resolvedModule : g.keySet()) {
nameToModule.put(resolvedModule.name(), resolvedModule);
}
this.parent = parent;
- this.graph = graph;
- this.modules = Collections.unmodifiableSet(graph.keySet());
+ this.graph = g;
+ this.modules = Collections.unmodifiableSet(g.keySet());
this.nameToModule = Collections.unmodifiableMap(nameToModule);
}
@@ -283,10 +287,10 @@
Objects.requireNonNull(after);
Objects.requireNonNull(roots);
- Resolver resolver = new Resolver(before, this, after);
+ Resolver resolver = new Resolver(before, this, after, null);
resolver.resolveRequires(roots);
- return new Configuration(this, resolver);
+ return new Configuration(this, resolver, true);
}
@@ -340,10 +344,32 @@
Objects.requireNonNull(after);
Objects.requireNonNull(roots);
- Resolver resolver = new Resolver(before, this, after);
+ Resolver resolver = new Resolver(before, this, after, null);
resolver.resolveRequires(roots).resolveUses();
- return new Configuration(this, resolver);
+ return new Configuration(this, resolver, true);
+ }
+
+
+ /**
+ * Resolves a collection of root modules, with service binding, and with
+ * the empty configuration as its parent. The post resolution checks
+ * are optionally run.
+ *
+ * This method is used to create the configuration for the boot layer.
+ */
+ static Configuration resolveRequiresAndUses(ModuleFinder finder,
+ Collection roots,
+ boolean check,
+ PrintStream traceOutput)
+ {
+ Configuration parent = empty();
+
+ Resolver resolver
+ = new Resolver(finder, parent, ModuleFinder.empty(), traceOutput);
+ resolver.resolveRequires(roots).resolveUses();
+
+ return new Configuration(parent, resolver, check);
}
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java
--- a/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java Tue May 03 12:25:20 2016 -0700
@@ -27,13 +27,17 @@
import java.io.InputStream;
import java.io.IOException;
+import java.io.PrintStream;
import java.io.UncheckedIOException;
+import java.net.URI;
import java.nio.ByteBuffer;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -45,7 +49,7 @@
import static java.util.Objects.*;
import jdk.internal.module.Checks;
-import jdk.internal.module.Hasher.DependencyHashes;
+import jdk.internal.module.ModuleHashes;
/**
@@ -372,8 +376,9 @@
private Provides(String service, Set providers, boolean check) {
this.service = check ? requireServiceTypeName(service) : service;
- providers = check ? Collections.unmodifiableSet(new HashSet<>(providers))
- : Collections.unmodifiableSet(providers);
+ providers = check
+ ? Collections.unmodifiableSet(new LinkedHashSet<>(providers))
+ : Collections.unmodifiableSet(providers);
if (providers.isEmpty())
throw new IllegalArgumentException("Empty providers set");
if (check)
@@ -787,7 +792,7 @@
private final String osVersion;
private final Set conceals;
private final Set packages;
- private final DependencyHashes hashes;
+ private final ModuleHashes hashes;
private ModuleDescriptor(String name,
boolean automatic,
@@ -802,7 +807,7 @@
String osArch,
String osVersion,
Set conceals,
- DependencyHashes hashes)
+ ModuleHashes hashes)
{
this.name = name;
@@ -878,7 +883,8 @@
String osArch,
String osVersion,
Set conceals,
- Set packages) {
+ Set packages,
+ ModuleHashes hashes) {
this.name = name;
this.automatic = automatic;
this.synthetic = synthetic;
@@ -894,7 +900,7 @@
this.osName = osName;
this.osArch = osArch;
this.osVersion = osVersion;
- this.hashes = null;
+ this.hashes = hashes;
}
/**
@@ -1063,9 +1069,9 @@
}
/**
- * Returns the object with the hashes of the dependences.
+ * Returns the object with the hashes of other modules
*/
- Optional hashes() {
+ Optional hashes() {
return Optional.ofNullable(hashes);
}
@@ -1103,7 +1109,7 @@
String osArch;
String osVersion;
String mainClass;
- DependencyHashes hashes;
+ ModuleHashes hashes;
/**
* Initializes a new builder with the given module name.
@@ -1580,7 +1586,7 @@
return this;
}
- /* package */ Builder hashes(DependencyHashes hashes) {
+ /* package */ Builder hashes(ModuleHashes hashes) {
this.hashes = hashes;
return this;
}
@@ -1719,7 +1725,9 @@
hc = hc * 43 + Objects.hashCode(osVersion);
hc = hc * 43 + Objects.hashCode(conceals);
hc = hc * 43 + Objects.hashCode(hashes);
- if (hc != 0) hash = hc;
+ if (hc == 0)
+ hc = -1;
+ hash = hc;
}
return hc;
}
@@ -1925,11 +1933,12 @@
static {
/**
- * Setup the shared secret to allow code in other packages create
- * ModuleDescriptor and associated objects directly.
+ * Setup the shared secret to allow code in other packages access
+ * private package methods in java.lang.module.
*/
jdk.internal.misc.SharedSecrets
.setJavaLangModuleAccess(new jdk.internal.misc.JavaLangModuleAccess() {
+
@Override
public Requires newRequires(Set ms, String mn) {
return new Requires(ms, mn, false);
@@ -1974,7 +1983,8 @@
String osArch,
String osVersion,
Set conceals,
- Set packages) {
+ Set packages,
+ ModuleHashes hashes) {
return new ModuleDescriptor(name,
automatic,
synthetic,
@@ -1988,7 +1998,29 @@
osArch,
osVersion,
conceals,
- packages);
+ packages,
+ hashes);
+ }
+
+ @Override
+ public Configuration resolveRequiresAndUses(ModuleFinder finder,
+ Collection roots,
+ boolean check,
+ PrintStream traceOutput)
+ {
+ return Configuration.resolveRequiresAndUses(finder, roots, check, traceOutput);
+ }
+
+ @Override
+ public ModuleReference newPatchedModule(ModuleDescriptor descriptor,
+ URI location,
+ Supplier s) {
+ return new ModuleReference(descriptor, location, s, true, null);
+ }
+
+ @Override
+ public Optional hashes(ModuleDescriptor descriptor) {
+ return descriptor.hashes();
}
});
}
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/module/ModuleInfo.java
--- a/jdk/src/java.base/share/classes/java/lang/module/ModuleInfo.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleInfo.java Tue May 03 12:25:20 2016 -0700
@@ -37,11 +37,12 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.function.Supplier;
-import jdk.internal.module.Hasher.DependencyHashes;
+import jdk.internal.module.ModuleHashes;
import static jdk.internal.module.ClassFileConstants.*;
@@ -337,7 +338,7 @@
// computeIfAbsent
Set providers = pm.get(sn);
if (providers == null) {
- providers = new HashSet<>();
+ providers = new LinkedHashSet<>(); // preserve order
pm.put(sn, providers);
}
providers.add(cn);
@@ -425,7 +426,7 @@
map.put(dn, hash);
}
- builder.hashes(new DependencyHashes(algorithm, map));
+ builder.hashes(new ModuleHashes(algorithm, map));
}
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/module/ModulePath.java
--- a/jdk/src/java.base/share/classes/java/lang/module/ModulePath.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModulePath.java Tue May 03 12:25:20 2016 -0700
@@ -40,7 +40,7 @@
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
+import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@@ -52,7 +52,6 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
-import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@@ -190,18 +189,16 @@
}
}
- if (attrs.isRegularFile() || attrs.isDirectory()) {
- // packaged or exploded module
- ModuleReference mref = readModule(entry, attrs);
- if (mref != null) {
- String name = mref.descriptor().name();
- return Collections.singletonMap(name, mref);
- }
+ // packaged or exploded module
+ ModuleReference mref = readModule(entry, attrs);
+ if (mref != null) {
+ String name = mref.descriptor().name();
+ return Collections.singletonMap(name, mref);
+ } else {
+ // skipped
+ return Collections.emptyMap();
}
- // not recognized
- throw new FindException("Unrecognized module: " + entry);
-
} catch (IOException ioe) {
throw new FindException(ioe);
}
@@ -238,16 +235,13 @@
// module found
if (mref != null) {
-
// can have at most one version of a module in the directory
String name = mref.descriptor().name();
if (nameToReference.put(name, mref) != null) {
throw new FindException("Two versions of module "
- + name + " found in " + dir);
+ + name + " found in " + dir);
}
-
}
-
}
}
@@ -257,28 +251,40 @@
/**
* Locates a packaged or exploded module, returning a {@code ModuleReference}
- * to the module. Returns {@code null} if the module is not recognized
- * as a packaged or exploded module.
+ * to the module. Returns {@code null} if the entry is skipped because it is
+ * to a directory that does not contain a module-info.class or it's a hidden
+ * file.
*
* @throws IOException if an I/O error occurs
- * @throws FindException if an error occurs parsing the module descriptor
+ * @throws FindException if the file is not recognized as a module or an
+ * error occurs parsing its module descriptor
*/
private ModuleReference readModule(Path entry, BasicFileAttributes attrs)
throws IOException
{
try {
- ModuleReference mref = null;
if (attrs.isDirectory()) {
- mref = readExplodedModule(entry);
- } if (attrs.isRegularFile()) {
- if (entry.toString().endsWith(".jar")) {
- mref = readJar(entry);
- } else if (isLinkPhase && entry.toString().endsWith(".jmod")) {
- mref = readJMod(entry);
+ return readExplodedModule(entry); // may return null
+ }
+
+ String fn = entry.getFileName().toString();
+ if (attrs.isRegularFile()) {
+ if (fn.endsWith(".jar")) {
+ return readJar(entry);
+ } else if (fn.endsWith(".jmod")) {
+ if (isLinkPhase)
+ return readJMod(entry);
+ throw new FindException("JMOD files not supported: " + entry);
}
}
- return mref;
+
+ // skip hidden files
+ if (fn.startsWith(".") || Files.isHidden(entry)) {
+ return null;
+ } else {
+ throw new FindException("Unrecognized module: " + entry);
+ }
} catch (InvalidModuleDescriptorException e) {
throw new FindException("Error reading module: " + entry, e);
@@ -292,15 +298,17 @@
return zf.stream()
.filter(e -> e.getName().startsWith("classes/") &&
e.getName().endsWith(".class"))
- .map(e -> toPackageName(e))
+ .map(e -> toPackageName(e.getName().substring(8)))
.filter(pkg -> pkg.length() > 0) // module-info
- .distinct()
.collect(Collectors.toSet());
}
/**
* Returns a {@code ModuleReference} to a module in jmod file on the
* file system.
+ *
+ * @throws IOException
+ * @throws InvalidModuleDescriptorException
*/
private ModuleReference readJMod(Path file) throws IOException {
try (ZipFile zf = new ZipFile(file.toString())) {
@@ -419,13 +427,12 @@
// scan the entries in the JAR file to locate the .class and service
// configuration file
- Stream stream = jf.stream()
- .map(e -> e.getName())
- .filter(e -> (e.endsWith(".class") || e.startsWith(SERVICES_PREFIX)))
- .distinct();
- Map> map
- = stream.collect(Collectors.partitioningBy(s -> s.endsWith(".class"),
- Collectors.toSet()));
+ Map> map =
+ jf.stream()
+ .map(JarEntry::getName)
+ .filter(s -> (s.endsWith(".class") ^ s.startsWith(SERVICES_PREFIX)))
+ .collect(Collectors.partitioningBy(s -> s.endsWith(".class"),
+ Collectors.toSet()));
Set classFiles = map.get(Boolean.TRUE);
Set configFiles = map.get(Boolean.FALSE);
@@ -433,19 +440,18 @@
classFiles.stream()
.map(c -> toPackageName(c))
.distinct()
- .forEach(p -> builder.exports(p));
+ .forEach(builder::exports);
// map names of service configuration files to service names
Set serviceNames = configFiles.stream()
.map(this::toServiceName)
- .filter(Optional::isPresent)
- .map(Optional::get)
+ .flatMap(Optional::stream)
.collect(Collectors.toSet());
// parse each service configuration file
for (String sn : serviceNames) {
JarEntry entry = jf.getJarEntry(SERVICES_PREFIX + sn);
- Set providerClasses = new HashSet<>();
+ Set providerClasses = new LinkedHashSet<>();
try (InputStream in = jf.getInputStream(entry)) {
BufferedReader reader
= new BufferedReader(new InputStreamReader(in, "UTF-8"));
@@ -475,19 +481,25 @@
private Set jarPackages(JarFile jf) {
return jf.stream()
.filter(e -> e.getName().endsWith(".class"))
- .map(e -> toPackageName(e))
+ .map(e -> toPackageName(e.getName()))
.filter(pkg -> pkg.length() > 0) // module-info
- .distinct()
.collect(Collectors.toSet());
}
/**
* Returns a {@code ModuleReference} to a module in modular JAR file on
* the file system.
+ *
+ * @throws IOException
+ * @throws FindException
+ * @throws InvalidModuleDescriptorException
*/
private ModuleReference readJar(Path file) throws IOException {
- try (JarFile jf = new JarFile(file.toString())) {
-
+ try (JarFile jf = new JarFile(file.toFile(),
+ true, // verify
+ ZipFile.OPEN_READ,
+ JarFile.Release.RUNTIME))
+ {
ModuleDescriptor md;
JarEntry entry = jf.getJarEntry(MODULE_INFO);
if (entry == null) {
@@ -520,7 +532,6 @@
path.toString().endsWith(".class")))
.map(path -> toPackageName(dir.relativize(path)))
.filter(pkg -> pkg.length() > 0) // module-info
- .distinct()
.collect(Collectors.toSet());
} catch (IOException x) {
throw new UncheckedIOException(x);
@@ -530,6 +541,9 @@
/**
* Returns a {@code ModuleReference} to an exploded module on the file
* system or {@code null} if {@code module-info.class} not found.
+ *
+ * @throws IOException
+ * @throws InvalidModuleDescriptorException
*/
private ModuleReference readExplodedModule(Path dir) throws IOException {
Path mi = dir.resolve(MODULE_INFO);
@@ -559,19 +573,6 @@
}
}
- private String toPackageName(ZipEntry entry) {
- String name = entry.getName();
- assert name.endsWith(".class");
- // jmod classes in classes/, jar in /
- int start = name.startsWith("classes/") ? 8 : 0;
- int index = name.lastIndexOf("/");
- if (index > start) {
- return name.substring(start, index).replace('/', '.');
- } else {
- return "";
- }
- }
-
private String toPackageName(Path path) {
String name = path.toString();
assert name.endsWith(".class");
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/module/ModuleReader.java
--- a/jdk/src/java.base/share/classes/java/lang/module/ModuleReader.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleReader.java Tue May 03 12:25:20 2016 -0700
@@ -142,10 +142,11 @@
* @see ClassLoader#defineClass(String, ByteBuffer, java.security.ProtectionDomain)
*/
default Optional read(String name) throws IOException {
- Optional in = open(name);
- if (in.isPresent()) {
- byte[] bytes = in.get().readAllBytes();
- return Optional.of(ByteBuffer.wrap(bytes));
+ Optional oin = open(name);
+ if (oin.isPresent()) {
+ try (InputStream in = oin.get()) {
+ return Optional.of(ByteBuffer.wrap(in.readAllBytes()));
+ }
} else {
return Optional.empty();
}
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/module/ModuleReference.java
--- a/jdk/src/java.base/share/classes/java/lang/module/ModuleReference.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleReference.java Tue May 03 12:25:20 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -32,7 +32,7 @@
import java.util.Optional;
import java.util.function.Supplier;
-import jdk.internal.module.Hasher.HashSupplier;
+import jdk.internal.module.ModuleHashes.HashSupplier;
/**
@@ -54,12 +54,33 @@
private final URI location;
private final Supplier readerSupplier;
+ // true if this is a reference to a patched module
+ private boolean patched;
+
// the function that computes the hash of this module reference
private final HashSupplier hasher;
// cached hash string to avoid needing to compute it many times
private String cachedHash;
+
+ /**
+ * Constructs a new instance of this class.
+ */
+ ModuleReference(ModuleDescriptor descriptor,
+ URI location,
+ Supplier readerSupplier,
+ boolean patched,
+ HashSupplier hasher)
+
+ {
+ this.descriptor = Objects.requireNonNull(descriptor);
+ this.location = location;
+ this.readerSupplier = Objects.requireNonNull(readerSupplier);
+ this.patched = patched;
+ this.hasher = hasher;
+ }
+
/**
* Constructs a new instance of this class.
*/
@@ -67,11 +88,9 @@
URI location,
Supplier readerSupplier,
HashSupplier hasher)
+
{
- this.descriptor = Objects.requireNonNull(descriptor);
- this.location = location;
- this.readerSupplier = Objects.requireNonNull(readerSupplier);
- this.hasher = hasher;
+ this(descriptor, location, readerSupplier, false, hasher);
}
@@ -96,10 +115,9 @@
URI location,
Supplier readerSupplier)
{
- this(descriptor, location, readerSupplier, null);
+ this(descriptor, location, readerSupplier, false, null);
}
-
/**
* Returns the module descriptor.
*
@@ -151,6 +169,20 @@
/**
+ * Returns {@code true} if this module has been patched via -Xpatch.
+ */
+ boolean isPatched() {
+ return patched;
+ }
+
+ /**
+ * Returns the hash supplier for this module.
+ */
+ HashSupplier hasher() {
+ return hasher;
+ }
+
+ /**
* Computes the hash of this module, returning it as a hex string.
* Returns {@code null} if the hash cannot be computed.
*
@@ -166,8 +198,6 @@
return result;
}
- private int hash;
-
/**
* Computes a hash code for this module reference.
*
@@ -181,12 +211,17 @@
public int hashCode() {
int hc = hash;
if (hc == 0) {
- hc = Objects.hash(descriptor, location, readerSupplier, hasher);
- if (hc != 0) hash = hc;
+ hc = Objects.hash(descriptor, location, readerSupplier, hasher,
+ Boolean.valueOf(patched));
+ if (hc == 0)
+ hc = -1;
+ hash = hc;
}
return hc;
}
+ private int hash;
+
/**
* Tests this module reference for equality with the given object.
*
@@ -214,7 +249,8 @@
return Objects.equals(this.descriptor, that.descriptor)
&& Objects.equals(this.location, that.location)
&& Objects.equals(this.readerSupplier, that.readerSupplier)
- && Objects.equals(this.hasher, that.hasher);
+ && Objects.equals(this.hasher, that.hasher)
+ && this.patched == that.patched;
}
/**
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/module/ModuleReferences.java
--- a/jdk/src/java.base/share/classes/java/lang/module/ModuleReferences.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleReferences.java Tue May 03 12:25:20 2016 -0700
@@ -48,8 +48,8 @@
import jdk.internal.misc.JavaLangAccess;
import jdk.internal.misc.SharedSecrets;
-import jdk.internal.module.Hasher;
-import jdk.internal.module.Hasher.HashSupplier;
+import jdk.internal.module.ModuleHashes;
+import jdk.internal.module.ModuleHashes.HashSupplier;
import jdk.internal.module.ModulePatcher;
import sun.net.www.ParseUtil;
@@ -89,7 +89,7 @@
static ModuleReference newJarModule(ModuleDescriptor md, Path file) {
URI uri = file.toUri();
Supplier supplier = () -> new JarModuleReader(file, uri);
- HashSupplier hasher = (algorithm) -> Hasher.generate(file, algorithm);
+ HashSupplier hasher = (a) -> ModuleHashes.computeHashAsString(file, a);
return newModule(md, uri, supplier, hasher);
}
@@ -99,7 +99,7 @@
static ModuleReference newJModModule(ModuleDescriptor md, Path file) {
URI uri = file.toUri();
Supplier supplier = () -> new JModModuleReader(file, uri);
- HashSupplier hasher = (algorithm) -> Hasher.generate(file, algorithm);
+ HashSupplier hasher = (a) -> ModuleHashes.computeHashAsString(file, a);
return newModule(md, file.toUri(), supplier, hasher);
}
@@ -122,7 +122,7 @@
private final ReadWriteLock lock = new ReentrantReadWriteLock();
private final Lock readLock = lock.readLock();
private final Lock writeLock = lock.writeLock();
- private volatile boolean closed;
+ private boolean closed;
SafeCloseModuleReader() { }
@@ -198,7 +198,10 @@
static JarFile newJarFile(Path path) {
try {
- return new JarFile(path.toFile());
+ return new JarFile(path.toFile(),
+ true, // verify
+ ZipFile.OPEN_READ,
+ JarFile.Release.RUNTIME);
} catch (IOException ioe) {
throw new UncheckedIOException(ioe);
}
@@ -219,6 +222,8 @@
if (je != null) {
String encodedPath = ParseUtil.encodePath(name, false);
String uris = "jar:" + uri + "!/" + encodedPath;
+ if (jf.isMultiRelease())
+ uris += "#runtime";
return Optional.of(URI.create(uris));
} else {
return Optional.empty();
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/module/Resolver.java
--- a/jdk/src/java.base/share/classes/java/lang/module/Resolver.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/module/Resolver.java Tue May 03 12:25:20 2016 -0700
@@ -25,8 +25,8 @@
package java.lang.module;
+import java.io.PrintStream;
import java.lang.module.ModuleDescriptor.Requires.Modifier;
-import java.lang.reflect.Layer;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
@@ -43,7 +43,7 @@
import java.util.StringJoiner;
import java.util.stream.Collectors;
-import jdk.internal.module.Hasher;
+import jdk.internal.module.ModuleHashes;
/**
* The resolver used by {@link Configuration#resolveRequires} and
@@ -55,6 +55,7 @@
private final ModuleFinder beforeFinder;
private final Configuration parent;
private final ModuleFinder afterFinder;
+ private final PrintStream traceOutput;
// maps module name to module reference
private final Map nameToReference = new HashMap<>();
@@ -62,10 +63,12 @@
Resolver(ModuleFinder beforeFinder,
Configuration parent,
- ModuleFinder afterFinder) {
+ ModuleFinder afterFinder,
+ PrintStream traceOutput) {
this.beforeFinder = beforeFinder;
this.parent = parent;
this.afterFinder = afterFinder;
+ this.traceOutput = traceOutput;
}
@@ -76,8 +79,6 @@
*/
Resolver resolveRequires(Collection roots) {
- long start = trace_start("Resolve");
-
// create the visit stack to get us started
Deque q = new ArrayDeque<>();
for (String root : roots) {
@@ -95,10 +96,9 @@
}
}
- if (TRACE) {
+ if (isTracing()) {
trace("Root module %s located", root);
- if (mref.location().isPresent())
- trace(" (%s)", mref.location().get());
+ mref.location().ifPresent(uri -> trace(" (%s)", uri));
}
assert mref.descriptor().name().equals(root);
@@ -108,13 +108,6 @@
resolve(q);
- if (TRACE) {
- long duration = System.currentTimeMillis() - start;
- Set names = nameToReference.keySet();
- trace("Resolver completed in %s ms", duration);
- names.stream().sorted().forEach(name -> trace(" %s", name));
- }
-
return this;
}
@@ -153,11 +146,10 @@
q.offer(mref.descriptor());
resolved.add(mref.descriptor());
- if (TRACE) {
+ if (isTracing()) {
trace("Module %s located, required by %s",
dn, descriptor.name());
- if (mref.location().isPresent())
- trace(" (%s)", mref.location().get());
+ mref.location().ifPresent(uri -> trace(" (%s)", uri));
}
}
@@ -175,8 +167,6 @@
*/
Resolver resolveUses() {
- long start = trace_start("Bind");
-
// Scan the finders for all available service provider modules. As
// java.base uses services then then module finders will be scanned
// anyway.
@@ -230,10 +220,10 @@
String pn = provider.name();
if (!nameToReference.containsKey(pn)) {
-
- if (TRACE && mref.location().isPresent())
- trace(" (%s)", mref.location().get());
-
+ if (isTracing()) {
+ mref.location()
+ .ifPresent(uri -> trace(" (%s)", uri));
+ }
nameToReference.put(pn, mref);
q.push(provider);
}
@@ -248,14 +238,6 @@
} while (!candidateConsumers.isEmpty());
-
- if (TRACE) {
- long duration = System.currentTimeMillis() - start;
- Set names = nameToReference.keySet();
- trace("Bind completed in %s ms", duration);
- names.stream().sorted().forEach(name -> trace(" %s", name));
- }
-
return this;
}
@@ -264,23 +246,33 @@
* Execute post-resolution checks and returns the module graph of resolved
* modules as {@code Map}. The resolved modules will be in the given
* configuration.
+ *
+ * @param check {@true} to execute the post resolution checks
*/
- Map> finish(Configuration cf) {
+ Map> finish(Configuration cf,
+ boolean check)
+ {
+ if (isTracing()) {
+ trace("Result:");
+ Set names = nameToReference.keySet();
+ names.stream().sorted().forEach(name -> trace(" %s", name));
+ }
- detectCycles();
-
- checkPlatformConstraints();
-
- checkHashes();
+ if (check) {
+ detectCycles();
+ checkPlatformConstraints();
+ checkHashes();
+ }
Map> graph = makeGraph(cf);
- checkExportSuppliers(graph);
+ if (check) {
+ checkExportSuppliers(graph);
+ }
return graph;
}
-
/**
* Checks the given module graph for cycles.
*
@@ -420,52 +412,44 @@
}
-
/**
* Checks the hashes in the module descriptor to ensure that they match
- * the hash of the dependency's module reference.
+ * any recorded hashes.
*/
private void checkHashes() {
-
for (ModuleReference mref : nameToReference.values()) {
ModuleDescriptor descriptor = mref.descriptor();
- // get map of module names to hash
- Optional ohashes = descriptor.hashes();
+ // get map of module hashes
+ Optional ohashes = descriptor.hashes();
if (!ohashes.isPresent())
continue;
- Hasher.DependencyHashes hashes = ohashes.get();
-
- // check dependences
- for (ModuleDescriptor.Requires d : descriptor.requires()) {
- String dn = d.name();
- String recordedHash = hashes.hashFor(dn);
-
- if (recordedHash != null) {
+ ModuleHashes hashes = ohashes.get();
- ModuleReference other = nameToReference.get(dn);
- if (other == null) {
- other = parent.findModule(dn)
- .map(ResolvedModule::reference)
- .orElse(null);
- }
- if (other == null)
- throw new InternalError(dn + " not found");
+ String algorithm = hashes.algorithm();
+ for (String dn : hashes.names()) {
+ ModuleReference other = nameToReference.get(dn);
+ if (other == null) {
+ other = parent.findModule(dn)
+ .map(ResolvedModule::reference)
+ .orElse(null);
+ }
- String actualHash = other.computeHash(hashes.algorithm());
+ // skip checking the hash if the module has been patched
+ if (other != null && !other.isPatched()) {
+ String recordedHash = hashes.hashFor(dn);
+ String actualHash = other.computeHash(algorithm);
if (actualHash == null)
fail("Unable to compute the hash of module %s", dn);
-
if (!recordedHash.equals(actualHash)) {
- fail("Hash of %s (%s) differs to expected hash (%s)",
- dn, actualHash, recordedHash);
+ fail("Hash of %s (%s) differs to expected hash (%s)" +
+ " recorded in %s", dn, actualHash, recordedHash,
+ descriptor.name());
}
+ }
+ }
- }
-
- }
}
-
}
@@ -666,7 +650,7 @@
// source is exported to descriptor2
String source = export.source();
ModuleDescriptor other
- = packageToExporter.put(source, descriptor2);
+ = packageToExporter.put(source, descriptor2);
if (other != null && other != descriptor2) {
// package might be local to descriptor1
@@ -690,33 +674,38 @@
}
}
- // uses S
- for (String service : descriptor1.uses()) {
- String pn = packageName(service);
- if (!packageToExporter.containsKey(pn)) {
- fail("Module %s does not read a module that exports %s",
- descriptor1.name(), pn);
- }
- }
+ // uses/provides checks not applicable to automatic modules
+ if (!descriptor1.isAutomatic()) {
- // provides S
- for (Map.Entry entry :
- descriptor1.provides().entrySet()) {
- String service = entry.getKey();
- ModuleDescriptor.Provides provides = entry.getValue();
-
- String pn = packageName(service);
- if (!packageToExporter.containsKey(pn)) {
- fail("Module %s does not read a module that exports %s",
- descriptor1.name(), pn);
+ // uses S
+ for (String service : descriptor1.uses()) {
+ String pn = packageName(service);
+ if (!packageToExporter.containsKey(pn)) {
+ fail("Module %s does not read a module that exports %s",
+ descriptor1.name(), pn);
+ }
}
- for (String provider : provides.providers()) {
- if (!packages.contains(packageName(provider))) {
- fail("Provider %s not in module %s",
- provider, descriptor1.name());
+ // provides S
+ for (Map.Entry entry :
+ descriptor1.provides().entrySet()) {
+ String service = entry.getKey();
+ ModuleDescriptor.Provides provides = entry.getValue();
+
+ String pn = packageName(service);
+ if (!packageToExporter.containsKey(pn)) {
+ fail("Module %s does not read a module that exports %s",
+ descriptor1.name(), pn);
+ }
+
+ for (String provider : provides.providers()) {
+ if (!packages.contains(packageName(provider))) {
+ fail("Provider %s not in module %s",
+ provider, descriptor1.name());
+ }
}
}
+
}
}
@@ -796,27 +785,18 @@
throw new ResolutionException(msg);
}
-
/**
- * Tracing support, limited to boot layer for now.
+ * Tracing support
*/
- private final static boolean TRACE
- = Boolean.getBoolean("jdk.launcher.traceResolver")
- && (Layer.boot() == null);
-
- private String op;
-
- private long trace_start(String op) {
- this.op = op;
- return System.currentTimeMillis();
+ private boolean isTracing() {
+ return traceOutput != null;
}
private void trace(String fmt, Object ... args) {
- if (TRACE) {
- System.out.print("[" + op + "] ");
- System.out.format(fmt, args);
- System.out.println();
+ if (traceOutput != null) {
+ traceOutput.format("[Resolver] " + fmt, args);
+ traceOutput.println();
}
}
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/module/SystemModuleFinder.java
--- a/jdk/src/java.base/share/classes/java/lang/module/SystemModuleFinder.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/module/SystemModuleFinder.java Tue May 03 12:25:20 2016 -0700
@@ -44,6 +44,7 @@
import jdk.internal.jimage.ImageLocation;
import jdk.internal.jimage.ImageReader;
import jdk.internal.jimage.ImageReaderFactory;
+import jdk.internal.module.ModuleHashes;
import jdk.internal.module.SystemModules;
import jdk.internal.module.ModulePatcher;
import jdk.internal.perf.PerfCounter;
@@ -101,13 +102,16 @@
for (int i = 0; i < n; i++) {
String mn = moduleNames[i];
ModuleDescriptor md;
+ String hash;
if (fastLoad) {
md = descriptors[i];
+ hash = SystemModules.MODULES_TO_HASH[i];
} else {
// fallback to read module-info.class
// if fast loading of ModuleDescriptors is disabled
ImageLocation location = imageReader.findLocation(mn, "module-info.class");
md = ModuleDescriptor.read(imageReader.getResourceBuffer(location));
+ hash = null;
}
if (!md.name().equals(mn))
throw new InternalError();
@@ -123,7 +127,8 @@
}
};
- ModuleReference mref = new ModuleReference(md, uri, readerSupplier);
+ ModuleReference mref =
+ new ModuleReference(md, uri, readerSupplier, hashSupplier(hash));
// may need a reference to a patched module if -Xpatch specified
mref = ModulePatcher.interposeIfNeeded(mref);
@@ -142,6 +147,18 @@
initTime.addElapsedTimeFrom(t0);
}
+ private static ModuleHashes.HashSupplier hashSupplier(String hash) {
+ if (hash == null)
+ return null;
+
+ return new ModuleHashes.HashSupplier() {
+ @Override
+ public String generate(String algorithm) {
+ return hash;
+ }
+ };
+ }
+
SystemModuleFinder() { }
@Override
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/reflect/Layer.java
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Layer.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Layer.java Tue May 03 12:25:20 2016 -0700
@@ -27,6 +27,7 @@
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
+import java.lang.module.ModuleDescriptor.Provides;
import java.lang.module.ResolvedModule;
import java.util.Collections;
import java.util.HashMap;
@@ -41,6 +42,8 @@
import jdk.internal.loader.Loader;
import jdk.internal.loader.LoaderPool;
import jdk.internal.misc.SharedSecrets;
+import jdk.internal.module.ServicesCatalog;
+import jdk.internal.module.ServicesCatalog.ServiceProvider;
import sun.security.util.SecurityConstants;
@@ -549,4 +552,55 @@
public static Layer boot() {
return SharedSecrets.getJavaLangAccess().getBootLayer();
}
+
+
+ /**
+ * Returns the ServicesCatalog for this Layer, creating it if not
+ * already created.
+ */
+ ServicesCatalog getServicesCatalog() {
+ ServicesCatalog servicesCatalog = this.servicesCatalog;
+ if (servicesCatalog != null)
+ return servicesCatalog;
+
+ Map> map = new HashMap<>();
+ for (Module m : nameToModule.values()) {
+ ModuleDescriptor descriptor = m.getDescriptor();
+ for (Provides provides : descriptor.provides().values()) {
+ String service = provides.service();
+ Set providers
+ = map.computeIfAbsent(service, k -> new HashSet<>());
+ for (String pn : provides.providers()) {
+ providers.add(new ServiceProvider(m, pn));
+ }
+ }
+ }
+
+ ServicesCatalog catalog = new ServicesCatalog() {
+ @Override
+ public void register(Module module) {
+ throw new UnsupportedOperationException();
+ }
+ @Override
+ public Set findServices(String service) {
+ Set providers = map.get(service);
+ if (providers == null) {
+ return Collections.emptySet();
+ } else {
+ return Collections.unmodifiableSet(providers);
+ }
+ }
+ };
+
+ synchronized (this) {
+ servicesCatalog = this.servicesCatalog;
+ if (servicesCatalog == null) {
+ this.servicesCatalog = servicesCatalog = catalog;
+ }
+ }
+
+ return servicesCatalog;
+ }
+
+ private volatile ServicesCatalog servicesCatalog;
}
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/reflect/Module.java
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Module.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Module.java Tue May 03 12:25:20 2016 -0700
@@ -43,11 +43,7 @@
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
-import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.function.Function;
import java.util.stream.Stream;
@@ -142,9 +138,6 @@
this.name = null;
this.loader = loader;
this.descriptor = null;
-
- // unnamed modules are loose
- this.loose = true;
}
@@ -245,17 +238,27 @@
}
- // -- readability --
+ // --
+
+ // the special Module to mean reads or exported to "all unnamed modules"
+ private static final Module ALL_UNNAMED_MODULE = new Module(null);
- // true if this module reads all unnamed modules (a.k.a. loose module)
- private volatile boolean loose;
+ // special Module to mean exported to "everyone"
+ private static final Module EVERYONE_MODULE = new Module(null);
+
+ // exported to all modules
+ private static final Set EVERYONE = Collections.singleton(EVERYONE_MODULE);
+
+
+ // -- readability --
// the modules that this module permanently reads
// (will be final when the modules are defined in reverse topology order)
private volatile Set reads;
- // created lazily, additional modules that this module reflectively reads
- private volatile WeakSet transientReads;
+ // additional module (2nd key) that some module (1st key) reflectively reads
+ private static final WeakPairMap transientReads
+ = new WeakPairMap<>();
/**
@@ -284,22 +287,19 @@
// check if this module reads other
if (other.isNamed()) {
-
Set reads = this.reads; // volatile read
if (reads != null && reads.contains(other))
return true;
-
- } else {
-
- // loose modules read all unnamed modules
- if (this.loose)
- return true;
-
}
// check if this module reads the other module reflectively
- WeakSet tr = this.transientReads; // volatile read
- if (tr != null && tr.contains(other))
+ if (transientReads.containsKeyPair(this, other))
+ return true;
+
+ // if other is an unnamed module then check if this module reads
+ // all unnamed modules
+ if (!other.isNamed()
+ && transientReads.containsKeyPair(this, ALL_UNNAMED_MODULE))
return true;
return false;
@@ -346,8 +346,7 @@
}
/**
- * Makes the given {@code Module} readable to this module without
- * notifying the VM.
+ * Updates this module to read another module without notifying the VM.
*
* @apiNote This method is for VM white-box testing.
*/
@@ -361,40 +360,28 @@
* If {@code syncVM} is {@code true} then the VM is notified.
*/
private void implAddReads(Module other, boolean syncVM) {
+ Objects.requireNonNull(other);
// nothing to do
if (other == this || !this.isNamed())
return;
- // if the other is null then change this module to be loose.
- if (other == null) {
- if (syncVM)
- addReads0(this, null);
- this.loose = true;
- return;
- }
-
// check if we already read this module
Set reads = this.reads;
if (reads != null && reads.contains(other))
return;
// update VM first, just in case it fails
- if (syncVM)
- addReads0(this, other);
+ if (syncVM) {
+ if (other == ALL_UNNAMED_MODULE) {
+ addReads0(this, null);
+ } else {
+ addReads0(this, other);
+ }
+ }
// add reflective read
- WeakSet tr = this.transientReads;
- if (tr == null) {
- synchronized (this) {
- tr = this.transientReads;
- if (tr == null) {
- tr = new WeakSet<>();
- this.transientReads = tr;
- }
- }
- }
- tr.add(other);
+ transientReads.putIfAbsent(this, other, Boolean.TRUE);
}
@@ -404,15 +391,10 @@
// (will be final when the modules are defined in reverse topology order)
private volatile Map> exports;
- // created lazily, additional exports added at run-time
- private volatile Map> transientExports;
-
- // the special Module to mean exported to all modules
- private static final Module EVERYONE_MODULE = new Module(null);
- private static final Set EVERYONE = Collections.singleton(EVERYONE_MODULE);
-
- // the special Module to mean exported to all unnamed modules
- private static final Module ALL_UNNAMED_MODULE = new Module(null);
+ // additional exports added at run-time
+ // this module (1st key), other module (2nd key), exported packages (value)
+ private static final WeakPairMap>
+ transientExports = new WeakPairMap<>();
/**
@@ -489,23 +471,9 @@
if (exports != null) {
Set targets = exports.get(pn);
- if (targets != null) {
-
- // exported to all modules
- if (targets.contains(EVERYONE_MODULE))
- return true;
-
- if (other != EVERYONE_MODULE) {
- // exported to other
- if (targets.contains(other))
- return true;
-
- // other is an unnamed module && exported to all unnamed
- if (!other.isNamed() && targets.contains(ALL_UNNAMED_MODULE))
- return true;
- }
-
- }
+ if ((targets != null)
+ && (targets.contains(other) || targets.contains(EVERYONE_MODULE)))
+ return true;
}
return false;
}
@@ -515,29 +483,27 @@
* package package to the given module.
*/
private boolean isExportedReflectively(String pn, Module other) {
- Map> te = this.transientExports;
- if (te != null) {
- WeakSet targets = te.get(pn);
+ // exported to all modules
+ Map exports = transientExports.get(this, EVERYONE_MODULE);
+ if (exports != null && exports.containsKey(pn))
+ return true;
- if (targets != null) {
-
- // exported to all modules
- if (targets.contains(EVERYONE_MODULE))
- return true;
+ if (other != EVERYONE_MODULE) {
- if (other != EVERYONE_MODULE) {
+ // exported to other
+ exports = transientExports.get(this, other);
+ if (exports != null && exports.containsKey(pn))
+ return true;
- // exported to other
- if (targets.contains(other))
- return true;
-
- // other is an unnamed module && exported to all unnamed
- if (!other.isNamed() && targets.contains(ALL_UNNAMED_MODULE))
- return true;
- }
+ // other is an unnamed module && exported to all unnamed
+ if (!other.isNamed()) {
+ exports = transientExports.get(this, ALL_UNNAMED_MODULE);
+ if (exports != null && exports.containsKey(pn))
+ return true;
}
}
+
return false;
}
@@ -638,34 +604,19 @@
}
}
- // create transientExports if needed
- Map> te = this.transientExports; // read
- if (te == null) {
- synchronized (this) {
- te = this.transientExports;
- if (te == null) {
- te = new ConcurrentHashMap<>();
- this.transientExports = te; // volatile write
- }
- }
- }
-
// add package name to transientExports if absent
- WeakSet s = te.get(pn);
- if (s == null) {
- s = new WeakSet<>();
- WeakSet prev = te.putIfAbsent(pn, s);
- if (prev != null)
- s = prev;
- }
- s.add(other);
+ transientExports
+ .computeIfAbsent(this, other,
+ (_this, _other) -> new ConcurrentHashMap<>())
+ .putIfAbsent(pn, Boolean.TRUE);
}
// -- services --
- // created lazily, additional service types that this module uses
- private volatile WeakSet> transientUses;
+ // additional service type (2nd key) that some module (1st key) uses
+ private static final WeakPairMap, Boolean> transientUses
+ = new WeakPairMap<>();
/**
* If the caller's module is this module then update this module to add a
@@ -702,17 +653,7 @@
}
if (!canUse(st)) {
- WeakSet> uses = this.transientUses;
- if (uses == null) {
- synchronized (this) {
- uses = this.transientUses;
- if (uses == null) {
- uses = new WeakSet<>();
- this.transientUses = uses;
- }
- }
- }
- uses.add(st);
+ transientUses.putIfAbsent(this, st, Boolean.TRUE);
}
}
@@ -746,11 +687,7 @@
return true;
// uses added via addUses
- WeakSet> uses = this.transientUses;
- if (uses != null && uses.contains(st))
- return true;
-
- return false;
+ return transientUses.containsKeyPair(this, st);
}
@@ -885,7 +822,7 @@
// -- creating Module objects --
/**
- * Find the runtime Module corresponding to the given ReadDependence
+ * Find the runtime Module corresponding to the given ResolvedModule
* in the given parent Layer (or its parents).
*/
private static Module find(ResolvedModule resolvedModule, Layer layer) {
@@ -969,7 +906,7 @@
// automatic modules reads all unnamed modules
if (descriptor.isAutomatic()) {
- m.implAddReads(null, true);
+ m.implAddReads(ALL_UNNAMED_MODULE, true);
}
// exports
@@ -1097,7 +1034,7 @@
* the representation is the string {@code "module"}, followed by a space,
* and then the module name. For an unnamed module, the representation is
* the string {@code "unnamed module"}, followed by a space, and then an
- * implementation specific identifier for the unnamed module.
+ * implementation specific string that identifies the unnamed module.
*
* @return The string representation of this module
*/
@@ -1112,46 +1049,6 @@
}
- // -- supporting classes --
-
-
- /**
- * A "not-a-Set" set of weakly referenced objects that supports concurrent
- * access.
- */
- private static class WeakSet {
- private final ReadWriteLock lock = new ReentrantReadWriteLock();
- private final Lock readLock = lock.readLock();
- private final Lock writeLock = lock.writeLock();
-
- private final WeakHashMap map = new WeakHashMap<>();
-
- /**
- * Adds the specified element to the set.
- */
- void add(E e) {
- writeLock.lock();
- try {
- map.put(e, Boolean.TRUE);
- } finally {
- writeLock.unlock();
- }
- }
-
- /**
- * Returns {@code true} if this set contains the specified element.
- */
- boolean contains(E e) {
- readLock.lock();
- try {
- return map.containsKey(e);
- } finally {
- readLock.unlock();
- }
- }
- }
-
-
// -- native methods --
// JVM_DefineModule
@@ -1196,8 +1093,12 @@
m1.implAddReads(m2, true);
}
@Override
+ public void addReadsAllUnnamed(Module m) {
+ m.implAddReads(Module.ALL_UNNAMED_MODULE);
+ }
+ @Override
public void addExports(Module m, String pn, Module other) {
- m.implAddExports(pn, Objects.requireNonNull(other), true);
+ m.implAddExports(pn, other, true);
}
@Override
public void addExportsToAll(Module m, String pn) {
@@ -1211,6 +1112,10 @@
public void addPackage(Module m, String pn) {
m.implAddPackage(pn, true);
}
+ @Override
+ public ServicesCatalog getServicesCatalog(Layer layer) {
+ return layer.getServicesCatalog();
+ }
});
}
}
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java Tue May 03 09:48:02 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java Tue May 03 12:25:20 2016 -0700
@@ -582,7 +582,7 @@
}
private static final String DEBUG =
- GetPropertyAction.getProperty("jdk.proxy.debug", "");
+ GetPropertyAction.privilegedGetProperty("jdk.proxy.debug", "");
private static boolean isDebug() {
return !DEBUG.isEmpty();
diff -r 8ff4232c93c2 -r 74cd426ebb3d jdk/src/java.base/share/classes/java/lang/reflect/WeakPairMap.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/WeakPairMap.java Tue May 03 12:25:20 2016 -0700
@@ -0,0 +1,354 @@
+/*
+ * Copyright (c) 2016, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.lang.reflect;
+
+import java.lang.ref.Reference;
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
+import java.util.Collection;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.BiFunction;
+
+/**
+ * A WeakHashMap-like data structure that uses a pair of weakly-referenced keys
+ * with identity equality semantics to associate a strongly-referenced value.
+ * Unlike WeakHashMap, this data structure is thread-safe.
+ *
+ * @param the type of 1st key in key pair
+ * @param the type of 2nd key in key pair
+ * @param the type of value
+ * @author Peter Levart
+ */
+final class WeakPairMap {
+
+ private final ConcurrentHashMap, V> map = new ConcurrentHashMap<>();
+ private final ReferenceQueue