Merge
authorduke
Wed, 05 Jul 2017 20:18:12 +0200
changeset 28782 c947edc94732
parent 28781 70a5f7d7a66a (current diff)
parent 28780 2146473d5a01 (diff)
child 28790 981892a5cc55
Merge
hotspot/make/linux/makefiles/build_vm_def.sh
jdk/src/java.management/share/classes/java/lang/management/PlatformComponent.java
jdk/src/java.management/share/classes/sun/management/ExtendedPlatformComponent.java
jdk/src/java.security.acl/share/classes/java/security/acl/Acl.java
jdk/src/java.security.acl/share/classes/java/security/acl/AclEntry.java
jdk/src/java.security.acl/share/classes/java/security/acl/AclNotFoundException.java
jdk/src/java.security.acl/share/classes/java/security/acl/Group.java
jdk/src/java.security.acl/share/classes/java/security/acl/LastOwnerException.java
jdk/src/java.security.acl/share/classes/java/security/acl/NotOwnerException.java
jdk/src/java.security.acl/share/classes/java/security/acl/Owner.java
jdk/src/java.security.acl/share/classes/java/security/acl/Permission.java
jdk/src/java.security.acl/share/classes/java/security/acl/package-info.java
jdk/src/java.security.acl/share/classes/sun/security/acl/AclEntryImpl.java
jdk/src/java.security.acl/share/classes/sun/security/acl/AclImpl.java
jdk/src/java.security.acl/share/classes/sun/security/acl/AllPermissionsImpl.java
jdk/src/java.security.acl/share/classes/sun/security/acl/GroupImpl.java
jdk/src/java.security.acl/share/classes/sun/security/acl/OwnerImpl.java
jdk/src/java.security.acl/share/classes/sun/security/acl/PermissionImpl.java
jdk/src/java.security.acl/share/classes/sun/security/acl/PrincipalImpl.java
jdk/src/java.security.acl/share/classes/sun/security/acl/WorldGroupImpl.java
--- a/.hgtags-top-repo	Thu Feb 05 11:43:29 2015 -0800
+++ b/.hgtags-top-repo	Wed Jul 05 20:18:12 2017 +0200
@@ -291,3 +291,4 @@
 12f1e276447bcc81516e85367d53e4f08897049d jdk9-b46
 b6cca3e6175a69f39e5799b7349ddb0176630291 jdk9-b47
 0064e246d83f6f9fc245c19b6d05041ecaf4b6d4 jdk9-b48
+d91ed1951b948210590ce1394bea5515357246ba jdk9-b49
--- a/common/bin/unshuffle_list.txt	Thu Feb 05 11:43:29 2015 -0800
+++ b/common/bin/unshuffle_list.txt	Wed Jul 05 20:18:12 2017 +0200
@@ -123,6 +123,7 @@
 jdk/src/java.base/share/classes/java/math : jdk/src/share/classes/java/math
 jdk/src/java.base/share/classes/java/net : jdk/src/share/classes/java/net
 jdk/src/java.base/share/classes/java/nio : jdk/src/share/classes/java/nio
+jdk/src/java.base/share/classes/java/security/acl : jdk/src/share/classes/java/security/acl
 jdk/src/java.base/share/classes/java/security/cert : jdk/src/share/classes/java/security/cert
 jdk/src/java.base/share/classes/java/security/interfaces : jdk/src/share/classes/java/security/interfaces
 jdk/src/java.base/share/classes/java/security : jdk/src/share/classes/java/security
@@ -179,6 +180,7 @@
 jdk/src/java.base/share/classes/sun/nio/cs : jdk/src/share/classes/sun/nio/cs
 jdk/src/java.base/share/classes/sun/nio/fs : jdk/src/share/classes/sun/nio/fs
 jdk/src/java.base/share/classes/sun/reflect : jdk/src/share/classes/sun/reflect
+jdk/src/java.base/share/classes/sun/security/acl : jdk/src/share/classes/sun/security/acl
 jdk/src/java.base/share/classes/sun/security/action : jdk/src/share/classes/sun/security/action
 jdk/src/java.base/share/classes/sun/security/internal : jdk/src/share/classes/sun/security/internal
 jdk/src/java.base/share/classes/sun/security/jca : jdk/src/share/classes/sun/security/jca
@@ -1211,8 +1213,6 @@
 jdk/src/java.rmi/unix/bin/java-rmi.cgi.sh : jdk/src/solaris/bin/java-rmi.cgi.sh
 jdk/src/java.scripting/share/classes/javax/script : jdk/src/share/classes/javax/script
 jdk/src/java.scripting/share/classes/com/sun/tools/script/shell : jdk/src/share/classes/com/sun/tools/script/shell
-jdk/src/java.security.acl/share/classes/java/security/acl : jdk/src/share/classes/java/security/acl
-jdk/src/java.security.acl/share/classes/sun/security/acl : jdk/src/share/classes/sun/security/acl
 jdk/src/java.security.jgss/macosx/native/libosxkrb5/nativeccache.c : jdk/src/share/native/sun/security/krb5/nativeccache.c
 jdk/src/java.security.jgss/macosx/native/libosxkrb5/SCDynamicStoreConfig.m : jdk/src/macosx/native/sun/security/krb5/SCDynamicStoreConfig.m
 jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos : jdk/src/share/classes/javax/security/auth/kerberos
--- a/hotspot/.hgtags	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/.hgtags	Wed Jul 05 20:18:12 2017 +0200
@@ -451,3 +451,4 @@
 a184ee1d717297bd35b7c3e35393e137921a3ed2 jdk9-b46
 3b241fb72b8925b75941d612db762a6d5da66d02 jdk9-b47
 cc775a4a24c7f5d9e624b4205e9fbd48a17331f6 jdk9-b48
+360cd1fc42f10941a9fd17cc32d5b85a22d12a0b jdk9-b49
--- a/hotspot/make/aix/makefiles/mapfile-vers-debug	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/make/aix/makefiles/mapfile-vers-debug	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2015, 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
@@ -132,6 +132,7 @@
                 JVM_GetMethodIxSignatureUTF;
                 JVM_GetMethodParameters;
                 JVM_GetMethodTypeAnnotations;
+                JVM_GetNanoTimeAdjustment;
                 JVM_GetPrimitiveArrayElement;
                 JVM_GetProtectionDomain;
                 JVM_GetStackAccessControlContext;
--- a/hotspot/make/aix/makefiles/mapfile-vers-product	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/make/aix/makefiles/mapfile-vers-product	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2015, 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
@@ -130,6 +130,7 @@
                 JVM_GetMethodIxNameUTF;
                 JVM_GetMethodIxSignatureUTF;
                 JVM_GetMethodParameters;
+                JVM_GetNanoTimeAdjustment;
                 JVM_GetPrimitiveArrayElement;
                 JVM_GetProtectionDomain;
                 JVM_GetStackAccessControlContext;
--- a/hotspot/make/bsd/makefiles/mapfile-vers-darwin-debug	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/make/bsd/makefiles/mapfile-vers-darwin-debug	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2015, 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
@@ -130,6 +130,7 @@
                 _JVM_GetMethodIxSignatureUTF
                 _JVM_GetMethodParameters
                 _JVM_GetMethodTypeAnnotations
+                _JVM_GetNanoTimeAdjustment
                 _JVM_GetPrimitiveArrayElement
                 _JVM_GetProtectionDomain
                 _JVM_GetStackAccessControlContext
--- a/hotspot/make/bsd/makefiles/mapfile-vers-darwin-product	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/make/bsd/makefiles/mapfile-vers-darwin-product	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2015, 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
@@ -130,6 +130,7 @@
                 _JVM_GetMethodIxSignatureUTF
                 _JVM_GetMethodParameters
                 _JVM_GetMethodTypeAnnotations
+                _JVM_GetNanoTimeAdjustment
                 _JVM_GetPrimitiveArrayElement
                 _JVM_GetProtectionDomain
                 _JVM_GetStackAccessControlContext
--- a/hotspot/make/bsd/makefiles/mapfile-vers-debug	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/make/bsd/makefiles/mapfile-vers-debug	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2015, 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
@@ -132,6 +132,7 @@
                 JVM_GetMethodIxSignatureUTF;
                 JVM_GetMethodParameters;
                 JVM_GetMethodTypeAnnotations;
+                JVM_GetNanoTimeAdjustment;
                 JVM_GetPrimitiveArrayElement;
                 JVM_GetProtectionDomain;
                 JVM_GetStackAccessControlContext;
--- a/hotspot/make/bsd/makefiles/mapfile-vers-product	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/make/bsd/makefiles/mapfile-vers-product	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2015, 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
@@ -132,6 +132,7 @@
                 JVM_GetMethodIxSignatureUTF;
                 JVM_GetMethodParameters;
                 JVM_GetMethodTypeAnnotations;
+                JVM_GetNanoTimeAdjustment;
                 JVM_GetPrimitiveArrayElement;
                 JVM_GetProtectionDomain;
                 JVM_GetStackAccessControlContext;
--- a/hotspot/make/linux/makefiles/build_vm_def.sh	Thu Feb 05 11:43:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-# If we're cross compiling use that path for nm
-if [ "$CROSS_COMPILE_ARCH" != "" ]; then 
-NM=$ALT_COMPILER_PATH/nm
-else
-NM=nm
-fi
-
-$NM --defined-only $* \
-    | awk '{
-              if ($3 ~ /^_ZTV/ || $3 ~ /^gHotSpotVM/) print "\t" $3 ";"
-              if ($3 ~ /^UseSharedSpaces$/) print "\t" $3 ";"
-              if ($3 ~ /^_ZN9Arguments17SharedArchivePathE$/) print "\t" $3 ";"
-          }' \
-    | sort -u
--- a/hotspot/make/linux/makefiles/mapfile-vers-debug	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/make/linux/makefiles/mapfile-vers-debug	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2015, 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
@@ -132,6 +132,7 @@
                 JVM_GetMethodIxSignatureUTF;
                 JVM_GetMethodParameters;
                 JVM_GetMethodTypeAnnotations;
+                JVM_GetNanoTimeAdjustment;
                 JVM_GetPrimitiveArrayElement;
                 JVM_GetProtectionDomain;
                 JVM_GetStackAccessControlContext;
--- a/hotspot/make/linux/makefiles/mapfile-vers-product	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/make/linux/makefiles/mapfile-vers-product	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2015, 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
@@ -132,6 +132,7 @@
                 JVM_GetMethodIxSignatureUTF;
                 JVM_GetMethodParameters;
                 JVM_GetMethodTypeAnnotations;
+                JVM_GetNanoTimeAdjustment;
                 JVM_GetPrimitiveArrayElement;
                 JVM_GetProtectionDomain;
                 JVM_GetStackAccessControlContext;
--- a/hotspot/make/linux/makefiles/vm.make	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/make/linux/makefiles/vm.make	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2015, 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
@@ -239,8 +239,14 @@
 	rm -f $@
 	cat $^ > $@
 
+VMDEF_PAT  = ^_ZTV
+VMDEF_PAT := ^gHotSpotVM|$(VMDEF_PAT)
+VMDEF_PAT := ^UseSharedSpaces$$|$(VMDEF_PAT)
+VMDEF_PAT := ^_ZN9Arguments17SharedArchivePathE$$|$(VMDEF_PAT)
+
 vm.def: $(Res_Files) $(Obj_Files)
-	sh $(GAMMADIR)/make/linux/makefiles/build_vm_def.sh *.o > $@
+	$(QUIETLY) $(NM) --defined-only $(Obj_Files) | sort -k3 -u | \
+	awk '$$3 ~ /$(VMDEF_PAT)/ { print "\t" $$3 ";" }' > $@
 
 mapfile_ext:
 	rm -f $@
--- a/hotspot/make/solaris/makefiles/mapfile-vers	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/make/solaris/makefiles/mapfile-vers	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2015, 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
@@ -132,6 +132,7 @@
                 JVM_GetMethodIxSignatureUTF;
                 JVM_GetMethodParameters;
                 JVM_GetMethodTypeAnnotations;
+                JVM_GetNanoTimeAdjustment;
                 JVM_GetPrimitiveArrayElement;
                 JVM_GetProtectionDomain;
                 JVM_GetStackAccessControlContext;
--- a/hotspot/src/cpu/sparc/vm/sparc.ad	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/cpu/sparc/vm/sparc.ad	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 1998, 2015, 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
@@ -2996,7 +2996,7 @@
   %}
 
 enc_class enc_String_Equals(o0RegP str1, o1RegP str2, g3RegI cnt, notemp_iRegI result) %{
-    Label Lword_loop, Lpost_word, Lchar, Lchar_loop, Ldone;
+    Label Lchar, Lchar_loop, Ldone;
     MacroAssembler _masm(&cbuf);
 
     Register   str1_reg = reg_to_register_object($str1$$reg);
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -6194,7 +6194,7 @@
   ShortBranchVerifier sbv(this);
   assert(UseSSE42Intrinsics, "SSE4.2 is required");
 
-  // This method uses pcmpestri inxtruction with bound registers
+  // This method uses pcmpestri instruction with bound registers
   //   inputs:
   //     xmm - substring
   //     rax - substring length (elements count)
@@ -6355,7 +6355,7 @@
   //
   assert(int_cnt2 == -1 || (0 < int_cnt2 && int_cnt2 < 8), "should be != 0");
 
-  // This method uses pcmpestri inxtruction with bound registers
+  // This method uses pcmpestri instruction with bound registers
   //   inputs:
   //     xmm - substring
   //     rax - substring length (elements count)
@@ -6644,7 +6644,6 @@
     // start from first character again because it has aligned address.
     int stride2 = 16;
     int adr_stride  = stride  << scale;
-    int adr_stride2 = stride2 << scale;
 
     assert(result == rax && cnt2 == rdx && cnt1 == rcx, "pcmpestri");
     // rax and rdx are used by pcmpestri as elements counters
@@ -6743,7 +6742,7 @@
     //   inputs:
     //     vec1- substring
     //     rax - negative string length (elements count)
-    //     mem - scaned string
+    //     mem - scanned string
     //     rdx - string length (elements count)
     //     pcmpmask - cmp mode: 11000 (string compare with negated result)
     //               + 00 (unsigned bytes) or  + 01 (unsigned shorts)
--- a/hotspot/src/os/aix/vm/os_aix.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/os/aix/vm/os_aix.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -1115,6 +1115,15 @@
   return jlong(time.tv_sec) * 1000 + jlong(time.tv_usec / 1000);
 }
 
+void os::javaTimeSystemUTC(jlong &seconds, jlong &nanos) {
+  timeval time;
+  int status = gettimeofday(&time, NULL);
+  assert(status != -1, "aix error at gettimeofday()");
+  seconds = jlong(time.tv_sec);
+  nanos = jlong(time.tv_usec) * 1000;
+}
+
+
 // We need to manually declare mread_real_time,
 // because IBM didn't provide a prototype in time.h.
 // (they probably only ever tested in C, not C++)
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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
@@ -984,6 +984,14 @@
   return jlong(time.tv_sec) * 1000  +  jlong(time.tv_usec / 1000);
 }
 
+void os::javaTimeSystemUTC(jlong &seconds, jlong &nanos) {
+  timeval time;
+  int status = gettimeofday(&time, NULL);
+  assert(status != -1, "bsd error");
+  seconds = jlong(time.tv_sec);
+  nanos = jlong(time.tv_usec) * 1000;
+}
+
 #ifndef __APPLE__
   #ifndef CLOCK_MONOTONIC
     #define CLOCK_MONOTONIC (1)
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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
@@ -1322,6 +1322,15 @@
   return jlong(time.tv_sec) * 1000  +  jlong(time.tv_usec / 1000);
 }
 
+void os::javaTimeSystemUTC(jlong &seconds, jlong &nanos) {
+  timeval time;
+  int status = gettimeofday(&time, NULL);
+  assert(status != -1, "linux error");
+  seconds = jlong(time.tv_sec);
+  nanos = jlong(time.tv_usec) * 1000;
+}
+
+
 #ifndef CLOCK_MONOTONIC
   #define CLOCK_MONOTONIC (1)
 #endif
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -1475,6 +1475,16 @@
   return jlong(t.tv_sec) * 1000  +  jlong(t.tv_usec) / 1000;
 }
 
+void os::javaTimeSystemUTC(jlong &seconds, jlong &nanos) {
+  timeval t;
+  if (gettimeofday(&t, NULL) == -1) {
+    fatal(err_msg("os::javaTimeSystemUTC: gettimeofday (%s)", strerror(errno)));
+  }
+  seconds = jlong(t.tv_sec);
+  nanos = jlong(t.tv_usec) * 1000;
+}
+
+
 jlong os::javaTimeNanos() {
   return (jlong)getTimeNanos();
 }
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -839,6 +839,12 @@
   return (a - offset()) / 10000;
 }
 
+// Returns time ticks in (10th of micro seconds)
+jlong windows_to_time_ticks(FILETIME wt) {
+  jlong a = jlong_from(wt.dwHighDateTime, wt.dwLowDateTime);
+  return (a - offset());
+}
+
 FILETIME java_to_windows_time(jlong l) {
   jlong a = (l * 10000) + offset();
   FILETIME result;
@@ -874,6 +880,15 @@
   }
 }
 
+void os::javaTimeSystemUTC(jlong &seconds, jlong &nanos) {
+  FILETIME wt;
+  GetSystemTimeAsFileTime(&wt);
+  jlong ticks = windows_to_time_ticks(wt); // 10th of micros
+  jlong secs = jlong(ticks / 10000000); // 10000 * 1000
+  seconds = secs;
+  nanos = jlong(ticks - (secs*10000000)) * 100;
+}
+
 jlong os::javaTimeNanos() {
   if (!win32::_has_performance_count) {
     return javaTimeMillis() * NANOSECS_PER_MILLISEC; // the best we can do.
@@ -1693,7 +1708,7 @@
     }
     break;
 
-  case 6004:
+  case 10000:
     if (is_workstation) {
       st->print("10");
     } else {
--- a/hotspot/src/share/vm/classfile/verifier.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/classfile/verifier.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -1950,7 +1950,7 @@
   InstanceKlass* target_instance = InstanceKlass::cast(target_class);
   fieldDescriptor fd;
   if (is_method) {
-    Method* m = target_instance->uncached_lookup_method(field_name, field_sig, Klass::normal);
+    Method* m = target_instance->uncached_lookup_method(field_name, field_sig, Klass::find_overpass);
     if (m != NULL && m->is_protected()) {
       if (!this_class->is_same_class_package(m->method_holder())) {
         return true;
@@ -2496,7 +2496,7 @@
       Method* m = InstanceKlass::cast(ref_klass)->uncached_lookup_method(
         vmSymbols::object_initializer_name(),
         cp->signature_ref_at(bcs->get_index_u2()),
-        Klass::normal);
+        Klass::find_overpass);
       // Do nothing if method is not found.  Let resolution detect the error.
       if (m != NULL) {
         instanceKlassHandle mh(THREAD, m->method_holder());
--- a/hotspot/src/share/vm/code/codeCache.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/code/codeCache.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -199,15 +199,10 @@
   }
   guarantee(NonProfiledCodeHeapSize + ProfiledCodeHeapSize + NonNMethodCodeHeapSize <= ReservedCodeCacheSize, "Size check");
 
-  // Align reserved sizes of CodeHeaps
-  size_t non_method_size   = ReservedCodeSpace::allocation_align_size_up(NonNMethodCodeHeapSize);
-  size_t profiled_size     = ReservedCodeSpace::allocation_align_size_up(ProfiledCodeHeapSize);
-  size_t non_profiled_size = ReservedCodeSpace::allocation_align_size_up(NonProfiledCodeHeapSize);
-
-  // Compute initial sizes of CodeHeaps
-  size_t init_non_method_size   = MIN2(InitialCodeCacheSize, non_method_size);
-  size_t init_profiled_size     = MIN2(InitialCodeCacheSize, profiled_size);
-  size_t init_non_profiled_size = MIN2(InitialCodeCacheSize, non_profiled_size);
+  // Align CodeHeaps
+  size_t alignment = heap_alignment();
+  size_t non_method_size = align_size_up(NonNMethodCodeHeapSize, alignment);
+  size_t profiled_size   = align_size_down(ProfiledCodeHeapSize, alignment);
 
   // Reserve one continuous chunk of memory for CodeHeaps and split it into
   // parts for the individual heaps. The memory layout looks like this:
@@ -216,18 +211,27 @@
   //      Profiled nmethods
   //         Non-nmethods
   // ---------- low ------------
-  ReservedCodeSpace rs = reserve_heap_memory(non_profiled_size + profiled_size + non_method_size);
+  ReservedCodeSpace rs = reserve_heap_memory(ReservedCodeCacheSize);
   ReservedSpace non_method_space    = rs.first_part(non_method_size);
   ReservedSpace rest                = rs.last_part(non_method_size);
   ReservedSpace profiled_space      = rest.first_part(profiled_size);
   ReservedSpace non_profiled_space  = rest.last_part(profiled_size);
 
   // Non-nmethods (stubs, adapters, ...)
-  add_heap(non_method_space, "CodeHeap 'non-nmethods'", init_non_method_size, CodeBlobType::NonNMethod);
+  add_heap(non_method_space, "CodeHeap 'non-nmethods'", CodeBlobType::NonNMethod);
   // Tier 2 and tier 3 (profiled) methods
-  add_heap(profiled_space, "CodeHeap 'profiled nmethods'", init_profiled_size, CodeBlobType::MethodProfiled);
+  add_heap(profiled_space, "CodeHeap 'profiled nmethods'", CodeBlobType::MethodProfiled);
   // Tier 1 and tier 4 (non-profiled) methods and native methods
-  add_heap(non_profiled_space, "CodeHeap 'non-profiled nmethods'", init_non_profiled_size, CodeBlobType::MethodNonProfiled);
+  add_heap(non_profiled_space, "CodeHeap 'non-profiled nmethods'", CodeBlobType::MethodNonProfiled);
+}
+
+size_t CodeCache::heap_alignment() {
+  // If large page support is enabled, align code heaps according to large
+  // page size to make sure that code cache is covered by large pages.
+  const size_t page_size = os::can_execute_large_page_memory() ?
+             os::page_size_for_region_unaligned(ReservedCodeCacheSize, 8) :
+             os::vm_page_size();
+  return MAX2(page_size, (size_t) os::vm_allocation_granularity());
 }
 
 ReservedCodeSpace CodeCache::reserve_heap_memory(size_t size) {
@@ -284,7 +288,7 @@
   return NULL;
 }
 
-void CodeCache::add_heap(ReservedSpace rs, const char* name, size_t size_initial, int code_blob_type) {
+void CodeCache::add_heap(ReservedSpace rs, const char* name, int code_blob_type) {
   // Check if heap is needed
   if (!heap_available(code_blob_type)) {
     return;
@@ -295,8 +299,8 @@
   _heaps->append(heap);
 
   // Reserve Space
+  size_t size_initial = MIN2(InitialCodeCacheSize, rs.size());
   size_initial = round_to(size_initial, os::vm_page_size());
-
   if (!heap->reserve(rs, size_initial, CodeCacheSegmentSize)) {
     vm_exit_during_initialization("Could not reserve enough space for code cache");
   }
@@ -840,7 +844,7 @@
   } else {
     // Use a single code heap
     ReservedCodeSpace rs = reserve_heap_memory(ReservedCodeCacheSize);
-    add_heap(rs, "CodeCache", InitialCodeCacheSize, CodeBlobType::All);
+    add_heap(rs, "CodeCache", CodeBlobType::All);
   }
 
   // Initialize ICache flush mechanism
--- a/hotspot/src/share/vm/code/codeCache.hpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/code/codeCache.hpp	Wed Jul 05 20:18:12 2017 +0200
@@ -98,12 +98,13 @@
   // CodeHeap management
   static void initialize_heaps();                             // Initializes the CodeHeaps
   // Creates a new heap with the given name and size, containing CodeBlobs of the given type
-  static void add_heap(ReservedSpace rs, const char* name, size_t size_initial, int code_blob_type);
+  static void add_heap(ReservedSpace rs, const char* name, int code_blob_type);
   static CodeHeap* get_code_heap(const CodeBlob* cb);         // Returns the CodeHeap for the given CodeBlob
   static CodeHeap* get_code_heap(int code_blob_type);         // Returns the CodeHeap for the given CodeBlobType
   // Returns the name of the VM option to set the size of the corresponding CodeHeap
   static const char* get_code_heap_flag_name(int code_blob_type);
   static bool heap_available(int code_blob_type);             // Returns true if an own CodeHeap for the given CodeBlobType is available
+  static size_t heap_alignment();                             // Returns the alignment of the CodeHeaps in bytes
   static ReservedCodeSpace reserve_heap_memory(size_t size);  // Reserves one continuous chunk of memory for the CodeHeaps
 
   // Iteration
--- a/hotspot/src/share/vm/compiler/compilerOracle.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/compiler/compilerOracle.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -553,7 +553,8 @@
   int match = MethodMatcher::Exact;
   while (name[0] == '*') {
     match |= MethodMatcher::Suffix;
-    strcpy(name, name + 1);
+    // Copy remaining string plus NUL to the beginning
+    memmove(name, name + 1, strlen(name + 1) + 1);
   }
 
   if (strcmp(name, "*") == 0) return MethodMatcher::Any;
@@ -689,6 +690,13 @@
   return NULL;
 }
 
+int skip_whitespace(char* line) {
+  // Skip any leading spaces
+  int whitespace_read = 0;
+  sscanf(line, "%*[ \t]%n", &whitespace_read);
+  return whitespace_read;
+}
+
 void CompilerOracle::parse_from_line(char* line) {
   if (line[0] == '\0') return;
   if (line[0] == '#')  return;
@@ -755,15 +763,9 @@
 
     line += bytes_read;
 
-    // Skip any leading spaces before signature
-    int whitespace_read = 0;
-    sscanf(line, "%*[ \t]%n", &whitespace_read);
-    if (whitespace_read > 0) {
-      line += whitespace_read;
-    }
-
     // there might be a signature following the method.
     // signatures always begin with ( so match that by hand
+    line += skip_whitespace(line);
     if (1 == sscanf(line, "(%254[[);/" RANGEBASE "]%n", sig + 1, &bytes_read)) {
       sig[0] = '(';
       line += bytes_read;
@@ -786,7 +788,9 @@
       //
       // For future extensions: extend scan_flag_and_value()
       char option[256]; // stores flag for Type (1) and type of Type (2)
-      while (sscanf(line, "%*[ \t]%255[a-zA-Z0-9]%n", option, &bytes_read) == 1) {
+
+      line += skip_whitespace(line);
+      while (sscanf(line, "%255[a-zA-Z0-9]%n", option, &bytes_read) == 1) {
         if (match != NULL && !_quiet) {
           // Print out the last match added
           ttyLocker ttyl;
@@ -816,6 +820,7 @@
           // Type (1) option
           match = add_option_string(c_name, c_match, m_name, m_match, signature, option, true);
         }
+        line += skip_whitespace(line);
       } // while(
     } else {
       match = add_predicate(command, c_name, c_match, m_name, m_match, signature);
--- a/hotspot/src/share/vm/interpreter/linkResolver.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -289,11 +289,11 @@
 // returns first instance method
 // Looks up method in classes, then looks up local default methods
 void LinkResolver::lookup_instance_method_in_klasses(methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, TRAPS) {
-  Method* result_oop = klass->uncached_lookup_method(name, signature, Klass::normal);
+  Method* result_oop = klass->uncached_lookup_method(name, signature, Klass::find_overpass);
   result = methodHandle(THREAD, result_oop);
   while (!result.is_null() && result->is_static() && result->method_holder()->super() != NULL) {
     KlassHandle super_klass = KlassHandle(THREAD, result->method_holder()->super());
-    result = methodHandle(THREAD, super_klass->uncached_lookup_method(name, signature, Klass::normal));
+    result = methodHandle(THREAD, super_klass->uncached_lookup_method(name, signature, Klass::find_overpass));
   }
 
   if (klass->oop_is_array()) {
@@ -320,7 +320,8 @@
   // First check in default method array
   if (!resolved_method->is_abstract() &&
     (InstanceKlass::cast(klass())->default_methods() != NULL)) {
-    int index = InstanceKlass::find_method_index(InstanceKlass::cast(klass())->default_methods(), name, signature, false, false);
+    int index = InstanceKlass::find_method_index(InstanceKlass::cast(klass())->default_methods(),
+                                                 name, signature, Klass::find_overpass, Klass::find_static);
     if (index >= 0 ) {
       vtable_index = InstanceKlass::cast(klass())->default_vtable_indices()->at(index);
     }
--- a/hotspot/src/share/vm/memory/universe.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/memory/universe.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -115,6 +115,7 @@
 LatestMethodCache* Universe::_finalizer_register_cache = NULL;
 LatestMethodCache* Universe::_loader_addClass_cache    = NULL;
 LatestMethodCache* Universe::_pd_implies_cache         = NULL;
+LatestMethodCache* Universe::_throw_illegal_access_error_cache = NULL;
 oop Universe::_out_of_memory_error_java_heap          = NULL;
 oop Universe::_out_of_memory_error_metaspace          = NULL;
 oop Universe::_out_of_memory_error_class_metaspace    = NULL;
@@ -130,7 +131,6 @@
 oop Universe::_vm_exception                           = NULL;
 oop Universe::_allocation_context_notification_obj    = NULL;
 
-Method* Universe::_throw_illegal_access_error         = NULL;
 Array<int>* Universe::_the_empty_int_array            = NULL;
 Array<u2>* Universe::_the_empty_short_array           = NULL;
 Array<Klass*>* Universe::_the_empty_klass_array     = NULL;
@@ -236,6 +236,7 @@
   _finalizer_register_cache->serialize(f);
   _loader_addClass_cache->serialize(f);
   _pd_implies_cache->serialize(f);
+  _throw_illegal_access_error_cache->serialize(f);
 }
 
 void Universe::check_alignment(uintx size, uintx alignment, const char* name) {
@@ -664,6 +665,7 @@
   Universe::_finalizer_register_cache = new LatestMethodCache();
   Universe::_loader_addClass_cache    = new LatestMethodCache();
   Universe::_pd_implies_cache         = new LatestMethodCache();
+  Universe::_throw_illegal_access_error_cache = new LatestMethodCache();
 
   if (UseSharedSpaces) {
     // Read the data structures supporting the shared spaces (shared
@@ -1016,7 +1018,8 @@
     tty->print_cr("Unable to link/verify Unsafe.throwIllegalAccessError method");
     return false; // initialization failed (cannot throw exception yet)
   }
-  Universe::_throw_illegal_access_error = m;
+  Universe::_throw_illegal_access_error_cache->init(
+    SystemDictionary::misc_Unsafe_klass(), m);
 
   // Setup method for registering loaded classes in class loader vector
   InstanceKlass::cast(SystemDictionary::ClassLoader_klass())->link_class(CHECK_false);
@@ -1042,7 +1045,7 @@
       return false; // initialization failed
     }
     Universe::_pd_implies_cache->init(
-      SystemDictionary::ProtectionDomain_klass(), m);;
+      SystemDictionary::ProtectionDomain_klass(), m);
   }
 
   // This needs to be done before the first scavenge/gc, since
--- a/hotspot/src/share/vm/memory/universe.hpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/memory/universe.hpp	Wed Jul 05 20:18:12 2017 +0200
@@ -148,8 +148,7 @@
   static LatestMethodCache* _finalizer_register_cache; // static method for registering finalizable objects
   static LatestMethodCache* _loader_addClass_cache;    // method for registering loaded classes in class loader vector
   static LatestMethodCache* _pd_implies_cache;         // method for checking protection domain attributes
-
-  static Method* _throw_illegal_access_error;
+  static LatestMethodCache* _throw_illegal_access_error_cache; // Unsafe.throwIllegalAccessError() method
 
   // preallocated error objects (no backtrace)
   static oop          _out_of_memory_error_java_heap;
@@ -305,6 +304,7 @@
   static Method*      loader_addClass_method()        { return _loader_addClass_cache->get_method(); }
 
   static Method*      protection_domain_implies_method() { return _pd_implies_cache->get_method(); }
+  static Method*      throw_illegal_access_error()    { return _throw_illegal_access_error_cache->get_method(); }
 
   static oop          null_ptr_exception_instance()   { return _null_ptr_exception_instance;   }
   static oop          arithmetic_exception_instance() { return _arithmetic_exception_instance; }
@@ -314,8 +314,6 @@
   static inline oop   allocation_context_notification_obj();
   static inline void  set_allocation_context_notification_obj(oop obj);
 
-  static Method*      throw_illegal_access_error()    { return _throw_illegal_access_error; }
-
   static Array<int>*       the_empty_int_array()    { return _the_empty_int_array; }
   static Array<u2>*        the_empty_short_array()  { return _the_empty_short_array; }
   static Array<Method*>* the_empty_method_array() { return _the_empty_method_array; }
--- a/hotspot/src/share/vm/oops/arrayKlass.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/oops/arrayKlass.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -71,10 +71,13 @@
   return super()->find_field(name, sig, fd);
 }
 
-Method* ArrayKlass::uncached_lookup_method(Symbol* name, Symbol* signature, MethodLookupMode mode) const {
+Method* ArrayKlass::uncached_lookup_method(Symbol* name, Symbol* signature, OverpassLookupMode overpass_mode) const {
   // There are no methods in an array klass but the super class (Object) has some
   assert(super(), "super klass must be present");
-  return super()->uncached_lookup_method(name, signature, mode);
+  // Always ignore overpass methods in superclasses, although technically the
+  // super klass of an array, (j.l.Object) should not have
+  // any overpass methods present.
+  return super()->uncached_lookup_method(name, signature, Klass::skip_overpass);
 }
 
 ArrayKlass::ArrayKlass(Symbol* name) {
--- a/hotspot/src/share/vm/oops/arrayKlass.hpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/oops/arrayKlass.hpp	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -82,7 +82,7 @@
   Klass* find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const;
 
   // Lookup operations
-  Method* uncached_lookup_method(Symbol* name, Symbol* signature, MethodLookupMode mode) const;
+  Method* uncached_lookup_method(Symbol* name, Symbol* signature, OverpassLookupMode overpass_mode) const;
 
   // Casting from Klass*
   static ArrayKlass* cast(Klass* k) {
--- a/hotspot/src/share/vm/oops/constantPool.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/oops/constantPool.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -493,12 +493,7 @@
 }
 
 char* ConstantPool::string_at_noresolve(int which) {
-  Symbol* s = unresolved_string_at(which);
-  if (s == NULL) {
-    return (char*)"<pseudo-string>";
-  } else {
-    return unresolved_string_at(which)->as_C_string();
-  }
+  return unresolved_string_at(which)->as_C_string();
 }
 
 BasicType ConstantPool::basic_type_for_signature_at(int which) {
@@ -1828,7 +1823,7 @@
       // explicitly, because it may require scavenging.
       int obj_index = cp_to_object_index(index);
       pseudo_string_at_put(index, obj_index, patch());
-      DEBUG_ONLY(cp_patches->at_put(index, Handle());)
+     DEBUG_ONLY(cp_patches->at_put(index, Handle());)
     }
   }
 #ifdef ASSERT
--- a/hotspot/src/share/vm/oops/constantPool.hpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/oops/constantPool.hpp	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -48,17 +48,21 @@
 class CPSlot VALUE_OBJ_CLASS_SPEC {
   intptr_t _ptr;
  public:
+  enum TagBits  { _resolved_value = 0, _symbol_bit = 1, _pseudo_bit = 2, _symbol_mask = 3 };
+
   CPSlot(intptr_t ptr): _ptr(ptr) {}
   CPSlot(Klass* ptr): _ptr((intptr_t)ptr) {}
-  CPSlot(Symbol* ptr): _ptr((intptr_t)ptr | 1) {}
+  CPSlot(Symbol* ptr): _ptr((intptr_t)ptr | _symbol_bit) {}
+  CPSlot(Symbol* ptr, int tag_bits): _ptr((intptr_t)ptr | tag_bits) {}
 
   intptr_t value()   { return _ptr; }
-  bool is_resolved()   { return (_ptr & 1) == 0; }
-  bool is_unresolved() { return (_ptr & 1) == 1; }
+  bool is_resolved()      { return (_ptr & _symbol_bit ) == _resolved_value; }
+  bool is_unresolved()    { return (_ptr & _symbol_bit ) != _resolved_value; }
+  bool is_pseudo_string() { return (_ptr & _symbol_mask) == _symbol_bit + _pseudo_bit; }
 
   Symbol* get_symbol() {
     assert(is_unresolved(), "bad call");
-    return (Symbol*)(_ptr & ~1);
+    return (Symbol*)(_ptr & ~_symbol_mask);
   }
   Klass* get_klass() {
     assert(is_resolved(), "bad call");
@@ -261,7 +265,7 @@
 
   void unresolved_string_at_put(int which, Symbol* s) {
     release_tag_at_put(which, JVM_CONSTANT_String);
-    *symbol_at_addr(which) = s;
+    slot_at_put(which, CPSlot(s, CPSlot::_symbol_bit));
   }
 
   void int_at_put(int which, jint i) {
@@ -405,20 +409,18 @@
   // use pseudo-strings to link themselves to related metaobjects.
 
   bool is_pseudo_string_at(int which) {
-    // A pseudo string is a string that doesn't have a symbol in the cpSlot
-    return unresolved_string_at(which) == NULL;
+    assert(tag_at(which).is_string(), "Corrupted constant pool");
+    return slot_at(which).is_pseudo_string();
   }
 
   oop pseudo_string_at(int which, int obj_index) {
-    assert(tag_at(which).is_string(), "Corrupted constant pool");
-    assert(unresolved_string_at(which) == NULL, "shouldn't have symbol");
+    assert(is_pseudo_string_at(which), "must be a pseudo-string");
     oop s = resolved_references()->obj_at(obj_index);
     return s;
   }
 
   oop pseudo_string_at(int which) {
-    assert(tag_at(which).is_string(), "Corrupted constant pool");
-    assert(unresolved_string_at(which) == NULL, "shouldn't have symbol");
+    assert(is_pseudo_string_at(which), "must be a pseudo-string");
     int obj_index = cp_to_object_index(which);
     oop s = resolved_references()->obj_at(obj_index);
     return s;
@@ -426,7 +428,8 @@
 
   void pseudo_string_at_put(int which, int obj_index, oop x) {
     assert(tag_at(which).is_string(), "Corrupted constant pool");
-    unresolved_string_at_put(which, NULL); // indicates patched string
+    Symbol* sym = unresolved_string_at(which);
+    slot_at_put(which, CPSlot(sym, (CPSlot::_symbol_bit | CPSlot::_pseudo_bit)));
     string_at_put(which, obj_index, x);    // this works just fine
   }
 
@@ -443,15 +446,14 @@
 
   Symbol* unresolved_string_at(int which) {
     assert(tag_at(which).is_string(), "Corrupted constant pool");
-    Symbol* s = *symbol_at_addr(which);
-    return s;
+    Symbol* sym = slot_at(which).get_symbol();
+    return sym;
   }
 
   // Returns an UTF8 for a CONSTANT_String entry at a given index.
   // UTF8 char* representation was chosen to avoid conversion of
   // java_lang_Strings at resolved entries into Symbol*s
   // or vice versa.
-  // Caller is responsible for checking for pseudo-strings.
   char* string_at_noresolve(int which);
 
   jint name_and_type_at(int which) {
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -1416,18 +1416,21 @@
 
 // find_method looks up the name/signature in the local methods array
 Method* InstanceKlass::find_method(Symbol* name, Symbol* signature) const {
-  return find_method_impl(name, signature, false);
+  return find_method_impl(name, signature, find_overpass, find_static);
 }
 
-Method* InstanceKlass::find_method_impl(Symbol* name, Symbol* signature, bool skipping_overpass) const {
-  return InstanceKlass::find_method_impl(methods(), name, signature, skipping_overpass, false);
+Method* InstanceKlass::find_method_impl(Symbol* name, Symbol* signature,
+                                        OverpassLookupMode overpass_mode, StaticLookupMode static_mode) const {
+  return InstanceKlass::find_method_impl(methods(), name, signature, overpass_mode, static_mode);
 }
 
 // find_instance_method looks up the name/signature in the local methods array
 // and skips over static methods
 Method* InstanceKlass::find_instance_method(
     Array<Method*>* methods, Symbol* name, Symbol* signature) {
-  Method* meth = InstanceKlass::find_method_impl(methods, name, signature, false, true);
+  Method* meth = InstanceKlass::find_method_impl(methods, name, signature,
+                                                 find_overpass, skip_static);
+  assert(((meth == NULL) || !meth->is_static()), "find_instance_method should have skipped statics");
   return meth;
 }
 
@@ -1440,12 +1443,12 @@
 // find_method looks up the name/signature in the local methods array
 Method* InstanceKlass::find_method(
     Array<Method*>* methods, Symbol* name, Symbol* signature) {
-  return InstanceKlass::find_method_impl(methods, name, signature, false, false);
+  return InstanceKlass::find_method_impl(methods, name, signature, find_overpass, find_static);
 }
 
 Method* InstanceKlass::find_method_impl(
-    Array<Method*>* methods, Symbol* name, Symbol* signature, bool skipping_overpass, bool skipping_static) {
-  int hit = find_method_index(methods, name, signature, skipping_overpass, skipping_static);
+    Array<Method*>* methods, Symbol* name, Symbol* signature, OverpassLookupMode overpass_mode, StaticLookupMode static_mode) {
+  int hit = find_method_index(methods, name, signature, overpass_mode, static_mode);
   return hit >= 0 ? methods->at(hit): NULL;
 }
 
@@ -1463,7 +1466,9 @@
 // is important during method resolution to prefer a static method, for example,
 // over an overpass method.
 int InstanceKlass::find_method_index(
-    Array<Method*>* methods, Symbol* name, Symbol* signature, bool skipping_overpass, bool skipping_static) {
+    Array<Method*>* methods, Symbol* name, Symbol* signature, OverpassLookupMode overpass_mode, StaticLookupMode static_mode) {
+  bool skipping_overpass = (overpass_mode == skip_overpass);
+  bool skipping_static = (static_mode == skip_static);
   int hit = binary_search(methods, name);
   if (hit != -1) {
     Method* m = methods->at(hit);
@@ -1489,7 +1494,7 @@
     }
     // not found
 #ifdef ASSERT
-    int index = skipping_overpass || skipping_static ? -1 : linear_search(methods, name, signature);
+    int index = (skipping_overpass || skipping_static) ? -1 : linear_search(methods, name, signature);
     assert(index == -1, err_msg("binary search should have found entry %d", index));
 #endif
   }
@@ -1515,16 +1520,16 @@
 
 // uncached_lookup_method searches both the local class methods array and all
 // superclasses methods arrays, skipping any overpass methods in superclasses.
-Method* InstanceKlass::uncached_lookup_method(Symbol* name, Symbol* signature, MethodLookupMode mode) const {
-  MethodLookupMode lookup_mode = mode;
+Method* InstanceKlass::uncached_lookup_method(Symbol* name, Symbol* signature, OverpassLookupMode overpass_mode) const {
+  OverpassLookupMode overpass_local_mode = overpass_mode;
   Klass* klass = const_cast<InstanceKlass*>(this);
   while (klass != NULL) {
-    Method* method = InstanceKlass::cast(klass)->find_method_impl(name, signature, (lookup_mode == skip_overpass));
+    Method* method = InstanceKlass::cast(klass)->find_method_impl(name, signature, overpass_local_mode, find_static);
     if (method != NULL) {
       return method;
     }
     klass = InstanceKlass::cast(klass)->super();
-    lookup_mode = skip_overpass;   // Always ignore overpass methods in superclasses
+    overpass_local_mode = skip_overpass;   // Always ignore overpass methods in superclasses
   }
   return NULL;
 }
@@ -1554,7 +1559,7 @@
   }
   // Look up interfaces
   if (m == NULL) {
-    m = lookup_method_in_all_interfaces(name, signature, normal);
+    m = lookup_method_in_all_interfaces(name, signature, find_defaults);
   }
   return m;
 }
@@ -1564,7 +1569,7 @@
 // They should only be found in the initial InterfaceMethodRef
 Method* InstanceKlass::lookup_method_in_all_interfaces(Symbol* name,
                                                        Symbol* signature,
-                                                       MethodLookupMode mode) const {
+                                                       DefaultsLookupMode defaults_mode) const {
   Array<Klass*>* all_ifs = transitive_interfaces();
   int num_ifs = all_ifs->length();
   InstanceKlass *ik = NULL;
@@ -1572,7 +1577,7 @@
     ik = InstanceKlass::cast(all_ifs->at(i));
     Method* m = ik->lookup_method(name, signature);
     if (m != NULL && m->is_public() && !m->is_static() &&
-        ((mode != skip_defaults) || !m->is_default_method())) {
+        ((defaults_mode != skip_defaults) || !m->is_default_method())) {
       return m;
     }
   }
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -499,14 +499,15 @@
   static bool method_matches(Method* m, Symbol* signature, bool skipping_overpass, bool skipping_static);
 
   // find a local method index in default_methods (returns -1 if not found)
-  static int find_method_index(Array<Method*>* methods, Symbol* name, Symbol* signature, bool skipping_overpass, bool skipping_static);
+  static int find_method_index(Array<Method*>* methods, Symbol* name, Symbol* signature,
+                               OverpassLookupMode overpass_mode, StaticLookupMode static_mode);
 
   // lookup operation (returns NULL if not found)
-  Method* uncached_lookup_method(Symbol* name, Symbol* signature, MethodLookupMode mode) const;
+  Method* uncached_lookup_method(Symbol* name, Symbol* signature, OverpassLookupMode overpass_mode) const;
 
   // lookup a method in all the interfaces that this class implements
   // (returns NULL if not found)
-  Method* lookup_method_in_all_interfaces(Symbol* name, Symbol* signature, MethodLookupMode mode) const;
+  Method* lookup_method_in_all_interfaces(Symbol* name, Symbol* signature, DefaultsLookupMode defaults_mode) const;
 
   // lookup a method in local defaults then in all interfaces
   // (returns NULL if not found)
@@ -1058,8 +1059,10 @@
   Klass* array_klass_impl(bool or_null, TRAPS);
 
   // find a local method (returns NULL if not found)
-  Method* find_method_impl(Symbol* name, Symbol* signature, bool skipping_overpass) const;
-  static Method* find_method_impl(Array<Method*>* methods, Symbol* name, Symbol* signature, bool skipping_overpass, bool skipping_static);
+  Method* find_method_impl(Symbol* name, Symbol* signature,
+                           OverpassLookupMode overpass_mode, StaticLookupMode static_mode) const;
+  static Method* find_method_impl(Array<Method*>* methods, Symbol* name, Symbol* signature,
+                                  OverpassLookupMode overpass_mode, StaticLookupMode static_mode);
 
   // Free CHeap allocated fields.
   void release_C_heap_structures();
--- a/hotspot/src/share/vm/oops/klass.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/oops/klass.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -140,7 +140,7 @@
   return NULL;
 }
 
-Method* Klass::uncached_lookup_method(Symbol* name, Symbol* signature, MethodLookupMode mode) const {
+Method* Klass::uncached_lookup_method(Symbol* name, Symbol* signature, OverpassLookupMode overpass_mode) const {
 #ifdef ASSERT
   tty->print_cr("Error: uncached_lookup_method called on a klass oop."
                 " Likely error: reflection method does not correctly"
--- a/hotspot/src/share/vm/oops/klass.hpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/oops/klass.hpp	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -164,7 +164,9 @@
   void* operator new(size_t size, ClassLoaderData* loader_data, size_t word_size, TRAPS) throw();
 
  public:
-  enum MethodLookupMode { normal, skip_overpass, skip_defaults };
+  enum DefaultsLookupMode { find_defaults, skip_defaults };
+  enum OverpassLookupMode { find_overpass, skip_overpass };
+  enum StaticLookupMode   { find_static,   skip_static };
 
   bool is_klass() const volatile { return true; }
 
@@ -413,10 +415,10 @@
   // lookup operation for MethodLookupCache
   friend class MethodLookupCache;
   virtual Klass* find_field(Symbol* name, Symbol* signature, fieldDescriptor* fd) const;
-  virtual Method* uncached_lookup_method(Symbol* name, Symbol* signature, MethodLookupMode mode) const;
+  virtual Method* uncached_lookup_method(Symbol* name, Symbol* signature, OverpassLookupMode overpass_mode) const;
  public:
   Method* lookup_method(Symbol* name, Symbol* signature) const {
-    return uncached_lookup_method(name, signature, normal);
+    return uncached_lookup_method(name, signature, find_overpass);
   }
 
   // array class with specific rank
--- a/hotspot/src/share/vm/oops/klassVtable.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/oops/klassVtable.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -649,7 +649,7 @@
   // this check for all access permissions.
   InstanceKlass *sk = InstanceKlass::cast(super);
   if (sk->has_miranda_methods()) {
-    if (sk->lookup_method_in_all_interfaces(name, signature, Klass::normal) != NULL) {
+    if (sk->lookup_method_in_all_interfaces(name, signature, Klass::find_defaults) != NULL) {
       return false;  // found a matching miranda; we do not need a new entry
     }
   }
@@ -725,7 +725,7 @@
              && mo->method_holder() != NULL
              && mo->method_holder()->super() != NULL)
       {
-         mo = mo->method_holder()->super()->uncached_lookup_method(name, signature, Klass::normal);
+         mo = mo->method_holder()->super()->uncached_lookup_method(name, signature, Klass::find_overpass);
       }
       if (mo == NULL || mo->access_flags().is_private() ) {
         // super class hierarchy does not implement it or protection is different
@@ -770,7 +770,7 @@
       if (is_miranda(im, class_methods, default_methods, super)) { // is it a miranda at all?
         InstanceKlass *sk = InstanceKlass::cast(super);
         // check if it is a duplicate of a super's miranda
-        if (sk->lookup_method_in_all_interfaces(im->name(), im->signature(), Klass::normal) == NULL) {
+        if (sk->lookup_method_in_all_interfaces(im->name(), im->signature(), Klass::find_defaults) == NULL) {
           new_mirandas->append(im);
         }
         if (all_mirandas != NULL) {
--- a/hotspot/src/share/vm/opto/library_call.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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
@@ -1351,7 +1351,6 @@
   Node* cache            = __ ConI(cache_i);
   Node* md2              = __ ConI(md2_i);
   Node* lastChar         = __ ConI(target_array->char_at(target_length - 1));
-  Node* targetCount      = __ ConI(target_length);
   Node* targetCountLess1 = __ ConI(target_length - 1);
   Node* targetOffset     = __ ConI(targetOffset_i);
   Node* sourceEnd        = __ SubI(__ AddI(sourceOffset, sourceCount), targetCountLess1);
@@ -1408,8 +1407,6 @@
   Node* arg      = argument(1);
 
   Node* result;
-  // Disable the use of pcmpestri until it can be guaranteed that
-  // the load doesn't cross into the uncommited space.
   if (Matcher::has_match_rule(Op_StrIndexOf) &&
       UseSSE42Intrinsics) {
     // Generate SSE4.2 version of indexOf
@@ -1421,9 +1418,6 @@
       return true;
     }
 
-    ciInstanceKlass* str_klass = env()->String_klass();
-    const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(str_klass);
-
     // Make the merge point
     RegionNode* result_rgn = new RegionNode(4);
     Node*       result_phi = new PhiNode(result_rgn, TypeInt::INT);
--- a/hotspot/src/share/vm/opto/output.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/opto/output.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -2475,7 +2475,7 @@
       if( iop == Op_Con ) continue;      // Do not schedule Top
       if( iop == Op_Node &&     // Do not schedule PhiNodes, ProjNodes
           mach->pipeline() == MachNode::pipeline_class() &&
-          !n->is_SpillCopy() )  // Breakpoints, Prolog, etc
+          !n->is_SpillCopy() && !n->is_MachMerge() )  // Breakpoints, Prolog, etc
         continue;
       break;                    // Funny loop structure to be sure...
     }
--- a/hotspot/src/share/vm/opto/postaloc.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/opto/postaloc.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -428,6 +428,7 @@
         // Insert the merge node into the block before the first use.
         uint use_index = block->find_node(reg2defuse.at(reg).first_use());
         block->insert_node(merge, use_index++);
+        _cfg.map_node_to_block(merge, block);
 
         // Let the allocator know about the new node, use the same lrg
         _lrg_map.extend(merge->_idx, lrg);
--- a/hotspot/src/share/vm/prims/jvm.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -300,6 +300,48 @@
   return os::javaTimeNanos();
 JVM_END
 
+// The function below is actually exposed by sun.misc.VM and not
+// java.lang.System, but we choose to keep it here so that it stays next
+// to JVM_CurrentTimeMillis and JVM_NanoTime
+
+const jlong MAX_DIFF_SECS = 0x0100000000LL; //  2^32
+const jlong MIN_DIFF_SECS = -MAX_DIFF_SECS; // -2^32
+
+JVM_LEAF(jlong, JVM_GetNanoTimeAdjustment(JNIEnv *env, jclass ignored, jlong offset_secs))
+  JVMWrapper("JVM_GetNanoTimeAdjustment");
+  jlong seconds;
+  jlong nanos;
+
+  os::javaTimeSystemUTC(seconds, nanos);
+
+  // We're going to verify that the result can fit in a long.
+  // For that we need the difference in seconds between 'seconds'
+  // and 'offset_secs' to be such that:
+  //     |seconds - offset_secs| < (2^63/10^9)
+  // We're going to approximate 10^9 ~< 2^30 (1000^3 ~< 1024^3)
+  // which makes |seconds - offset_secs| < 2^33
+  // and we will prefer +/- 2^32 as the maximum acceptable diff
+  // as 2^32 has a more natural feel than 2^33...
+  //
+  // So if |seconds - offset_secs| >= 2^32 - we return a special
+  // sentinel value (-1) which the caller should take as an
+  // exception value indicating that the offset given to us is
+  // too far from range of the current time - leading to too big
+  // a nano adjustment. The caller is expected to recover by
+  // computing a more accurate offset and calling this method
+  // again. (For the record 2^32 secs is ~136 years, so that
+  // should rarely happen)
+  //
+  jlong diff = seconds - offset_secs;
+  if (diff >= MAX_DIFF_SECS || diff <= MIN_DIFF_SECS) {
+     return -1; // sentinel value: the offset is too far off the target
+  }
+
+  // return the adjustment. If you compute a time by adding
+  // this number of nanoseconds along with the number of seconds
+  // in the offset you should get the current UTC time.
+  return (diff * (jlong)1000000000) + nanos;
+JVM_END
 
 JVM_ENTRY(void, JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos,
                                jobject dst, jint dst_pos, jint length))
@@ -1167,7 +1209,7 @@
   Method* m_oop = object->klass()->uncached_lookup_method(
                                            vmSymbols::run_method_name(),
                                            vmSymbols::void_object_signature(),
-                                           Klass::normal);
+                                           Klass::find_overpass);
   methodHandle m (THREAD, m_oop);
   if (m.is_null() || !m->is_method() || !m()->is_public() || m()->is_static()) {
     THROW_MSG_0(vmSymbols::java_lang_InternalError(), "No run method");
--- a/hotspot/src/share/vm/prims/jvm.h	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/prims/jvm.h	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -131,6 +131,9 @@
 JNIEXPORT jlong JNICALL
 JVM_NanoTime(JNIEnv *env, jclass ignored);
 
+JNIEXPORT jlong JNICALL
+JVM_GetNanoTimeAdjustment(JNIEnv *env, jclass ignored, jlong offset_secs);
+
 JNIEXPORT void JNICALL
 JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos,
               jobject dst, jint dst_pos, jint length);
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -3376,7 +3376,9 @@
     // not yet in the vtable, because the vtable setup is in progress.
     // This must be done after we adjust the default_methods and
     // default_vtable_indices for methods already in the vtable.
+    // If redefining Unsafe, walk all the vtables looking for entries.
     if (ik->vtable_length() > 0 && (_the_class_oop->is_interface()
+        || _the_class_oop == SystemDictionary::misc_Unsafe_klass()
         || ik->is_subtype_of(_the_class_oop))) {
       // ik->vtable() creates a wrapper object; rm cleans it up
       ResourceMark rm(_thread);
@@ -3396,7 +3398,9 @@
     // interface, then we have to call adjust_method_entries() for
     // every InstanceKlass that has an itable since there isn't a
     // subclass relationship between an interface and an InstanceKlass.
+    // If redefining Unsafe, walk all the itables looking for entries.
     if (ik->itable_length() > 0 && (_the_class_oop->is_interface()
+        || _the_class_oop == SystemDictionary::misc_Unsafe_klass()
         || ik->is_subclass_of(_the_class_oop))) {
       // ik->itable() creates a wrapper object; rm cleans it up
       ResourceMark rm(_thread);
--- a/hotspot/src/share/vm/prims/methodComparator.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/prims/methodComparator.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, 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
@@ -405,6 +405,8 @@
     if (strcmp(_old_cp->string_at_noresolve(cpi_old),
                _new_cp->string_at_noresolve(cpi_new)) != 0)
       return false;
+    if (_old_cp->is_pseudo_string_at(cpi_old) || _new_cp->is_pseudo_string_at(cpi_new))
+      return (_old_cp->is_pseudo_string_at(cpi_old) == _new_cp->is_pseudo_string_at(cpi_new));
   } else if (tag_old.is_klass() || tag_old.is_unresolved_klass()) {
     // tag_old should be klass - 4881222
     if (! (tag_new.is_unresolved_klass() || tag_new.is_klass()))
--- a/hotspot/src/share/vm/prims/nativeLookup.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/prims/nativeLookup.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -393,7 +393,7 @@
 
   // Find method and invoke standard lookup
   methodHandle method (THREAD,
-                       klass->uncached_lookup_method(m_name, s_name, Klass::normal));
+                       klass->uncached_lookup_method(m_name, s_name, Klass::find_overpass));
   address result = lookup(method, in_base_library, CATCH);
   assert(in_base_library, "must be in basic library");
   guarantee(result != NULL, "must be non NULL");
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Wed Jul 05 20:18:12 2017 +0200
@@ -1127,7 +1127,7 @@
 #endif
 
 intx Arguments::scaled_compile_threshold(intx threshold, double scale) {
-  if (scale == 1.0 || scale < 0.0) {
+  if (scale == 1.0 || scale <= 0.0) {
     return threshold;
   } else {
     return (intx)(threshold * scale);
@@ -1143,7 +1143,7 @@
 
   // Check value to avoid calculating log2 of 0.
   if (scale == 0.0) {
-    return 1;
+    return freq_log;
   }
 
   intx scaled_freq = scaled_compile_threshold((intx)1 << freq_log, scale);
@@ -3479,8 +3479,10 @@
     set_mode_flags(_int);
   }
 
-  if ((TieredCompilation && CompileThresholdScaling == 0)
-      || (!TieredCompilation && scaled_compile_threshold(CompileThreshold) == 0)) {
+  // CompileThresholdScaling == 0.0 is same as -Xint: Disable compilation (enable interpreter-only mode),
+  // but like -Xint, leave compilation thresholds unaffected.
+  // With tiered compilation disabled, setting CompileThreshold to 0 disables compilation as well.
+  if ((CompileThresholdScaling == 0.0) || (!TieredCompilation && CompileThreshold == 0)) {
     set_mode_flags(_int);
   }
 
--- a/hotspot/src/share/vm/runtime/os.hpp	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/src/share/vm/runtime/os.hpp	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -173,10 +173,10 @@
   static jlong  javaTimeMillis();
   static jlong  javaTimeNanos();
   static void   javaTimeNanos_info(jvmtiTimerInfo *info_ptr);
+  static void   javaTimeSystemUTC(jlong &seconds, jlong &nanos);
   static void   run_periodic_checks();
   static bool   supports_monotonic_clock();
 
-
   // Returns the elapsed time in seconds since the vm started.
   static double elapsedTime();
 
--- a/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java	Wed Jul 05 20:18:12 2017 +0200
@@ -87,6 +87,13 @@
         {
             "-XX:-TieredCompilation",
             "-XX:+PrintFlagsFinal",
+            "-XX:CompileThreshold=1000",
+            "-XX:CompileThresholdScaling=0.0",
+            "-version"
+        },
+        {
+            "-XX:-TieredCompilation",
+            "-XX:+PrintFlagsFinal",
             "-XX:CompileThreshold=0",
             "-XX:CompileThresholdScaling=0.75",
             "-version"
@@ -108,6 +115,11 @@
             "double CompileThresholdScaling                  := 0.750000                            {product}"
         },
         {
+            "intx CompileThreshold                         := 1000                                {pd product}",
+            "double CompileThresholdScaling                  := 0.000000                            {product}",
+            "interpreted mode"
+        },
+        {
             "intx CompileThreshold                         := 0                                   {pd product}",
             "double CompileThresholdScaling                  := 0.750000                            {product}",
             "interpreted mode"
@@ -295,21 +307,21 @@
             "double CompileThresholdScaling                  := 2.000000                            {product}"
         },
         {
-            "intx Tier0BackedgeNotifyFreqLog               := 0                                   {product}",
-            "intx Tier0InvokeNotifyFreqLog                 := 0                                   {product}",
-            "intx Tier23InlineeNotifyFreqLog               := 0                                   {product}",
-            "intx Tier2BackedgeNotifyFreqLog               := 0                                   {product}",
-            "intx Tier2InvokeNotifyFreqLog                 := 0                                   {product}",
-            "intx Tier3BackEdgeThreshold                   := 0                                   {product}",
-            "intx Tier3BackedgeNotifyFreqLog               := 0                                   {product}",
-            "intx Tier3CompileThreshold                    := 0                                   {product}",
-            "intx Tier3InvocationThreshold                 := 0                                   {product}",
-            "intx Tier3InvokeNotifyFreqLog                 := 0                                   {product}",
-            "intx Tier3MinInvocationThreshold              := 0                                   {product}",
-            "intx Tier4BackEdgeThreshold                   := 0                                   {product}",
-            "intx Tier4CompileThreshold                    := 0                                   {product}",
-            "intx Tier4InvocationThreshold                 := 0                                   {product}",
-            "intx Tier4MinInvocationThreshold              := 0                                   {product}",
+            "intx Tier0BackedgeNotifyFreqLog               := 10                                  {product}",
+            "intx Tier0InvokeNotifyFreqLog                 := 7                                   {product}",
+            "intx Tier23InlineeNotifyFreqLog               := 20                                  {product}",
+            "intx Tier2BackedgeNotifyFreqLog               := 14                                  {product}",
+            "intx Tier2InvokeNotifyFreqLog                 := 11                                  {product}",
+            "intx Tier3BackEdgeThreshold                   := 60000                               {product}",
+            "intx Tier3BackedgeNotifyFreqLog               := 13                                  {product}",
+            "intx Tier3CompileThreshold                    := 2000                                {product}",
+            "intx Tier3InvocationThreshold                 := 200                                 {product}",
+            "intx Tier3InvokeNotifyFreqLog                 := 10                                  {product}",
+            "intx Tier3MinInvocationThreshold              := 100                                 {product}",
+            "intx Tier4BackEdgeThreshold                   := 40000                               {product}",
+            "intx Tier4CompileThreshold                    := 15000                               {product}",
+            "intx Tier4InvocationThreshold                 := 5000                                {product}",
+            "intx Tier4MinInvocationThreshold              := 600                                 {product}",
             "double CompileThresholdScaling                  := 0.000000                            {product}",
             "interpreted mode"
         }
--- a/hotspot/test/compiler/codecache/cli/printcodecache/PrintCodeCacheRunner.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/test/compiler/codecache/cli/printcodecache/PrintCodeCacheRunner.java	Wed Jul 05 20:18:12 2017 +0200
@@ -82,6 +82,9 @@
                 ExitCode.OK,
                 testCaseDescription.getTestOptions(options,
                         CommandLineOptionTest.prepareBooleanFlag(
-                                "PrintCodeCache", printCodeCache)));
+                                "PrintCodeCache", printCodeCache),
+                        // Do not use large pages to avoid large page
+                        // alignment of code heaps affecting their size.
+                        "-XX:-UseLargePages"));
     }
 }
--- a/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java	Wed Jul 05 20:18:12 2017 +0200
@@ -36,7 +36,7 @@
         try {
             // adjust timeout and substract vm init and exit time
             long timeout = Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT);
-            timeout *= 0.9;
+            timeout *= 0.8;
             new TimeLimitedRunner(timeout, 2.0d, this::test).call();
         } catch (Exception e) {
             throw new Error("Exception occurred during test execution", e);
--- a/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java	Wed Jul 05 20:18:12 2017 +0200
@@ -77,7 +77,7 @@
     }
 
     public OverloadCompileQueueTest() {
-        Helper.startInfiniteLoopThread(this::lockUnlock);
+        Helper.startInfiniteLoopThread(this::lockUnlock, 100L);
     }
 
     @Override
@@ -99,8 +99,9 @@
 
     private void lockUnlock() {
         try {
+            int sleep = Helper.RNG.nextInt(MAX_SLEEP);
             Helper.WHITE_BOX.lockCompilation();
-            Thread.sleep(Helper.RNG.nextInt(MAX_SLEEP));
+            Thread.sleep(sleep);
         } catch (InterruptedException e) {
             throw new Error("TESTBUG: lockUnlocker thread was unexpectedly interrupted", e);
         } finally {
--- a/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java	Wed Jul 05 20:18:12 2017 +0200
@@ -26,7 +26,6 @@
  * @bug 8042235
  * @summary redefining method used by multiple MethodHandles crashes VM
  * @compile -XDignore.symbol.file RedefineMethodUsedByMultipleMethodHandles.java
- * @ignore 7076820
  * @run main RedefineMethodUsedByMultipleMethodHandles
  */
 
--- a/hotspot/test/compiler/oracle/CheckCompileCommandOption.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/test/compiler/oracle/CheckCompileCommandOption.java	Wed Jul 05 20:18:12 2017 +0200
@@ -21,12 +21,15 @@
  * questions.
  */
 
+import java.io.PrintWriter;
+import java.io.File;
+
 import com.oracle.java.testlibrary.*;
 
 /*
  * @test CheckCompileCommandOption
- * @bug 8055286 8056964 8059847
- * @summary "Checks parsing of -XX:+CompileCommand=option"
+ * @bug 8055286 8056964 8059847 8069035
+ * @summary "Checks parsing of -XX:CompileCommand=option"
  * @library /testlibrary
  * @run main CheckCompileCommandOption
  */
@@ -45,38 +48,69 @@
     // have the the following types: intx, uintx, bool, ccstr,
     // ccstrlist, and double.
 
+    private static final String[][] FILE_ARGUMENTS = {
+        {
+            "-XX:CompileCommandFile=" + new File(System.getProperty("test.src", "."), "command1.txt"),
+            "-version"
+        },
+        {
+            "-XX:CompileCommandFile=" + new File(System.getProperty("test.src", "."), "command2.txt"),
+            "-version"
+        }
+    };
+
+    private static final String[][] FILE_EXPECTED_OUTPUT = {
+        {
+            "CompileCommand: option com/oracle/Test.test bool MyBoolOption1 = true",
+            "CompileCommand: option com/oracle/Test.test bool MyBoolOption2 = true",
+            "CompileCommand: option com/oracle/Test.test bool MyBoolOption3 = true",
+            "CompileCommand: option com/oracle/Test.test bool MyBoolOption4 = true",
+            "CompileCommand: option com/oracle/Test.test bool MyBoolOption5 = true",
+            "CompileCommand: option com/oracle/Test.test bool MyBoolOption6 = true",
+            "CompileCommand: option com/oracle/Test.test bool MyBoolOption7 = true",
+            "CompileCommand: option com/oracle/Test.test bool MyBoolOption8 = true",
+            "CompileCommand: option com/oracle/Test.test(I) bool MyBoolOption9 = true",
+            "CompileCommand: option com/oracle/Test.test(I) bool MyBoolOption10 = true",
+            "CompileCommand: option com/oracle/Test.test(I) bool MyBoolOption11 = true",
+            "CompileCommand: option com/oracle/Test.test(I) bool MyBoolOption12 = true",
+            "CompileCommand: option com/oracle/Test.test(I) bool MyBoolOption13 = true",
+            "CompileCommand: option com/oracle/Test.test(I) bool MyBoolOption14 = true",
+            "CompileCommand: option com/oracle/Test.test(I) bool MyBoolOption15 = true",
+            "CompileCommand: option com/oracle/Test.test(I) bool MyBoolOption16 = true"
+        },
+        {
+            "CompileCommand: option Test.test const char* MyListOption = '_foo _bar'",
+            "CompileCommand: option Test.test const char* MyStrOption = '_foo'",
+            "CompileCommand: option Test.test bool MyBoolOption = false",
+            "CompileCommand: option Test.test intx MyIntxOption = -1",
+            "CompileCommand: option Test.test uintx MyUintxOption = 1",
+            "CompileCommand: option Test.test bool MyFlag = true",
+            "CompileCommand: option Test.test double MyDoubleOption = 1.123000"
+        }
+    };
+
     private static final String[][] TYPE_1_ARGUMENTS = {
         {
             "-XX:CompileCommand=option,com/oracle/Test.test,MyBoolOption1",
             "-XX:CompileCommand=option,com/oracle/Test,test,MyBoolOption2",
             "-XX:CompileCommand=option,com.oracle.Test::test,MyBoolOption3",
             "-XX:CompileCommand=option,com/oracle/Test::test,MyBoolOption4",
-            "-version"
-        },
-        {
-            "-XX:CompileCommand=option,com/oracle/Test.test,MyBoolOption1,MyBoolOption2",
-            "-version"
-        },
-        {
-            "-XX:CompileCommand=option,com/oracle/Test,test,MyBoolOption1,MyBoolOption2",
+            "-XX:CompileCommand=option,com/oracle/Test.test,MyBoolOption5,MyBoolOption6",
+            "-XX:CompileCommand=option,com/oracle/Test,test,MyBoolOption7,MyBoolOption8",
             "-version"
         }
     };
 
     private static final String[][] TYPE_1_EXPECTED_OUTPUTS = {
         {
-            "CompilerOracle: option com/oracle/Test.test bool MyBoolOption1 = true",
-            "CompilerOracle: option com/oracle/Test.test bool MyBoolOption2 = true",
-            "CompilerOracle: option com/oracle/Test.test bool MyBoolOption3 = true",
-            "CompilerOracle: option com/oracle/Test.test bool MyBoolOption4 = true"
-        },
-        {
-            "CompilerOracle: option com/oracle/Test.test bool MyBoolOption1 = true",
-            "CompilerOracle: option com/oracle/Test.test bool MyBoolOption2 = true",
-        },
-        {
-            "CompilerOracle: option com/oracle/Test.test bool MyBoolOption1 = true",
-            "CompilerOracle: option com/oracle/Test.test bool MyBoolOption2 = true",
+            "CompileCommand: option com/oracle/Test.test bool MyBoolOption1 = true",
+            "CompileCommand: option com/oracle/Test.test bool MyBoolOption2 = true",
+            "CompileCommand: option com/oracle/Test.test bool MyBoolOption3 = true",
+            "CompileCommand: option com/oracle/Test.test bool MyBoolOption4 = true",
+            "CompileCommand: option com/oracle/Test.test bool MyBoolOption5 = true",
+            "CompileCommand: option com/oracle/Test.test bool MyBoolOption6 = true",
+            "CompileCommand: option com/oracle/Test.test bool MyBoolOption7 = true",
+            "CompileCommand: option com/oracle/Test.test bool MyBoolOption8 = true"
         }
     };
 
@@ -88,38 +122,28 @@
             "-XX:CompileCommand=option,Test::test,intx,MyIntxOption,-1",
             "-XX:CompileCommand=option,Test::test,uintx,MyUintxOption,1",
             "-XX:CompileCommand=option,Test::test,MyFlag",
-            "-XX:CompileCommand=option,Test::test,double,MyDoubleOption,1.123",
-            "-version"
-        },
-        {
-            "-XX:CompileCommand=option,Test.test,double,MyDoubleOption,1.123",
-            "-version"
-        },
-        {
-            "-XX:CompileCommand=option,Test::test,bool,MyBoolOption,false,intx,MyIntxOption,-1,uintx,MyUintxOption,1,MyFlag,double,MyDoubleOption,1.123",
+            "-XX:CompileCommand=option,Test::test,double,MyDoubleOption1,1.123",
+            "-XX:CompileCommand=option,Test.test,double,MyDoubleOption2,1.123",
+            "-XX:CompileCommand=option,Test::test,bool,MyBoolOptionX,false,intx,MyIntxOptionX,-1,uintx,MyUintxOptionX,1,MyFlagX,double,MyDoubleOptionX,1.123",
             "-version"
         }
     };
 
     private static final String[][] TYPE_2_EXPECTED_OUTPUTS = {
         {
-            "CompilerOracle: option Test.test const char* MyListOption = '_foo _bar'",
-            "CompilerOracle: option Test.test const char* MyStrOption = '_foo'",
-            "CompilerOracle: option Test.test bool MyBoolOption = false",
-            "CompilerOracle: option Test.test intx MyIntxOption = -1",
-            "CompilerOracle: option Test.test uintx MyUintxOption = 1",
-            "CompilerOracle: option Test.test bool MyFlag = true",
-            "CompilerOracle: option Test.test double MyDoubleOption = 1.123000"
-        },
-        {
-            "CompilerOracle: option Test.test double MyDoubleOption = 1.123000"
-        },
-        {
-            "CompilerOracle: option Test.test bool MyBoolOption = false",
-            "CompilerOracle: option Test.test intx MyIntxOption = -1",
-            "CompilerOracle: option Test.test uintx MyUintxOption = 1",
-            "CompilerOracle: option Test.test bool MyFlag = true",
-            "CompilerOracle: option Test.test double MyDoubleOption = 1.123000",
+            "CompileCommand: option Test.test const char* MyListOption = '_foo _bar'",
+            "CompileCommand: option Test.test const char* MyStrOption = '_foo'",
+            "CompileCommand: option Test.test bool MyBoolOption = false",
+            "CompileCommand: option Test.test intx MyIntxOption = -1",
+            "CompileCommand: option Test.test uintx MyUintxOption = 1",
+            "CompileCommand: option Test.test bool MyFlag = true",
+            "CompileCommand: option Test.test double MyDoubleOption1 = 1.123000",
+            "CompileCommand: option Test.test double MyDoubleOption2 = 1.123000",
+            "CompileCommand: option Test.test bool MyBoolOptionX = false",
+            "CompileCommand: option Test.test intx MyIntxOptionX = -1",
+            "CompileCommand: option Test.test uintx MyUintxOptionX = 1",
+            "CompileCommand: option Test.test bool MyFlagX = true",
+            "CompileCommand: option Test.test double MyDoubleOptionX = 1.123000",
         }
     };
 
@@ -172,7 +196,7 @@
             out.shouldContain(expected_output);
         }
 
-        out.shouldNotContain("CompileCommand: unrecognized line");
+        out.shouldNotContain("CompileCommand: An error occured during parsing");
         out.shouldHaveExitValue(0);
     }
 
@@ -183,7 +207,7 @@
         pb = ProcessTools.createJavaProcessBuilder(arguments);
         out = new OutputAnalyzer(pb.start());
 
-        out.shouldContain("CompileCommand: unrecognized line");
+        out.shouldContain("CompileCommand: An error occured during parsing");
         out.shouldHaveExitValue(0);
     }
 
@@ -212,5 +236,10 @@
         for (String[] arguments: TYPE_2_INVALID_ARGUMENTS) {
             verifyInvalidOption(arguments);
         }
+
+        // Check if commands in command file are parsed correctly
+        for (int i = 0; i < FILE_ARGUMENTS.length; i++) {
+            verifyValidOption(FILE_ARGUMENTS[i], FILE_EXPECTED_OUTPUT[i]);
+        }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/oracle/TestCompileCommand.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.PrintWriter;
+import java.io.File;
+
+import com.oracle.java.testlibrary.*;
+
+/*
+ * @test TestCompileCommand
+ * @bug 8069389
+ * @summary "Regression tests of -XX:CompileCommand"
+ * @library /testlibrary
+ * @run main TestCompileCommand
+ */
+
+public class TestCompileCommand {
+
+    private static final String[][] ARGUMENTS = {
+        {
+            "-XX:CompileCommand=print,*01234567890123456789012345678901234567890123456789,*0123456789012345678901234567890123456789",
+            "-version"
+        }
+    };
+
+    private static final String[][] OUTPUTS = {
+        {
+            "print *01234567890123456789012345678901234567890123456789.*0123456789012345678901234567890123456789"
+        }
+    };
+
+    private static void verifyValidOption(String[] arguments, String[] expected_outputs) throws Exception {
+        ProcessBuilder pb;
+        OutputAnalyzer out;
+
+        pb = ProcessTools.createJavaProcessBuilder(arguments);
+        out = new OutputAnalyzer(pb.start());
+
+        for (String expected_output : expected_outputs) {
+            out.shouldContain(expected_output);
+        }
+
+        out.shouldNotContain("CompileCommand: An error occured during parsing");
+        out.shouldHaveExitValue(0);
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        if (ARGUMENTS.length != OUTPUTS.length) {
+            throw new RuntimeException("Test is set up incorrectly: length of arguments and expected outputs for type (1) options does not match.");
+        }
+
+        // Check if type (1) options are parsed correctly
+        for (int i = 0; i < ARGUMENTS.length; i++) {
+            verifyValidOption(ARGUMENTS[i], OUTPUTS[i]);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/oracle/command1.txt	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,12 @@
+option,com/oracle/Test.test,MyBoolOption1
+option,com/oracle/Test,test,MyBoolOption2
+option,com.oracle.Test::test,MyBoolOption3
+option,com/oracle/Test::test,MyBoolOption4
+option,com/oracle/Test.test,MyBoolOption5,MyBoolOption6
+option,com/oracle/Test,test,MyBoolOption7,MyBoolOption8
+option,com/oracle/Test.test(I),MyBoolOption9
+option,com/oracle/Test,test,(I),MyBoolOption10
+option,com.oracle.Test::test(I),MyBoolOption11
+option,com/oracle/Test::test(I),MyBoolOption12
+option,com/oracle/Test.test(I),MyBoolOption13,MyBoolOption14
+option,com/oracle/Test,test(I),MyBoolOption15,MyBoolOption16
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/oracle/command2.txt	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,7 @@
+option,Test::test,ccstrlist,MyListOption,_foo,_bar
+option,Test::test,ccstr,MyStrOption,_foo
+option,Test::test,bool,MyBoolOption,false
+option,Test::test,intx,MyIntxOption,-1
+option,Test::test,uintx,MyUintxOption,1
+option,Test::test,MyFlag
+option,Test::test,double,MyDoubleOption,1.123
--- a/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java	Wed Jul 05 20:18:12 2017 +0200
@@ -28,7 +28,6 @@
  * @bug 8038636
  * @library /testlibrary
  * @build Agent
- * @ignore 7076820
  * @run main ClassFileInstaller Agent
  * @run main Launcher
  * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 -XX:ReservedCodeCacheSize=3M Agent
--- a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java	Wed Jul 05 20:18:12 2017 +0200
@@ -28,7 +28,6 @@
  * @bug 8040237
  * @library /testlibrary
  * @build Agent Test A B
- * @ignore 7076820
  * @run main ClassFileInstaller Agent
  * @run main Launcher
  * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 -XX:ReservedCodeCacheSize=3M Agent
--- a/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, 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
@@ -119,13 +119,13 @@
             return new String[] { getMethodWithLockName() };
         }
 
-        public void lock(booleab forceAbort) {
+        public void lock(boolean forceAbort) {
             synchronized(monitor) {
                 if (forceAbort) {
                     // We're calling native method in order to force
                     // abort. It's done by explicit xabort call emitted
                     // in SharedRuntime::generate_native_wrapper.
-                    // If an actuall JNI call will be replaced by
+                    // If an actual JNI call will be replaced by
                     // intrinsic - we'll be in trouble, since xabort
                     // will be no longer called and test may fail.
                     UNSAFE.addressSize();
--- a/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java	Wed Jul 05 20:18:12 2017 +0200
@@ -34,7 +34,6 @@
 /*
  * @test
  * @bug 8059624 8064669
- * @ignore 8066998
  * @library /testlibrary /../../test/lib
  * @build ForceNMethodSweepTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
@@ -42,7 +41,7 @@
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:-TieredCompilation -XX:+WhiteBoxAPI
  *                   -XX:CompileCommand=compileonly,SimpleTestCase$Helper::*
- *                   ForceNMethodSweepTest
+ *                   -XX:-BackgroundCompilation ForceNMethodSweepTest
  * @summary testing of WB::forceNMethodSweep
  */
 public class ForceNMethodSweepTest extends CompilerWhiteBoxTest {
--- a/hotspot/test/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/hotspot/test/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java	Wed Jul 05 20:18:12 2017 +0200
@@ -41,6 +41,10 @@
             // Compressed Class Space is only available on 64-bit JVMs
             return;
         }
+        if (!Platform.shouldSAAttach()) {
+            System.out.println("SA attach not expected to work - test skipped.");
+            return;
+        }
 
         String pid = Integer.toString(ProcessTools.getProcessId());
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Unsafe/AllocateInstance.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verifies the behaviour of Unsafe.allocateInstance
+ * @library /testlibrary
+ * @run main AllocateInstance
+ */
+
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class AllocateInstance {
+    public static void main(String args[]) throws Exception {
+        Unsafe unsafe = Utils.getUnsafe();
+
+        // allocateInstance() should not result in a call to the constructor
+        TestClass tc = (TestClass)unsafe.allocateInstance(TestClass.class);
+        assertFalse(tc.calledConstructor);
+
+        // allocateInstance() on an abstract class should result in an InstantiationException
+        try {
+            AbstractClass ac = (AbstractClass)unsafe.allocateInstance(AbstractClass.class);
+            throw new RuntimeException("Did not get expected InstantiationException");
+        } catch (InstantiationException e) {
+            // Expected
+        }
+    }
+
+    class TestClass {
+        public boolean calledConstructor = false;
+
+        public TestClass() {
+            calledConstructor = true;
+        }
+    }
+
+    abstract class AbstractClass {
+        public AbstractClass() {}
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Unsafe/AllocateMemory.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verifies behaviour of Unsafe.allocateMemory
+ * @library /testlibrary
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:MallocMaxTestWords=20m AllocateMemory
+ */
+
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class AllocateMemory {
+    public static void main(String args[]) throws Exception {
+        Unsafe unsafe = Utils.getUnsafe();
+
+        // Allocate a byte, write to the location and read back the value
+        long address = unsafe.allocateMemory(1);
+        assertNotEquals(address, 0L);
+
+        unsafe.putByte(address, Byte.MAX_VALUE);
+        assertEquals(Byte.MAX_VALUE, unsafe.getByte(address));
+        unsafe.freeMemory(address);
+
+        // Call to allocateMemory() with a negative value should result in an IllegalArgumentException
+        try {
+            address = unsafe.allocateMemory(-1);
+            throw new RuntimeException("Did not get expected IllegalArgumentException");
+        } catch (IllegalArgumentException e) {
+            // Expected
+            assertNotEquals(address, 0L);
+        }
+
+        // allocateMemory() should throw an OutOfMemoryError when the underlying malloc fails,
+        // we test this by limiting the malloc using -XX:MallocMaxTestWords
+        try {
+            address = unsafe.allocateMemory(20 * 1024 * 1024 * 8);
+        } catch (OutOfMemoryError e) {
+            // Expected
+            return;
+        }
+        throw new RuntimeException("Did not get expected OutOfMemoryError");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Unsafe/CopyMemory.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verifies behaviour of Unsafe.copyMemory
+ * @library /testlibrary
+ * @run main CopyMemory
+ */
+
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class CopyMemory {
+    final static int LENGTH = 8;
+    public static void main(String args[]) throws Exception {
+        Unsafe unsafe = Utils.getUnsafe();
+        long src = unsafe.allocateMemory(LENGTH);
+        long dst = unsafe.allocateMemory(LENGTH);
+        assertNotEquals(src, 0L);
+        assertNotEquals(dst, 0L);
+
+        // call copyMemory() with different lengths and verify the contents of
+        // the destination array
+        for (int i = 0; i < LENGTH; i++) {
+            unsafe.putByte(src + i, (byte)i);
+            unsafe.copyMemory(src, dst, i);
+            for (int j = 0; j < i; j++) {
+                assertEquals(unsafe.getByte(src + j), unsafe.getByte(src + j));
+            }
+        }
+        unsafe.freeMemory(src);
+        unsafe.freeMemory(dst);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Unsafe/DefineClass.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verifies the behaviour of Unsafe.defineClass
+ * @library /testlibrary
+ * @run main DefineClass
+ */
+
+import java.security.ProtectionDomain;
+import java.io.InputStream;
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class DefineClass {
+    public static void main(String args[]) throws Exception {
+        Unsafe unsafe = Utils.getUnsafe();
+        TestClassLoader classloader = new TestClassLoader();
+        ProtectionDomain pd = new ProtectionDomain(null, null);
+
+        byte klassbuf[] = InMemoryJavaCompiler.compile("TestClass", "class TestClass { }");
+
+        // Invalid class data
+        try {
+            unsafe.defineClass(null, klassbuf, 4, klassbuf.length - 4, classloader, pd);
+            throw new RuntimeException("defineClass did not throw expected ClassFormatError");
+        } catch (ClassFormatError e) {
+            // Expected
+        }
+
+        // Negative offset
+        try {
+            unsafe.defineClass(null, klassbuf, -1, klassbuf.length, classloader, pd);
+            throw new RuntimeException("defineClass did not throw expected IndexOutOfBoundsException");
+        } catch (IndexOutOfBoundsException e) {
+            // Expected
+        }
+
+        // Negative length
+        try {
+            unsafe.defineClass(null, klassbuf, 0, -1, classloader, pd);
+            throw new RuntimeException("defineClass did not throw expected IndexOutOfBoundsException");
+        } catch (IndexOutOfBoundsException e) {
+            // Expected
+        }
+
+        // Offset greater than klassbuf.length
+        try {
+            unsafe.defineClass(null, klassbuf, klassbuf.length + 1, klassbuf.length, classloader, pd);
+            throw new RuntimeException("defineClass did not throw expected IndexOutOfBoundsException");
+        } catch (IndexOutOfBoundsException e) {
+            // Expected
+        }
+
+        // Length greater than klassbuf.length
+        try {
+            unsafe.defineClass(null, klassbuf, 0, klassbuf.length + 1, classloader, pd);
+            throw new RuntimeException("defineClass did not throw expected IndexOutOfBoundsException");
+        } catch (IndexOutOfBoundsException e) {
+            // Expected
+        }
+
+        Class klass = unsafe.defineClass(null, klassbuf, 0, klassbuf.length, classloader, pd);
+        assertEquals(klass.getClassLoader(), classloader);
+        assertEquals(klass.getProtectionDomain(), pd);
+    }
+
+    private static class TestClassLoader extends ClassLoader {
+        public TestClassLoader(ClassLoader parent) {
+            super(parent);
+        }
+
+        public TestClassLoader() {
+            super();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Unsafe/FieldOffset.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verifies the behaviour of Unsafe.fieldOffset
+ * @library /testlibrary
+ * @run main FieldOffset
+ */
+
+import java.lang.reflect.Field;
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+import java.lang.reflect.*;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class FieldOffset {
+    public static void main(String args[]) throws Exception {
+        Unsafe unsafe = Utils.getUnsafe();
+        Field fields[] = Test.class.getDeclaredFields();
+
+        for (int i = 0; i < fields.length; i++) {
+            int offset = unsafe.fieldOffset(fields[i]);
+            // Ensure we got a valid offset value back
+            assertNotEquals(offset, unsafe.INVALID_FIELD_OFFSET);
+
+            // Make sure the field offset is unique
+            for (int j = 0; j < i; j++) {
+                assertNotEquals(offset, unsafe.fieldOffset(fields[j]));
+            }
+        }
+    }
+
+    class Test {
+        boolean booleanField;
+        byte byteField;
+        char charField;
+        double doubleField;
+        float floatField;
+        int intField;
+        long longField;
+        Object objectField;
+        short shortField;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Unsafe/GetField.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verifies behaviour of Unsafe.getField
+ * @library /testlibrary
+ * @run main GetField
+ */
+
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+import java.lang.reflect.*;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class GetField {
+    public static void main(String args[]) throws Exception {
+        Unsafe unsafe = Utils.getUnsafe();
+        // Unsafe.INVALID_FIELD_OFFSET is a static final int field,
+        // make sure getField returns the correct field
+        Field field = Unsafe.class.getField("INVALID_FIELD_OFFSET");
+        assertNotEquals(field.getModifiers() & Modifier.FINAL, 0);
+        assertNotEquals(field.getModifiers() & Modifier.STATIC, 0);
+        assertEquals(field.getType(), int.class);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Unsafe/GetPutAddress.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * Verify behaviour of Unsafe.get/putAddress and Unsafe.addressSize
+ * @library /testlibrary
+ * @run main GetPutAddress
+ */
+
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class GetPutAddress {
+    public static void main(String args[]) throws Exception {
+        Unsafe unsafe = Utils.getUnsafe();
+        int addressSize = unsafe.addressSize();
+        // Ensure the size returned from Unsafe.addressSize is correct
+        assertEquals(unsafe.addressSize(), Platform.is32bit() ? 4 : 8);
+
+        // Write the address, read it back and make sure it's the same value
+        long address = unsafe.allocateMemory(addressSize);
+        unsafe.putAddress(address, address);
+        long readAddress = unsafe.getAddress(address);
+        if (addressSize == 4) {
+          readAddress &= 0x00000000FFFFFFFFL;
+        }
+        assertEquals(address, readAddress);
+        unsafe.freeMemory(address);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Unsafe/GetPutBoolean.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verify behaviour of Unsafe.get/putBoolean
+ * @library /testlibrary
+ * @run main GetPutBoolean
+ */
+
+import java.lang.reflect.Field;
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class GetPutBoolean {
+    public static void main(String args[]) throws Exception {
+        Unsafe unsafe = Utils.getUnsafe();
+        Test t = new Test();
+        Field field = Test.class.getField("b1");
+
+        int offset = unsafe.fieldOffset(field);
+        assertEquals(false, unsafe.getBoolean(t, offset));
+        unsafe.putBoolean(t, offset, true);
+        assertEquals(true, unsafe.getBoolean(t, offset));
+
+        boolean arrayBoolean[] = { true, false, false, true };
+        int scale = unsafe.arrayIndexScale(arrayBoolean.getClass());
+        offset = unsafe.arrayBaseOffset(arrayBoolean.getClass());
+        for (int i = 0; i < arrayBoolean.length; i++) {
+            assertEquals(unsafe.getBoolean(arrayBoolean, offset), arrayBoolean[i]);
+            offset += scale;
+        }
+    }
+
+    static class Test {
+        public boolean b1 = false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Unsafe/GetPutByte.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verify behaviour of Unsafe.get/putByte
+ * @library /testlibrary
+ * @run main GetPutByte
+ */
+
+import java.lang.reflect.Field;
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class GetPutByte {
+    public static void main(String args[]) throws Exception {
+        Unsafe unsafe = Utils.getUnsafe();
+        Test t = new Test();
+        Field field = Test.class.getField("b");
+
+        int offset = unsafe.fieldOffset(field);
+        assertEquals((byte)0, unsafe.getByte(t, offset));
+        unsafe.putByte(t, offset, (byte)1);
+        assertEquals((byte)1, unsafe.getByte(t, offset));
+
+        long address = unsafe.allocateMemory(8);
+        unsafe.putByte(address, (byte)2);
+        assertEquals((byte)2, unsafe.getByte(address));
+        unsafe.freeMemory(address);
+
+        byte arrayByte[] = { -1, 0, 1, 2 };
+        int scale = unsafe.arrayIndexScale(arrayByte.getClass());
+        offset = unsafe.arrayBaseOffset(arrayByte.getClass());
+        for (int i = 0; i < arrayByte.length; i++) {
+            assertEquals(unsafe.getByte(arrayByte, offset), arrayByte[i]);
+            offset += scale;
+        }
+    }
+
+    static class Test {
+        public byte b = 0;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Unsafe/GetPutChar.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verify behaviour of Unsafe.get/putChar
+ * @library /testlibrary
+ * @run main GetPutChar
+ */
+
+import java.lang.reflect.Field;
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class GetPutChar {
+    public static void main(String args[]) throws Exception {
+        Unsafe unsafe = Utils.getUnsafe();
+        Test t = new Test();
+        Field field = Test.class.getField("c");
+
+        int offset = unsafe.fieldOffset(field);
+        assertEquals('\u0000', unsafe.getChar(t, offset));
+        unsafe.putChar(t, offset, '\u0001');
+        assertEquals('\u0001', unsafe.getChar(t, offset));
+
+        long address = unsafe.allocateMemory(8);
+        unsafe.putChar(address, '\u0002');
+        assertEquals('\u0002', unsafe.getChar(address));
+        unsafe.freeMemory(address);
+
+        char arrayChar[] = { '\uabcd', '\u00ff', '\uff00', };
+        int scale = unsafe.arrayIndexScale(arrayChar.getClass());
+        offset = unsafe.arrayBaseOffset(arrayChar.getClass());
+        for (int i = 0; i < arrayChar.length; i++) {
+            assertEquals(unsafe.getChar(arrayChar, offset), arrayChar[i]);
+            offset += scale;
+        }
+    }
+
+    static class Test {
+        public char c = '\u0000';
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Unsafe/GetPutDouble.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verify behaviour of Unsafe.get/putDouble
+ * @library /testlibrary
+ * @run main GetPutDouble
+ */
+
+import java.lang.reflect.Field;
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class GetPutDouble {
+    public static void main(String args[]) throws Exception {
+        Unsafe unsafe = Utils.getUnsafe();
+        Test t = new Test();
+        Field field = Test.class.getField("d");
+
+        int offset = unsafe.fieldOffset(field);
+        assertEquals(-1.0, unsafe.getDouble(t, offset));
+        unsafe.putDouble(t, offset, 0.0);
+        assertEquals(0.0, unsafe.getDouble(t, offset));
+
+        long address = unsafe.allocateMemory(8);
+        unsafe.putDouble(address, 1.0);
+        assertEquals(1.0, unsafe.getDouble(address));
+        unsafe.freeMemory(address);
+
+        double arrayDouble[] = { -1.0, 0.0, 1.0, 2.0 };
+        int scale = unsafe.arrayIndexScale(arrayDouble.getClass());
+        offset = unsafe.arrayBaseOffset(arrayDouble.getClass());
+        for (int i = 0; i < arrayDouble.length; i++) {
+            assertEquals(unsafe.getDouble(arrayDouble, offset), arrayDouble[i]);
+            offset += scale;
+        }
+    }
+
+    static class Test {
+        public double d = -1.0;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Unsafe/GetPutFloat.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verify behaviour of Unsafe.get/putFloat
+ * @library /testlibrary
+ * @run main GetPutFloat
+ */
+
+import java.lang.reflect.Field;
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class GetPutFloat {
+    public static void main(String args[]) throws Exception {
+        Unsafe unsafe = Utils.getUnsafe();
+        Test t = new Test();
+        Field field = Test.class.getField("f");
+
+        int offset = unsafe.fieldOffset(field);
+        assertEquals(-1.0f, unsafe.getFloat(t, offset));
+        unsafe.putFloat(t, offset, 0.0f);
+        assertEquals(0.0f, unsafe.getFloat(t, offset));
+
+        long address = unsafe.allocateMemory(8);
+        unsafe.putFloat(address, 1.0f);
+        assertEquals(1.0f, unsafe.getFloat(address));
+        unsafe.freeMemory(address);
+
+        float arrayFloat[] = { -1.0f, 0.0f, 1.0f, 2.0f };
+        int scale = unsafe.arrayIndexScale(arrayFloat.getClass());
+        offset = unsafe.arrayBaseOffset(arrayFloat.getClass());
+        for (int i = 0; i < arrayFloat.length; i++) {
+            assertEquals(unsafe.getFloat(arrayFloat, offset), arrayFloat[i]);
+            offset += scale;
+        }
+    }
+
+    static class Test {
+        public float f = -1.0f;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Unsafe/GetPutInt.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @library /testlibrary
+ * @run main GetPutInt
+ */
+
+import java.lang.reflect.Field;
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class GetPutInt {
+    public static void main(String args[]) throws Exception {
+        Unsafe unsafe = Utils.getUnsafe();
+        Test t = new Test();
+        Field field = Test.class.getField("i");
+
+        int offset = unsafe.fieldOffset(field);
+        assertEquals(-1, unsafe.getInt(t, offset));
+        unsafe.putInt(t, offset, 0);
+        assertEquals(0, unsafe.getInt(t, offset));
+
+        long address = unsafe.allocateMemory(8);
+        unsafe.putInt(address, 1);
+        assertEquals(1, unsafe.getInt(address));
+        unsafe.freeMemory(address);
+
+        int arrayInt[] = { -1, 0, 1, 2 };
+        int scale = unsafe.arrayIndexScale(arrayInt.getClass());
+        offset = unsafe.arrayBaseOffset(arrayInt.getClass());
+        for (int i = 0; i < arrayInt.length; i++) {
+            assertEquals(unsafe.getInt(arrayInt, offset), arrayInt[i]);
+            offset += scale;
+        }
+    }
+
+    static class Test {
+        public int i = -1;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Unsafe/GetPutLong.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verify behaviour of Unsafe.get/putLong
+ * @library /testlibrary
+ * @run main GetPutLong
+ */
+
+import java.lang.reflect.Field;
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class GetPutLong {
+    public static void main(String args[]) throws Exception {
+        Unsafe unsafe = Utils.getUnsafe();
+        Test t = new Test();
+        Field field = Test.class.getField("l");
+
+        int offset = unsafe.fieldOffset(field);
+        assertEquals(-1L, unsafe.getLong(t, offset));
+        unsafe.putLong(t, offset, 0L);
+        assertEquals(0L, unsafe.getLong(t, offset));
+
+        long address = unsafe.allocateMemory(8);
+        unsafe.putLong(address, 1L);
+        assertEquals(1L, unsafe.getLong(address));
+        unsafe.freeMemory(address);
+
+        long arrayLong[] = { -1, 0, 1, 2 };
+        int scale = unsafe.arrayIndexScale(arrayLong.getClass());
+        offset = unsafe.arrayBaseOffset(arrayLong.getClass());
+        for (int i = 0; i < arrayLong.length; i++) {
+            assertEquals(unsafe.getLong(arrayLong, offset), arrayLong[i]);
+            offset += scale;
+        }
+    }
+
+    static class Test {
+        public long l = -1L;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Unsafe/GetPutObject.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verify behaviour of Unsafe.get/putObject
+ * @library /testlibrary
+ * @run main GetPutObject
+ */
+
+import java.lang.reflect.Field;
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class GetPutObject {
+    public static void main(String args[]) throws Exception {
+        Unsafe unsafe = Utils.getUnsafe();
+        Test t = new Test();
+        Object o = new Object();
+        Field field = Test.class.getField("o");
+
+        int offset = unsafe.fieldOffset(field);
+        assertEquals(t.o, unsafe.getObject(t, offset));
+
+        unsafe.putObject(t, offset, o);
+        assertEquals(o, unsafe.getObject(t, offset));
+
+        Object arrayObject[] = { unsafe, null, new Object() };
+        int scale = unsafe.arrayIndexScale(arrayObject.getClass());
+        offset = unsafe.arrayBaseOffset(arrayObject.getClass());
+        for (int i = 0; i < arrayObject.length; i++) {
+            assertEquals(unsafe.getObject(arrayObject, offset), arrayObject[i]);
+            offset += scale;
+        }
+    }
+
+    static class Test {
+        public Object o = new Object();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Unsafe/GetPutShort.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verify behaviour of Unsafe.get/putShort
+ * @library /testlibrary
+ * @run main GetPutShort
+ */
+
+import java.lang.reflect.Field;
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class GetPutShort {
+    public static void main(String args[]) throws Exception {
+        Unsafe unsafe = Utils.getUnsafe();
+        Test t = new Test();
+        Field field = Test.class.getField("s");
+
+        int offset = unsafe.fieldOffset(field);
+        assertEquals((short)-1, unsafe.getShort(t, offset));
+        unsafe.putShort(t, offset, (short)0);
+        assertEquals((short)0, unsafe.getShort(t, offset));
+
+        long address = unsafe.allocateMemory(8);
+        unsafe.putShort(address, (short)1);
+        assertEquals((short)1, unsafe.getShort(address));
+        unsafe.freeMemory(address);
+
+        short arrayShort[] = { -1, 0, 1, 2 };
+        int scale = unsafe.arrayIndexScale(arrayShort.getClass());
+        offset = unsafe.arrayBaseOffset(arrayShort.getClass());
+        for (int i = 0; i < arrayShort.length; i++) {
+            assertEquals(unsafe.getShort(arrayShort, offset), arrayShort[i]);
+            offset += scale;
+        }
+    }
+
+    static class Test {
+        public short s = -1;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Unsafe/GetUnsafe.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verifies that getUnsafe() actually throws SecurityException when unsafeAccess is prohibited.
+ * @library /testlibrary
+ * @run main GetUnsafe
+ */
+
+import sun.misc.Unsafe;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class GetUnsafe {
+    public static void main(String args[]) throws Exception {
+        try {
+            Unsafe unsafe = Unsafe.getUnsafe();
+        } catch (SecurityException e) {
+            // Expected
+            return;
+        }
+        throw new RuntimeException("Did not get expected SecurityException");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Unsafe/PageSize.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Make sure pageSize() returns a value that is a power of two
+ * @library /testlibrary
+ * @run main PageSize
+ */
+
+import java.lang.reflect.Field;
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class PageSize {
+    public static void main(String args[]) throws Exception {
+        Unsafe unsafe = Utils.getUnsafe();
+        int pageSize = unsafe.pageSize();
+
+        for (int n = 1; n != 0; n <<= 1) {
+            if (pageSize == n) {
+                return;
+            }
+        }
+        throw new RuntimeException("Expected pagesize to be a power of two, actual pagesize:" + pageSize);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Unsafe/SetMemory.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verifies that setMemory works correctly
+ * @library /testlibrary
+ * @run main SetMemory
+ */
+
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class SetMemory {
+    public static void main(String args[]) throws Exception {
+        Unsafe unsafe = Utils.getUnsafe();
+        long address = unsafe.allocateMemory(1);
+        assertNotEquals(address, 0L);
+        unsafe.setMemory(address, 1, (byte)17);
+        assertEquals((byte)17, unsafe.getByte(address));
+        unsafe.freeMemory(address);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Unsafe/ThrowException.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Verify that throwException() can throw an exception
+ * @library /testlibrary
+ * @run main ThrowException
+ */
+
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class ThrowException {
+    public static void main(String args[]) throws Exception {
+        Unsafe unsafe = Utils.getUnsafe();
+        try {
+            unsafe.throwException(new TestException());
+        } catch (Throwable t) {
+            if (t instanceof TestException) {
+                return;
+            }
+            throw t;
+        }
+        throw new RuntimeException("Did not throw expected TestException");
+    }
+    static class TestException extends Exception {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/serviceability/jvmti/TestLambdaFormRetransformation.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,138 @@
+
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8008678
+ * @summary JSR 292: constant pool reconstitution must support pseudo strings
+ * @library /testlibrary
+ * @compile -XDignore.symbol.file TestLambdaFormRetransformation.java
+ * @run main TestLambdaFormRetransformation
+ */
+
+import java.io.IOException;
+import java.lang.instrument.ClassFileTransformer;
+import java.lang.instrument.IllegalClassFormatException;
+import java.lang.instrument.Instrumentation;
+import java.lang.instrument.UnmodifiableClassException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.security.ProtectionDomain;
+import java.util.Arrays;
+
+import com.oracle.java.testlibrary.ExitCode;
+import com.oracle.java.testlibrary.OutputAnalyzer;
+import com.oracle.java.testlibrary.ProcessTools;
+
+public class TestLambdaFormRetransformation {
+    private static String MANIFEST = String.format("Manifest-Version: 1.0\n" +
+                                                   "Premain-Class: %s\n" +
+                                                   "Can-Retransform-Classes: true\n",
+                                                   Agent.class.getName());
+
+    private static String CP = System.getProperty("test.classes");
+
+    public static void main(String args[]) throws Throwable {
+        Path agent = TestLambdaFormRetransformation.buildAgent();
+        OutputAnalyzer oa = ProcessTools.executeTestJvm("-javaagent:" +
+                                agent.toAbsolutePath().toString(), "-version");
+        oa.shouldHaveExitValue(ExitCode.OK.value);
+    }
+
+    private static Path buildAgent() throws IOException {
+        Path manifest = TestLambdaFormRetransformation.createManifest();
+        Path jar = Files.createTempFile(Paths.get("."), null, ".jar");
+
+        String[] args = new String[] {
+            "-cfm",
+            jar.toAbsolutePath().toString(),
+            manifest.toAbsolutePath().toString(),
+            "-C",
+            TestLambdaFormRetransformation.CP,
+            Agent.class.getName() + ".class"
+        };
+
+        sun.tools.jar.Main jarTool = new sun.tools.jar.Main(System.out, System.err, "jar");
+
+        if (!jarTool.run(args)) {
+            throw new Error("jar failed: args=" + Arrays.toString(args));
+        }
+        return jar;
+    }
+
+    private static Path createManifest() throws IOException {
+        Path manifest = Files.createTempFile(Paths.get("."), null, ".mf");
+        byte[] manifestBytes = TestLambdaFormRetransformation.MANIFEST.getBytes();
+        Files.write(manifest, manifestBytes);
+        return manifest;
+    }
+}
+
+class Agent implements ClassFileTransformer {
+    private static Runnable lambda = () -> {
+        System.out.println("I'll crash you!");
+    };
+
+    public static void premain(String args, Instrumentation instrumentation) {
+        if (!instrumentation.isRetransformClassesSupported()) {
+            System.out.println("Class retransformation is not supported.");
+            return;
+        }
+        System.out.println("Calling lambda to ensure that lambda forms were created");
+
+        Agent.lambda.run();
+
+        System.out.println("Registering class file transformer");
+
+        instrumentation.addTransformer(new Agent());
+
+        for (Class c : instrumentation.getAllLoadedClasses()) {
+            if (c.getName().contains("LambdaForm") &&
+                instrumentation.isModifiableClass(c)) {
+                System.out.format("We've found a modifiable lambda form: %s%n", c.getName());
+                try {
+                    instrumentation.retransformClasses(c);
+                } catch (UnmodifiableClassException e) {
+                    throw new AssertionError("Modification of modifiable class " +
+                                             "caused UnmodifiableClassException", e);
+                }
+            }
+        }
+    }
+
+    public static void main(String args[]) {
+    }
+
+    @Override
+    public byte[] transform(ClassLoader loader,
+                            String className,
+                            Class<?> classBeingRedefined,
+                            ProtectionDomain protectionDomain,
+                            byte[] classfileBuffer
+                           ) throws IllegalClassFormatException {
+        System.out.println("Transforming " + className);
+        return classfileBuffer.clone();
+    }
+}
--- a/jdk/.hgtags	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/.hgtags	Wed Jul 05 20:18:12 2017 +0200
@@ -291,3 +291,4 @@
 efedac7f44ed41cea2b1038138047271f55aacba jdk9-b46
 b641c14730ac05d9ec8b4f66e6fca3dc21adb403 jdk9-b47
 ebb2eb7f1aec78eb6d8cc4c96f018afa11093cde jdk9-b48
+541a8cef4e0d54c3e4b52a98c6af3c31e2096669 jdk9-b49
--- a/jdk/make/data/tzdata/VERSION	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/make/data/tzdata/VERSION	Wed Jul 05 20:18:12 2017 +0200
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2014j
+tzdata2015a
--- a/jdk/make/data/tzdata/antarctica	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/make/data/tzdata/antarctica	Wed Jul 05 20:18:12 2017 +0200
@@ -70,8 +70,8 @@
 Rule	ChileAQ	2010	only	-	Apr	Sun>=1	3:00u	0	-
 Rule	ChileAQ	2011	only	-	May	Sun>=2	3:00u	0	-
 Rule	ChileAQ	2011	only	-	Aug	Sun>=16	4:00u	1:00	S
-Rule	ChileAQ	2012	max	-	Apr	Sun>=23	3:00u	0	-
-Rule	ChileAQ	2012	max	-	Sep	Sun>=2	4:00u	1:00	S
+Rule	ChileAQ	2012	2015	-	Apr	Sun>=23	3:00u	0	-
+Rule	ChileAQ	2012	2014	-	Sep	Sun>=2	4:00u	1:00	S
 
 # Argentina - year-round bases
 # Belgrano II, Confin Coast, -770227-0343737, since 1972-02-05
@@ -377,9 +377,10 @@
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Antarctica/Palmer	0	-	zzz	1965
-			-4:00	ArgAQ	AR%sT	1969 Oct 5
+			-4:00	ArgAQ	AR%sT	1969 Oct  5
 			-3:00	ArgAQ	AR%sT	1982 May
-			-4:00	ChileAQ	CL%sT
+			-4:00	ChileAQ	CL%sT	2015 Apr 26 3:00u
+			-3:00	-	CLT
 #
 #
 # McMurdo Station, Ross Island, since 1955-12
--- a/jdk/make/data/tzdata/asia	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/make/data/tzdata/asia	Wed Jul 05 20:18:12 2017 +0200
@@ -168,10 +168,7 @@
 			4:00	Azer	AZ%sT
 
 # Bahrain
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Bahrain	3:22:20 -	LMT	1920     # Manamah
-			4:00	-	GST	1972 Jun
-			3:00	-	AST
+# See Asia/Qatar.
 
 # Bangladesh
 # From Alexander Krivenyshev (2009-05-13):
@@ -1754,9 +1751,7 @@
 ###############################################################################
 
 # Kuwait
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Kuwait	3:11:56 -	LMT	1950
-			3:00	-	AST
+# See Asia/Riyadh.
 
 # Laos
 # See Asia/Bangkok.
@@ -1977,12 +1972,7 @@
 			5:45	-	NPT	# Nepal Time
 
 # Oman
-
-# Milne says 3:54:24 was the meridian of the Muscat Tidal Observatory.
-
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Muscat	3:54:24 -	LMT	1920
-			4:00	-	GST
+# See Asia/Dubai.
 
 # Pakistan
 
@@ -2476,6 +2466,7 @@
 Zone	Asia/Qatar	3:26:08 -	LMT	1920     # Al Dawhah / Doha
 			4:00	-	GST	1972 Jun
 			3:00	-	AST
+Link Asia/Qatar Asia/Bahrain
 
 # Saudi Arabia
 #
@@ -2502,6 +2493,8 @@
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Riyadh	3:06:52 -	LMT	1947 Mar 14
 			3:00	-	AST
+Link Asia/Riyadh Asia/Aden	# Yemen
+Link Asia/Riyadh Asia/Kuwait
 
 # Singapore
 # taken from Mok Ly Yng (2003-10-30)
@@ -2790,6 +2783,7 @@
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Dubai	3:41:12 -	LMT	1920
 			4:00	-	GST
+Link Asia/Dubai Asia/Muscat	# Oman
 
 # Uzbekistan
 # Byalokoz 1919 says Uzbekistan was 4:27:53.
@@ -2874,10 +2868,4 @@
 			7:00	-	ICT
 
 # Yemen
-
-# Milne says 2:59:54 was the meridian of the saluting battery at Aden,
-# and that Yemen was at 1:55:56, the meridian of the Hagia Sophia.
-
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Aden	2:59:54	-	LMT	1950
-			3:00	-	AST
+# See Asia/Riyadh.
--- a/jdk/make/data/tzdata/backward	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/make/data/tzdata/backward	Wed Jul 05 20:18:12 2017 +0200
@@ -28,7 +28,7 @@
 # and their old names.  Many names changed in late 1993.
 
 # Link	TARGET			LINK-NAME
-Link	Africa/Asmara		Africa/Asmera
+Link	Africa/Nairobi		Africa/Asmera
 Link	Africa/Abidjan		Africa/Timbuktu
 Link	America/Argentina/Catamarca	America/Argentina/ComodRivadavia
 Link	America/Adak		America/Atka
--- a/jdk/make/data/tzdata/europe	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/make/data/tzdata/europe	Wed Jul 05 20:18:12 2017 +0200
@@ -1430,35 +1430,32 @@
 # might be a reference to the Julian calendar as opposed to Gregorian, or it
 # might mean something else (???).
 #
-# From Paul Eggert (2006-03-22):
-# The Iceland Almanak, Shanks & Pottenger, and Whitman disagree on many points.
-# We go with the Almanak, except for one claim from Shanks & Pottenger, namely
-# that Reykavik was 21W57 from 1837 to 1908, local mean time before that.
+# From Paul Eggert (2014-11-22):
+# The information below is taken from the 1988 Almanak; see
+# http://www.almanak.hi.is/klukkan.html
 #
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
-Rule	Iceland	1917	1918	-	Feb	19	23:00	1:00	S
+Rule	Iceland	1917	1919	-	Feb	19	23:00	1:00	S
 Rule	Iceland	1917	only	-	Oct	21	 1:00	0	-
-Rule	Iceland	1918	only	-	Nov	16	 1:00	0	-
+Rule	Iceland	1918	1919	-	Nov	16	 1:00	0	-
+Rule	Iceland	1921	only	-	Mar	19	23:00	1:00	S
+Rule	Iceland	1921	only	-	Jun	23	 1:00	0	-
 Rule	Iceland	1939	only	-	Apr	29	23:00	1:00	S
-Rule	Iceland	1939	only	-	Nov	29	 2:00	0	-
+Rule	Iceland	1939	only	-	Oct	29	 2:00	0	-
 Rule	Iceland	1940	only	-	Feb	25	 2:00	1:00	S
-Rule	Iceland	1940	only	-	Nov	 3	 2:00	0	-
-Rule	Iceland	1941	only	-	Mar	 2	 1:00s	1:00	S
-Rule	Iceland	1941	only	-	Nov	 2	 1:00s	0	-
-Rule	Iceland	1942	only	-	Mar	 8	 1:00s	1:00	S
-Rule	Iceland	1942	only	-	Oct	25	 1:00s	0	-
+Rule	Iceland	1940	1941	-	Nov	Sun>=2	 1:00s	0	-
+Rule	Iceland	1941	1942	-	Mar	Sun>=2	 1:00s	1:00	S
 # 1943-1946 - first Sunday in March until first Sunday in winter
 Rule	Iceland	1943	1946	-	Mar	Sun>=1	 1:00s	1:00	S
-Rule	Iceland	1943	1948	-	Oct	Sun>=22	 1:00s	0	-
+Rule	Iceland	1942	1948	-	Oct	Sun>=22	 1:00s	0	-
 # 1947-1967 - first Sunday in April until first Sunday in winter
 Rule	Iceland	1947	1967	-	Apr	Sun>=1	 1:00s	1:00	S
-# 1949 Oct transition delayed by 1 week
+# 1949 and 1967 Oct transitions delayed by 1 week
 Rule	Iceland	1949	only	-	Oct	30	 1:00s	0	-
 Rule	Iceland	1950	1966	-	Oct	Sun>=22	 1:00s	0	-
 Rule	Iceland	1967	only	-	Oct	29	 1:00s	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Atlantic/Reykjavik	-1:27:24 -	LMT	1837
-			-1:27:48 -	RMT	1908 # Reykjavik Mean Time?
+Zone Atlantic/Reykjavik	-1:28	-	LMT	1908
 			-1:00	Iceland	IS%sT	1968 Apr  7  1:00s
 			 0:00	-	GMT
 
--- a/jdk/make/data/tzdata/leapseconds	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/make/data/tzdata/leapseconds	Wed Jul 05 20:18:12 2017 +0200
@@ -77,3 +77,7 @@
 Leap	2005	Dec	31	23:59:60	+	S
 Leap	2008	Dec	31	23:59:60	+	S
 Leap	2012	Jun	30	23:59:60	+	S
+Leap	2015	Jun	30	23:59:60	+	S
+
+#	Updated through IERS Bulletin C49
+#	File expires on:  28 December 2015
--- a/jdk/make/data/tzdata/northamerica	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/make/data/tzdata/northamerica	Wed Jul 05 20:18:12 2017 +0200
@@ -147,7 +147,7 @@
 Rule	US	1918	1919	-	Oct	lastSun	2:00	0	S
 Rule	US	1942	only	-	Feb	9	2:00	1:00	W # War
 Rule	US	1945	only	-	Aug	14	23:00u	1:00	P # Peace
-Rule	US	1945	only	-	Sep	30	2:00	0	S
+Rule	US	1945	only	-	Sep	lastSun	2:00	0	S
 Rule	US	1967	2006	-	Oct	lastSun	2:00	0	S
 Rule	US	1967	1973	-	Apr	lastSun	2:00	1:00	D
 Rule	US	1974	only	-	Jan	6	2:00	1:00	D
@@ -2147,11 +2147,11 @@
 
 # Mexico
 
-# From Paul Eggert (2001-03-05):
+# From Paul Eggert (2014-12-07):
 # The Investigation and Analysis Service of the
 # Mexican Library of Congress (MLoC) has published a
 # history of Mexican local time (in Spanish)
-# http://www.cddhcu.gob.mx/bibliot/publica/inveyana/polisoc/horver/
+# http://www.diputados.gob.mx/bibliot/publica/inveyana/polisoc/horver/index.htm
 #
 # Here are the discrepancies between Shanks & Pottenger (S&P) and the MLoC.
 # (In all cases we go with the MLoC.)
@@ -2320,6 +2320,24 @@
 # efecto desde las dos horas del segundo domingo de marzo y concluirá a
 # las dos horas del primer domingo de noviembre.
 
+# From Steffen Thorsen (2014-12-08), translated by Gwillim Law:
+# The Mexican state of Quintana Roo will likely change to EST in 2015.
+#
+# http://www.unioncancun.mx/articulo/2014/12/04/medio-ambiente/congreso-aprueba-una-hora-mas-de-sol-en-qroo
+# "With this change, the time conflict that has existed between the municipios
+# of Quintana Roo and the municipio of Felipe Carrillo Puerto may come to an
+# end. The latter declared itself in rebellion 15 years ago when a time change
+# was initiated in Mexico, and since then it has refused to change its time
+# zone along with the rest of the country."
+#
+# From Steffen Thorsen (2015-01-14), translated by Gwillim Law:
+# http://sipse.com/novedades/confirman-aplicacion-de-nueva-zona-horaria-para-quintana-roo-132331.html
+# "...the new time zone will come into effect at two o'clock on the first Sunday
+# of February, when we will have to advance the clock one hour from its current
+# time..."
+#
+# Also, the new zone will not use DST.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Mexico	1939	only	-	Feb	5	0:00	1:00	D
 Rule	Mexico	1939	only	-	Jun	25	0:00	0	S
@@ -2340,7 +2358,8 @@
 Zone America/Cancun	-5:47:04 -	LMT	1922 Jan  1  0:12:56
 			-6:00	-	CST	1981 Dec 23
 			-5:00	Mexico	E%sT	1998 Aug  2  2:00
-			-6:00	Mexico	C%sT
+			-6:00	Mexico	C%sT	2015 Feb  1  2:00
+			-5:00	-	EST
 # Campeche, Yucatán; represented by Mérida
 Zone America/Merida	-5:58:28 -	LMT	1922 Jan  1  0:01:32
 			-6:00	-	CST	1981 Dec 23
--- a/jdk/make/data/tzdata/southamerica	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/make/data/tzdata/southamerica	Wed Jul 05 20:18:12 2017 +0200
@@ -1229,6 +1229,11 @@
 # DST Start: first Saturday of September 2014 (Sun 07 Sep 2014 04:00 UTC)
 # http://www.diariooficial.interior.gob.cl//media/2014/02/19/do-20140219.pdf
 
+# From Juan Correa (2015-01-28):
+# ... today the Ministry of Energy announced that Chile will drop DST, will keep
+# "summer time" (UTC -3 / UTC -5) all year round....
+# http://www.minenergia.cl/ministerio/noticias/generales/ministerio-de-energia-anuncia.html
+
 # NOTE: ChileAQ rules for Antarctic bases are stored separately in the
 # 'antarctica' file.
 
@@ -1270,8 +1275,8 @@
 Rule	Chile	2010	only	-	Apr	Sun>=1	3:00u	0	-
 Rule	Chile	2011	only	-	May	Sun>=2	3:00u	0	-
 Rule	Chile	2011	only	-	Aug	Sun>=16	4:00u	1:00	S
-Rule	Chile	2012	max	-	Apr	Sun>=23	3:00u	0	-
-Rule	Chile	2012	max	-	Sep	Sun>=2	4:00u	1:00	S
+Rule	Chile	2012	2015	-	Apr	Sun>=23	3:00u	0	-
+Rule	Chile	2012	2014	-	Sep	Sun>=2	4:00u	1:00	S
 # IATA SSIM anomalies: (1992-02) says 1992-03-14;
 # (1996-09) says 1998-03-08.  Ignore these.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -1282,11 +1287,13 @@
 			-4:00	-	CLT	1919 Jul  1 # Chile Time
 			-4:42:46 -	SMT	1927 Sep  1 # Santiago Mean Time
 			-5:00	Chile	CL%sT	1947 May 22 # Chile Time
-			-4:00	Chile	CL%sT
+			-4:00	Chile	CL%sT	2015 Apr 26  3:00u
+			-3:00	-	CLT
 Zone Pacific/Easter	-7:17:44 -	LMT	1890
 			-7:17:28 -	EMT	1932 Sep    # Easter Mean Time
-			-7:00	Chile	EAS%sT	1982 Mar 13 21:00 # Easter Time
-			-6:00	Chile	EAS%sT
+			-7:00	Chile	EAS%sT	1982 Mar 13 3:00u # Easter Time
+			-6:00	Chile	EAS%sT	2015 Apr 26 3:00u
+			-5:00	-	EAST
 #
 # Salas y Gómez Island is uninhabited.
 # Other Chilean locations, including Juan Fernández Is, Desventuradas Is,
--- a/jdk/make/data/tzdata/zone.tab	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/make/data/tzdata/zone.tab	Wed Jul 05 20:18:12 2017 +0200
@@ -297,7 +297,7 @@
 MV	+0410+07330	Indian/Maldives
 MW	-1547+03500	Africa/Blantyre
 MX	+1924-09909	America/Mexico_City	Central Time - most locations
-MX	+2105-08646	America/Cancun	Central Time - Quintana Roo
+MX	+2105-08646	America/Cancun	Eastern Standard Time - Quintana Roo
 MX	+2058-08937	America/Merida	Central Time - Campeche, Yucatan
 MX	+2540-10019	America/Monterrey	Mexican Central Time - Coahuila, Durango, Nuevo Leon, Tamaulipas away from US border
 MX	+2550-09730	America/Matamoros	US Central Time - Coahuila, Durango, Nuevo Leon, Tamaulipas near US border
--- a/jdk/make/src/classes/build/tools/module/boot.modules	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/make/src/classes/build/tools/module/boot.modules	Wed Jul 05 20:18:12 2017 +0200
@@ -11,7 +11,6 @@
 java.prefs
 java.rmi
 java.scripting
-java.security.acl
 java.security.jgss
 java.security.sasl
 java.smartcardio
--- a/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -1059,6 +1059,7 @@
 void PostJVMInit(JNIEnv *env, jstring mainClass, JavaVM *vm) {
     jvmInstance = vm;
     SetMainClassForAWT(env, mainClass);
+    CHECK_EXCEPTION_RETURN();
     ShowSplashScreen();
 }
 
--- a/jdk/src/java.base/share/classes/java/lang/Number.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/Number.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2015, 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
@@ -37,7 +37,7 @@
  *
  * For platform classes, the conversion is often analogous to a
  * narrowing primitive conversion or a widening primitive conversion
- * as defining in <cite>The Java&trade; Language Specification</cite>
+ * as defined in <cite>The Java&trade; Language Specification</cite>
  * for converting between primitive types.  Therefore, conversions may
  * lose information about the overall magnitude of a numeric value, may
  * lose precision, and may even return a result of a different sign
@@ -54,8 +54,7 @@
  */
 public abstract class Number implements java.io.Serializable {
     /**
-     * Returns the value of the specified number as an {@code int},
-     * which may involve rounding or truncation.
+     * Returns the value of the specified number as an {@code int}.
      *
      * @return  the numeric value represented by this object after conversion
      *          to type {@code int}.
@@ -63,8 +62,7 @@
     public abstract int intValue();
 
     /**
-     * Returns the value of the specified number as a {@code long},
-     * which may involve rounding or truncation.
+     * Returns the value of the specified number as a {@code long}.
      *
      * @return  the numeric value represented by this object after conversion
      *          to type {@code long}.
@@ -72,8 +70,7 @@
     public abstract long longValue();
 
     /**
-     * Returns the value of the specified number as a {@code float},
-     * which may involve rounding.
+     * Returns the value of the specified number as a {@code float}.
      *
      * @return  the numeric value represented by this object after conversion
      *          to type {@code float}.
@@ -81,8 +78,7 @@
     public abstract float floatValue();
 
     /**
-     * Returns the value of the specified number as a {@code double},
-     * which may involve rounding.
+     * Returns the value of the specified number as a {@code double}.
      *
      * @return  the numeric value represented by this object after conversion
      *          to type {@code double}.
@@ -90,8 +86,7 @@
     public abstract double doubleValue();
 
     /**
-     * Returns the value of the specified number as a {@code byte},
-     * which may involve rounding or truncation.
+     * Returns the value of the specified number as a {@code byte}.
      *
      * <p>This implementation returns the result of {@link #intValue} cast
      * to a {@code byte}.
@@ -105,8 +100,7 @@
     }
 
     /**
-     * Returns the value of the specified number as a {@code short},
-     * which may involve rounding or truncation.
+     * Returns the value of the specified number as a {@code short}.
      *
      * <p>This implementation returns the result of {@link #intValue} cast
      * to a {@code short}.
--- a/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java	Wed Jul 05 20:18:12 2017 +0200
@@ -951,6 +951,9 @@
      * {@code command} array as its argument. This may result in
      * a {@link SecurityException} being thrown.
      *
+     * <p>If the operating system does not support the creation of
+     * processes, an {@link UnsupportedOperationException} will be thrown.
+     *
      * <p>Starting an operating system process is highly system-dependent.
      * Among the many things that can go wrong are:
      * <ul>
@@ -998,6 +1001,9 @@
      *
      *         </ul>
      *
+     * @throws  UnsupportedOperationException
+     *          If the operating system does not support the creation of processes.
+     *
      * @throws IOException if an I/O error occurs
      *
      * @see Runtime#exec(String[], String[], java.io.File)
--- a/jdk/src/java.base/share/classes/java/lang/Runtime.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/Runtime.java	Wed Jul 05 20:18:12 2017 +0200
@@ -564,6 +564,9 @@
      * <code>cmdarray</code> as its argument. This may result in a
      * {@link SecurityException} being thrown.
      *
+     * <p>If the operating system does not support the creation of
+     * processes, an {@link UnsupportedOperationException} will be thrown.
+     *
      * <p>Starting an operating system process is highly system-dependent.
      * Among the many things that can go wrong are:
      * <ul>
@@ -597,6 +600,9 @@
      *          {@link SecurityManager#checkExec checkExec}
      *          method doesn't allow creation of the subprocess
      *
+     * @throws  UnsupportedOperationException
+     *          If the operating system does not support the creation of processes.
+     *
      * @throws  IOException
      *          If an I/O error occurs
      *
--- a/jdk/src/java.base/share/classes/java/nio/channels/FileLock.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/nio/channels/FileLock.java	Wed Jul 05 20:18:12 2017 +0200
@@ -26,6 +26,7 @@
 package java.nio.channels;
 
 import java.io.IOException;
+import java.util.Objects;
 
 /**
  * A token representing a lock on a region of a file.
@@ -147,6 +148,7 @@
     protected FileLock(FileChannel channel,
                        long position, long size, boolean shared)
     {
+        Objects.requireNonNull(channel, "Null channel");
         if (position < 0)
             throw new IllegalArgumentException("Negative position");
         if (size < 0)
@@ -185,6 +187,7 @@
     protected FileLock(AsynchronousFileChannel channel,
                        long position, long size, boolean shared)
     {
+        Objects.requireNonNull(channel, "Null channel");
         if (position < 0)
             throw new IllegalArgumentException("Negative position");
         if (size < 0)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/security/acl/Acl.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,241 @@
+/*
+ * Copyright (c) 1996, 2013, 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.security.acl;
+
+import java.util.Enumeration;
+import java.security.Principal;
+
+/**
+ * Interface representing an Access Control List (ACL).  An Access
+ * Control List is a data structure used to guard access to
+ * resources.<p>
+ *
+ * An ACL can be thought of as a data structure with multiple ACL
+ * entries.  Each ACL entry, of interface type AclEntry, contains a
+ * set of permissions associated with a particular principal. (A
+ * principal represents an entity such as an individual user or a
+ * group). Additionally, each ACL entry is specified as being either
+ * positive or negative. If positive, the permissions are to be
+ * granted to the associated principal. If negative, the permissions
+ * are to be denied.<p>
+ *
+ * The ACL Entries in each ACL observe the following rules:
+ *
+ * <ul> <li>Each principal can have at most one positive ACL entry and
+ * one negative entry; that is, multiple positive or negative ACL
+ * entries are not allowed for any principal.  Each entry specifies
+ * the set of permissions that are to be granted (if positive) or
+ * denied (if negative).
+ *
+ * <li>If there is no entry for a particular principal, then the
+ * principal is considered to have a null (empty) permission set.
+ *
+ * <li>If there is a positive entry that grants a principal a
+ * particular permission, and a negative entry that denies the
+ * principal the same permission, the result is as though the
+ * permission was never granted or denied.
+ *
+ * <li>Individual permissions always override permissions of the
+ * group(s) to which the individual belongs. That is, individual
+ * negative permissions (specific denial of permissions) override the
+ * groups' positive permissions. And individual positive permissions
+ * override the groups' negative permissions.
+ *
+ * </ul>
+ *
+ * The {@code  java.security.acl } package provides the
+ * interfaces to the ACL and related data structures (ACL entries,
+ * groups, permissions, etc.), and the {@code  sun.security.acl }
+ * classes provide a default implementation of the interfaces. For
+ * example, {@code  java.security.acl.Acl } provides the
+ * interface to an ACL and the {@code  sun.security.acl.AclImpl }
+ * class provides the default implementation of the interface.<p>
+ *
+ * The {@code  java.security.acl.Acl } interface extends the
+ * {@code  java.security.acl.Owner } interface. The Owner
+ * interface is used to maintain a list of owners for each ACL.  Only
+ * owners are allowed to modify an ACL. For example, only an owner can
+ * call the ACL's {@code addEntry} method to add a new ACL entry
+ * to the ACL.
+ *
+ * @see java.security.acl.AclEntry
+ * @see java.security.acl.Owner
+ * @see java.security.acl.Acl#getPermissions
+ *
+ * @author Satish Dharmaraj
+ */
+
+public interface Acl extends Owner {
+
+    /**
+     * Sets the name of this ACL.
+     *
+     * @param caller the principal invoking this method. It must be an
+     * owner of this ACL.
+     *
+     * @param name the name to be given to this ACL.
+     *
+     * @exception NotOwnerException if the caller principal
+     * is not an owner of this ACL.
+     *
+     * @see #getName
+     */
+    public void setName(Principal caller, String name)
+      throws NotOwnerException;
+
+    /**
+     * Returns the name of this ACL.
+     *
+     * @return the name of this ACL.
+     *
+     * @see #setName
+     */
+    public String getName();
+
+    /**
+     * Adds an ACL entry to this ACL. An entry associates a principal
+     * (e.g., an individual or a group) with a set of
+     * permissions. Each principal can have at most one positive ACL
+     * entry (specifying permissions to be granted to the principal)
+     * and one negative ACL entry (specifying permissions to be
+     * denied). If there is already an ACL entry of the same type
+     * (negative or positive) already in the ACL, false is returned.
+     *
+     * @param caller the principal invoking this method. It must be an
+     * owner of this ACL.
+     *
+     * @param entry the ACL entry to be added to this ACL.
+     *
+     * @return true on success, false if an entry of the same type
+     * (positive or negative) for the same principal is already
+     * present in this ACL.
+     *
+     * @exception NotOwnerException if the caller principal
+     *  is not an owner of this ACL.
+     */
+    public boolean addEntry(Principal caller, AclEntry entry)
+      throws NotOwnerException;
+
+    /**
+     * Removes an ACL entry from this ACL.
+     *
+     * @param caller the principal invoking this method. It must be an
+     * owner of this ACL.
+     *
+     * @param entry the ACL entry to be removed from this ACL.
+     *
+     * @return true on success, false if the entry is not part of this ACL.
+     *
+     * @exception NotOwnerException if the caller principal is not
+     * an owner of this Acl.
+     */
+    public boolean removeEntry(Principal caller, AclEntry entry)
+          throws NotOwnerException;
+
+    /**
+     * Returns an enumeration for the set of allowed permissions for the
+     * specified principal (representing an entity such as an individual or
+     * a group). This set of allowed permissions is calculated as
+     * follows:
+     *
+     * <ul>
+     *
+     * <li>If there is no entry in this Access Control List for the
+     * specified principal, an empty permission set is returned.
+     *
+     * <li>Otherwise, the principal's group permission sets are determined.
+     * (A principal can belong to one or more groups, where a group is a
+     * group of principals, represented by the Group interface.)
+     * The group positive permission set is the union of all
+     * the positive permissions of each group that the principal belongs to.
+     * The group negative permission set is the union of all
+     * the negative permissions of each group that the principal belongs to.
+     * If there is a specific permission that occurs in both
+     * the positive permission set and the negative permission set,
+     * it is removed from both.<p>
+     *
+     * The individual positive and negative permission sets are also
+     * determined. The positive permission set contains the permissions
+     * specified in the positive ACL entry (if any) for the principal.
+     * Similarly, the negative permission set contains the permissions
+     * specified in the negative ACL entry (if any) for the principal.
+     * The individual positive (or negative) permission set is considered
+     * to be null if there is not a positive (negative) ACL entry for the
+     * principal in this ACL.<p>
+     *
+     * The set of permissions granted to the principal is then calculated
+     * using the simple rule that individual permissions always override
+     * the group permissions. That is, the principal's individual negative
+     * permission set (specific denial of permissions) overrides the group
+     * positive permission set, and the principal's individual positive
+     * permission set overrides the group negative permission set.
+     *
+     * </ul>
+     *
+     * @param user the principal whose permission set is to be returned.
+     *
+     * @return the permission set specifying the permissions the principal
+     * is allowed.
+     */
+    public Enumeration<Permission> getPermissions(Principal user);
+
+    /**
+     * Returns an enumeration of the entries in this ACL. Each element in
+     * the enumeration is of type AclEntry.
+     *
+     * @return an enumeration of the entries in this ACL.
+     */
+    public Enumeration<AclEntry> entries();
+
+    /**
+     * Checks whether or not the specified principal has the specified
+     * permission. If it does, true is returned, otherwise false is returned.
+     *
+     * More specifically, this method checks whether the passed permission
+     * is a member of the allowed permission set of the specified principal.
+     * The allowed permission set is determined by the same algorithm as is
+     * used by the {@code getPermissions} method.
+     *
+     * @param principal the principal, assumed to be a valid authenticated
+     * Principal.
+     *
+     * @param permission the permission to be checked for.
+     *
+     * @return true if the principal has the specified permission, false
+     * otherwise.
+     *
+     * @see #getPermissions
+     */
+    public boolean checkPermission(Principal principal, Permission permission);
+
+    /**
+     * Returns a string representation of the
+     * ACL contents.
+     *
+     * @return a string representation of the ACL contents.
+     */
+    public String toString();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/security/acl/AclEntry.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 1996, 2013, 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.security.acl;
+
+import java.util.Enumeration;
+import java.security.Principal;
+
+/**
+ * This is the interface used for representing one entry in an Access
+ * Control List (ACL).<p>
+ *
+ * An ACL can be thought of as a data structure with multiple ACL entry
+ * objects. Each ACL entry object contains a set of permissions associated
+ * with a particular principal. (A principal represents an entity such as
+ * an individual user or a group). Additionally, each ACL entry is specified
+ * as being either positive or negative. If positive, the permissions are
+ * to be granted to the associated principal. If negative, the permissions
+ * are to be denied. Each principal can have at most one positive ACL entry
+ * and one negative entry; that is, multiple positive or negative ACL
+ * entries are not allowed for any principal.
+ *
+ * Note: ACL entries are by default positive. An entry becomes a
+ * negative entry only if the
+ * {@link #setNegativePermissions() setNegativePermissions}
+ * method is called on it.
+ *
+ * @see java.security.acl.Acl
+ *
+ * @author      Satish Dharmaraj
+ */
+public interface AclEntry extends Cloneable {
+
+    /**
+     * Specifies the principal for which permissions are granted or denied
+     * by this ACL entry. If a principal was already set for this ACL entry,
+     * false is returned, otherwise true is returned.
+     *
+     * @param user the principal to be set for this entry.
+     *
+     * @return true if the principal is set, false if there was
+     * already a principal set for this entry.
+     *
+     * @see #getPrincipal
+     */
+    public boolean setPrincipal(Principal user);
+
+    /**
+     * Returns the principal for which permissions are granted or denied by
+     * this ACL entry. Returns null if there is no principal set for this
+     * entry yet.
+     *
+     * @return the principal associated with this entry.
+     *
+     * @see #setPrincipal
+     */
+    public Principal getPrincipal();
+
+    /**
+     * Sets this ACL entry to be a negative one. That is, the associated
+     * principal (e.g., a user or a group) will be denied the permission set
+     * specified in the entry.
+     *
+     * Note: ACL entries are by default positive. An entry becomes a
+     * negative entry only if this {@code setNegativePermissions}
+     * method is called on it.
+     */
+    public void setNegativePermissions();
+
+    /**
+     * Returns true if this is a negative ACL entry (one denying the
+     * associated principal the set of permissions in the entry), false
+     * otherwise.
+     *
+     * @return true if this is a negative ACL entry, false if it's not.
+     */
+    public boolean isNegative();
+
+    /**
+     * Adds the specified permission to this ACL entry. Note: An entry can
+     * have multiple permissions.
+     *
+     * @param permission the permission to be associated with
+     * the principal in this entry.
+     *
+     * @return true if the permission was added, false if the
+     * permission was already part of this entry's permission set.
+     */
+    public boolean addPermission(Permission permission);
+
+    /**
+     * Removes the specified permission from this ACL entry.
+     *
+     * @param permission the permission to be removed from this entry.
+     *
+     * @return true if the permission is removed, false if the
+     * permission was not part of this entry's permission set.
+     */
+    public boolean removePermission(Permission permission);
+
+    /**
+     * Checks if the specified permission is part of the
+     * permission set in this entry.
+     *
+     * @param permission the permission to be checked for.
+     *
+     * @return true if the permission is part of the
+     * permission set in this entry, false otherwise.
+     */
+    public boolean checkPermission(Permission permission);
+
+    /**
+     * Returns an enumeration of the permissions in this ACL entry.
+     *
+     * @return an enumeration of the permissions in this ACL entry.
+     */
+    public Enumeration<Permission> permissions();
+
+    /**
+     * Returns a string representation of the contents of this ACL entry.
+     *
+     * @return a string representation of the contents.
+     */
+    public String toString();
+
+    /**
+     * Clones this ACL entry.
+     *
+     * @return a clone of this ACL entry.
+     */
+    public Object clone();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/security/acl/AclNotFoundException.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 1996, 2003, 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.security.acl;
+
+/**
+ * This is an exception that is thrown whenever a reference is made to a
+ * non-existent ACL (Access Control List).
+ *
+ * @author      Satish Dharmaraj
+ */
+public class AclNotFoundException extends Exception {
+
+    private static final long serialVersionUID = 5684295034092681791L;
+
+    /**
+     * Constructs an AclNotFoundException.
+     */
+    public AclNotFoundException() {
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/security/acl/Group.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 1996, 2013, 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.security.acl;
+
+import java.util.Enumeration;
+import java.security.Principal;
+
+/**
+ * This interface is used to represent a group of principals. (A principal
+ * represents an entity such as an individual user or a company). <p>
+ *
+ * Note that Group extends Principal. Thus, either a Principal or a Group can
+ * be passed as an argument to methods containing a Principal parameter. For
+ * example, you can add either a Principal or a Group to a Group object by
+ * calling the object's {@code addMember} method, passing it the
+ * Principal or Group.
+ *
+ * @author      Satish Dharmaraj
+ */
+public interface Group extends Principal {
+
+    /**
+     * Adds the specified member to the group.
+     *
+     * @param user the principal to add to this group.
+     *
+     * @return true if the member was successfully added,
+     * false if the principal was already a member.
+     */
+    public boolean addMember(Principal user);
+
+    /**
+     * Removes the specified member from the group.
+     *
+     * @param user the principal to remove from this group.
+     *
+     * @return true if the principal was removed, or
+     * false if the principal was not a member.
+     */
+    public boolean removeMember(Principal user);
+
+    /**
+     * Returns true if the passed principal is a member of the group.
+     * This method does a recursive search, so if a principal belongs to a
+     * group which is a member of this group, true is returned.
+     *
+     * @param member the principal whose membership is to be checked.
+     *
+     * @return true if the principal is a member of this group,
+     * false otherwise.
+     */
+    public boolean isMember(Principal member);
+
+
+    /**
+     * Returns an enumeration of the members in the group.
+     * The returned objects can be instances of either Principal
+     * or Group (which is a subclass of Principal).
+     *
+     * @return an enumeration of the group members.
+     */
+    public Enumeration<? extends Principal> members();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/security/acl/LastOwnerException.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 1996, 2003, 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.security.acl;
+
+/**
+ * This is an exception that is thrown whenever an attempt is made to delete
+ * the last owner of an Access Control List.
+ *
+ * @see java.security.acl.Owner#deleteOwner
+ *
+ * @author Satish Dharmaraj
+ */
+public class LastOwnerException extends Exception {
+
+    private static final long serialVersionUID = -5141997548211140359L;
+
+    /**
+     * Constructs a LastOwnerException.
+     */
+    public LastOwnerException() {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/security/acl/NotOwnerException.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 1996, 2003, 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.security.acl;
+
+/**
+ * This is an exception that is thrown whenever the modification of an object
+ * (such as an Access Control List) is only allowed to be done by an owner of
+ * the object, but the Principal attempting the modification is not an owner.
+ *
+ * @author      Satish Dharmaraj
+ */
+public class NotOwnerException extends Exception {
+
+    private static final long serialVersionUID = -5555597911163362399L;
+
+    /**
+     * Constructs a NotOwnerException.
+     */
+    public NotOwnerException() {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/security/acl/Owner.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 1996, 2013, 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.security.acl;
+
+import java.security.Principal;
+
+/**
+ * Interface for managing owners of Access Control Lists (ACLs) or ACL
+ * configurations. (Note that the Acl interface in the
+ * {@code  java.security.acl} package extends this Owner
+ * interface.) The initial owner Principal should be specified as an
+ * argument to the constructor of the class implementing this interface.
+ *
+ * @see java.security.acl.Acl
+ *
+ */
+public interface Owner {
+
+    /**
+     * Adds an owner. Only owners can modify ACL contents. The caller
+     * principal must be an owner of the ACL in order to invoke this method.
+     * That is, only an owner can add another owner. The initial owner is
+     * configured at ACL construction time.
+     *
+     * @param caller the principal invoking this method. It must be an owner
+     * of the ACL.
+     *
+     * @param owner the owner that should be added to the list of owners.
+     *
+     * @return true if successful, false if owner is already an owner.
+     * @exception NotOwnerException if the caller principal is not an owner
+     * of the ACL.
+     */
+    public boolean addOwner(Principal caller, Principal owner)
+      throws NotOwnerException;
+
+    /**
+     * Deletes an owner. If this is the last owner in the ACL, an exception is
+     * raised.<p>
+     *
+     * The caller principal must be an owner of the ACL in order to invoke
+     * this method.
+     *
+     * @param caller the principal invoking this method. It must be an owner
+     * of the ACL.
+     *
+     * @param owner the owner to be removed from the list of owners.
+     *
+     * @return true if the owner is removed, false if the owner is not part
+     * of the list of owners.
+     *
+     * @exception NotOwnerException if the caller principal is not an owner
+     * of the ACL.
+     *
+     * @exception LastOwnerException if there is only one owner left, so that
+     * deleteOwner would leave the ACL owner-less.
+     */
+    public boolean deleteOwner(Principal caller, Principal owner)
+      throws NotOwnerException, LastOwnerException;
+
+    /**
+     * Returns true if the given principal is an owner of the ACL.
+     *
+     * @param owner the principal to be checked to determine whether or not
+     * it is an owner.
+     *
+     * @return true if the passed principal is in the list of owners, false
+     * if not.
+     */
+    public boolean isOwner(Principal owner);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/security/acl/Permission.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 1996, 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.security.acl;
+
+
+/**
+ * This interface represents a permission, such as that used to grant
+ * a particular type of access to a resource.
+ *
+ * @author Satish Dharmaraj
+ */
+public interface Permission {
+
+    /**
+     * Returns true if the object passed matches the permission represented
+     * in this interface.
+     *
+     * @param another the Permission object to compare with.
+     *
+     * @return true if the Permission objects are equal, false otherwise
+     */
+    public boolean equals(Object another);
+
+    /**
+     * Prints a string representation of this permission.
+     *
+     * @return the string representation of the permission.
+     */
+    public String toString();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/security/acl/package-info.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 1998, 2013, 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.
+ */
+
+/**
+ * The classes and interfaces in this package have been
+ * superseded by classes in the java.security package.
+ * See that package and, for example, java.security.Permission for details.
+ *
+ * @since 1.1
+ */
+package java.security.acl;
--- a/jdk/src/java.base/share/classes/java/time/Clock.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/time/Clock.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -61,12 +61,15 @@
  */
 package java.time;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
 import static java.time.LocalTime.NANOS_PER_MINUTE;
 import static java.time.LocalTime.NANOS_PER_SECOND;
 
 import java.io.Serializable;
 import java.util.Objects;
 import java.util.TimeZone;
+import sun.misc.VM;
 
 /**
  * A clock providing access to the current instant, date and time using a time-zone.
@@ -446,10 +449,22 @@
      */
     static final class SystemClock extends Clock implements Serializable {
         private static final long serialVersionUID = 6740630888130243051L;
+        private static final long OFFSET_SEED =
+                System.currentTimeMillis()/1000 - 1024; // initial offest
         private final ZoneId zone;
+        // We don't actually need a volatile here.
+        // We don't care if offset is set or read concurrently by multiple
+        // threads - we just need a value which is 'recent enough' - in other
+        // words something that has been updated at least once in the last
+        // 2^32 secs (~136 years). And even if we by chance see an invalid
+        // offset, the worst that can happen is that we will get a -1 value
+        // from getNanoTimeAdjustment, forcing us to update the offset
+        // once again.
+        private transient long offset;
 
         SystemClock(ZoneId zone) {
             this.zone = zone;
+            this.offset = OFFSET_SEED;
         }
         @Override
         public ZoneId getZone() {
@@ -464,11 +479,50 @@
         }
         @Override
         public long millis() {
+            // System.currentTimeMillis() and VM.getNanoTimeAdjustment(offset)
+            // use the same time source - System.currentTimeMillis() simply
+            // limits the resolution to milliseconds.
+            // So we take the faster path and call System.currentTimeMillis()
+            // directly - in order to avoid the performance penalty of
+            // VM.getNanoTimeAdjustment(offset) which is less efficient.
             return System.currentTimeMillis();
         }
         @Override
         public Instant instant() {
-            return Instant.ofEpochMilli(millis());
+            // Take a local copy of offset. offset can be updated concurrently
+            // by other threads (even if we haven't made it volatile) so we will
+            // work with a local copy.
+            long localOffset = offset;
+            long adjustment = VM.getNanoTimeAdjustment(localOffset);
+
+            if (adjustment == -1) {
+                // -1 is a sentinel value returned by VM.getNanoTimeAdjustment
+                // when the offset it is given is too far off the current UTC
+                // time. In principle, this should not happen unless the
+                // JVM has run for more than ~136 years (not likely) or
+                // someone is fiddling with the system time, or the offset is
+                // by chance at 1ns in the future (very unlikely).
+                // We can easily recover from all these conditions by bringing
+                // back the offset in range and retry.
+
+                // bring back the offset in range. We use -1024 to make
+                // it more unlikely to hit the 1ns in the future condition.
+                localOffset = System.currentTimeMillis()/1000 - 1024;
+
+                // retry
+                adjustment = VM.getNanoTimeAdjustment(localOffset);
+
+                if (adjustment == -1) {
+                    // Should not happen: we just recomputed a new offset.
+                    // It should have fixed the issue.
+                    throw new InternalError("Offset " + localOffset + " is not in range");
+                } else {
+                    // OK - recovery succeeded. Update the offset for the
+                    // next call...
+                    offset = localOffset;
+                }
+            }
+            return Instant.ofEpochSecond(localOffset, adjustment);
         }
         @Override
         public boolean equals(Object obj) {
@@ -485,6 +539,12 @@
         public String toString() {
             return "SystemClock[" + zone + "]";
         }
+        private void readObject(ObjectInputStream is)
+                throws IOException, ClassNotFoundException {
+            // ensure that offset is initialized
+            is.defaultReadObject();
+            offset = OFFSET_SEED;
+        }
     }
 
     //-----------------------------------------------------------------------
--- a/jdk/src/java.base/share/classes/java/time/chrono/JapaneseEra.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/time/chrono/JapaneseEra.java	Wed Jul 05 20:18:12 2017 +0200
@@ -195,10 +195,11 @@
      * @throws DateTimeException if the value is invalid
      */
     public static JapaneseEra of(int japaneseEra) {
-        if (japaneseEra < MEIJI.eraValue || japaneseEra + ERA_OFFSET > KNOWN_ERAS.length) {
+        int i = ordinal(japaneseEra);
+        if (i < 0 || i >= KNOWN_ERAS.length) {
             throw new DateTimeException("Invalid era: " + japaneseEra);
         }
-        return KNOWN_ERAS[ordinal(japaneseEra)];
+        return KNOWN_ERAS[i];
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatter.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatter.java	Wed Jul 05 20:18:12 2017 +0200
@@ -117,8 +117,9 @@
  * {@code parse(CharSequence text, DateTimeFormatter formatter)}.
  * <p>For example:
  * <blockquote><pre>
+ *  LocalDate date = LocalDate.now();
  *  String text = date.format(formatter);
- *  LocalDate date = LocalDate.parse(text, formatter);
+ *  LocalDate parsedDate = LocalDate.parse(text, formatter);
  * </pre></blockquote>
  * <p>
  * In addition to the format, formatters can be created with desired Locale,
@@ -265,9 +266,10 @@
  * <p>
  * For example:
  * <blockquote><pre>
+ *  LocalDate date = LocalDate.now();
  *  DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy MM dd");
  *  String text = date.format(formatter);
- *  LocalDate date = LocalDate.parse(text, formatter);
+ *  LocalDate parsedDate = LocalDate.parse(text, formatter);
  * </pre></blockquote>
  * <p>
  * All letters 'A' to 'Z' and 'a' to 'z' are reserved as pattern letters. The
--- a/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Wed Jul 05 20:18:12 2017 +0200
@@ -849,6 +849,7 @@
      * @param fractionalDigits  the number of fractional second digits to format with,
      *  from 0 to 9, or -1 to use as many digits as necessary
      * @return this, for chaining, not null
+     * @throws IllegalArgumentException if the number of fractional digits is invalid
      */
     public DateTimeFormatterBuilder appendInstant(int fractionalDigits) {
         if (fractionalDigits < -1 || fractionalDigits > 9) {
@@ -909,6 +910,7 @@
      * @param pattern  the pattern to use, not null
      * @param noOffsetText  the text to use when the offset is zero, not null
      * @return this, for chaining, not null
+     * @throws IllegalArgumentException if the pattern is invalid
      */
     public DateTimeFormatterBuilder appendOffset(String pattern, String noOffsetText) {
         appendInternal(new OffsetIdPrinterParser(pattern, noOffsetText));
--- a/jdk/src/java.base/share/classes/java/time/package-info.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/time/package-info.java	Wed Jul 05 20:18:12 2017 +0200
@@ -65,7 +65,7 @@
  * The main API for dates, times, instants, and durations.
  * </p>
  * <p>
- * The classes defined here represent the principal date-time concepts,
+ * The classes defined here represent the principle date-time concepts,
  * including instants, durations, dates, times, time-zones and periods.
  * They are based on the ISO calendar system, which is the <i>de facto</i> world
  * calendar following the proleptic Gregorian rules.
@@ -247,8 +247,8 @@
  * </ul>
  * <p>
  * Multiple calendar systems is an awkward addition to the design challenges.
- * The first principal is that most users want the standard ISO calendar system.
- * As such, the main classes are ISO-only. The second principal is that most of those that want a
+ * The first principle is that most users want the standard ISO calendar system.
+ * As such, the main classes are ISO-only. The second principle is that most of those that want a
  * non-ISO calendar system want it for user interaction, thus it is a UI localization issue.
  * As such, date and time objects should be held as ISO objects in the data model and persistent
  * storage, only being converted to and from a local calendar for display.
--- a/jdk/src/java.base/share/classes/java/util/Formatter.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/Formatter.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -57,6 +57,7 @@
 import java.time.temporal.ChronoField;
 import java.time.temporal.TemporalAccessor;
 import java.time.temporal.TemporalQueries;
+import java.time.temporal.UnsupportedTemporalTypeException;
 
 import sun.misc.DoubleConsts;
 import sun.misc.FormattedFloatingDecimal;
@@ -4056,7 +4057,12 @@
                     break;
                 }
                 case DateTime.NANOSECOND:  { // 'N' (000000000 - 999999999)
-                    int i = t.get(ChronoField.MILLI_OF_SECOND) * 1000000;
+                    int i;
+                    try {
+                        i = t.get(ChronoField.NANO_OF_SECOND);
+                    } catch (UnsupportedTemporalTypeException u) {
+                        i = t.get(ChronoField.MILLI_OF_SECOND) * 1000000;
+                    }
                     Flags flags = Flags.ZERO_PAD;
                     sb.append(localizedMagnitude(null, i, flags, 9, l));
                     break;
--- a/jdk/src/java.base/share/classes/java/util/Optional.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/Optional.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -28,6 +28,7 @@
 import java.util.function.Function;
 import java.util.function.Predicate;
 import java.util.function.Supplier;
+import java.util.stream.Stream;
 
 /**
  * A container object which may or may not contain a non-null value.
@@ -155,8 +156,9 @@
      * null
      */
     public void ifPresent(Consumer<? super T> consumer) {
-        if (value != null)
+        if (value != null) {
             consumer.accept(value);
+        }
     }
 
     /**
@@ -172,10 +174,11 @@
      */
     public Optional<T> filter(Predicate<? super T> predicate) {
         Objects.requireNonNull(predicate);
-        if (!isPresent())
+        if (!isPresent()) {
             return this;
-        else
+        } else {
             return predicate.test(value) ? this : empty();
+        }
     }
 
     /**
@@ -209,9 +212,9 @@
      */
     public<U> Optional<U> map(Function<? super T, ? extends U> mapper) {
         Objects.requireNonNull(mapper);
-        if (!isPresent())
+        if (!isPresent()) {
             return empty();
-        else {
+        } else {
             return Optional.ofNullable(mapper.apply(value));
         }
     }
@@ -235,14 +238,37 @@
      */
     public<U> Optional<U> flatMap(Function<? super T, Optional<U>> mapper) {
         Objects.requireNonNull(mapper);
-        if (!isPresent())
+        if (!isPresent()) {
             return empty();
-        else {
+        } else {
             return Objects.requireNonNull(mapper.apply(value));
         }
     }
 
     /**
+     * If a value is present return a sequential {@link Stream} containing only
+     * that value, otherwise return an empty {@code Stream}.
+     *
+     * @apiNote This method can be used to transform a {@code Stream} of
+     * optional elements to a {@code Stream} of present value elements:
+     *
+     * <pre>{@code
+     *     Stream<Optional<T>> os = ..
+     *     Stream<T> s = os.flatMap(Optional::stream)
+     * }</pre>
+     *
+     * @return the optional value as a {@code Stream}
+     * @since 1.9
+     */
+    public Stream<T> stream() {
+        if (!isPresent()) {
+            return Stream.empty();
+        } else {
+            return Stream.of(value);
+        }
+    }
+
+    /**
      * Return the value if present, otherwise return {@code other}.
      *
      * @param other the value to be returned if there is no value present, may
--- a/jdk/src/java.base/share/classes/java/util/OptionalDouble.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/OptionalDouble.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 import java.util.function.DoubleConsumer;
 import java.util.function.DoubleSupplier;
 import java.util.function.Supplier;
+import java.util.stream.DoubleStream;
 
 /**
  * A container object which may or may not contain a {@code double} value.
@@ -138,8 +139,32 @@
      * null
      */
     public void ifPresent(DoubleConsumer consumer) {
-        if (isPresent)
+        if (isPresent) {
             consumer.accept(value);
+        }
+    }
+
+    /**
+     * If a value is present return a sequential {@link DoubleStream} containing
+     * only that value, otherwise return an empty {@code DoubleStream}.
+     *
+     * @apiNote This method can be used to transform a {@code Stream} of
+     * optional doubles to a {@code DoubleStream} of present doubles:
+     *
+     * <pre>{@code
+     *     Stream<OptionalDouble> os = ..
+     *     DoubleStream s = os.flatMapToDouble(OptionalDouble::stream)
+     * }</pre>
+     *
+     * @return the optional value as a {@code DoubleStream}
+     * @since 1.9
+     */
+    public DoubleStream stream() {
+        if (isPresent) {
+            return DoubleStream.of(value);
+        } else {
+            return DoubleStream.empty();
+        }
     }
 
     /**
@@ -182,7 +207,7 @@
      * @throws NullPointerException if no value is present and
      * {@code exceptionSupplier} is null
      */
-    public<X extends Throwable> double orElseThrow(Supplier<X> exceptionSupplier) throws X {
+    public<X extends Throwable> double orElseThrow(Supplier<? extends X> exceptionSupplier) throws X {
         if (isPresent) {
             return value;
         } else {
--- a/jdk/src/java.base/share/classes/java/util/OptionalInt.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/OptionalInt.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 import java.util.function.IntConsumer;
 import java.util.function.IntSupplier;
 import java.util.function.Supplier;
+import java.util.stream.IntStream;
 
 /**
  * A container object which may or may not contain a {@code int} value.
@@ -138,8 +139,32 @@
      * null
      */
     public void ifPresent(IntConsumer consumer) {
-        if (isPresent)
+        if (isPresent) {
             consumer.accept(value);
+        }
+    }
+
+    /**
+     * If a value is present return a sequential {@link IntStream} containing
+     * only that value, otherwise return an empty {@code IntStream}.
+     *
+     * @apiNote This method can be used to transform a {@code Stream} of
+     * optional integers to an {@code IntStream} of present integers:
+     *
+     * <pre>{@code
+     *     Stream<OptionalInt> os = ..
+     *     IntStream s = os.flatMapToInt(OptionalInt::stream)
+     * }</pre>
+     *
+     * @return the optional value as an {@code IntStream}
+     * @since 1.9
+     */
+    public IntStream stream() {
+        if (isPresent) {
+            return IntStream.of(value);
+        } else {
+            return IntStream.empty();
+        }
     }
 
     /**
@@ -182,7 +207,7 @@
      * @throws NullPointerException if no value is present and
      * {@code exceptionSupplier} is null
      */
-    public<X extends Throwable> int orElseThrow(Supplier<X> exceptionSupplier) throws X {
+    public<X extends Throwable> int orElseThrow(Supplier<? extends X> exceptionSupplier) throws X {
         if (isPresent) {
             return value;
         } else {
--- a/jdk/src/java.base/share/classes/java/util/OptionalLong.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/OptionalLong.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 import java.util.function.LongConsumer;
 import java.util.function.LongSupplier;
 import java.util.function.Supplier;
+import java.util.stream.LongStream;
 
 /**
  * A container object which may or may not contain a {@code long} value.
@@ -138,8 +139,32 @@
      * null
      */
     public void ifPresent(LongConsumer consumer) {
-        if (isPresent)
+        if (isPresent) {
             consumer.accept(value);
+        }
+    }
+
+    /**
+     * If a value is present return a sequential {@link LongStream} containing
+     * only that value, otherwise return an empty {@code LongStream}.
+     *
+     * @apiNote This method can be used to transform a {@code Stream} of
+     * optional longs to a {@code LongStream} of present longs:
+     *
+     * <pre>{@code
+     *     Stream<OptionalLong> os = ..
+     *     LongStream s = os.flatMapToLong(OptionalLong::stream)
+     * }</pre>
+     *
+     * @return the optional value as a {@code LongStream}
+     * @since 1.9
+     */
+    public LongStream stream() {
+        if (isPresent) {
+            return LongStream.of(value);
+        } else {
+            return LongStream.empty();
+        }
     }
 
     /**
@@ -182,7 +207,7 @@
      * @throws NullPointerException if no value is present and
      * {@code exceptionSupplier} is null
      */
-    public<X extends Throwable> long orElseThrow(Supplier<X> exceptionSupplier) throws X {
+    public<X extends Throwable> long orElseThrow(Supplier<? extends X> exceptionSupplier) throws X {
         if (isPresent) {
             return value;
         } else {
--- a/jdk/src/java.base/share/classes/java/util/concurrent/TimeUnit.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/TimeUnit.java	Wed Jul 05 20:18:12 2017 +0200
@@ -131,6 +131,7 @@
 
     /**
      * Time unit representing sixty seconds
+     * @since 1.6
      */
     MINUTES {
         public long toNanos(long d)   { return x(d, C4/C0, MAX/(C4/C0)); }
@@ -146,6 +147,7 @@
 
     /**
      * Time unit representing sixty minutes
+     * @since 1.6
      */
     HOURS {
         public long toNanos(long d)   { return x(d, C5/C0, MAX/(C5/C0)); }
@@ -161,6 +163,7 @@
 
     /**
      * Time unit representing twenty four hours
+     * @since 1.6
      */
     DAYS {
         public long toNanos(long d)   { return x(d, C6/C0, MAX/(C6/C0)); }
--- a/jdk/src/java.base/share/classes/java/util/stream/BaseStream.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/stream/BaseStream.java	Wed Jul 05 20:18:12 2017 +0200
@@ -79,6 +79,14 @@
      * <p>This is a <a href="package-summary.html#StreamOps">terminal
      * operation</a>.
      *
+     * <p>
+     * The returned spliterator should report the set of characteristics derived
+     * from the stream pipeline (namely the characteristics derived from the
+     * stream source spliterator and the intermediate operations).
+     * Implementations may report a sub-set of those characteristics.  For
+     * example, it may be too expensive to compute the entire set for some or
+     * all possible stream pipelines.
+     *
      * @return the element spliterator for this stream
      */
     Spliterator<T> spliterator();
--- a/jdk/src/java.base/share/classes/sun/misc/VM.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/misc/VM.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, 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
@@ -402,6 +402,36 @@
      */
     public static native long getegid();
 
+    /**
+     * Get a nanosecond time stamp adjustment in the form of a single long.
+     *
+     * This value can be used to create an instant using
+     * {@link java.time.Instant#ofEpochSecond(long, long)
+     *  java.time.Instant.ofEpochSecond(offsetInSeconds,
+     *  getNanoTimeAdjustment(offsetInSeconds))}.
+     * <p>
+     * The value returned has the best resolution available to the JVM on
+     * the current system.
+     * This is usually down to microseconds - or tenth of microseconds -
+     * depending on the OS/Hardware and the JVM implementation.
+     *
+     * @param offsetInSeconds The offset in seconds from which the nanosecond
+     *        time stamp should be computed.
+     *
+     * @apiNote The offset should be recent enough - so that
+     *         {@code offsetInSeconds} is within {@code +/- 2^32} seconds of the
+     *         current UTC time. If the offset is too far off, {@code -1} will be
+     *         returned. As such, {@code -1} must not be considered as a valid
+     *         nano time adjustment, but as an exception value indicating
+     *         that an offset closer to the current time should be used.
+     *
+     * @return A nanosecond time stamp adjustment in the form of a single long.
+     *     If the offset is too far off the current time, this method returns -1.
+     *     In that case, the caller should call this method again, passing a
+     *     more accurate offset.
+     */
+    public static native long getNanoTimeAdjustment(long offsetInSeconds);
+
     static {
         initialize();
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/acl/AclEntryImpl.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 1996, 2011, 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 sun.security.acl;
+
+import java.util.*;
+import java.security.Principal;
+import java.security.acl.*;
+
+/**
+ * This is a class that describes one entry that associates users
+ * or groups with permissions in the ACL.
+ * The entry may be used as a way of granting or denying permissions.
+ * @author      Satish Dharmaraj
+ */
+public class AclEntryImpl implements AclEntry {
+    private Principal user = null;
+    private Vector<Permission> permissionSet = new Vector<>(10, 10);
+    private boolean negative = false;
+
+    /**
+     * Construct an ACL entry that associates a user with permissions
+     * in the ACL.
+     * @param user The user that is associated with this entry.
+     */
+    public AclEntryImpl(Principal user) {
+        this.user = user;
+    }
+
+    /**
+     * Construct a null ACL entry
+     */
+    public AclEntryImpl() {
+    }
+
+    /**
+     * Sets the principal in the entity. If a group or a
+     * principal had already been set, a false value is
+     * returned, otherwise a true value is returned.
+     * @param user The user that is associated with this entry.
+     * @return true if the principal is set, false if there is
+     * one already.
+     */
+    public boolean setPrincipal(Principal user) {
+        if (this.user != null)
+          return false;
+        this.user = user;
+        return true;
+    }
+
+    /**
+     * This method sets the ACL to have negative permissions.
+     * That is the user or group is denied the permission set
+     * specified in the entry.
+     */
+    public void setNegativePermissions() {
+        negative = true;
+    }
+
+    /**
+     * Returns true if this is a negative ACL.
+     */
+    public boolean isNegative() {
+        return negative;
+    }
+
+    /**
+     * A principal or a group can be associated with multiple
+     * permissions. This method adds a permission to the ACL entry.
+     * @param permission The permission to be associated with
+     * the principal or the group in the entry.
+     * @return true if the permission was added, false if the
+     * permission was already part of the permission set.
+     */
+    public boolean addPermission(Permission permission) {
+
+        if (permissionSet.contains(permission))
+          return false;
+
+        permissionSet.addElement(permission);
+
+        return true;
+    }
+
+    /**
+     * The method disassociates the permission from the Principal
+     * or the Group in this ACL entry.
+     * @param permission The permission to be disassociated with
+     * the principal or the group in the entry.
+     * @return true if the permission is removed, false if the
+     * permission is not part of the permission set.
+     */
+    public boolean removePermission(Permission permission) {
+        return permissionSet.removeElement(permission);
+    }
+
+    /**
+     * Checks if the passed permission is part of the allowed
+     * permission set in this entry.
+     * @param permission The permission that has to be part of
+     * the permission set in the entry.
+     * @return true if the permission passed is part of the
+     * permission set in the entry, false otherwise.
+     */
+    public boolean checkPermission(Permission permission) {
+        return permissionSet.contains(permission);
+    }
+
+    /**
+     * return an enumeration of the permissions in this ACL entry.
+     */
+    public Enumeration<Permission> permissions() {
+        return permissionSet.elements();
+    }
+
+    /**
+     * Return a string representation of  the contents of the ACL entry.
+     */
+    public String toString() {
+        StringBuffer s = new StringBuffer();
+        if (negative)
+          s.append("-");
+        else
+          s.append("+");
+        if (user instanceof Group)
+            s.append("Group.");
+        else
+            s.append("User.");
+        s.append(user + "=");
+        Enumeration<Permission> e = permissions();
+        while(e.hasMoreElements()) {
+            Permission p = e.nextElement();
+            s.append(p);
+            if (e.hasMoreElements())
+                s.append(",");
+        }
+        return new String(s);
+    }
+
+    /**
+     * Clones an AclEntry.
+     */
+    @SuppressWarnings("unchecked") // Safe casts assuming clone() works correctly
+    public synchronized Object clone() {
+        AclEntryImpl cloned;
+        cloned = new AclEntryImpl(user);
+        cloned.permissionSet = (Vector<Permission>) permissionSet.clone();
+        cloned.negative = negative;
+        return cloned;
+    }
+
+    /**
+     * Return the Principal associated in this ACL entry.
+     * The method returns null if the entry uses a group
+     * instead of a principal.
+     */
+    public Principal getPrincipal() {
+        return user;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/acl/AclImpl.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,408 @@
+/*
+ * Copyright (c) 1996, 2011, 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 sun.security.acl;
+
+import java.io.*;
+import java.util.*;
+import java.security.Principal;
+import java.security.acl.*;
+
+/**
+ * An Access Control List (ACL) is encapsulated by this class.
+ * @author      Satish Dharmaraj
+ */
+public class AclImpl extends OwnerImpl implements Acl {
+    //
+    // Maintain four tables. one each for positive and negative
+    // ACLs. One each depending on whether the entity is a group
+    // or principal.
+    //
+    private Hashtable<Principal, AclEntry> allowedUsersTable =
+                                        new Hashtable<>(23);
+    private Hashtable<Principal, AclEntry> allowedGroupsTable =
+                                        new Hashtable<>(23);
+    private Hashtable<Principal, AclEntry> deniedUsersTable =
+                                        new Hashtable<>(23);
+    private Hashtable<Principal, AclEntry> deniedGroupsTable =
+                                        new Hashtable<>(23);
+    private String aclName = null;
+    private Vector<Permission> zeroSet = new Vector<>(1,1);
+
+
+    /**
+     * Constructor for creating an empty ACL.
+     */
+    public AclImpl(Principal owner, String name) {
+        super(owner);
+        try {
+            setName(owner, name);
+        } catch (Exception e) {}
+    }
+
+    /**
+     * Sets the name of the ACL.
+     * @param caller the principal who is invoking this method.
+     * @param name the name of the ACL.
+     * @exception NotOwnerException if the caller principal is
+     * not on the owners list of the Acl.
+     */
+    public void setName(Principal caller, String name)
+      throws NotOwnerException
+    {
+        if (!isOwner(caller))
+            throw new NotOwnerException();
+
+        aclName = name;
+    }
+
+    /**
+     * Returns the name of the ACL.
+     * @return the name of the ACL.
+     */
+    public String getName() {
+        return aclName;
+    }
+
+    /**
+     * Adds an ACL entry to this ACL. An entry associates a
+     * group or a principal with a set of permissions. Each
+     * user or group can have one positive ACL entry and one
+     * negative ACL entry. If there is one of the type (negative
+     * or positive) already in the table, a false value is returned.
+     * The caller principal must be a part of the owners list of
+     * the ACL in order to invoke this method.
+     * @param caller the principal who is invoking this method.
+     * @param entry the ACL entry that must be added to the ACL.
+     * @return true on success, false if the entry is already present.
+     * @exception NotOwnerException if the caller principal
+     * is not on the owners list of the Acl.
+     */
+    public synchronized boolean addEntry(Principal caller, AclEntry entry)
+      throws NotOwnerException
+    {
+        if (!isOwner(caller))
+            throw new NotOwnerException();
+
+        Hashtable<Principal, AclEntry> aclTable = findTable(entry);
+        Principal key = entry.getPrincipal();
+
+        if (aclTable.get(key) != null)
+            return false;
+
+        aclTable.put(key, entry);
+        return true;
+    }
+
+    /**
+     * Removes an ACL entry from this ACL.
+     * The caller principal must be a part of the owners list of the ACL
+     * in order to invoke this method.
+     * @param caller the principal who is invoking this method.
+     * @param entry the ACL entry that must be removed from the ACL.
+     * @return true on success, false if the entry is not part of the ACL.
+     * @exception NotOwnerException if the caller principal is not
+     * the owners list of the Acl.
+     */
+    public synchronized boolean removeEntry(Principal caller, AclEntry entry)
+      throws NotOwnerException
+    {
+        if (!isOwner(caller))
+            throw new NotOwnerException();
+
+        Hashtable<Principal, AclEntry> aclTable = findTable(entry);
+        Principal key = entry.getPrincipal();
+
+        AclEntry o = aclTable.remove(key);
+        return (o != null);
+    }
+
+    /**
+     * This method returns the set of allowed permissions for the
+     * specified principal. This set of allowed permissions is calculated
+     * as follows:
+     *
+     * If there is no entry for a group or a principal an empty permission
+     * set is assumed.
+     *
+     * The group positive permission set is the union of all
+     * the positive permissions of each group that the individual belongs to.
+     * The group negative permission set is the union of all
+     * the negative permissions of each group that the individual belongs to.
+     * If there is a specific permission that occurs in both
+     * the postive permission set and the negative permission set,
+     * it is removed from both. The group positive and negatoive permission
+     * sets are calculated.
+     *
+     * The individial positive permission set and the individual negative
+     * permission set is then calculated. Again abscence of an entry means
+     * the empty set.
+     *
+     * The set of permissions granted to the principal is then calculated using
+     * the simple rule: Individual permissions always override the Group permissions.
+     * Specifically, individual negative permission set (specific
+     * denial of permissions) overrides the group positive permission set.
+     * And the individual positive permission set override the group negative
+     * permission set.
+     *
+     * @param user the principal for which the ACL entry is returned.
+     * @return The resulting permission set that the principal is allowed.
+     */
+    public synchronized Enumeration<Permission> getPermissions(Principal user) {
+
+        Enumeration<Permission> individualPositive;
+        Enumeration<Permission> individualNegative;
+        Enumeration<Permission> groupPositive;
+        Enumeration<Permission> groupNegative;
+
+        //
+        // canonicalize the sets. That is remove common permissions from
+        // positive and negative sets.
+        //
+        groupPositive =
+            subtract(getGroupPositive(user), getGroupNegative(user));
+        groupNegative  =
+            subtract(getGroupNegative(user), getGroupPositive(user));
+        individualPositive =
+            subtract(getIndividualPositive(user), getIndividualNegative(user));
+        individualNegative =
+            subtract(getIndividualNegative(user), getIndividualPositive(user));
+
+        //
+        // net positive permissions is individual positive permissions
+        // plus (group positive - individual negative).
+        //
+        Enumeration<Permission> temp1 =
+            subtract(groupPositive, individualNegative);
+        Enumeration<Permission> netPositive =
+            union(individualPositive, temp1);
+
+        // recalculate the enumeration since we lost it in performing the
+        // subtraction
+        //
+        individualPositive =
+            subtract(getIndividualPositive(user), getIndividualNegative(user));
+        individualNegative =
+            subtract(getIndividualNegative(user), getIndividualPositive(user));
+
+        //
+        // net negative permissions is individual negative permissions
+        // plus (group negative - individual positive).
+        //
+        temp1 = subtract(groupNegative, individualPositive);
+        Enumeration<Permission> netNegative = union(individualNegative, temp1);
+
+        return subtract(netPositive, netNegative);
+    }
+
+    /**
+     * This method checks whether or not the specified principal
+     * has the required permission. If permission is denied
+     * permission false is returned, a true value is returned otherwise.
+     * This method does not authenticate the principal. It presumes that
+     * the principal is a valid authenticated principal.
+     * @param principal the name of the authenticated principal
+     * @param permission the permission that the principal must have.
+     * @return true of the principal has the permission desired, false
+     * otherwise.
+     */
+    public boolean checkPermission(Principal principal, Permission permission)
+    {
+        Enumeration<Permission> permSet = getPermissions(principal);
+        while (permSet.hasMoreElements()) {
+            Permission p = permSet.nextElement();
+            if (p.equals(permission))
+              return true;
+        }
+        return false;
+    }
+
+    /**
+     * returns an enumeration of the entries in this ACL.
+     */
+    public synchronized Enumeration<AclEntry> entries() {
+        return new AclEnumerator(this,
+                                 allowedUsersTable, allowedGroupsTable,
+                                 deniedUsersTable, deniedGroupsTable);
+    }
+
+    /**
+     * return a stringified version of the
+     * ACL.
+     */
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        Enumeration<AclEntry> entries = entries();
+        while (entries.hasMoreElements()) {
+            AclEntry entry = entries.nextElement();
+            sb.append(entry.toString().trim());
+            sb.append("\n");
+        }
+
+        return sb.toString();
+    }
+
+    //
+    // Find the table that this entry belongs to. There are 4
+    // tables that are maintained. One each for postive and
+    // negative ACLs and one each for groups and users.
+    // This method figures out which
+    // table is the one that this AclEntry belongs to.
+    //
+    private Hashtable<Principal, AclEntry> findTable(AclEntry entry) {
+        Hashtable<Principal, AclEntry> aclTable = null;
+
+        Principal p = entry.getPrincipal();
+        if (p instanceof Group) {
+            if (entry.isNegative())
+                aclTable = deniedGroupsTable;
+            else
+                aclTable = allowedGroupsTable;
+        } else {
+            if (entry.isNegative())
+                aclTable = deniedUsersTable;
+            else
+                aclTable = allowedUsersTable;
+        }
+        return aclTable;
+    }
+
+    //
+    // returns the set e1 U e2.
+    //
+    private static Enumeration<Permission> union(Enumeration<Permission> e1,
+                Enumeration<Permission> e2) {
+        Vector<Permission> v = new Vector<>(20, 20);
+
+        while (e1.hasMoreElements())
+            v.addElement(e1.nextElement());
+
+        while (e2.hasMoreElements()) {
+            Permission o = e2.nextElement();
+            if (!v.contains(o))
+                v.addElement(o);
+        }
+
+        return v.elements();
+    }
+
+    //
+    // returns the set e1 - e2.
+    //
+    private Enumeration<Permission> subtract(Enumeration<Permission> e1,
+                Enumeration<Permission> e2) {
+        Vector<Permission> v = new Vector<>(20, 20);
+
+        while (e1.hasMoreElements())
+            v.addElement(e1.nextElement());
+
+        while (e2.hasMoreElements()) {
+            Permission o = e2.nextElement();
+            if (v.contains(o))
+                v.removeElement(o);
+        }
+
+        return v.elements();
+    }
+
+    private Enumeration<Permission> getGroupPositive(Principal user) {
+        Enumeration<Permission> groupPositive = zeroSet.elements();
+        Enumeration<Principal> e = allowedGroupsTable.keys();
+        while (e.hasMoreElements()) {
+            Group g = (Group)e.nextElement();
+            if (g.isMember(user)) {
+                AclEntry ae = allowedGroupsTable.get(g);
+                groupPositive = union(ae.permissions(), groupPositive);
+            }
+        }
+        return groupPositive;
+    }
+
+    private Enumeration<Permission> getGroupNegative(Principal user) {
+        Enumeration<Permission> groupNegative = zeroSet.elements();
+        Enumeration<Principal> e = deniedGroupsTable.keys();
+        while (e.hasMoreElements()) {
+            Group g = (Group)e.nextElement();
+            if (g.isMember(user)) {
+                AclEntry ae = deniedGroupsTable.get(g);
+                groupNegative = union(ae.permissions(), groupNegative);
+            }
+        }
+        return groupNegative;
+    }
+
+    private Enumeration<Permission> getIndividualPositive(Principal user) {
+        Enumeration<Permission> individualPositive = zeroSet.elements();
+        AclEntry ae = allowedUsersTable.get(user);
+        if (ae != null)
+            individualPositive = ae.permissions();
+        return individualPositive;
+    }
+
+    private Enumeration<Permission> getIndividualNegative(Principal user) {
+        Enumeration<Permission> individualNegative = zeroSet.elements();
+        AclEntry ae  = deniedUsersTable.get(user);
+        if (ae != null)
+            individualNegative = ae.permissions();
+        return individualNegative;
+    }
+}
+
+final class AclEnumerator implements Enumeration<AclEntry> {
+    Acl acl;
+    Enumeration<AclEntry> u1, u2, g1, g2;
+
+    AclEnumerator(Acl acl, Hashtable<?,AclEntry> u1, Hashtable<?,AclEntry> g1,
+                  Hashtable<?,AclEntry> u2, Hashtable<?,AclEntry> g2) {
+        this.acl = acl;
+        this.u1 = u1.elements();
+        this.u2 = u2.elements();
+        this.g1 = g1.elements();
+        this.g2 = g2.elements();
+    }
+
+    public boolean hasMoreElements() {
+        return (u1.hasMoreElements() ||
+                u2.hasMoreElements() ||
+                g1.hasMoreElements() ||
+                g2.hasMoreElements());
+    }
+
+    public AclEntry nextElement()
+    {
+        AclEntry o;
+        synchronized (acl) {
+            if (u1.hasMoreElements())
+                return u1.nextElement();
+            if (u2.hasMoreElements())
+                return u2.nextElement();
+            if (g1.hasMoreElements())
+                return g1.nextElement();
+            if (g2.hasMoreElements())
+                return g2.nextElement();
+        }
+        throw new NoSuchElementException("Acl Enumerator");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/acl/AllPermissionsImpl.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 1996, 1997, 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 sun.security.acl;
+
+import java.security.Principal;
+import java.security.acl.*;
+
+/**
+ * This class implements the principal interface for the set of all permissions.
+ * @author Satish Dharmaraj
+ */
+public class AllPermissionsImpl extends PermissionImpl {
+
+    public AllPermissionsImpl(String s) {
+        super(s);
+    }
+
+    /**
+     * This function returns true if the permission passed matches the permission represented in
+     * this interface.
+     * @param another The Permission object to compare with.
+     * @returns true always
+     */
+    public boolean equals(Permission another) {
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/acl/GroupImpl.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 1996, 2011, 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 sun.security.acl;
+
+import java.util.*;
+import java.security.*;
+import java.security.acl.*;
+
+/**
+ * This class implements a group of principals.
+ * @author      Satish Dharmaraj
+ */
+public class GroupImpl implements Group {
+    private Vector<Principal> groupMembers = new Vector<>(50, 100);
+    private String group;
+
+    /**
+     * Constructs a Group object with no members.
+     * @param groupName the name of the group
+     */
+    public GroupImpl(String groupName) {
+        this.group = groupName;
+    }
+
+    /**
+     * adds the specified member to the group.
+     * @param user The principal to add to the group.
+     * @return true if the member was added - false if the
+     * member could not be added.
+     */
+    public boolean addMember(Principal user) {
+        if (groupMembers.contains(user))
+          return false;
+
+        // do not allow groups to be added to itself.
+        if (group.equals(user.toString()))
+            throw new IllegalArgumentException();
+
+        groupMembers.addElement(user);
+        return true;
+    }
+
+    /**
+     * removes the specified member from the group.
+     * @param user The principal to remove from the group.
+     * @param true if the principal was removed false if
+     * the principal was not a member
+     */
+    public boolean removeMember(Principal user) {
+        return groupMembers.removeElement(user);
+    }
+
+    /**
+     * returns the enumeration of the members in the group.
+     */
+    public Enumeration<? extends Principal> members() {
+        return groupMembers.elements();
+    }
+
+    /**
+     * This function returns true if the group passed matches
+     * the group represented in this interface.
+     * @param another The group to compare this group to.
+     */
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof Group == false) {
+            return false;
+        }
+        Group another = (Group)obj;
+        return group.equals(another.toString());
+    }
+
+    // equals(Group) for compatibility
+    public boolean equals(Group another) {
+        return equals((Object)another);
+    }
+
+    /**
+     * Prints a stringified version of the group.
+     */
+    public String toString() {
+        return group;
+    }
+
+    /**
+     * return a hashcode for the principal.
+     */
+    public int hashCode() {
+        return group.hashCode();
+    }
+
+    /**
+     * returns true if the passed principal is a member of the group.
+     * @param member The principal whose membership must be checked for.
+     * @return true if the principal is a member of this group,
+     * false otherwise
+     */
+    public boolean isMember(Principal member) {
+
+        //
+        // if the member is part of the group (common case), return true.
+        // if not, recursively search depth first in the group looking for the
+        // principal.
+        //
+        if (groupMembers.contains(member)) {
+            return true;
+        } else {
+            Vector<Group> alreadySeen = new Vector<>(10);
+            return isMemberRecurse(member, alreadySeen);
+        }
+    }
+
+    /**
+     * return the name of the principal.
+     */
+    public String getName() {
+        return group;
+    }
+
+    //
+    // This function is the recursive search of groups for this
+    // implementation of the Group. The search proceeds building up
+    // a vector of already seen groups. Only new groups are considered,
+    // thereby avoiding loops.
+    //
+    boolean isMemberRecurse(Principal member, Vector<Group> alreadySeen) {
+        Enumeration<? extends Principal> e = members();
+        while (e.hasMoreElements()) {
+            boolean mem = false;
+            Principal p = (Principal) e.nextElement();
+
+            // if the member is in this collection, return true
+            if (p.equals(member)) {
+                return true;
+            } else if (p instanceof GroupImpl) {
+                //
+                // if not recurse if the group has not been checked already.
+                // Can call method in this package only if the object is an
+                // instance of this class. Otherwise call the method defined
+                // in the interface. (This can lead to a loop if a mixture of
+                // implementations form a loop, but we live with this improbable
+                // case rather than clutter the interface by forcing the
+                // implementation of this method.)
+                //
+                GroupImpl g = (GroupImpl) p;
+                alreadySeen.addElement(this);
+                if (!alreadySeen.contains(g))
+                  mem =  g.isMemberRecurse(member, alreadySeen);
+            } else if (p instanceof Group) {
+                Group g = (Group) p;
+                if (!alreadySeen.contains(g))
+                  mem = g.isMember(member);
+            }
+
+            if (mem)
+              return mem;
+        }
+        return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/acl/OwnerImpl.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 1996, 2006, 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 sun.security.acl;
+
+import java.util.*;
+import java.security.*;
+import java.security.acl.*;
+
+/**
+ * Class implementing the Owner interface. The
+ * initial owner principal is configured as
+ * part of the constructor.
+ * @author      Satish Dharmaraj
+ */
+public class OwnerImpl implements Owner {
+    private Group ownerGroup;
+
+    public OwnerImpl(Principal owner) {
+        ownerGroup = new GroupImpl("AclOwners");
+        ownerGroup.addMember(owner);
+    }
+
+    /**
+     * Adds an owner. Owners can modify ACL contents and can disassociate
+     * ACLs from the objects they protect in the AclConfig interface.
+     * The caller principal must be a part of the owners list of the ACL in
+     * order to invoke this method. The initial owner is configured
+     * at ACL construction time.
+     * @param caller the principal who is invoking this method.
+     * @param owner The owner that should be added to the owners list.
+     * @return true if success, false if already an owner.
+     * @exception NotOwnerException if the caller principal is not on
+     * the owners list of the Acl.
+     */
+    public synchronized boolean addOwner(Principal caller, Principal owner)
+      throws NotOwnerException
+    {
+        if (!isOwner(caller))
+            throw new NotOwnerException();
+
+        ownerGroup.addMember(owner);
+        return false;
+    }
+
+    /**
+     * Delete owner. If this is the last owner in the ACL, an exception is
+     * raised.
+     * The caller principal must be a part of the owners list of the ACL in
+     * order to invoke this method.
+     * @param caller the principal who is invoking this method.
+     * @param owner The owner to be removed from the owners list.
+     * @return true if the owner is removed, false if the owner is not part
+     * of the owners list.
+     * @exception NotOwnerException if the caller principal is not on
+     * the owners list of the Acl.
+     * @exception LastOwnerException if there is only one owner left in the group, then
+     * deleteOwner would leave the ACL owner-less. This exception is raised in such a case.
+     */
+    public synchronized boolean deleteOwner(Principal caller, Principal owner)
+      throws NotOwnerException, LastOwnerException
+    {
+        if (!isOwner(caller))
+            throw new NotOwnerException();
+
+        Enumeration<? extends Principal> e = ownerGroup.members();
+        //
+        // check if there is atleast 2 members left.
+        //
+        Object o = e.nextElement();
+        if (e.hasMoreElements())
+            return ownerGroup.removeMember(owner);
+        else
+            throw new LastOwnerException();
+
+    }
+
+    /**
+     * returns if the given principal belongs to the owner list.
+     * @param owner The owner to check if part of the owners list
+     * @return true if the passed principal is in the owner list, false if not.
+     */
+    public synchronized boolean isOwner(Principal owner) {
+        return ownerGroup.isMember(owner);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/acl/PermissionImpl.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 1996, 1999, 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 sun.security.acl;
+
+import java.security.Principal;
+import java.security.acl.*;
+
+/**
+ * The PermissionImpl class implements the permission
+ * interface for permissions that are strings.
+ * @author Satish Dharmaraj
+ */
+public class PermissionImpl implements Permission {
+
+    private String permission;
+
+    /**
+     * Construct a permission object using a string.
+     * @param permission the stringified version of the permission.
+     */
+    public PermissionImpl(String permission) {
+        this.permission = permission;
+    }
+
+    /**
+     * This function returns true if the object passed matches the permission
+     * represented in this interface.
+     * @param another The Permission object to compare with.
+     * @return true if the Permission objects are equal, false otherwise
+     */
+    public boolean equals(Object another) {
+        if (another instanceof Permission) {
+            Permission p = (Permission) another;
+            return permission.equals(p.toString());
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Prints a stringified version of the permission.
+     * @return the string representation of the Permission.
+     */
+    public String toString() {
+        return permission;
+    }
+
+    /**
+     * Returns a hashcode for this PermissionImpl.
+     *
+     * @return a hashcode for this PermissionImpl.
+     */
+    public int hashCode() {
+        return toString().hashCode();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/acl/PrincipalImpl.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 1996, 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 sun.security.acl;
+
+import java.security.*;
+
+/**
+ * This class implements the principal interface.
+ *
+ * @author      Satish Dharmaraj
+ */
+public class PrincipalImpl implements Principal {
+
+    private String user;
+
+    /**
+     * Construct a principal from a string user name.
+     * @param user The string form of the principal name.
+     */
+    public PrincipalImpl(String user) {
+        this.user = user;
+    }
+
+    /**
+     * This function returns true if the object passed matches
+     * the principal represented in this implementation
+     * @param another the Principal to compare with.
+     * @return true if the Principal passed is the same as that
+     * encapsulated in this object, false otherwise
+     */
+    public boolean equals(Object another) {
+        if (another instanceof PrincipalImpl) {
+            PrincipalImpl p = (PrincipalImpl) another;
+            return user.equals(p.toString());
+        } else
+          return false;
+    }
+
+    /**
+     * Prints a stringified version of the principal.
+     */
+    public String toString() {
+        return user;
+    }
+
+    /**
+     * return a hashcode for the principal.
+     */
+    public int hashCode() {
+        return user.hashCode();
+    }
+
+    /**
+     * return the name of the principal.
+     */
+    public String getName() {
+        return user;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/acl/WorldGroupImpl.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1996, 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 sun.security.acl;
+
+import java.security.*;
+
+/**
+ * This class implements a group of principals.
+ * @author Satish Dharmaraj
+ */
+public class WorldGroupImpl extends GroupImpl {
+
+    public WorldGroupImpl(String s) {
+        super(s);
+    }
+
+    /**
+     * returns true for all passed principals
+     * @param member The principal whose membership must be checked in this Group.
+     * @return true always since this is the "world" group.
+     */
+    public boolean isMember(Principal member) {
+        return true;
+    }
+}
--- a/jdk/src/java.base/share/classes/sun/util/resources/TimeZoneNames.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/util/resources/TimeZoneNames.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, 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
@@ -408,7 +408,7 @@
             {"America/Buenos_Aires", AGT},
             {"America/Cambridge_Bay", MST},
             {"America/Campo_Grande", AMT},
-            {"America/Cancun", CST},
+            {"America/Cancun", EST},
             {"America/Caracas", new String[] {"Venezuela Time", "VET",
                                               "Venezuela Summer Time", "VEST",
                                               "Venezuela Time", "VET"}},
--- a/jdk/src/java.base/share/native/include/jvm.h	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/share/native/include/jvm.h	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -104,6 +104,9 @@
 JNIEXPORT jlong JNICALL
 JVM_NanoTime(JNIEnv *env, jclass ignored);
 
+JNIEXPORT jlong JNICALL
+JVM_GetNanoTimeAdjustment(JNIEnv *env, jclass ignored, jlong offset_secs);
+
 JNIEXPORT void JNICALL
 JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos,
               jobject dst, jint dst_pos, jint length);
--- a/jdk/src/java.base/share/native/libjava/VM.c	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/share/native/libjava/VM.c	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2015, 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
@@ -33,6 +33,11 @@
 
 #include "sun_misc_VM.h"
 
+/* Only register the performance-critical methods */
+static JNINativeMethod methods[] = {
+    {"getNanoTimeAdjustment", "(J)J", (void *)&JVM_GetNanoTimeAdjustment}
+};
+
 JNIEXPORT jobject JNICALL
 Java_sun_misc_VM_latestUserDefinedLoader(JNIEnv *env, jclass cls) {
     return JVM_LatestUserDefinedLoader(env);
@@ -49,6 +54,14 @@
         return;
     }
 
+    // Registers implementations of native methods described in methods[]
+    // above.
+    // In particular, registers JVM_GetNanoTimeAdjustment as the implementation
+    // of the native sun.misc.VM.getNanoTimeAdjustment - avoiding the cost of
+    // introducing a Java_sun_misc_VM_getNanoTimeAdjustment  wrapper
+    (*env)->RegisterNatives(env, cls,
+                            methods, sizeof(methods)/sizeof(methods[0]));
+
     func_p = (GetJvmVersionInfo_fp) JDK_FindJvmEntry("JVM_GetVersionInfo");
      if (func_p != NULL) {
         jvm_version_info info;
--- a/jdk/src/java.base/share/native/libjli/java.c	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/share/native/libjli/java.c	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2015, 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
@@ -350,12 +350,6 @@
         } \
     } while (JNI_FALSE)
 
-#define CHECK_EXCEPTION_RETURN() \
-    do { \
-        if ((*env)->ExceptionOccurred(env)) { \
-            return; \
-        } \
-    } while (JNI_FALSE)
 
 int JNICALL
 JavaMain(void * _args)
@@ -466,6 +460,7 @@
      * of the application class.
      */
     PostJVMInit(env, appClass, vm);
+    CHECK_EXCEPTION_LEAVE(1);
     /*
      * The LoadMainClass not only loads the main class, it will also ensure
      * that the main method's signature is correct, therefore further checking
--- a/jdk/src/java.base/share/native/libjli/java.h	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.base/share/native/libjli/java.h	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, 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
@@ -254,4 +254,11 @@
 #define NULL_CHECK(NC_check_pointer) \
     NULL_CHECK_RETURN_VALUE(NC_check_pointer, )
 
+#define CHECK_EXCEPTION_RETURN() \
+    do { \
+        if ((*env)->ExceptionOccurred(env)) { \
+            return; \
+        } \
+    } while (JNI_FALSE)
+
 #endif /* _JAVA_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.management/share/classes/META-INF/services/sun.management.spi.PlatformMBeanProvider	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,25 @@
+#
+# Copyright (c) 2015, 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.
+#
+com.sun.management.internal.PlatformMBeanProviderImpl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.management/share/classes/com/sun/management/internal/PlatformMBeanProviderImpl.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2015, 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 com.sun.management.internal;
+
+import java.lang.management.ManagementFactory;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import javax.management.DynamicMBean;
+import javax.management.ObjectName;
+import sun.management.ManagementFactoryHelper;
+import sun.management.spi.PlatformMBeanProvider;
+
+public final class PlatformMBeanProviderImpl extends PlatformMBeanProvider {
+    private final List<PlatformComponent<?>> mxbeanList;
+
+    public PlatformMBeanProviderImpl() {
+        mxbeanList = Collections.unmodifiableList(init());
+    }
+
+    @Override
+    public List<PlatformComponent<?>> getPlatformComponentList() {
+        return mxbeanList;
+    }
+
+    private List<PlatformComponent<?>> init() {
+        ArrayList<PlatformComponent<?>> initMBeanList = new ArrayList<>();
+        /**
+         * Garbage Collector in the Java virtual machine.
+         */
+        initMBeanList.add(new PlatformComponent<java.lang.management.MemoryManagerMXBean>() {
+            private final Set<String> garbageCollectorMXBeanInterfaceNames
+                    = Collections.unmodifiableSet(
+                            Stream.of("java.lang.management.MemoryManagerMXBean",
+                                    "java.lang.management.GarbageCollectorMXBean",
+                                    "com.sun.management.GarbageCollectorMXBean")
+                            .collect(Collectors.toSet()));
+
+            @Override
+            public Set<Class<? extends java.lang.management.MemoryManagerMXBean>> mbeanInterfaces() {
+                return Stream.of(java.lang.management.MemoryManagerMXBean.class,
+                        java.lang.management.GarbageCollectorMXBean.class,
+                        com.sun.management.GarbageCollectorMXBean.class)
+                        .collect(Collectors.toSet());
+            }
+
+            @Override
+            public Set<String> mbeanInterfaceNames() {
+                return garbageCollectorMXBeanInterfaceNames;
+            }
+
+            @Override
+            public String getObjectNamePattern() {
+                return ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE + ",name=*";
+            }
+
+            @Override
+            public boolean isSingleton() {
+                return false; // zero or more instances
+            }
+
+            @Override
+            public Map<String, java.lang.management.MemoryManagerMXBean> nameToMBeanMap() {
+                List<java.lang.management.GarbageCollectorMXBean> list
+                        = ManagementFactoryHelper.getGarbageCollectorMXBeans();;
+                Map<String, java.lang.management.MemoryManagerMXBean> map;
+                if (list.isEmpty()) {
+                    map = Collections.<String, java.lang.management.MemoryManagerMXBean>emptyMap();
+                } else {
+                    map = new HashMap<>(list.size());
+                    for (java.lang.management.MemoryManagerMXBean gcm : list) {
+                        map.put(gcm.getObjectName().getCanonicalName(),
+                                gcm);
+                    }
+                }
+                return map;
+            }
+        });
+
+        /**
+         * OperatingSystemMXBean
+         */
+        initMBeanList.add(new PlatformComponent<java.lang.management.OperatingSystemMXBean>() {
+            private final Set<String> operatingSystemMXBeanInterfaceNames
+                    = Collections.unmodifiableSet(
+                            Stream.of("java.lang.management.OperatingSystemMXBean",
+                                    "com.sun.management.OperatingSystemMXBean",
+                                    "com.sun.management.UnixOperatingSystemMXBean")
+                            .collect(Collectors.toSet()));
+
+            @Override
+            public Set<Class<? extends java.lang.management.OperatingSystemMXBean>> mbeanInterfaces() {
+                return Stream.of(java.lang.management.OperatingSystemMXBean.class,
+                        com.sun.management.OperatingSystemMXBean.class,
+                        com.sun.management.UnixOperatingSystemMXBean.class)
+                        .collect(Collectors.toSet());
+            }
+
+            @Override
+            public Set<String> mbeanInterfaceNames() {
+                return operatingSystemMXBeanInterfaceNames;
+            }
+
+            @Override
+            public String getObjectNamePattern() {
+                return ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME;
+            }
+
+            @Override
+            public Map<String, java.lang.management.OperatingSystemMXBean> nameToMBeanMap() {
+                return Collections.<String, java.lang.management.OperatingSystemMXBean>singletonMap(
+                        ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME,
+                        ManagementFactoryHelper.getOperatingSystemMXBean());
+            }
+        });
+
+        /**
+         * Diagnostic support for the HotSpot Virtual Machine.
+         */
+        initMBeanList.add(new PlatformComponent<com.sun.management.HotSpotDiagnosticMXBean>() {
+            private final Set<String> hotSpotDiagnosticMXBeanInterfaceNames =
+                    Collections.unmodifiableSet(Collections.<String>singleton("com.sun.management.HotSpotDiagnosticMXBean"));
+
+            @Override
+            public Set<Class<? extends com.sun.management.HotSpotDiagnosticMXBean>> mbeanInterfaces() {
+                return Collections.singleton(com.sun.management.HotSpotDiagnosticMXBean.class);
+            }
+
+            @Override
+            public Set<String> mbeanInterfaceNames() {
+                return hotSpotDiagnosticMXBeanInterfaceNames;
+            }
+
+            @Override
+            public String getObjectNamePattern() {
+                return "com.sun.management:type=HotSpotDiagnostic";
+            }
+
+            @Override
+            public Map<String, com.sun.management.HotSpotDiagnosticMXBean> nameToMBeanMap() {
+                return Collections.<String, com.sun.management.HotSpotDiagnosticMXBean>singletonMap(
+                        "com.sun.management:type=HotSpotDiagnostic",
+                        ManagementFactoryHelper.getDiagnosticMXBean());
+            }
+        });
+
+        /**
+         * DynamicMBean
+         */
+        HashMap<ObjectName, DynamicMBean> dynmbeans
+                = ManagementFactoryHelper.getPlatformDynamicMBeans();
+        final Set<String> dynamicMBeanInterfaceNames =
+            Collections.unmodifiableSet(Collections.<String>singleton("javax.management.DynamicMBean"));
+        for (Map.Entry<ObjectName, DynamicMBean> e : dynmbeans.entrySet()) {
+            initMBeanList.add(new PlatformComponent<DynamicMBean>() {
+                @Override
+                public Set<String> mbeanInterfaceNames() {
+                    return dynamicMBeanInterfaceNames;
+                }
+
+                @Override
+                public Set<Class<? extends DynamicMBean>> mbeanInterfaces() {
+                    return Collections.emptySet(); // DynamicMBean cannot be used to find an MBean by ManagementFactory
+                }
+
+                @Override
+                public String getObjectNamePattern() {
+                    return e.getKey().getCanonicalName();
+                }
+
+                @Override
+                public Map<String, DynamicMBean> nameToMBeanMap() {
+                    return Collections.<String, DynamicMBean>singletonMap(
+                            e.getKey().getCanonicalName(),
+                            e.getValue());
+                }
+            });
+        }
+        initMBeanList.trimToSize();
+        return initMBeanList;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.management/share/classes/java/lang/management/DefaultPlatformMBeanProvider.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,503 @@
+/*
+ * Copyright (c) 2015, 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.management;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import javax.management.DynamicMBean;
+import javax.management.ObjectName;
+import sun.management.ManagementFactoryHelper;
+import sun.management.spi.PlatformMBeanProvider;
+
+class DefaultPlatformMBeanProvider extends PlatformMBeanProvider {
+    private final List<PlatformComponent<?>> mxbeanList;
+
+    DefaultPlatformMBeanProvider() {
+        mxbeanList = Collections.unmodifiableList(init());
+    }
+
+    @Override
+    public List<PlatformComponent<?>> getPlatformComponentList() {
+        return mxbeanList;
+    }
+
+    private List<PlatformComponent<?>> init() {
+        ArrayList<PlatformComponent<?>> initMBeanList = new ArrayList<>();
+        /**
+         * Class loading system of the Java virtual machine.
+         */
+        initMBeanList.add(new PlatformComponent<ClassLoadingMXBean>() {
+            private final Set<String> classLoadingInterfaceNames =
+                    Collections.unmodifiableSet(Collections.singleton(
+                            "java.lang.management.ClassLoadingMXBean"));
+
+            @Override
+            public Set<Class<? extends ClassLoadingMXBean>> mbeanInterfaces() {
+                return Collections.singleton(ClassLoadingMXBean.class);
+            }
+
+            @Override
+            public Set<String> mbeanInterfaceNames() {
+                return classLoadingInterfaceNames;
+            }
+
+            @Override
+            public String getObjectNamePattern() {
+                return ManagementFactory.CLASS_LOADING_MXBEAN_NAME;
+            }
+
+            @Override
+            public Map<String, ClassLoadingMXBean> nameToMBeanMap() {
+                return Collections.singletonMap(
+                        ManagementFactory.CLASS_LOADING_MXBEAN_NAME,
+                        ManagementFactoryHelper.getClassLoadingMXBean());
+            }
+        });
+
+        /**
+         * Compilation system of the Java virtual machine.
+         */
+        initMBeanList.add(new PlatformComponent<CompilationMXBean>() {
+            private final Set<String> compilationMXBeanInterfaceNames
+                    = Collections.unmodifiableSet(Collections.singleton(
+                            "java.lang.management.CompilationMXBean"));
+
+            @Override
+            public Set<Class<? extends CompilationMXBean>> mbeanInterfaces() {
+                return Collections.singleton(CompilationMXBean.class);
+            }
+
+            @Override
+            public Set<String> mbeanInterfaceNames() {
+                return compilationMXBeanInterfaceNames;
+            }
+
+            @Override
+            public String getObjectNamePattern() {
+                return ManagementFactory.COMPILATION_MXBEAN_NAME;
+            }
+
+            @Override
+            public Map<String, CompilationMXBean> nameToMBeanMap() {
+                CompilationMXBean m = ManagementFactoryHelper.getCompilationMXBean();
+                if (m == null) {
+                    return Collections.emptyMap();
+                } else {
+                    return Collections.singletonMap(
+                            ManagementFactory.COMPILATION_MXBEAN_NAME,
+                            ManagementFactoryHelper.getCompilationMXBean());
+                }
+            }
+        });
+
+        /**
+         * Memory system of the Java virtual machine.
+         */
+        initMBeanList.add(new PlatformComponent<MemoryMXBean>() {
+            private final Set<String> memoryMXBeanInterfaceNames
+                    = Collections.unmodifiableSet(Collections.singleton(
+                            "java.lang.management.MemoryMXBean"));
+
+            @Override
+            public Set<Class<? extends MemoryMXBean>> mbeanInterfaces() {
+                return Collections.singleton(MemoryMXBean.class);
+            }
+
+            @Override
+            public Set<String> mbeanInterfaceNames() {
+                return memoryMXBeanInterfaceNames;
+            }
+
+            @Override
+            public String getObjectNamePattern() {
+                return ManagementFactory.MEMORY_MXBEAN_NAME;
+            }
+
+            @Override
+            public Map<String, MemoryMXBean> nameToMBeanMap() {
+                return Collections.singletonMap(
+                        ManagementFactory.MEMORY_MXBEAN_NAME,
+                        ManagementFactoryHelper.getMemoryMXBean());
+            }
+        });
+
+        /**
+         * Garbage Collector in the Java virtual machine.
+         */
+        initMBeanList.add(new PlatformComponent<MemoryManagerMXBean>() {
+            private final Set<String> garbageCollectorMXBeanInterfaceNames
+                    = Collections.unmodifiableSet(
+                            Stream.of("java.lang.management.MemoryManagerMXBean",
+                                    "java.lang.management.GarbageCollectorMXBean")
+                            .collect(Collectors.toSet()));
+            @Override
+            public Set<Class<? extends MemoryManagerMXBean>> mbeanInterfaces() {
+                return Stream.of(MemoryManagerMXBean.class,
+                        GarbageCollectorMXBean.class,
+                        com.sun.management.GarbageCollectorMXBean.class).collect(Collectors.toSet());
+            }
+
+            @Override
+            public Set<String> mbeanInterfaceNames() {
+                return garbageCollectorMXBeanInterfaceNames;
+            }
+
+            @Override
+            public String getObjectNamePattern() {
+                return ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE + ",name=*";
+            }
+
+            @Override
+            public boolean isSingleton() {
+                return false; // zero or more instances
+            }
+
+            @Override
+            public Map<String, MemoryManagerMXBean> nameToMBeanMap() {
+                List<GarbageCollectorMXBean> list
+                        = ManagementFactoryHelper.getGarbageCollectorMXBeans();
+                Map<String, MemoryManagerMXBean> map;
+                if (list.isEmpty()) {
+                    map = Collections.emptyMap();
+                } else {
+                    map = new HashMap<>(list.size());
+                    for (MemoryManagerMXBean gcm : list) {
+                        map.put(gcm.getObjectName().getCanonicalName(),
+                                gcm);
+                    }
+                }
+                return map;
+            }
+
+        });
+
+        /**
+         * Memory manager in the Java virtual machine.
+         */
+        initMBeanList.add(new PlatformComponent<MemoryManagerMXBean>() {
+            private final Set<String> memoryManagerMXBeanInterfaceNames
+                    = Collections.unmodifiableSet(Collections.singleton(
+                            "java.lang.management.MemoryManagerMXBean"));
+
+            @Override
+            public Set<Class<? extends MemoryManagerMXBean>> mbeanInterfaces() {
+                return Collections.singleton(MemoryManagerMXBean.class);
+            }
+
+            @Override
+            public Set<String> mbeanInterfaceNames() {
+                return memoryManagerMXBeanInterfaceNames;
+            }
+
+            @Override
+            public String getObjectNamePattern() {
+                return ManagementFactory.MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE + ",name=*";
+            }
+
+            @Override
+            public boolean isSingleton() {
+                return false; // zero or more instances
+            }
+
+            @Override
+            public Map<String, MemoryManagerMXBean> nameToMBeanMap() {
+                List<MemoryManagerMXBean> list
+                        = ManagementFactoryHelper.getMemoryManagerMXBeans();
+                return list.stream()
+                        .filter(this::isMemoryManager)
+                        .collect(Collectors.toMap(
+                                pmo -> pmo.getObjectName().getCanonicalName(), Function.identity()));
+            }
+
+            // ManagementFactoryHelper.getMemoryManagerMXBeans() returns all
+            // memory managers - we need to filter out those that do not match
+            // the pattern for which we are registered
+            private boolean isMemoryManager(MemoryManagerMXBean mbean) {
+                final ObjectName name = mbean.getObjectName();
+                return ManagementFactory.MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE.startsWith(name.getDomain())
+                        && ManagementFactory.MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE.contains(
+                                "type="+name.getKeyProperty("type"));
+            }
+        });
+
+        /**
+         * Memory pool in the Java virtual machine.
+         */
+        initMBeanList.add(new PlatformComponent<MemoryPoolMXBean>() {
+            private final Set<String> memoryPoolMXBeanInterfaceNames
+                    = Collections.unmodifiableSet(Collections.singleton(
+                            "java.lang.management.MemoryPoolMXBean"));
+
+            @Override
+            public Set<Class<? extends MemoryPoolMXBean>> mbeanInterfaces() {
+                return Collections.singleton(MemoryPoolMXBean.class);
+            }
+
+            @Override
+            public Set<String> mbeanInterfaceNames() {
+                return memoryPoolMXBeanInterfaceNames;
+            }
+
+            @Override
+            public String getObjectNamePattern() {
+                return ManagementFactory.MEMORY_POOL_MXBEAN_DOMAIN_TYPE + ",name=*";
+            }
+
+            @Override
+            public boolean isSingleton() {
+                return false; // zero or more instances
+            }
+
+            @Override
+            public Map<String, MemoryPoolMXBean> nameToMBeanMap() {
+                List<MemoryPoolMXBean> list
+                        = ManagementFactoryHelper.getMemoryPoolMXBeans();
+                Map<String, MemoryPoolMXBean> map;
+                if (list.isEmpty()) {
+                    map = Collections.<String, MemoryPoolMXBean>emptyMap();
+                } else {
+                    map = new HashMap<>(list.size());
+                    for (MemoryPoolMXBean mpm : list) {
+                        map.put(mpm.getObjectName().getCanonicalName(),
+                                mpm);
+                    }
+                }
+                return map;
+            }
+        });
+
+        /**
+         * Runtime system of the Java virtual machine.
+         */
+        initMBeanList.add(new PlatformComponent<RuntimeMXBean>() {
+            private final Set<String> runtimeMXBeanInterfaceNames
+                    = Collections.unmodifiableSet(Collections.singleton(
+                            "java.lang.management.RuntimeMXBean"));
+
+            @Override
+            public Set<Class<? extends RuntimeMXBean>> mbeanInterfaces() {
+                return Collections.singleton(RuntimeMXBean.class);
+            }
+
+            @Override
+            public Set<String> mbeanInterfaceNames() {
+                return runtimeMXBeanInterfaceNames;
+            }
+
+            @Override
+            public String getObjectNamePattern() {
+                return ManagementFactory.RUNTIME_MXBEAN_NAME;
+            }
+
+            @Override
+            public Map<String, RuntimeMXBean> nameToMBeanMap() {
+                return Collections.singletonMap(
+                        ManagementFactory.RUNTIME_MXBEAN_NAME,
+                        ManagementFactoryHelper.getRuntimeMXBean());
+            }
+        });
+
+        /**
+         * Threading system of the Java virtual machine.
+         */
+        initMBeanList.add(new PlatformComponent<ThreadMXBean>() {
+            private final Set<String> threadMXBeanInterfaceNames
+                    = Collections.unmodifiableSet(Collections.singleton(
+                            "java.lang.management.ThreadMXBean"));
+
+            @Override
+            public Set<Class<? extends ThreadMXBean>> mbeanInterfaces() {
+                return Collections.singleton(ThreadMXBean.class);
+            }
+
+            @Override
+            public Set<String> mbeanInterfaceNames() {
+                return threadMXBeanInterfaceNames;
+            }
+
+            @Override
+            public String getObjectNamePattern() {
+                return ManagementFactory.THREAD_MXBEAN_NAME;
+            }
+
+            @Override
+            public Map<String, ThreadMXBean> nameToMBeanMap() {
+                return Collections.singletonMap(
+                        ManagementFactory.THREAD_MXBEAN_NAME,
+                        ManagementFactoryHelper.getThreadMXBean());
+            }
+        });
+
+        /**
+         * Logging facility.
+         */
+        initMBeanList.add(new PlatformComponent<PlatformLoggingMXBean>() {
+            private final Set<String> platformLoggingMXBeanInterfaceNames
+                    = Collections.unmodifiableSet(Collections.singleton(
+                            "java.lang.management.PlatformLoggingMXBean"));
+
+            @Override
+            public Set<Class<? extends PlatformLoggingMXBean>> mbeanInterfaces() {
+                return Collections.singleton(PlatformLoggingMXBean.class);
+            }
+
+            @Override
+            public Set<String> mbeanInterfaceNames() {
+                return platformLoggingMXBeanInterfaceNames;
+            }
+
+            @Override
+            public String getObjectNamePattern() {
+                return "java.util.logging:type=Logging";
+            }
+
+            @Override
+            public Map<String, PlatformLoggingMXBean> nameToMBeanMap() {
+                return Collections.singletonMap(
+                        "java.util.logging:type=Logging",
+                        ManagementFactoryHelper.getPlatformLoggingMXBean());
+            }
+        });
+
+        /**
+         * Buffer pools.
+         */
+        initMBeanList.add(new PlatformComponent<BufferPoolMXBean>() {
+            private final Set<String> bufferPoolMXBeanInterfaceNames
+                    = Collections.unmodifiableSet(Collections.singleton(
+                            "java.lang.management.BufferPoolMXBean"));
+
+            @Override
+            public Set<Class<? extends BufferPoolMXBean>> mbeanInterfaces() {
+                return Collections.singleton(BufferPoolMXBean.class);
+            }
+
+            @Override
+            public Set<String> mbeanInterfaceNames() {
+                return bufferPoolMXBeanInterfaceNames;
+            }
+
+            @Override
+            public String getObjectNamePattern() {
+                return "java.nio:type=BufferPool,name=*";
+            }
+
+            @Override
+            public boolean isSingleton() {
+                return false; // zero or more instances
+            }
+
+            @Override
+            public Map<String, BufferPoolMXBean> nameToMBeanMap() {
+                List<BufferPoolMXBean> list
+                        = ManagementFactoryHelper.getBufferPoolMXBeans();
+                Map<String, BufferPoolMXBean> map;
+                if (list.isEmpty()) {
+                    map = Collections.<String, BufferPoolMXBean>emptyMap();
+                } else {
+                    map = new HashMap<>(list.size());
+                    list.stream()
+                        .forEach(mbean -> map.put(mbean.getObjectName().getCanonicalName(),mbean));
+                }
+                return map;
+            }
+        });
+
+        /**
+         * OperatingSystemMXBean
+         */
+        initMBeanList.add(new PlatformComponent<OperatingSystemMXBean>() {
+            private final Set<String> operatingSystemMXBeanInterfaceNames
+                    = Collections.unmodifiableSet(Collections.singleton(
+                            "java.lang.management.OperatingSystemMXBean"));
+
+            @Override
+            public Set<Class<? extends OperatingSystemMXBean>> mbeanInterfaces() {
+                return Collections.singleton(OperatingSystemMXBean.class);
+            }
+
+            @Override
+            public Set<String> mbeanInterfaceNames() {
+                return operatingSystemMXBeanInterfaceNames;
+            }
+
+            @Override
+            public String getObjectNamePattern() {
+                return ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME;
+            }
+
+            @Override
+            public Map<String, OperatingSystemMXBean> nameToMBeanMap() {
+                return Collections.singletonMap(
+                        ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME,
+                        ManagementFactoryHelper.getOperatingSystemMXBean());
+            }
+
+        });
+
+        /**
+         * DynamicMBean
+         */
+        HashMap<ObjectName, DynamicMBean> dynmbeans
+                = ManagementFactoryHelper.getPlatformDynamicMBeans();
+        final Set<String> dynamicMBeanInterfaceNames =
+            Collections.unmodifiableSet(Collections.singleton("javax.management.DynamicMBean"));
+        for (Map.Entry<ObjectName, DynamicMBean> e : dynmbeans.entrySet()) {
+            initMBeanList.add(new PlatformComponent<DynamicMBean>() {
+                @Override
+                public Set<Class<? extends DynamicMBean>> mbeanInterfaces() {
+                    return Collections.emptySet();
+                }
+
+                @Override
+                public Set<String> mbeanInterfaceNames() {
+                    return dynamicMBeanInterfaceNames;
+                }
+
+                @Override
+                public String getObjectNamePattern() {
+                    return e.getKey().getCanonicalName();
+                }
+
+                @Override
+                public Map<String, DynamicMBean> nameToMBeanMap() {
+                    return Collections.<String, DynamicMBean>singletonMap(
+                            e.getKey().getCanonicalName(),
+                            e.getValue());
+                }
+            });
+        }
+
+        initMBeanList.trimToSize();
+        return initMBeanList;
+    }
+}
--- a/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -24,35 +24,40 @@
  */
 
 package java.lang.management;
+import java.io.FilePermission;
+import java.io.IOException;
 import javax.management.DynamicMBean;
 import javax.management.MBeanServer;
 import javax.management.MBeanServerConnection;
 import javax.management.MBeanServerFactory;
 import javax.management.MBeanServerPermission;
 import javax.management.NotificationEmitter;
-import javax.management.ObjectInstance;
 import javax.management.ObjectName;
-import javax.management.InstanceAlreadyExistsException;
 import javax.management.InstanceNotFoundException;
 import javax.management.MalformedObjectNameException;
-import javax.management.MBeanRegistrationException;
-import javax.management.NotCompliantMBeanException;
 import javax.management.StandardEmitterMBean;
 import javax.management.StandardMBean;
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
-import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Map;
 import java.security.AccessController;
 import java.security.Permission;
 import java.security.PrivilegedAction;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Optional;
+import java.util.ServiceLoader;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import static java.util.stream.Collectors.toMap;
+import java.util.stream.Stream;
 import javax.management.JMX;
-import sun.management.ManagementFactoryHelper;
-import sun.management.ExtendedPlatformComponent;
+import sun.management.Util;
+import sun.management.spi.PlatformMBeanProvider;
+import sun.management.spi.PlatformMBeanProvider.PlatformComponent;
 
 /**
  * The {@code ManagementFactory} class is a factory class for getting
@@ -316,7 +321,7 @@
      * the Java virtual machine.
      */
     public static ClassLoadingMXBean getClassLoadingMXBean() {
-        return ManagementFactoryHelper.getClassLoadingMXBean();
+        return getPlatformMXBean(ClassLoadingMXBean.class);
     }
 
     /**
@@ -326,7 +331,7 @@
      * @return a {@link MemoryMXBean} object for the Java virtual machine.
      */
     public static MemoryMXBean getMemoryMXBean() {
-        return ManagementFactoryHelper.getMemoryMXBean();
+        return getPlatformMXBean(MemoryMXBean.class);
     }
 
     /**
@@ -336,7 +341,7 @@
      * @return a {@link ThreadMXBean} object for the Java virtual machine.
      */
     public static ThreadMXBean getThreadMXBean() {
-        return ManagementFactoryHelper.getThreadMXBean();
+        return getPlatformMXBean(ThreadMXBean.class);
     }
 
     /**
@@ -347,7 +352,7 @@
 
      */
     public static RuntimeMXBean getRuntimeMXBean() {
-        return ManagementFactoryHelper.getRuntimeMXBean();
+        return getPlatformMXBean(RuntimeMXBean.class);
     }
 
     /**
@@ -360,7 +365,7 @@
      *   no compilation system.
      */
     public static CompilationMXBean getCompilationMXBean() {
-        return ManagementFactoryHelper.getCompilationMXBean();
+        return getPlatformMXBean(CompilationMXBean.class);
     }
 
     /**
@@ -371,7 +376,7 @@
      * the Java virtual machine.
      */
     public static OperatingSystemMXBean getOperatingSystemMXBean() {
-        return ManagementFactoryHelper.getOperatingSystemMXBean();
+        return getPlatformMXBean(OperatingSystemMXBean.class);
     }
 
     /**
@@ -384,7 +389,7 @@
      *
      */
     public static List<MemoryPoolMXBean> getMemoryPoolMXBeans() {
-        return ManagementFactoryHelper.getMemoryPoolMXBeans();
+        return getPlatformMXBeans(MemoryPoolMXBean.class);
     }
 
     /**
@@ -397,7 +402,7 @@
      *
      */
     public static List<MemoryManagerMXBean> getMemoryManagerMXBeans() {
-        return ManagementFactoryHelper.getMemoryManagerMXBeans();
+        return getPlatformMXBeans(MemoryManagerMXBean.class);
     }
 
 
@@ -413,7 +418,7 @@
      *
      */
     public static List<GarbageCollectorMXBean> getGarbageCollectorMXBeans() {
-        return ManagementFactoryHelper.getGarbageCollectorMXBeans();
+        return getPlatformMXBeans(GarbageCollectorMXBean.class);
     }
 
     private static MBeanServer platformMBeanServer;
@@ -467,35 +472,11 @@
 
         if (platformMBeanServer == null) {
             platformMBeanServer = MBeanServerFactory.createMBeanServer();
-            for (PlatformComponent pc : PlatformComponent.values()) {
-                List<? extends PlatformManagedObject> list =
-                    pc.getMXBeans(pc.getMXBeanInterface());
-                for (PlatformManagedObject o : list) {
-                    // Each PlatformComponent represents one management
-                    // interface. Some MXBean may extend another one.
-                    // The MXBean instances for one platform component
-                    // (returned by pc.getMXBeans()) might be also
-                    // the MXBean instances for another platform component.
-                    // e.g. com.sun.management.GarbageCollectorMXBean
-                    //
-                    // So need to check if an MXBean instance is registered
-                    // before registering into the platform MBeanServer
-                    if (!platformMBeanServer.isRegistered(o.getObjectName())) {
-                        addMXBean(platformMBeanServer, o);
-                    }
-                }
-            }
-            HashMap<ObjectName, DynamicMBean> dynmbeans =
-                    ManagementFactoryHelper.getPlatformDynamicMBeans();
-            for (Map.Entry<ObjectName, DynamicMBean> e : dynmbeans.entrySet()) {
-                addDynamicMBean(platformMBeanServer, e.getValue(), e.getKey());
-            }
-            for (final PlatformManagedObject o :
-                                       ExtendedPlatformComponent.getMXBeans()) {
-                if (!platformMBeanServer.isRegistered(o.getObjectName())) {
-                    addMXBean(platformMBeanServer, o);
-                }
-            }
+            platformComponents()
+                    .stream()
+                    .filter(PlatformComponent::shouldRegister)
+                    .flatMap(pc -> pc.nameToMBeanMap().entrySet().stream())
+                    .forEach(entry -> addMXBean(platformMBeanServer, entry.getKey(), entry.getValue()));
         }
         return platformMBeanServer;
     }
@@ -600,11 +581,8 @@
         // bootstrap class loader
         final Class<?> cls = mxbeanInterface;
         ClassLoader loader =
-            AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
-                public ClassLoader run() {
-                    return cls.getClassLoader();
-                }
-            });
+            AccessController.doPrivileged(
+                    (PrivilegedAction<ClassLoader>) () -> cls.getClassLoader());
         if (!sun.misc.VM.isSystemDomainLoader(loader)) {
             throw new IllegalArgumentException(mxbeanName +
                 " is not a platform MXBean");
@@ -619,7 +597,6 @@
                     " is not an instance of " + mxbeanInterface);
             }
 
-            final Class<?>[] interfaces;
             // check if the registered MBean is a notification emitter
             boolean emitter = connection.isInstanceOf(objName, NOTIF_EMITTER);
 
@@ -661,20 +638,11 @@
      */
     public static <T extends PlatformManagedObject>
             T getPlatformMXBean(Class<T> mxbeanInterface) {
-        PlatformComponent pc = PlatformComponent.getPlatformComponent(mxbeanInterface);
-        if (pc == null) {
-            T mbean = ExtendedPlatformComponent.getMXBean(mxbeanInterface);
-            if (mbean != null) {
-                return mbean;
-            }
-            throw new IllegalArgumentException(mxbeanInterface.getName() +
-                " is not a platform management interface");
-        }
-        if (!pc.isSingleton())
-            throw new IllegalArgumentException(mxbeanInterface.getName() +
-                " can have zero or more than one instances");
+        PlatformComponent<?> pc = PlatformMBeanFinder.findSingleton(mxbeanInterface);
 
-        return pc.getSingletonMXBean(mxbeanInterface);
+        List<? extends T> mbeans = pc.getMBeans(mxbeanInterface);
+        assert mbeans.isEmpty() || mbeans.size() == 1;
+        return mbeans.isEmpty() ? null : mbeans.get(0);
     }
 
     /**
@@ -701,16 +669,19 @@
      */
     public static <T extends PlatformManagedObject> List<T>
             getPlatformMXBeans(Class<T> mxbeanInterface) {
-        PlatformComponent pc = PlatformComponent.getPlatformComponent(mxbeanInterface);
+        // Validates at first the specified interface by finding at least one
+        // PlatformComponent whose MXBean implements this interface.
+        // An interface can be implemented by different MBeans, provided by
+        // different platform components.
+        PlatformComponent<?> pc = PlatformMBeanFinder.findFirst(mxbeanInterface);
         if (pc == null) {
-            T mbean = ExtendedPlatformComponent.getMXBean(mxbeanInterface);
-            if (mbean != null) {
-                return Collections.singletonList(mbean);
-            }
-            throw new IllegalArgumentException(mxbeanInterface.getName() +
-                " is not a platform management interface");
+            throw new IllegalArgumentException(mxbeanInterface.getName()
+                    + " is not a platform management interface");
         }
-        return Collections.unmodifiableList(pc.getMXBeans(mxbeanInterface));
+
+        return platformComponents().stream()
+                .flatMap(p -> p.getMBeans(mxbeanInterface).stream())
+                .collect(Collectors.toList());
     }
 
     /**
@@ -753,22 +724,8 @@
                                 Class<T> mxbeanInterface)
         throws java.io.IOException
     {
-        PlatformComponent pc = PlatformComponent.getPlatformComponent(mxbeanInterface);
-        if (pc == null) {
-            T mbean = ExtendedPlatformComponent.getMXBean(mxbeanInterface);
-            if (mbean != null) {
-                ObjectName on = mbean.getObjectName();
-                return ManagementFactory.newPlatformMXBeanProxy(connection,
-                                                                on.getCanonicalName(),
-                                                                mxbeanInterface);
-            }
-            throw new IllegalArgumentException(mxbeanInterface.getName() +
-                " is not a platform management interface");
-        }
-        if (!pc.isSingleton())
-            throw new IllegalArgumentException(mxbeanInterface.getName() +
-                " can have zero or more than one instances");
-        return pc.getSingletonMXBean(connection, mxbeanInterface);
+        PlatformComponent<?> pc = PlatformMBeanFinder.findSingleton(mxbeanInterface);
+        return newPlatformMXBeanProxy(connection, pc.getObjectNamePattern(), mxbeanInterface);
     }
 
     /**
@@ -804,19 +761,56 @@
                                        Class<T> mxbeanInterface)
         throws java.io.IOException
     {
-        PlatformComponent pc = PlatformComponent.getPlatformComponent(mxbeanInterface);
+        // Validates at first the specified interface by finding at least one
+        // PlatformComponent whose MXBean implements this interface.
+        // An interface can be implemented by different MBeans, provided by
+        // different platform components.
+        PlatformComponent<?> pc = PlatformMBeanFinder.findFirst(mxbeanInterface);
         if (pc == null) {
-            T mbean = ExtendedPlatformComponent.getMXBean(mxbeanInterface);
-            if (mbean != null) {
-                ObjectName on = mbean.getObjectName();
-                T proxy = ManagementFactory.newPlatformMXBeanProxy(connection,
-                            on.getCanonicalName(), mxbeanInterface);
-                return Collections.singletonList(proxy);
+            throw new IllegalArgumentException(mxbeanInterface.getName()
+                    + " is not a platform management interface");
+        }
+
+        // Collect all names, eliminate duplicates.
+        Stream<String> names = Stream.empty();
+        for (PlatformComponent<?> p : platformComponents()) {
+            names = Stream.concat(names, getProxyNames(p, connection, mxbeanInterface));
+        }
+        Set<String> objectNames = names.collect(Collectors.toSet());
+        if (objectNames.isEmpty()) return Collections.emptyList();
+
+        // Map names on proxies.
+        List<T> proxies = new ArrayList<>();
+        for (String name : objectNames) {
+            proxies.add(newPlatformMXBeanProxy(connection, name, mxbeanInterface));
+        }
+        return proxies;
+    }
+
+    // Returns a stream containing all ObjectNames of the MBeans represented by
+    // the specified PlatformComponent and implementing the specified interface.
+    // If the PlatformComponent is a singleton, the name returned by
+    // PlatformComponent.getObjectNamePattern() will be used, otherwise
+    // we will query the specified MBeanServerConnection (conn.queryNames)
+    // with the pattern returned by PlatformComponent.getObjectNamePattern()
+    // in order to find the names of matching MBeans.
+    // In case of singleton, we do not check whether the MBean is registered
+    // in the connection because the caller "getPlatformMXBeans" will do the check
+    // when creating a proxy.
+    private static Stream<String> getProxyNames(PlatformComponent<?> pc,
+                                                MBeanServerConnection conn,
+                                                Class<?> intf)
+            throws IOException
+    {
+        if (pc.mbeanInterfaceNames().contains(intf.getName())) {
+            if (pc.isSingleton()) {
+                return Stream.of(pc.getObjectNamePattern());
+            } else {
+                return conn.queryNames(Util.newObjectName(pc.getObjectNamePattern()), null)
+                        .stream().map(ObjectName::getCanonicalName);
             }
-            throw new IllegalArgumentException(mxbeanInterface.getName() +
-                " is not a platform management interface");
         }
-        return Collections.unmodifiableList(pc.getMXBeans(connection, mxbeanInterface));
+        return Stream.empty();
     }
 
     /**
@@ -835,63 +829,145 @@
     public static Set<Class<? extends PlatformManagedObject>>
            getPlatformManagementInterfaces()
     {
-        Set<Class<? extends PlatformManagedObject>> result =
-            new HashSet<>();
-        for (PlatformComponent component: PlatformComponent.values()) {
-            result.add(component.getMXBeanInterface());
-        }
-        return Collections.unmodifiableSet(result);
+        return platformComponents()
+                .stream()
+                .flatMap(pc -> pc.mbeanInterfaces().stream())
+                .filter(clazz -> PlatformManagedObject.class.isAssignableFrom(clazz))
+                .map(clazz -> clazz.asSubclass(PlatformManagedObject.class))
+                .collect(Collectors.toSet());
     }
 
     private static final String NOTIF_EMITTER =
         "javax.management.NotificationEmitter";
 
-    /**
-     * Registers an MXBean.
-     */
-    private static void addMXBean(final MBeanServer mbs, final PlatformManagedObject pmo) {
-        // Make DynamicMBean out of MXBean by wrapping it with a StandardMBean
+    private static void addMXBean(final MBeanServer mbs, String name, final Object pmo)
+    {
         try {
-            AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
-                public Void run() throws InstanceAlreadyExistsException,
-                                         MBeanRegistrationException,
-                                         NotCompliantMBeanException {
-                    final DynamicMBean dmbean;
-                    if (pmo instanceof DynamicMBean) {
-                        dmbean = DynamicMBean.class.cast(pmo);
-                    } else if (pmo instanceof NotificationEmitter) {
-                        dmbean = new StandardEmitterMBean(pmo, null, true, (NotificationEmitter) pmo);
-                    } else {
-                        dmbean = new StandardMBean(pmo, null, true);
-                    }
+            ObjectName oname = ObjectName.getInstance(name);
+            // Make DynamicMBean out of MXBean by wrapping it with a StandardMBean
+            AccessController.doPrivileged((PrivilegedExceptionAction<Void>) () -> {
+                final DynamicMBean dmbean;
+                if (pmo instanceof DynamicMBean) {
+                    dmbean = DynamicMBean.class.cast(pmo);
+                } else if (pmo instanceof NotificationEmitter) {
+                    dmbean = new StandardEmitterMBean(pmo, null, true, (NotificationEmitter) pmo);
+                } else {
+                    dmbean = new StandardMBean(pmo, null, true);
+                }
 
-                    mbs.registerMBean(dmbean, pmo.getObjectName());
-                    return null;
-                }
+                mbs.registerMBean(dmbean, oname);
+                return null;
             });
+        } catch (MalformedObjectNameException mone) {
+            throw new IllegalArgumentException(mone);
         } catch (PrivilegedActionException e) {
             throw new RuntimeException(e.getException());
         }
     }
 
-    /**
-     * Registers a DynamicMBean.
-     */
-    private static void addDynamicMBean(final MBeanServer mbs,
-                                        final DynamicMBean dmbean,
-                                        final ObjectName on) {
-        try {
-            AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
-                @Override
-                public Void run() throws InstanceAlreadyExistsException,
-                                         MBeanRegistrationException,
-                                         NotCompliantMBeanException {
-                    mbs.registerMBean(dmbean, on);
-                    return null;
-                }
-            });
-        } catch (PrivilegedActionException e) {
-            throw new RuntimeException(e.getException());
+    private static Collection<PlatformComponent<?>> platformComponents()
+    {
+        return PlatformMBeanFinder.getMap().values();
+    }
+
+    private static class PlatformMBeanFinder
+    {
+        private static final Map<String, PlatformComponent<?>> componentMap;
+        static {
+            // get all providers
+            List<PlatformMBeanProvider> providers = AccessController.doPrivileged(
+                (PrivilegedAction<List<PlatformMBeanProvider>>) () -> {
+                     List<PlatformMBeanProvider> all = new ArrayList<>();
+                     ServiceLoader.loadInstalled(PlatformMBeanProvider.class)
+                                  .forEach(all::add);
+                     all.add(new DefaultPlatformMBeanProvider());
+                     return all;
+                }, null, new FilePermission("<<ALL FILES>>", "read"),
+                         new RuntimePermission("sun.management.spi.PlatformMBeanProvider"));
+
+            // load all platform components into a map
+            componentMap = providers.stream()
+                .flatMap(p -> toPlatformComponentStream(p))
+                // The first one wins if multiple PlatformComponents
+                // with same ObjectName pattern,
+                .collect(toMap(PlatformComponent::getObjectNamePattern,
+                               Function.identity(),
+                              (p1, p2) -> p1));
+        }
+
+        static Map<String, PlatformComponent<?>> getMap() {
+            return componentMap;
+        }
+
+        // Loads all platform components from a provider into a stream
+        // Ensures that two different components are not declared with the same
+        // object name pattern. Throws InternalError if the provider incorrectly
+        // declares two platform components with the same pattern.
+        private static Stream<PlatformComponent<?>>
+            toPlatformComponentStream(PlatformMBeanProvider provider)
+        {
+            return provider.getPlatformComponentList()
+                           .stream()
+                           .collect(toMap(PlatformComponent::getObjectNamePattern,
+                                          Function.identity(),
+                                          (p1, p2) -> {
+                                              throw new InternalError(
+                                                 p1.getObjectNamePattern() +
+                                                 " has been used as key for " + p1 +
+                                                 ", it cannot be reused for " + p2);
+                                          }))
+                           .values().stream();
+        }
+
+        // Finds the first PlatformComponent whose mbeanInterfaceNames() list
+        // contains the specified class name. An MBean interface can be implemented
+        // by different MBeans, provided by different platform components.
+        // For instance the MemoryManagerMXBean interface is implemented both by
+        // regular memory managers, and garbage collector MXBeans. This method is
+        // mainly used to verify that there is at least one PlatformComponent
+        // which provides an implementation of the desired interface.
+        static PlatformComponent<?> findFirst(Class<?> mbeanIntf)
+        {
+            String name = mbeanIntf.getName();
+            Optional<PlatformComponent<?>> op = getMap().values()
+                .stream()
+                .filter(pc -> pc.mbeanInterfaceNames().contains(name))
+                .findFirst();
+
+            if (op.isPresent()) {
+                return op.get();
+            } else {
+                return null;
+            }
+        }
+
+        // Finds a PlatformComponent whose mbeanInterface name list contains
+        // the specified class name, and make sure that one and only one exists.
+        static PlatformComponent<?> findSingleton(Class<?> mbeanIntf)
+        {
+            String name = mbeanIntf.getName();
+            Optional<PlatformComponent<?>> op = getMap().values()
+                .stream()
+                .filter(pc -> pc.mbeanInterfaceNames().contains(name))
+                .reduce((p1, p2) -> {
+                    if (p2 != null) {
+                        throw new IllegalArgumentException(mbeanIntf.getName() +
+                            " can have more than one instance");
+                    } else {
+                        return p1;
+                    }
+                });
+
+            PlatformComponent<?> singleton = op.isPresent() ? op.get() : null;
+            if (singleton == null) {
+                throw new IllegalArgumentException(mbeanIntf.getName() +
+                    " is not a platform management interface");
+            }
+            if (!singleton.isSingleton()) {
+                throw new IllegalArgumentException(mbeanIntf.getName() +
+                    " can have more than one instance");
+            }
+            return singleton;
         }
     }
 }
--- a/jdk/src/java.management/share/classes/java/lang/management/PlatformComponent.java	Thu Feb 05 11:43:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,468 +0,0 @@
-/*
- * Copyright (c) 2008, 2012, 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.management;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.HashSet;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-
-import com.sun.management.HotSpotDiagnosticMXBean;
-import com.sun.management.UnixOperatingSystemMXBean;
-
-import sun.management.ManagementFactoryHelper;
-import sun.management.Util;
-
-/**
- * This enum class defines the list of platform components
- * that provides monitoring and management support.
- * Each enum represents one MXBean interface. A MXBean
- * instance could implement one or more MXBean interfaces.
- *
- * For example, com.sun.management.GarbageCollectorMXBean
- * extends java.lang.management.GarbageCollectorMXBean
- * and there is one set of garbage collection MXBean instances,
- * each of which implements both c.s.m. and j.l.m. interfaces.
- * There are two separate enums GARBAGE_COLLECTOR
- * and SUN_GARBAGE_COLLECTOR so that ManagementFactory.getPlatformMXBeans(Class)
- * will return the list of MXBeans of the specified type.
- *
- * To add a new MXBean interface for the Java platform,
- * add a new enum constant and implement the MXBeanFetcher.
- */
-enum PlatformComponent {
-
-    /**
-     * Class loading system of the Java virtual machine.
-     */
-    CLASS_LOADING(
-        "java.lang.management.ClassLoadingMXBean",
-        "java.lang", "ClassLoading", defaultKeyProperties(),
-        true, // singleton
-        new MXBeanFetcher<ClassLoadingMXBean>() {
-            public List<ClassLoadingMXBean> getMXBeans() {
-                return Collections.singletonList(ManagementFactoryHelper.getClassLoadingMXBean());
-            }
-        }),
-
-    /**
-     * Compilation system of the Java virtual machine.
-     */
-    COMPILATION(
-        "java.lang.management.CompilationMXBean",
-        "java.lang", "Compilation", defaultKeyProperties(),
-        true, // singleton
-        new MXBeanFetcher<CompilationMXBean>() {
-            public List<CompilationMXBean> getMXBeans() {
-                CompilationMXBean m = ManagementFactoryHelper.getCompilationMXBean();
-                if (m == null) {
-                   return Collections.emptyList();
-                } else {
-                   return Collections.singletonList(m);
-                }
-            }
-        }),
-
-    /**
-     * Memory system of the Java virtual machine.
-     */
-    MEMORY(
-        "java.lang.management.MemoryMXBean",
-        "java.lang", "Memory", defaultKeyProperties(),
-        true, // singleton
-        new MXBeanFetcher<MemoryMXBean>() {
-            public List<MemoryMXBean> getMXBeans() {
-                return Collections.singletonList(ManagementFactoryHelper.getMemoryMXBean());
-            }
-        }),
-
-    /**
-     * Garbage Collector in the Java virtual machine.
-     */
-    GARBAGE_COLLECTOR(
-        "java.lang.management.GarbageCollectorMXBean",
-        "java.lang", "GarbageCollector", keyProperties("name"),
-        false, // zero or more instances
-        new MXBeanFetcher<GarbageCollectorMXBean>() {
-            public List<GarbageCollectorMXBean> getMXBeans() {
-                return ManagementFactoryHelper.
-                           getGarbageCollectorMXBeans();
-            }
-        }),
-
-    /**
-     * Memory manager in the Java virtual machine.
-     */
-    MEMORY_MANAGER(
-        "java.lang.management.MemoryManagerMXBean",
-        "java.lang", "MemoryManager", keyProperties("name"),
-        false, // zero or more instances
-        new MXBeanFetcher<MemoryManagerMXBean>() {
-            public List<MemoryManagerMXBean> getMXBeans() {
-                return ManagementFactoryHelper.getMemoryManagerMXBeans();
-            }
-        },
-        GARBAGE_COLLECTOR),
-
-    /**
-     * Memory pool in the Java virtual machine.
-     */
-    MEMORY_POOL(
-        "java.lang.management.MemoryPoolMXBean",
-        "java.lang", "MemoryPool", keyProperties("name"),
-        false, // zero or more instances
-        new MXBeanFetcher<MemoryPoolMXBean>() {
-            public List<MemoryPoolMXBean> getMXBeans() {
-                return ManagementFactoryHelper.getMemoryPoolMXBeans();
-            }
-        }),
-
-    /**
-     * Operating system on which the Java virtual machine is running
-     */
-    OPERATING_SYSTEM(
-        "java.lang.management.OperatingSystemMXBean",
-        "java.lang", "OperatingSystem", defaultKeyProperties(),
-        true, // singleton
-        new MXBeanFetcher<OperatingSystemMXBean>() {
-            public List<OperatingSystemMXBean> getMXBeans() {
-                return Collections.singletonList(ManagementFactoryHelper.getOperatingSystemMXBean());
-            }
-        }),
-
-    /**
-     * Runtime system of the Java virtual machine.
-     */
-    RUNTIME(
-        "java.lang.management.RuntimeMXBean",
-        "java.lang", "Runtime", defaultKeyProperties(),
-        true, // singleton
-        new MXBeanFetcher<RuntimeMXBean>() {
-            public List<RuntimeMXBean> getMXBeans() {
-                return Collections.singletonList(ManagementFactoryHelper.getRuntimeMXBean());
-            }
-        }),
-
-    /**
-     * Threading system of the Java virtual machine.
-     */
-    THREADING(
-        "java.lang.management.ThreadMXBean",
-        "java.lang", "Threading", defaultKeyProperties(),
-        true, // singleton
-        new MXBeanFetcher<ThreadMXBean>() {
-            public List<ThreadMXBean> getMXBeans() {
-                return Collections.singletonList(ManagementFactoryHelper.getThreadMXBean());
-            }
-        }),
-
-
-    /**
-     * Logging facility.
-     */
-    LOGGING(
-        "java.lang.management.PlatformLoggingMXBean",
-        "java.util.logging", "Logging", defaultKeyProperties(),
-        true, // singleton
-        new MXBeanFetcher<PlatformLoggingMXBean>() {
-            public List<PlatformLoggingMXBean> getMXBeans() {
-                PlatformLoggingMXBean m = ManagementFactoryHelper.getPlatformLoggingMXBean();
-                if (m == null) {
-                   return Collections.emptyList();
-                } else {
-                   return Collections.singletonList(m);
-                }
-            }
-        }),
-
-    /**
-     * Buffer pools.
-     */
-    BUFFER_POOL(
-        "java.lang.management.BufferPoolMXBean",
-        "java.nio", "BufferPool", keyProperties("name"),
-        false, // zero or more instances
-        new MXBeanFetcher<BufferPoolMXBean>() {
-            public List<BufferPoolMXBean> getMXBeans() {
-                return ManagementFactoryHelper.getBufferPoolMXBeans();
-            }
-        }),
-
-
-    // Sun Platform Extension
-
-    /**
-     * Sun extension garbage collector that performs collections in cycles.
-     */
-    SUN_GARBAGE_COLLECTOR(
-        "com.sun.management.GarbageCollectorMXBean",
-        "java.lang", "GarbageCollector", keyProperties("name"),
-        false, // zero or more instances
-        new MXBeanFetcher<com.sun.management.GarbageCollectorMXBean>() {
-            public List<com.sun.management.GarbageCollectorMXBean> getMXBeans() {
-                return getGcMXBeanList(com.sun.management.GarbageCollectorMXBean.class);
-            }
-        }),
-
-    /**
-     * Sun extension operating system on which the Java virtual machine
-     * is running.
-     */
-    SUN_OPERATING_SYSTEM(
-        "com.sun.management.OperatingSystemMXBean",
-        "java.lang", "OperatingSystem", defaultKeyProperties(),
-        true, // singleton
-        new MXBeanFetcher<com.sun.management.OperatingSystemMXBean>() {
-            public List<com.sun.management.OperatingSystemMXBean> getMXBeans() {
-                return getOSMXBeanList(com.sun.management.OperatingSystemMXBean.class);
-            }
-        }),
-
-    /**
-     * Unix operating system.
-     */
-    SUN_UNIX_OPERATING_SYSTEM(
-        "com.sun.management.UnixOperatingSystemMXBean",
-        "java.lang", "OperatingSystem", defaultKeyProperties(),
-        true, // singleton
-        new MXBeanFetcher<UnixOperatingSystemMXBean>() {
-            public List<UnixOperatingSystemMXBean> getMXBeans() {
-                return getOSMXBeanList(com.sun.management.UnixOperatingSystemMXBean.class);
-            }
-        }),
-
-    /**
-     * Diagnostic support for the HotSpot Virtual Machine.
-     */
-    HOTSPOT_DIAGNOSTIC(
-        "com.sun.management.HotSpotDiagnosticMXBean",
-        "com.sun.management", "HotSpotDiagnostic", defaultKeyProperties(),
-        true, // singleton
-        new MXBeanFetcher<HotSpotDiagnosticMXBean>() {
-            public List<HotSpotDiagnosticMXBean> getMXBeans() {
-                return Collections.singletonList(ManagementFactoryHelper.getDiagnosticMXBean());
-            }
-        });
-
-
-    /**
-     * A task that returns the MXBeans for a component.
-     */
-    interface MXBeanFetcher<T extends PlatformManagedObject> {
-        public List<T> getMXBeans();
-    }
-
-    /*
-     * Returns a list of the GC MXBeans of the given type.
-     */
-    private static <T extends GarbageCollectorMXBean>
-            List<T> getGcMXBeanList(Class<T> gcMXBeanIntf) {
-        List<GarbageCollectorMXBean> list =
-            ManagementFactoryHelper.getGarbageCollectorMXBeans();
-        List<T> result = new ArrayList<>(list.size());
-        for (GarbageCollectorMXBean m : list) {
-            if (gcMXBeanIntf.isInstance(m)) {
-                result.add(gcMXBeanIntf.cast(m));
-            }
-        }
-        return result;
-    }
-
-    /*
-     * Returns the OS mxbean instance of the given type.
-     */
-    private static <T extends OperatingSystemMXBean>
-            List<T> getOSMXBeanList(Class<T> osMXBeanIntf) {
-        OperatingSystemMXBean m =
-            ManagementFactoryHelper.getOperatingSystemMXBean();
-        if (osMXBeanIntf.isInstance(m)) {
-            return Collections.singletonList(osMXBeanIntf.cast(m));
-        } else {
-            return Collections.emptyList();
-        }
-    }
-
-    private final String mxbeanInterfaceName;
-    private final String domain;
-    private final String type;
-    private final Set<String> keyProperties;
-    private final MXBeanFetcher<?> fetcher;
-    private final PlatformComponent[] subComponents;
-    private final boolean singleton;
-
-    private PlatformComponent(String intfName,
-                              String domain, String type,
-                              Set<String> keyProperties,
-                              boolean singleton,
-                              MXBeanFetcher<?> fetcher,
-                              PlatformComponent... subComponents) {
-        this.mxbeanInterfaceName = intfName;
-        this.domain = domain;
-        this.type = type;
-        this.keyProperties = keyProperties;
-        this.singleton = singleton;
-        this.fetcher = fetcher;
-        this.subComponents = subComponents;
-    }
-
-    private static Set<String> defaultKeyProps;
-    private static Set<String> defaultKeyProperties() {
-        if (defaultKeyProps == null) {
-            defaultKeyProps = Collections.singleton("type");
-        }
-        return defaultKeyProps;
-    }
-
-    private static Set<String> keyProperties(String... keyNames) {
-        Set<String> set = new HashSet<>();
-        set.add("type");
-        for (String s : keyNames) {
-            set.add(s);
-        }
-        return set;
-    }
-
-    boolean isSingleton() {
-        return singleton;
-    }
-
-    String getMXBeanInterfaceName() {
-        return mxbeanInterfaceName;
-    }
-
-    @SuppressWarnings("unchecked")
-    Class<? extends PlatformManagedObject> getMXBeanInterface() {
-        try {
-            // Lazy loading the MXBean interface only when it is needed
-            return (Class<? extends PlatformManagedObject>)
-                       Class.forName(mxbeanInterfaceName, false,
-                                     PlatformManagedObject.class.getClassLoader());
-        } catch (ClassNotFoundException x) {
-            throw new AssertionError(x);
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    <T extends PlatformManagedObject>
-        List<T> getMXBeans(Class<T> mxbeanInterface)
-    {
-        return (List<T>) fetcher.getMXBeans();
-    }
-
-    <T extends PlatformManagedObject> T getSingletonMXBean(Class<T> mxbeanInterface)
-    {
-        if (!singleton)
-            throw new IllegalArgumentException(mxbeanInterfaceName +
-                " can have zero or more than one instances");
-
-        List<T> list = getMXBeans(mxbeanInterface);
-        assert list.size() == 1;
-        return list.isEmpty() ? null : list.get(0);
-    }
-
-    <T extends PlatformManagedObject>
-            T getSingletonMXBean(MBeanServerConnection mbs, Class<T> mxbeanInterface)
-        throws java.io.IOException
-    {
-        if (!singleton)
-            throw new IllegalArgumentException(mxbeanInterfaceName +
-                " can have zero or more than one instances");
-
-        // ObjectName of a singleton MXBean contains only domain and type
-        assert keyProperties.size() == 1;
-        String on = domain + ":type=" + type;
-        return ManagementFactory.newPlatformMXBeanProxy(mbs,
-                                                        on,
-                                                        mxbeanInterface);
-    }
-
-    <T extends PlatformManagedObject>
-            List<T> getMXBeans(MBeanServerConnection mbs, Class<T> mxbeanInterface)
-        throws java.io.IOException
-    {
-        List<T> result = new ArrayList<>();
-        for (ObjectName on : getObjectNames(mbs)) {
-            result.add(ManagementFactory.
-                newPlatformMXBeanProxy(mbs,
-                                       on.getCanonicalName(),
-                                       mxbeanInterface)
-            );
-        }
-        return result;
-    }
-
-    private Set<ObjectName> getObjectNames(MBeanServerConnection mbs)
-        throws java.io.IOException
-    {
-        String domainAndType = domain + ":type=" + type;
-        if (keyProperties.size() > 1) {
-            // if there are more than 1 key properties (i.e. other than "type")
-            domainAndType += ",*";
-        }
-        ObjectName on = Util.newObjectName(domainAndType);
-        Set<ObjectName> set =  mbs.queryNames(on, null);
-        for (PlatformComponent pc : subComponents) {
-            set.addAll(pc.getObjectNames(mbs));
-        }
-        return set;
-    }
-
-    // a map from MXBean interface name to PlatformComponent
-    private static Map<String, PlatformComponent> enumMap;
-    private static synchronized void ensureInitialized() {
-        if (enumMap == null) {
-            enumMap = new HashMap<>();
-            for (PlatformComponent pc: PlatformComponent.values()) {
-                // Use String as the key rather than Class<?> to avoid
-                // causing unnecessary class loading of management interface
-                enumMap.put(pc.getMXBeanInterfaceName(), pc);
-            }
-        }
-    }
-
-    static boolean isPlatformMXBean(String cn) {
-        ensureInitialized();
-        return enumMap.containsKey(cn);
-    }
-
-    static <T extends PlatformManagedObject>
-        PlatformComponent getPlatformComponent(Class<T> mxbeanInterface)
-    {
-        ensureInitialized();
-        String cn = mxbeanInterface.getName();
-        PlatformComponent pc = enumMap.get(cn);
-        if (pc != null && pc.getMXBeanInterface() == mxbeanInterface)
-            return pc;
-        return null;
-    }
-
-    private static final long serialVersionUID = 6992337162326171013L;
-}
--- a/jdk/src/java.management/share/classes/sun/management/ExtendedPlatformComponent.java	Thu Feb 05 11:43:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2014, 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 sun.management;
-
-import java.util.Collections;
-import java.util.List;
-import java.lang.management.PlatformManagedObject;
-
-/**
- * Class to allow for an extended set of platform MXBeans
- */
-public final class ExtendedPlatformComponent {
-    private ExtendedPlatformComponent() {} // Don't create any instances
-
-    /**
-     * Get the extended set of platform MXBeans that should be registered in the
-     * platform MBeanServer, or an empty list if there are no such MXBeans.
-     */
-    public static List<? extends PlatformManagedObject> getMXBeans() {
-        return Collections.emptyList();
-    }
-
-    /**
-     * Returns the extended platform MXBean implementing the given
-     * mxbeanInterface, or null if there is no such MXBean.
-     */
-    public static <T extends PlatformManagedObject>
-            T getMXBean(Class<T> mxbeanInterface) {
-        return null;
-    }
-}
--- a/jdk/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java	Wed Jul 05 20:18:12 2017 +0200
@@ -42,14 +42,11 @@
 import sun.util.logging.LoggingSupport;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import com.sun.management.DiagnosticCommandMBean;
 import com.sun.management.HotSpotDiagnosticMXBean;
 
-import static java.lang.management.ManagementFactory.*;
-
 /**
  * ManagementFactoryHelper provides static factory methods to create
  * instances of the management interface.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.management/share/classes/sun/management/spi/PlatformMBeanProvider.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 2015, 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 sun.management.spi;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.ServiceLoader;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * The PlatformMBeanProvider class defines the abstract service interface
+ * that the {@link java.lang.management.ManagementFactory} will invoke to find,
+ * load, and register Platform MBeans.
+ *
+ * ManagementFactory loads the {@linkplain ServiceLoader#loadInstalled(java.lang.Class)
+ * installed providers} of this service interface and each provides the
+ * {@linkplain PlatformComponent platform components} that defines MXBean
+ * or DynamicMBean to be registered in the platform MBeanServer.
+ *
+ * A {@code PlatformMBeanProvider} will implement the {@code getPlatformComponentList()}
+ * method to return the list of {@code PlatformComponents} it provides.
+ */
+public abstract class PlatformMBeanProvider {
+    /**
+     * {@code PlatformComponent} models MBeans of a management interface supported
+     * by the platform.
+     *
+     * If a PlatformComponent models a singleton MBean, the {@link #getObjectNamePattern()
+     * ObjectName pattern} must be the {@link
+     * javax.management.ObjectName#getCanonicalName() canonical name} of that
+     * singleton MBean. Otherwise, it must be an ObjectName pattern
+     * that can be used to query the MBeans for this
+     * PlatformComponent registered in a {@code MBeanServer}.
+     * <br>
+     * The {@link #getObjectNamePattern() ObjectName pattern} serves as a unique
+     * key for identifying the instance of PlatformComponent. It is thus illegal
+     * for a given {@link PlatformMBeanProvider} to export several instance of
+     * PlatformComponent with the same
+     * {@link #getObjectNamePattern() ObjectName pattern} string.
+     * <br>
+     * If two different provider instances export a PlatformComponent for the
+     * same ObjectName pattern, only the PlatformComponent instance of the first
+     * provider will be taken into account.
+     *
+     * @param <T> The higher level interface for which the MBeans modeled by
+     * this object should be recognized. For instance, for the {@link
+     *        java.lang.management.ManagementFactory#getOperatingSystemMXBean()
+     *        Operating System MXBean}, this should be {@link
+     *        java.lang.management.OperatingSystemMXBean
+     *        java.lang.management.OperatingSystemMXBean}.
+     */
+    public interface PlatformComponent<T> {
+        /**
+         * Returns the names of the management interfaces implemented by the
+         * MBeans modeled by this {@code PlatformComponent}.
+         *
+         * @implNote
+         * When {@link java.lang.management.ManagementFactory#getPlatformMXBean(java.lang.Class)
+         * ManagementFactory.getPlatformMXBean(mxbeanInterface)} or {@link
+         * java.lang.management.ManagementFactory#getPlatformMXBeans(java.lang.Class)
+         * ManagementFactory.getPlatformMXBeans(mxbeanInterface)} are invoked,
+         * this PlatformComponent instance will match only if the name of the
+         * given {@code mxbeanInterface} is found in this list.
+         *
+         * @return the names of the management interfaces exported by the MBeans
+         * modeled by this object.
+         */
+        public Set<String> mbeanInterfaceNames();
+
+        /**
+         * A map from ObjectName string to the MBean instance this
+         * {@code PlatformComponent} creates.
+         *
+         * @implNote
+         * If {@link #shouldRegister()} is {@code true}, this method
+         * will be called when the {@link java.lang.management.ManagementFactory
+         * #getPlatformMBeanServer() Platform MBeanServer} is initialized.
+         * By default, this method will also be called by {@link
+         * #getMBeans(java.lang.Class)}, when {@link
+         * java.lang.management.ManagementFactory#getPlatformMXBean(java.lang.Class)
+         * ManagementFactory.getPlatformMXBean(mxbeanInterface)} or {@link
+         * java.lang.management.ManagementFactory#getPlatformMXBeans(java.lang.Class)
+         * ManagementFactory.getPlatformMXBeans(mxbeanInterface)} are invoked,
+         * and when the name of the given {@code mxbeanInterface} is contained
+         * in the names of management interfaces returned by {@link
+         * #mbeanInterfaceNames()}.
+         *
+         * @return A map with, for each MBean, the ObjectName string as key
+         *         and the MBean as value.
+         */
+        public Map<String, T> nameToMBeanMap();
+
+        /**
+         * An ObjectName pattern uniquely identifies the MBeans
+         * modeled by this {@code PlatformComponent}.
+         * If this instance models a singleton MBean, this must be
+         * the {@link
+         * javax.management.ObjectName#getCanonicalName() canonical name}
+         * of that singleton MBean.
+         *
+         * @return An ObjectName pattern uniquely identifies the MBeans
+         * modeled by this instance.
+         */
+        public String getObjectNamePattern();
+
+        /**
+         * Returns {@code true} if this {@code PlatformComponent} models
+         * a singleton MBean. By default, {@code true} is assumed.
+         *
+         * @return {@code true} if this instance models a singleton MBean.
+         */
+        public default boolean isSingleton() {
+            return true;
+        }
+
+        /**
+         * Returns {@code true} if the MBeans modeled by this {@code PlatformComponent}
+         * should automatically be registered in the {@link
+         * java.lang.management.ManagementFactory#getPlatformMBeanServer()
+         * Platform MBeanServer}.  By default, {@code true} is assumed.
+         *
+         * @return {@code true} if the MBeans modeled by this instance should
+         * automatically be registered in the Platform MBeanServer.
+         */
+        public default boolean shouldRegister() {
+            return true;
+        }
+
+        /**
+         * The set of interfaces implemented by the MBeans modeled
+         * by this {@code PlatformComponent}.
+         *
+         * @implNote
+         * {@link java.lang.management.ManagementFactory#getPlatformManagementInterfaces()
+         * ManagementFactory.getPlatformManagementInterfaces()} calls this
+         * method to find the management interfaces supported by the platform.
+         *
+         * @return The set of interfaces implemented by the MBeans modeled
+         *   by this instance
+         */
+        public Set<Class<? extends T>> mbeanInterfaces();
+
+        /**
+         * Return the list of MBeans that implement the given {@code mbeanIntf}
+         * modeled by this {@code PlatformComponent}. This method returns an
+         * empty list if no MBean implements the given {@code mbeanIntf}.
+         *
+         * @implNote This method will be called when {@link
+         * java.lang.management.ManagementFactory#getPlatformMXBean(java.lang.Class)
+         * ManagementFactory.getPlatformMXBean(mbeanIntf)} or {@link
+         * java.lang.management.ManagementFactory#getPlatformMXBeans(java.lang.Class)
+         * ManagementFactory.getPlatformMXBeans(mbeanIntf)} are invoked.
+         * By default it first checks whether the specified {@code mbeanIntf}
+         * name is contained in the returned list from the {@link #mbeanInterfaceNames()}
+         * method. If yes, it proceeds and calls
+         * {@link #mbeans().values()} and filters out all
+         * MBeans which are not instances of the given {@code mbeanIntf}.
+         * Otherwise, it returns an empty list.
+         *
+         * @param mbeanIntf A management interface.
+         * @return A (possibly empty) list of MBeans implementing the given
+         *         {@code mbeanIntf}.
+         */
+        public default <I> List<? extends I> getMBeans(Class<I> mbeanIntf) {
+            List<I> list;
+
+            if (!mbeanInterfaceNames().contains(mbeanIntf.getName())) {
+                list = Collections.emptyList();
+            } else {
+                list = nameToMBeanMap().values().stream()
+                        .filter(mbeanIntf::isInstance)
+                        .map(mbeanIntf::cast)
+                        .collect(Collectors.toList());
+            }
+            return list;
+        }
+    }
+
+    /**
+     * Instantiates a new PlatformMBeanProvider.
+     *
+     * @throws SecurityException if the subclass (and calling code) does not
+     *    have {@code RuntimePermission("sun.management.spi.PlatformMBeanProvider", "subclass")}
+     */
+    protected PlatformMBeanProvider () {
+        this(checkSubclassPermission());
+    }
+
+    private PlatformMBeanProvider(Void unused) {
+    }
+
+    /**
+     * Returns a list of PlatformComponent instances describing the Platform
+     * MBeans provided by this provider.
+     *
+     * @return a list of PlatformComponent instances describing the Platform
+     * MBeans provided by this provider.
+     */
+    public abstract List<PlatformComponent<?>> getPlatformComponentList();
+
+    private static Void checkSubclassPermission() {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(new RuntimePermission(PlatformMBeanProvider.class.getName(), "subclass"));
+        }
+        return null;
+    }
+}
--- a/jdk/src/java.security.acl/share/classes/java/security/acl/Acl.java	Thu Feb 05 11:43:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,241 +0,0 @@
-/*
- * Copyright (c) 1996, 2013, 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.security.acl;
-
-import java.util.Enumeration;
-import java.security.Principal;
-
-/**
- * Interface representing an Access Control List (ACL).  An Access
- * Control List is a data structure used to guard access to
- * resources.<p>
- *
- * An ACL can be thought of as a data structure with multiple ACL
- * entries.  Each ACL entry, of interface type AclEntry, contains a
- * set of permissions associated with a particular principal. (A
- * principal represents an entity such as an individual user or a
- * group). Additionally, each ACL entry is specified as being either
- * positive or negative. If positive, the permissions are to be
- * granted to the associated principal. If negative, the permissions
- * are to be denied.<p>
- *
- * The ACL Entries in each ACL observe the following rules:
- *
- * <ul> <li>Each principal can have at most one positive ACL entry and
- * one negative entry; that is, multiple positive or negative ACL
- * entries are not allowed for any principal.  Each entry specifies
- * the set of permissions that are to be granted (if positive) or
- * denied (if negative).
- *
- * <li>If there is no entry for a particular principal, then the
- * principal is considered to have a null (empty) permission set.
- *
- * <li>If there is a positive entry that grants a principal a
- * particular permission, and a negative entry that denies the
- * principal the same permission, the result is as though the
- * permission was never granted or denied.
- *
- * <li>Individual permissions always override permissions of the
- * group(s) to which the individual belongs. That is, individual
- * negative permissions (specific denial of permissions) override the
- * groups' positive permissions. And individual positive permissions
- * override the groups' negative permissions.
- *
- * </ul>
- *
- * The {@code  java.security.acl } package provides the
- * interfaces to the ACL and related data structures (ACL entries,
- * groups, permissions, etc.), and the {@code  sun.security.acl }
- * classes provide a default implementation of the interfaces. For
- * example, {@code  java.security.acl.Acl } provides the
- * interface to an ACL and the {@code  sun.security.acl.AclImpl }
- * class provides the default implementation of the interface.<p>
- *
- * The {@code  java.security.acl.Acl } interface extends the
- * {@code  java.security.acl.Owner } interface. The Owner
- * interface is used to maintain a list of owners for each ACL.  Only
- * owners are allowed to modify an ACL. For example, only an owner can
- * call the ACL's {@code addEntry} method to add a new ACL entry
- * to the ACL.
- *
- * @see java.security.acl.AclEntry
- * @see java.security.acl.Owner
- * @see java.security.acl.Acl#getPermissions
- *
- * @author Satish Dharmaraj
- */
-
-public interface Acl extends Owner {
-
-    /**
-     * Sets the name of this ACL.
-     *
-     * @param caller the principal invoking this method. It must be an
-     * owner of this ACL.
-     *
-     * @param name the name to be given to this ACL.
-     *
-     * @exception NotOwnerException if the caller principal
-     * is not an owner of this ACL.
-     *
-     * @see #getName
-     */
-    public void setName(Principal caller, String name)
-      throws NotOwnerException;
-
-    /**
-     * Returns the name of this ACL.
-     *
-     * @return the name of this ACL.
-     *
-     * @see #setName
-     */
-    public String getName();
-
-    /**
-     * Adds an ACL entry to this ACL. An entry associates a principal
-     * (e.g., an individual or a group) with a set of
-     * permissions. Each principal can have at most one positive ACL
-     * entry (specifying permissions to be granted to the principal)
-     * and one negative ACL entry (specifying permissions to be
-     * denied). If there is already an ACL entry of the same type
-     * (negative or positive) already in the ACL, false is returned.
-     *
-     * @param caller the principal invoking this method. It must be an
-     * owner of this ACL.
-     *
-     * @param entry the ACL entry to be added to this ACL.
-     *
-     * @return true on success, false if an entry of the same type
-     * (positive or negative) for the same principal is already
-     * present in this ACL.
-     *
-     * @exception NotOwnerException if the caller principal
-     *  is not an owner of this ACL.
-     */
-    public boolean addEntry(Principal caller, AclEntry entry)
-      throws NotOwnerException;
-
-    /**
-     * Removes an ACL entry from this ACL.
-     *
-     * @param caller the principal invoking this method. It must be an
-     * owner of this ACL.
-     *
-     * @param entry the ACL entry to be removed from this ACL.
-     *
-     * @return true on success, false if the entry is not part of this ACL.
-     *
-     * @exception NotOwnerException if the caller principal is not
-     * an owner of this Acl.
-     */
-    public boolean removeEntry(Principal caller, AclEntry entry)
-          throws NotOwnerException;
-
-    /**
-     * Returns an enumeration for the set of allowed permissions for the
-     * specified principal (representing an entity such as an individual or
-     * a group). This set of allowed permissions is calculated as
-     * follows:
-     *
-     * <ul>
-     *
-     * <li>If there is no entry in this Access Control List for the
-     * specified principal, an empty permission set is returned.
-     *
-     * <li>Otherwise, the principal's group permission sets are determined.
-     * (A principal can belong to one or more groups, where a group is a
-     * group of principals, represented by the Group interface.)
-     * The group positive permission set is the union of all
-     * the positive permissions of each group that the principal belongs to.
-     * The group negative permission set is the union of all
-     * the negative permissions of each group that the principal belongs to.
-     * If there is a specific permission that occurs in both
-     * the positive permission set and the negative permission set,
-     * it is removed from both.<p>
-     *
-     * The individual positive and negative permission sets are also
-     * determined. The positive permission set contains the permissions
-     * specified in the positive ACL entry (if any) for the principal.
-     * Similarly, the negative permission set contains the permissions
-     * specified in the negative ACL entry (if any) for the principal.
-     * The individual positive (or negative) permission set is considered
-     * to be null if there is not a positive (negative) ACL entry for the
-     * principal in this ACL.<p>
-     *
-     * The set of permissions granted to the principal is then calculated
-     * using the simple rule that individual permissions always override
-     * the group permissions. That is, the principal's individual negative
-     * permission set (specific denial of permissions) overrides the group
-     * positive permission set, and the principal's individual positive
-     * permission set overrides the group negative permission set.
-     *
-     * </ul>
-     *
-     * @param user the principal whose permission set is to be returned.
-     *
-     * @return the permission set specifying the permissions the principal
-     * is allowed.
-     */
-    public Enumeration<Permission> getPermissions(Principal user);
-
-    /**
-     * Returns an enumeration of the entries in this ACL. Each element in
-     * the enumeration is of type AclEntry.
-     *
-     * @return an enumeration of the entries in this ACL.
-     */
-    public Enumeration<AclEntry> entries();
-
-    /**
-     * Checks whether or not the specified principal has the specified
-     * permission. If it does, true is returned, otherwise false is returned.
-     *
-     * More specifically, this method checks whether the passed permission
-     * is a member of the allowed permission set of the specified principal.
-     * The allowed permission set is determined by the same algorithm as is
-     * used by the {@code getPermissions} method.
-     *
-     * @param principal the principal, assumed to be a valid authenticated
-     * Principal.
-     *
-     * @param permission the permission to be checked for.
-     *
-     * @return true if the principal has the specified permission, false
-     * otherwise.
-     *
-     * @see #getPermissions
-     */
-    public boolean checkPermission(Principal principal, Permission permission);
-
-    /**
-     * Returns a string representation of the
-     * ACL contents.
-     *
-     * @return a string representation of the ACL contents.
-     */
-    public String toString();
-}
--- a/jdk/src/java.security.acl/share/classes/java/security/acl/AclEntry.java	Thu Feb 05 11:43:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 1996, 2013, 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.security.acl;
-
-import java.util.Enumeration;
-import java.security.Principal;
-
-/**
- * This is the interface used for representing one entry in an Access
- * Control List (ACL).<p>
- *
- * An ACL can be thought of as a data structure with multiple ACL entry
- * objects. Each ACL entry object contains a set of permissions associated
- * with a particular principal. (A principal represents an entity such as
- * an individual user or a group). Additionally, each ACL entry is specified
- * as being either positive or negative. If positive, the permissions are
- * to be granted to the associated principal. If negative, the permissions
- * are to be denied. Each principal can have at most one positive ACL entry
- * and one negative entry; that is, multiple positive or negative ACL
- * entries are not allowed for any principal.
- *
- * Note: ACL entries are by default positive. An entry becomes a
- * negative entry only if the
- * {@link #setNegativePermissions() setNegativePermissions}
- * method is called on it.
- *
- * @see java.security.acl.Acl
- *
- * @author      Satish Dharmaraj
- */
-public interface AclEntry extends Cloneable {
-
-    /**
-     * Specifies the principal for which permissions are granted or denied
-     * by this ACL entry. If a principal was already set for this ACL entry,
-     * false is returned, otherwise true is returned.
-     *
-     * @param user the principal to be set for this entry.
-     *
-     * @return true if the principal is set, false if there was
-     * already a principal set for this entry.
-     *
-     * @see #getPrincipal
-     */
-    public boolean setPrincipal(Principal user);
-
-    /**
-     * Returns the principal for which permissions are granted or denied by
-     * this ACL entry. Returns null if there is no principal set for this
-     * entry yet.
-     *
-     * @return the principal associated with this entry.
-     *
-     * @see #setPrincipal
-     */
-    public Principal getPrincipal();
-
-    /**
-     * Sets this ACL entry to be a negative one. That is, the associated
-     * principal (e.g., a user or a group) will be denied the permission set
-     * specified in the entry.
-     *
-     * Note: ACL entries are by default positive. An entry becomes a
-     * negative entry only if this {@code setNegativePermissions}
-     * method is called on it.
-     */
-    public void setNegativePermissions();
-
-    /**
-     * Returns true if this is a negative ACL entry (one denying the
-     * associated principal the set of permissions in the entry), false
-     * otherwise.
-     *
-     * @return true if this is a negative ACL entry, false if it's not.
-     */
-    public boolean isNegative();
-
-    /**
-     * Adds the specified permission to this ACL entry. Note: An entry can
-     * have multiple permissions.
-     *
-     * @param permission the permission to be associated with
-     * the principal in this entry.
-     *
-     * @return true if the permission was added, false if the
-     * permission was already part of this entry's permission set.
-     */
-    public boolean addPermission(Permission permission);
-
-    /**
-     * Removes the specified permission from this ACL entry.
-     *
-     * @param permission the permission to be removed from this entry.
-     *
-     * @return true if the permission is removed, false if the
-     * permission was not part of this entry's permission set.
-     */
-    public boolean removePermission(Permission permission);
-
-    /**
-     * Checks if the specified permission is part of the
-     * permission set in this entry.
-     *
-     * @param permission the permission to be checked for.
-     *
-     * @return true if the permission is part of the
-     * permission set in this entry, false otherwise.
-     */
-    public boolean checkPermission(Permission permission);
-
-    /**
-     * Returns an enumeration of the permissions in this ACL entry.
-     *
-     * @return an enumeration of the permissions in this ACL entry.
-     */
-    public Enumeration<Permission> permissions();
-
-    /**
-     * Returns a string representation of the contents of this ACL entry.
-     *
-     * @return a string representation of the contents.
-     */
-    public String toString();
-
-    /**
-     * Clones this ACL entry.
-     *
-     * @return a clone of this ACL entry.
-     */
-    public Object clone();
-}
--- a/jdk/src/java.security.acl/share/classes/java/security/acl/AclNotFoundException.java	Thu Feb 05 11:43:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, 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.security.acl;
-
-/**
- * This is an exception that is thrown whenever a reference is made to a
- * non-existent ACL (Access Control List).
- *
- * @author      Satish Dharmaraj
- */
-public class AclNotFoundException extends Exception {
-
-    private static final long serialVersionUID = 5684295034092681791L;
-
-    /**
-     * Constructs an AclNotFoundException.
-     */
-    public AclNotFoundException() {
-    }
-
-}
--- a/jdk/src/java.security.acl/share/classes/java/security/acl/Group.java	Thu Feb 05 11:43:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 1996, 2013, 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.security.acl;
-
-import java.util.Enumeration;
-import java.security.Principal;
-
-/**
- * This interface is used to represent a group of principals. (A principal
- * represents an entity such as an individual user or a company). <p>
- *
- * Note that Group extends Principal. Thus, either a Principal or a Group can
- * be passed as an argument to methods containing a Principal parameter. For
- * example, you can add either a Principal or a Group to a Group object by
- * calling the object's {@code addMember} method, passing it the
- * Principal or Group.
- *
- * @author      Satish Dharmaraj
- */
-public interface Group extends Principal {
-
-    /**
-     * Adds the specified member to the group.
-     *
-     * @param user the principal to add to this group.
-     *
-     * @return true if the member was successfully added,
-     * false if the principal was already a member.
-     */
-    public boolean addMember(Principal user);
-
-    /**
-     * Removes the specified member from the group.
-     *
-     * @param user the principal to remove from this group.
-     *
-     * @return true if the principal was removed, or
-     * false if the principal was not a member.
-     */
-    public boolean removeMember(Principal user);
-
-    /**
-     * Returns true if the passed principal is a member of the group.
-     * This method does a recursive search, so if a principal belongs to a
-     * group which is a member of this group, true is returned.
-     *
-     * @param member the principal whose membership is to be checked.
-     *
-     * @return true if the principal is a member of this group,
-     * false otherwise.
-     */
-    public boolean isMember(Principal member);
-
-
-    /**
-     * Returns an enumeration of the members in the group.
-     * The returned objects can be instances of either Principal
-     * or Group (which is a subclass of Principal).
-     *
-     * @return an enumeration of the group members.
-     */
-    public Enumeration<? extends Principal> members();
-
-}
--- a/jdk/src/java.security.acl/share/classes/java/security/acl/LastOwnerException.java	Thu Feb 05 11:43:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, 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.security.acl;
-
-/**
- * This is an exception that is thrown whenever an attempt is made to delete
- * the last owner of an Access Control List.
- *
- * @see java.security.acl.Owner#deleteOwner
- *
- * @author Satish Dharmaraj
- */
-public class LastOwnerException extends Exception {
-
-    private static final long serialVersionUID = -5141997548211140359L;
-
-    /**
-     * Constructs a LastOwnerException.
-     */
-    public LastOwnerException() {
-    }
-}
--- a/jdk/src/java.security.acl/share/classes/java/security/acl/NotOwnerException.java	Thu Feb 05 11:43:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, 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.security.acl;
-
-/**
- * This is an exception that is thrown whenever the modification of an object
- * (such as an Access Control List) is only allowed to be done by an owner of
- * the object, but the Principal attempting the modification is not an owner.
- *
- * @author      Satish Dharmaraj
- */
-public class NotOwnerException extends Exception {
-
-    private static final long serialVersionUID = -5555597911163362399L;
-
-    /**
-     * Constructs a NotOwnerException.
-     */
-    public NotOwnerException() {
-    }
-}
--- a/jdk/src/java.security.acl/share/classes/java/security/acl/Owner.java	Thu Feb 05 11:43:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 1996, 2013, 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.security.acl;
-
-import java.security.Principal;
-
-/**
- * Interface for managing owners of Access Control Lists (ACLs) or ACL
- * configurations. (Note that the Acl interface in the
- * {@code  java.security.acl} package extends this Owner
- * interface.) The initial owner Principal should be specified as an
- * argument to the constructor of the class implementing this interface.
- *
- * @see java.security.acl.Acl
- *
- */
-public interface Owner {
-
-    /**
-     * Adds an owner. Only owners can modify ACL contents. The caller
-     * principal must be an owner of the ACL in order to invoke this method.
-     * That is, only an owner can add another owner. The initial owner is
-     * configured at ACL construction time.
-     *
-     * @param caller the principal invoking this method. It must be an owner
-     * of the ACL.
-     *
-     * @param owner the owner that should be added to the list of owners.
-     *
-     * @return true if successful, false if owner is already an owner.
-     * @exception NotOwnerException if the caller principal is not an owner
-     * of the ACL.
-     */
-    public boolean addOwner(Principal caller, Principal owner)
-      throws NotOwnerException;
-
-    /**
-     * Deletes an owner. If this is the last owner in the ACL, an exception is
-     * raised.<p>
-     *
-     * The caller principal must be an owner of the ACL in order to invoke
-     * this method.
-     *
-     * @param caller the principal invoking this method. It must be an owner
-     * of the ACL.
-     *
-     * @param owner the owner to be removed from the list of owners.
-     *
-     * @return true if the owner is removed, false if the owner is not part
-     * of the list of owners.
-     *
-     * @exception NotOwnerException if the caller principal is not an owner
-     * of the ACL.
-     *
-     * @exception LastOwnerException if there is only one owner left, so that
-     * deleteOwner would leave the ACL owner-less.
-     */
-    public boolean deleteOwner(Principal caller, Principal owner)
-      throws NotOwnerException, LastOwnerException;
-
-    /**
-     * Returns true if the given principal is an owner of the ACL.
-     *
-     * @param owner the principal to be checked to determine whether or not
-     * it is an owner.
-     *
-     * @return true if the passed principal is in the list of owners, false
-     * if not.
-     */
-    public boolean isOwner(Principal owner);
-
-}
--- a/jdk/src/java.security.acl/share/classes/java/security/acl/Permission.java	Thu Feb 05 11:43:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1996, 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.security.acl;
-
-
-/**
- * This interface represents a permission, such as that used to grant
- * a particular type of access to a resource.
- *
- * @author Satish Dharmaraj
- */
-public interface Permission {
-
-    /**
-     * Returns true if the object passed matches the permission represented
-     * in this interface.
-     *
-     * @param another the Permission object to compare with.
-     *
-     * @return true if the Permission objects are equal, false otherwise
-     */
-    public boolean equals(Object another);
-
-    /**
-     * Prints a string representation of this permission.
-     *
-     * @return the string representation of the permission.
-     */
-    public String toString();
-
-}
--- a/jdk/src/java.security.acl/share/classes/java/security/acl/package-info.java	Thu Feb 05 11:43:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 1998, 2013, 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.
- */
-
-/**
- * The classes and interfaces in this package have been
- * superseded by classes in the java.security package.
- * See that package and, for example, java.security.Permission for details.
- *
- * @since 1.1
- */
-package java.security.acl;
--- a/jdk/src/java.security.acl/share/classes/sun/security/acl/AclEntryImpl.java	Thu Feb 05 11:43:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 1996, 2011, 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 sun.security.acl;
-
-import java.util.*;
-import java.security.Principal;
-import java.security.acl.*;
-
-/**
- * This is a class that describes one entry that associates users
- * or groups with permissions in the ACL.
- * The entry may be used as a way of granting or denying permissions.
- * @author      Satish Dharmaraj
- */
-public class AclEntryImpl implements AclEntry {
-    private Principal user = null;
-    private Vector<Permission> permissionSet = new Vector<>(10, 10);
-    private boolean negative = false;
-
-    /**
-     * Construct an ACL entry that associates a user with permissions
-     * in the ACL.
-     * @param user The user that is associated with this entry.
-     */
-    public AclEntryImpl(Principal user) {
-        this.user = user;
-    }
-
-    /**
-     * Construct a null ACL entry
-     */
-    public AclEntryImpl() {
-    }
-
-    /**
-     * Sets the principal in the entity. If a group or a
-     * principal had already been set, a false value is
-     * returned, otherwise a true value is returned.
-     * @param user The user that is associated with this entry.
-     * @return true if the principal is set, false if there is
-     * one already.
-     */
-    public boolean setPrincipal(Principal user) {
-        if (this.user != null)
-          return false;
-        this.user = user;
-        return true;
-    }
-
-    /**
-     * This method sets the ACL to have negative permissions.
-     * That is the user or group is denied the permission set
-     * specified in the entry.
-     */
-    public void setNegativePermissions() {
-        negative = true;
-    }
-
-    /**
-     * Returns true if this is a negative ACL.
-     */
-    public boolean isNegative() {
-        return negative;
-    }
-
-    /**
-     * A principal or a group can be associated with multiple
-     * permissions. This method adds a permission to the ACL entry.
-     * @param permission The permission to be associated with
-     * the principal or the group in the entry.
-     * @return true if the permission was added, false if the
-     * permission was already part of the permission set.
-     */
-    public boolean addPermission(Permission permission) {
-
-        if (permissionSet.contains(permission))
-          return false;
-
-        permissionSet.addElement(permission);
-
-        return true;
-    }
-
-    /**
-     * The method disassociates the permission from the Principal
-     * or the Group in this ACL entry.
-     * @param permission The permission to be disassociated with
-     * the principal or the group in the entry.
-     * @return true if the permission is removed, false if the
-     * permission is not part of the permission set.
-     */
-    public boolean removePermission(Permission permission) {
-        return permissionSet.removeElement(permission);
-    }
-
-    /**
-     * Checks if the passed permission is part of the allowed
-     * permission set in this entry.
-     * @param permission The permission that has to be part of
-     * the permission set in the entry.
-     * @return true if the permission passed is part of the
-     * permission set in the entry, false otherwise.
-     */
-    public boolean checkPermission(Permission permission) {
-        return permissionSet.contains(permission);
-    }
-
-    /**
-     * return an enumeration of the permissions in this ACL entry.
-     */
-    public Enumeration<Permission> permissions() {
-        return permissionSet.elements();
-    }
-
-    /**
-     * Return a string representation of  the contents of the ACL entry.
-     */
-    public String toString() {
-        StringBuffer s = new StringBuffer();
-        if (negative)
-          s.append("-");
-        else
-          s.append("+");
-        if (user instanceof Group)
-            s.append("Group.");
-        else
-            s.append("User.");
-        s.append(user + "=");
-        Enumeration<Permission> e = permissions();
-        while(e.hasMoreElements()) {
-            Permission p = e.nextElement();
-            s.append(p);
-            if (e.hasMoreElements())
-                s.append(",");
-        }
-        return new String(s);
-    }
-
-    /**
-     * Clones an AclEntry.
-     */
-    @SuppressWarnings("unchecked") // Safe casts assuming clone() works correctly
-    public synchronized Object clone() {
-        AclEntryImpl cloned;
-        cloned = new AclEntryImpl(user);
-        cloned.permissionSet = (Vector<Permission>) permissionSet.clone();
-        cloned.negative = negative;
-        return cloned;
-    }
-
-    /**
-     * Return the Principal associated in this ACL entry.
-     * The method returns null if the entry uses a group
-     * instead of a principal.
-     */
-    public Principal getPrincipal() {
-        return user;
-    }
-}
--- a/jdk/src/java.security.acl/share/classes/sun/security/acl/AclImpl.java	Thu Feb 05 11:43:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,408 +0,0 @@
-/*
- * Copyright (c) 1996, 2011, 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 sun.security.acl;
-
-import java.io.*;
-import java.util.*;
-import java.security.Principal;
-import java.security.acl.*;
-
-/**
- * An Access Control List (ACL) is encapsulated by this class.
- * @author      Satish Dharmaraj
- */
-public class AclImpl extends OwnerImpl implements Acl {
-    //
-    // Maintain four tables. one each for positive and negative
-    // ACLs. One each depending on whether the entity is a group
-    // or principal.
-    //
-    private Hashtable<Principal, AclEntry> allowedUsersTable =
-                                        new Hashtable<>(23);
-    private Hashtable<Principal, AclEntry> allowedGroupsTable =
-                                        new Hashtable<>(23);
-    private Hashtable<Principal, AclEntry> deniedUsersTable =
-                                        new Hashtable<>(23);
-    private Hashtable<Principal, AclEntry> deniedGroupsTable =
-                                        new Hashtable<>(23);
-    private String aclName = null;
-    private Vector<Permission> zeroSet = new Vector<>(1,1);
-
-
-    /**
-     * Constructor for creating an empty ACL.
-     */
-    public AclImpl(Principal owner, String name) {
-        super(owner);
-        try {
-            setName(owner, name);
-        } catch (Exception e) {}
-    }
-
-    /**
-     * Sets the name of the ACL.
-     * @param caller the principal who is invoking this method.
-     * @param name the name of the ACL.
-     * @exception NotOwnerException if the caller principal is
-     * not on the owners list of the Acl.
-     */
-    public void setName(Principal caller, String name)
-      throws NotOwnerException
-    {
-        if (!isOwner(caller))
-            throw new NotOwnerException();
-
-        aclName = name;
-    }
-
-    /**
-     * Returns the name of the ACL.
-     * @return the name of the ACL.
-     */
-    public String getName() {
-        return aclName;
-    }
-
-    /**
-     * Adds an ACL entry to this ACL. An entry associates a
-     * group or a principal with a set of permissions. Each
-     * user or group can have one positive ACL entry and one
-     * negative ACL entry. If there is one of the type (negative
-     * or positive) already in the table, a false value is returned.
-     * The caller principal must be a part of the owners list of
-     * the ACL in order to invoke this method.
-     * @param caller the principal who is invoking this method.
-     * @param entry the ACL entry that must be added to the ACL.
-     * @return true on success, false if the entry is already present.
-     * @exception NotOwnerException if the caller principal
-     * is not on the owners list of the Acl.
-     */
-    public synchronized boolean addEntry(Principal caller, AclEntry entry)
-      throws NotOwnerException
-    {
-        if (!isOwner(caller))
-            throw new NotOwnerException();
-
-        Hashtable<Principal, AclEntry> aclTable = findTable(entry);
-        Principal key = entry.getPrincipal();
-
-        if (aclTable.get(key) != null)
-            return false;
-
-        aclTable.put(key, entry);
-        return true;
-    }
-
-    /**
-     * Removes an ACL entry from this ACL.
-     * The caller principal must be a part of the owners list of the ACL
-     * in order to invoke this method.
-     * @param caller the principal who is invoking this method.
-     * @param entry the ACL entry that must be removed from the ACL.
-     * @return true on success, false if the entry is not part of the ACL.
-     * @exception NotOwnerException if the caller principal is not
-     * the owners list of the Acl.
-     */
-    public synchronized boolean removeEntry(Principal caller, AclEntry entry)
-      throws NotOwnerException
-    {
-        if (!isOwner(caller))
-            throw new NotOwnerException();
-
-        Hashtable<Principal, AclEntry> aclTable = findTable(entry);
-        Principal key = entry.getPrincipal();
-
-        AclEntry o = aclTable.remove(key);
-        return (o != null);
-    }
-
-    /**
-     * This method returns the set of allowed permissions for the
-     * specified principal. This set of allowed permissions is calculated
-     * as follows:
-     *
-     * If there is no entry for a group or a principal an empty permission
-     * set is assumed.
-     *
-     * The group positive permission set is the union of all
-     * the positive permissions of each group that the individual belongs to.
-     * The group negative permission set is the union of all
-     * the negative permissions of each group that the individual belongs to.
-     * If there is a specific permission that occurs in both
-     * the postive permission set and the negative permission set,
-     * it is removed from both. The group positive and negatoive permission
-     * sets are calculated.
-     *
-     * The individial positive permission set and the individual negative
-     * permission set is then calculated. Again abscence of an entry means
-     * the empty set.
-     *
-     * The set of permissions granted to the principal is then calculated using
-     * the simple rule: Individual permissions always override the Group permissions.
-     * Specifically, individual negative permission set (specific
-     * denial of permissions) overrides the group positive permission set.
-     * And the individual positive permission set override the group negative
-     * permission set.
-     *
-     * @param user the principal for which the ACL entry is returned.
-     * @return The resulting permission set that the principal is allowed.
-     */
-    public synchronized Enumeration<Permission> getPermissions(Principal user) {
-
-        Enumeration<Permission> individualPositive;
-        Enumeration<Permission> individualNegative;
-        Enumeration<Permission> groupPositive;
-        Enumeration<Permission> groupNegative;
-
-        //
-        // canonicalize the sets. That is remove common permissions from
-        // positive and negative sets.
-        //
-        groupPositive =
-            subtract(getGroupPositive(user), getGroupNegative(user));
-        groupNegative  =
-            subtract(getGroupNegative(user), getGroupPositive(user));
-        individualPositive =
-            subtract(getIndividualPositive(user), getIndividualNegative(user));
-        individualNegative =
-            subtract(getIndividualNegative(user), getIndividualPositive(user));
-
-        //
-        // net positive permissions is individual positive permissions
-        // plus (group positive - individual negative).
-        //
-        Enumeration<Permission> temp1 =
-            subtract(groupPositive, individualNegative);
-        Enumeration<Permission> netPositive =
-            union(individualPositive, temp1);
-
-        // recalculate the enumeration since we lost it in performing the
-        // subtraction
-        //
-        individualPositive =
-            subtract(getIndividualPositive(user), getIndividualNegative(user));
-        individualNegative =
-            subtract(getIndividualNegative(user), getIndividualPositive(user));
-
-        //
-        // net negative permissions is individual negative permissions
-        // plus (group negative - individual positive).
-        //
-        temp1 = subtract(groupNegative, individualPositive);
-        Enumeration<Permission> netNegative = union(individualNegative, temp1);
-
-        return subtract(netPositive, netNegative);
-    }
-
-    /**
-     * This method checks whether or not the specified principal
-     * has the required permission. If permission is denied
-     * permission false is returned, a true value is returned otherwise.
-     * This method does not authenticate the principal. It presumes that
-     * the principal is a valid authenticated principal.
-     * @param principal the name of the authenticated principal
-     * @param permission the permission that the principal must have.
-     * @return true of the principal has the permission desired, false
-     * otherwise.
-     */
-    public boolean checkPermission(Principal principal, Permission permission)
-    {
-        Enumeration<Permission> permSet = getPermissions(principal);
-        while (permSet.hasMoreElements()) {
-            Permission p = permSet.nextElement();
-            if (p.equals(permission))
-              return true;
-        }
-        return false;
-    }
-
-    /**
-     * returns an enumeration of the entries in this ACL.
-     */
-    public synchronized Enumeration<AclEntry> entries() {
-        return new AclEnumerator(this,
-                                 allowedUsersTable, allowedGroupsTable,
-                                 deniedUsersTable, deniedGroupsTable);
-    }
-
-    /**
-     * return a stringified version of the
-     * ACL.
-     */
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        Enumeration<AclEntry> entries = entries();
-        while (entries.hasMoreElements()) {
-            AclEntry entry = entries.nextElement();
-            sb.append(entry.toString().trim());
-            sb.append("\n");
-        }
-
-        return sb.toString();
-    }
-
-    //
-    // Find the table that this entry belongs to. There are 4
-    // tables that are maintained. One each for postive and
-    // negative ACLs and one each for groups and users.
-    // This method figures out which
-    // table is the one that this AclEntry belongs to.
-    //
-    private Hashtable<Principal, AclEntry> findTable(AclEntry entry) {
-        Hashtable<Principal, AclEntry> aclTable = null;
-
-        Principal p = entry.getPrincipal();
-        if (p instanceof Group) {
-            if (entry.isNegative())
-                aclTable = deniedGroupsTable;
-            else
-                aclTable = allowedGroupsTable;
-        } else {
-            if (entry.isNegative())
-                aclTable = deniedUsersTable;
-            else
-                aclTable = allowedUsersTable;
-        }
-        return aclTable;
-    }
-
-    //
-    // returns the set e1 U e2.
-    //
-    private static Enumeration<Permission> union(Enumeration<Permission> e1,
-                Enumeration<Permission> e2) {
-        Vector<Permission> v = new Vector<>(20, 20);
-
-        while (e1.hasMoreElements())
-            v.addElement(e1.nextElement());
-
-        while (e2.hasMoreElements()) {
-            Permission o = e2.nextElement();
-            if (!v.contains(o))
-                v.addElement(o);
-        }
-
-        return v.elements();
-    }
-
-    //
-    // returns the set e1 - e2.
-    //
-    private Enumeration<Permission> subtract(Enumeration<Permission> e1,
-                Enumeration<Permission> e2) {
-        Vector<Permission> v = new Vector<>(20, 20);
-
-        while (e1.hasMoreElements())
-            v.addElement(e1.nextElement());
-
-        while (e2.hasMoreElements()) {
-            Permission o = e2.nextElement();
-            if (v.contains(o))
-                v.removeElement(o);
-        }
-
-        return v.elements();
-    }
-
-    private Enumeration<Permission> getGroupPositive(Principal user) {
-        Enumeration<Permission> groupPositive = zeroSet.elements();
-        Enumeration<Principal> e = allowedGroupsTable.keys();
-        while (e.hasMoreElements()) {
-            Group g = (Group)e.nextElement();
-            if (g.isMember(user)) {
-                AclEntry ae = allowedGroupsTable.get(g);
-                groupPositive = union(ae.permissions(), groupPositive);
-            }
-        }
-        return groupPositive;
-    }
-
-    private Enumeration<Permission> getGroupNegative(Principal user) {
-        Enumeration<Permission> groupNegative = zeroSet.elements();
-        Enumeration<Principal> e = deniedGroupsTable.keys();
-        while (e.hasMoreElements()) {
-            Group g = (Group)e.nextElement();
-            if (g.isMember(user)) {
-                AclEntry ae = deniedGroupsTable.get(g);
-                groupNegative = union(ae.permissions(), groupNegative);
-            }
-        }
-        return groupNegative;
-    }
-
-    private Enumeration<Permission> getIndividualPositive(Principal user) {
-        Enumeration<Permission> individualPositive = zeroSet.elements();
-        AclEntry ae = allowedUsersTable.get(user);
-        if (ae != null)
-            individualPositive = ae.permissions();
-        return individualPositive;
-    }
-
-    private Enumeration<Permission> getIndividualNegative(Principal user) {
-        Enumeration<Permission> individualNegative = zeroSet.elements();
-        AclEntry ae  = deniedUsersTable.get(user);
-        if (ae != null)
-            individualNegative = ae.permissions();
-        return individualNegative;
-    }
-}
-
-final class AclEnumerator implements Enumeration<AclEntry> {
-    Acl acl;
-    Enumeration<AclEntry> u1, u2, g1, g2;
-
-    AclEnumerator(Acl acl, Hashtable<?,AclEntry> u1, Hashtable<?,AclEntry> g1,
-                  Hashtable<?,AclEntry> u2, Hashtable<?,AclEntry> g2) {
-        this.acl = acl;
-        this.u1 = u1.elements();
-        this.u2 = u2.elements();
-        this.g1 = g1.elements();
-        this.g2 = g2.elements();
-    }
-
-    public boolean hasMoreElements() {
-        return (u1.hasMoreElements() ||
-                u2.hasMoreElements() ||
-                g1.hasMoreElements() ||
-                g2.hasMoreElements());
-    }
-
-    public AclEntry nextElement()
-    {
-        AclEntry o;
-        synchronized (acl) {
-            if (u1.hasMoreElements())
-                return u1.nextElement();
-            if (u2.hasMoreElements())
-                return u2.nextElement();
-            if (g1.hasMoreElements())
-                return g1.nextElement();
-            if (g2.hasMoreElements())
-                return g2.nextElement();
-        }
-        throw new NoSuchElementException("Acl Enumerator");
-    }
-}
--- a/jdk/src/java.security.acl/share/classes/sun/security/acl/AllPermissionsImpl.java	Thu Feb 05 11:43:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 1996, 1997, 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 sun.security.acl;
-
-import java.security.Principal;
-import java.security.acl.*;
-
-/**
- * This class implements the principal interface for the set of all permissions.
- * @author Satish Dharmaraj
- */
-public class AllPermissionsImpl extends PermissionImpl {
-
-    public AllPermissionsImpl(String s) {
-        super(s);
-    }
-
-    /**
-     * This function returns true if the permission passed matches the permission represented in
-     * this interface.
-     * @param another The Permission object to compare with.
-     * @returns true always
-     */
-    public boolean equals(Permission another) {
-        return true;
-    }
-}
--- a/jdk/src/java.security.acl/share/classes/sun/security/acl/GroupImpl.java	Thu Feb 05 11:43:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +0,0 @@
-/*
- * Copyright (c) 1996, 2011, 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 sun.security.acl;
-
-import java.util.*;
-import java.security.*;
-import java.security.acl.*;
-
-/**
- * This class implements a group of principals.
- * @author      Satish Dharmaraj
- */
-public class GroupImpl implements Group {
-    private Vector<Principal> groupMembers = new Vector<>(50, 100);
-    private String group;
-
-    /**
-     * Constructs a Group object with no members.
-     * @param groupName the name of the group
-     */
-    public GroupImpl(String groupName) {
-        this.group = groupName;
-    }
-
-    /**
-     * adds the specified member to the group.
-     * @param user The principal to add to the group.
-     * @return true if the member was added - false if the
-     * member could not be added.
-     */
-    public boolean addMember(Principal user) {
-        if (groupMembers.contains(user))
-          return false;
-
-        // do not allow groups to be added to itself.
-        if (group.equals(user.toString()))
-            throw new IllegalArgumentException();
-
-        groupMembers.addElement(user);
-        return true;
-    }
-
-    /**
-     * removes the specified member from the group.
-     * @param user The principal to remove from the group.
-     * @param true if the principal was removed false if
-     * the principal was not a member
-     */
-    public boolean removeMember(Principal user) {
-        return groupMembers.removeElement(user);
-    }
-
-    /**
-     * returns the enumeration of the members in the group.
-     */
-    public Enumeration<? extends Principal> members() {
-        return groupMembers.elements();
-    }
-
-    /**
-     * This function returns true if the group passed matches
-     * the group represented in this interface.
-     * @param another The group to compare this group to.
-     */
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof Group == false) {
-            return false;
-        }
-        Group another = (Group)obj;
-        return group.equals(another.toString());
-    }
-
-    // equals(Group) for compatibility
-    public boolean equals(Group another) {
-        return equals((Object)another);
-    }
-
-    /**
-     * Prints a stringified version of the group.
-     */
-    public String toString() {
-        return group;
-    }
-
-    /**
-     * return a hashcode for the principal.
-     */
-    public int hashCode() {
-        return group.hashCode();
-    }
-
-    /**
-     * returns true if the passed principal is a member of the group.
-     * @param member The principal whose membership must be checked for.
-     * @return true if the principal is a member of this group,
-     * false otherwise
-     */
-    public boolean isMember(Principal member) {
-
-        //
-        // if the member is part of the group (common case), return true.
-        // if not, recursively search depth first in the group looking for the
-        // principal.
-        //
-        if (groupMembers.contains(member)) {
-            return true;
-        } else {
-            Vector<Group> alreadySeen = new Vector<>(10);
-            return isMemberRecurse(member, alreadySeen);
-        }
-    }
-
-    /**
-     * return the name of the principal.
-     */
-    public String getName() {
-        return group;
-    }
-
-    //
-    // This function is the recursive search of groups for this
-    // implementation of the Group. The search proceeds building up
-    // a vector of already seen groups. Only new groups are considered,
-    // thereby avoiding loops.
-    //
-    boolean isMemberRecurse(Principal member, Vector<Group> alreadySeen) {
-        Enumeration<? extends Principal> e = members();
-        while (e.hasMoreElements()) {
-            boolean mem = false;
-            Principal p = (Principal) e.nextElement();
-
-            // if the member is in this collection, return true
-            if (p.equals(member)) {
-                return true;
-            } else if (p instanceof GroupImpl) {
-                //
-                // if not recurse if the group has not been checked already.
-                // Can call method in this package only if the object is an
-                // instance of this class. Otherwise call the method defined
-                // in the interface. (This can lead to a loop if a mixture of
-                // implementations form a loop, but we live with this improbable
-                // case rather than clutter the interface by forcing the
-                // implementation of this method.)
-                //
-                GroupImpl g = (GroupImpl) p;
-                alreadySeen.addElement(this);
-                if (!alreadySeen.contains(g))
-                  mem =  g.isMemberRecurse(member, alreadySeen);
-            } else if (p instanceof Group) {
-                Group g = (Group) p;
-                if (!alreadySeen.contains(g))
-                  mem = g.isMember(member);
-            }
-
-            if (mem)
-              return mem;
-        }
-        return false;
-    }
-}
--- a/jdk/src/java.security.acl/share/classes/sun/security/acl/OwnerImpl.java	Thu Feb 05 11:43:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 1996, 2006, 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 sun.security.acl;
-
-import java.util.*;
-import java.security.*;
-import java.security.acl.*;
-
-/**
- * Class implementing the Owner interface. The
- * initial owner principal is configured as
- * part of the constructor.
- * @author      Satish Dharmaraj
- */
-public class OwnerImpl implements Owner {
-    private Group ownerGroup;
-
-    public OwnerImpl(Principal owner) {
-        ownerGroup = new GroupImpl("AclOwners");
-        ownerGroup.addMember(owner);
-    }
-
-    /**
-     * Adds an owner. Owners can modify ACL contents and can disassociate
-     * ACLs from the objects they protect in the AclConfig interface.
-     * The caller principal must be a part of the owners list of the ACL in
-     * order to invoke this method. The initial owner is configured
-     * at ACL construction time.
-     * @param caller the principal who is invoking this method.
-     * @param owner The owner that should be added to the owners list.
-     * @return true if success, false if already an owner.
-     * @exception NotOwnerException if the caller principal is not on
-     * the owners list of the Acl.
-     */
-    public synchronized boolean addOwner(Principal caller, Principal owner)
-      throws NotOwnerException
-    {
-        if (!isOwner(caller))
-            throw new NotOwnerException();
-
-        ownerGroup.addMember(owner);
-        return false;
-    }
-
-    /**
-     * Delete owner. If this is the last owner in the ACL, an exception is
-     * raised.
-     * The caller principal must be a part of the owners list of the ACL in
-     * order to invoke this method.
-     * @param caller the principal who is invoking this method.
-     * @param owner The owner to be removed from the owners list.
-     * @return true if the owner is removed, false if the owner is not part
-     * of the owners list.
-     * @exception NotOwnerException if the caller principal is not on
-     * the owners list of the Acl.
-     * @exception LastOwnerException if there is only one owner left in the group, then
-     * deleteOwner would leave the ACL owner-less. This exception is raised in such a case.
-     */
-    public synchronized boolean deleteOwner(Principal caller, Principal owner)
-      throws NotOwnerException, LastOwnerException
-    {
-        if (!isOwner(caller))
-            throw new NotOwnerException();
-
-        Enumeration<? extends Principal> e = ownerGroup.members();
-        //
-        // check if there is atleast 2 members left.
-        //
-        Object o = e.nextElement();
-        if (e.hasMoreElements())
-            return ownerGroup.removeMember(owner);
-        else
-            throw new LastOwnerException();
-
-    }
-
-    /**
-     * returns if the given principal belongs to the owner list.
-     * @param owner The owner to check if part of the owners list
-     * @return true if the passed principal is in the owner list, false if not.
-     */
-    public synchronized boolean isOwner(Principal owner) {
-        return ownerGroup.isMember(owner);
-    }
-}
--- a/jdk/src/java.security.acl/share/classes/sun/security/acl/PermissionImpl.java	Thu Feb 05 11:43:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 1996, 1999, 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 sun.security.acl;
-
-import java.security.Principal;
-import java.security.acl.*;
-
-/**
- * The PermissionImpl class implements the permission
- * interface for permissions that are strings.
- * @author Satish Dharmaraj
- */
-public class PermissionImpl implements Permission {
-
-    private String permission;
-
-    /**
-     * Construct a permission object using a string.
-     * @param permission the stringified version of the permission.
-     */
-    public PermissionImpl(String permission) {
-        this.permission = permission;
-    }
-
-    /**
-     * This function returns true if the object passed matches the permission
-     * represented in this interface.
-     * @param another The Permission object to compare with.
-     * @return true if the Permission objects are equal, false otherwise
-     */
-    public boolean equals(Object another) {
-        if (another instanceof Permission) {
-            Permission p = (Permission) another;
-            return permission.equals(p.toString());
-        } else {
-            return false;
-        }
-    }
-
-    /**
-     * Prints a stringified version of the permission.
-     * @return the string representation of the Permission.
-     */
-    public String toString() {
-        return permission;
-    }
-
-    /**
-     * Returns a hashcode for this PermissionImpl.
-     *
-     * @return a hashcode for this PermissionImpl.
-     */
-    public int hashCode() {
-        return toString().hashCode();
-    }
-
-}
--- a/jdk/src/java.security.acl/share/classes/sun/security/acl/PrincipalImpl.java	Thu Feb 05 11:43:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 1996, 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 sun.security.acl;
-
-import java.security.*;
-
-/**
- * This class implements the principal interface.
- *
- * @author      Satish Dharmaraj
- */
-public class PrincipalImpl implements Principal {
-
-    private String user;
-
-    /**
-     * Construct a principal from a string user name.
-     * @param user The string form of the principal name.
-     */
-    public PrincipalImpl(String user) {
-        this.user = user;
-    }
-
-    /**
-     * This function returns true if the object passed matches
-     * the principal represented in this implementation
-     * @param another the Principal to compare with.
-     * @return true if the Principal passed is the same as that
-     * encapsulated in this object, false otherwise
-     */
-    public boolean equals(Object another) {
-        if (another instanceof PrincipalImpl) {
-            PrincipalImpl p = (PrincipalImpl) another;
-            return user.equals(p.toString());
-        } else
-          return false;
-    }
-
-    /**
-     * Prints a stringified version of the principal.
-     */
-    public String toString() {
-        return user;
-    }
-
-    /**
-     * return a hashcode for the principal.
-     */
-    public int hashCode() {
-        return user.hashCode();
-    }
-
-    /**
-     * return the name of the principal.
-     */
-    public String getName() {
-        return user;
-    }
-
-}
--- a/jdk/src/java.security.acl/share/classes/sun/security/acl/WorldGroupImpl.java	Thu Feb 05 11:43:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 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 sun.security.acl;
-
-import java.security.*;
-
-/**
- * This class implements a group of principals.
- * @author Satish Dharmaraj
- */
-public class WorldGroupImpl extends GroupImpl {
-
-    public WorldGroupImpl(String s) {
-        super(s);
-    }
-
-    /**
-     * returns true for all passed principals
-     * @param member The principal whose membership must be checked in this Group.
-     * @return true always since this is the "world" group.
-     */
-    public boolean isMember(Principal member) {
-        return true;
-    }
-}
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbApReq.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbApReq.java	Wed Jul 05 20:18:12 2017 +0200
@@ -60,16 +60,6 @@
     private static boolean DEBUG = Krb5.DEBUG;
     private static final char[] hexConst = "0123456789ABCDEF".toCharArray();
 
-    private static final MessageDigest md;
-
-    static {
-        try {
-            md = MessageDigest.getInstance("MD5");
-        } catch (NoSuchAlgorithmException ex) {
-            throw new RuntimeException("Impossible");
-        }
-    }
-
     /**
      * Constructs an AP-REQ message to send to the peer.
      * @param tgsCred the <code>Credentials</code> to be used to construct the
@@ -99,10 +89,10 @@
      * @param tgsCred the <code>Credentials</code> to be used to construct the
      *          AP Request  protocol message.
      * @param mutualRequired Whether mutual authentication is required
-     * @param useSubkey Whether the subkey is to be used to protect this
+     * @param useSubKey Whether the subkey is to be used to protect this
      *        specific application session. If this is not set then the
      *        session key from the ticket will be used.
-     * @param checksum checksum of the application data that accompanies
+     * @param cksum checksum of the application data that accompanies
      *        the KRB_AP_REQ.
      * @throws KrbException for any Kerberos protocol specific error
      * @throws IOException for any IO related errors
@@ -142,8 +132,8 @@
      * Constructs an AP-REQ message from the bytes received from the
      * peer.
      * @param message The message received from the peer
-     * @param keys <code>EncrtyptionKey</code>s to decrypt the message;
-     *       key selected will depend on etype used to encrypte data
+     * @param cred <code>KrbAcceptCredential</code> containing keys to decrypt
+     *    the message; key selected will depend on etype used to encrypt data
      * @throws KrbException for any Kerberos protocol specific error
      * @throws IOException for any IO related errors
      *          (e.g. socket operations)
@@ -311,7 +301,14 @@
         if (!authenticator.ctime.inClockSkew())
             throw new KrbApErrException(Krb5.KRB_AP_ERR_SKEW);
 
-        byte[] hash = md.digest(apReqMessg.authenticator.cipher);
+        byte[] hash;
+        try {
+            hash = MessageDigest.getInstance("MD5")
+                    .digest(apReqMessg.authenticator.cipher);
+        } catch (NoSuchAlgorithmException ex) {
+            throw new AssertionError("Impossible");
+        }
+
         char[] h = new char[hash.length * 2];
         for (int i=0; i<hash.length; i++) {
             h[2*i] = hexConst[(hash[i]&0xff)>>4];
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/de/TimeZoneNames_de.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/de/TimeZoneNames_de.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -409,7 +409,7 @@
             {"America/Buenos_Aires", AGT},
             {"America/Cambridge_Bay", MST},
             {"America/Campo_Grande", AMT},
-            {"America/Cancun", CST},
+            {"America/Cancun", EST},
             {"America/Caracas", new String[] {"Venezuelanische Zeit", "VET",
                                               "Venezuelanische Sommerzeit", "VEST",
                                               "Venezuelanische Zeit", "VET"}},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/es/TimeZoneNames_es.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/es/TimeZoneNames_es.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -409,7 +409,7 @@
             {"America/Buenos_Aires", AGT},
             {"America/Cambridge_Bay", MST},
             {"America/Campo_Grande", AMT},
-            {"America/Cancun", CST},
+            {"America/Cancun", EST},
             {"America/Caracas", new String[] {"Hora de Venezuela", "VET",
                                               "Hora de verano de Venezuela", "VEST",
                                               "Hora de Venezuela", "VET"}},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/fr/TimeZoneNames_fr.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/fr/TimeZoneNames_fr.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -409,7 +409,7 @@
             {"America/Buenos_Aires", AGT},
             {"America/Cambridge_Bay", MST},
             {"America/Campo_Grande", AMT},
-            {"America/Cancun", CST},
+            {"America/Cancun", EST},
             {"America/Caracas", new String[] {"Heure du Venezuela", "VET",
                                               "Heure d'\u00e9t\u00e9 du Venezuela", "VEST",
                                               "Heure du Venezuela", "VET"}},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/it/TimeZoneNames_it.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/it/TimeZoneNames_it.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -409,7 +409,7 @@
             {"America/Buenos_Aires", AGT},
             {"America/Cambridge_Bay", MST},
             {"America/Campo_Grande", AMT},
-            {"America/Cancun", CST},
+            {"America/Cancun", EST},
             {"America/Caracas", new String[] {"Ora del Venezuela", "VET",
                                               "Ora estiva del Venezuela", "VEST",
                                               "Ora del Venezuela", "VET"}},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/ja/TimeZoneNames_ja.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/ja/TimeZoneNames_ja.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -409,7 +409,7 @@
             {"America/Buenos_Aires", AGT},
             {"America/Cambridge_Bay", MST},
             {"America/Campo_Grande", AMT},
-            {"America/Cancun", CST},
+            {"America/Cancun", EST},
             {"America/Caracas", new String[] {"\u30d9\u30cd\u30ba\u30a8\u30e9\u6642\u9593", "VET",
                                               "\u30d9\u30cd\u30ba\u30a8\u30e9\u590f\u6642\u9593", "VEST",
                                               "\u30D9\u30CD\u30BA\u30A8\u30E9\u6642\u9593", "VET"}},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/ko/TimeZoneNames_ko.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/ko/TimeZoneNames_ko.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -409,7 +409,7 @@
             {"America/Buenos_Aires", AGT},
             {"America/Cambridge_Bay", MST},
             {"America/Campo_Grande", AMT},
-            {"America/Cancun", CST},
+            {"America/Cancun", EST},
             {"America/Caracas", new String[] {"\ubca0\ub124\uc218\uc5d8\ub77c \uc2dc\uac04", "VET",
                                               "\ubca0\ub124\uc218\uc5d8\ub77c \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "VEST",
                                               "\uBCA0\uB124\uC218\uC5D8\uB77C \uD45C\uC900\uC2DC", "VET"}},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/pt/TimeZoneNames_pt_BR.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/pt/TimeZoneNames_pt_BR.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -409,7 +409,7 @@
             {"America/Buenos_Aires", AGT},
             {"America/Cambridge_Bay", MST},
             {"America/Campo_Grande", AMT},
-            {"America/Cancun", CST},
+            {"America/Cancun", EST},
             {"America/Caracas", new String[] {"Fuso hor\u00e1rio da Venezuela", "VET",
                                               "Fuso hor\u00e1rio de ver\u00e3o da Venezuela", "VEST",
                                               "Hor\u00E1rio da Venezuela", "VET"}},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/sv/TimeZoneNames_sv.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/sv/TimeZoneNames_sv.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -409,7 +409,7 @@
             {"America/Buenos_Aires", AGT},
             {"America/Cambridge_Bay", MST},
             {"America/Campo_Grande", AMT},
-            {"America/Cancun", CST},
+            {"America/Cancun", EST},
             {"America/Caracas", new String[] {"Venezuela, normaltid", "VET",
                                               "Venezuela, sommartid", "VEST",
                                               "Venezuelansk tid", "VET"}},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/zh/TimeZoneNames_zh_CN.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/zh/TimeZoneNames_zh_CN.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -409,7 +409,7 @@
             {"America/Buenos_Aires", AGT},
             {"America/Cambridge_Bay", MST},
             {"America/Campo_Grande", AMT},
-            {"America/Cancun", CST},
+            {"America/Cancun", EST},
             {"America/Caracas", new String[] {"\u59d4\u5185\u745e\u62c9\u65f6\u95f4", "VET",
                                               "\u59d4\u5185\u745e\u62c9\u590f\u4ee4\u65f6", "VEST",
                                               "\u59D4\u5185\u745E\u62C9\u65F6\u95F4", "VET"}},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/zh/TimeZoneNames_zh_TW.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/zh/TimeZoneNames_zh_TW.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -409,7 +409,7 @@
             {"America/Buenos_Aires", AGT},
             {"America/Cambridge_Bay", MST},
             {"America/Campo_Grande", AMT},
-            {"America/Cancun", CST},
+            {"America/Cancun", EST},
             {"America/Caracas", new String[] {"\u59d4\u5167\u745e\u62c9\u6642\u9593", "VET",
                                               "\u59d4\u5167\u745e\u62c9\u590f\u4ee4\u6642\u9593", "VEST",
                                               "\u59D4\u5167\u745E\u62C9\u6642\u9593", "VET"}},
--- a/jdk/test/Makefile	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/Makefile	Wed Jul 05 20:18:12 2017 +0200
@@ -267,8 +267,8 @@
   EXTRA_JTREG_OPTIONS += -concurrency:$(CONCURRENCY)
 endif
 
-# Default JTREG to run (win32 script works for everybody)
-JTREG = $(JT_HOME)/win32/bin/jtreg
+# Default JTREG to run
+JTREG = $(JT_HOME)/bin/jtreg
 # run in agentvm mode
 JTREG_BASIC_OPTIONS += -agentvm
 # Only run automatic tests
--- a/jdk/test/ProblemList.txt	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/ProblemList.txt	Wed Jul 05 20:18:12 2017 +0200
@@ -1,6 +1,6 @@
 ###########################################################################
 #
-# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2015, 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
@@ -123,7 +123,6 @@
 # 8029891
 java/lang/ClassLoader/deadlock/GetResource.java                 generic-all
 
-
 ############################################################################
 
 # jdk_instrument
@@ -132,6 +131,9 @@
 java/lang/instrument/RedefineBigClass.sh                        generic-all
 java/lang/instrument/RetransformBigClass.sh                     generic-all
 
+# 8072130
+java/lang/instrument/BootClassPath/BootClassPathTest.sh         macosx-all
+
 ############################################################################
 
 # jdk_management
@@ -139,6 +141,9 @@
 # 8058492
 java/lang/management/ThreadMXBean/FindDeadlocks.java                                      generic-all
 
+# 8069286
+java/lang/management/MemoryMXBean/LowMemoryTest.java		generic-all
+
 ############################################################################
 
 # jdk_jmx
@@ -162,6 +167,9 @@
 # 6988950
 demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java	generic-all
 
+# 8071968
+javax/xml/ws/8046817/GenerateEnumSchema.java                windows-all
+
 ############################################################################
 
 # jdk_net
@@ -290,15 +298,18 @@
 # 8043571
 com/sun/jdi/RepStep.java                                        generic-all
 
-# 8044419
-com/sun/jdi/JdbReadTwiceTest.sh                                 generic-all
-
 # 8058616
 com/sun/jdi/RedefinePop.sh                                      generic-all
 
 # 8068645
 com/sun/jdi/CatchPatternTest.sh                                 generic-all
 
+# 8069402
+com/sun/jdi/ConnectedVMs.java					generic-all
+
+# 8067354
+com/sun/jdi/GetLocalVariables4Test.sh				windows-all
+
 ############################################################################
 
 # jdk_util
@@ -317,6 +328,9 @@
 # 8031482
 sun/tools/jcmd/TestJcmdSanity.java				windows-all
 
+# 8072131
+sun/tools/jmap/heapconfig/JMapHeapConfigTest.java macosx-all
+
 # 8027668
 sun/tools/jstatd/TestJstatdDefaults.java                generic-all
 sun/tools/jstatd/TestJstatdServer.java                  generic-all
--- a/jdk/test/com/sun/jdi/ImmutableResourceTest.sh	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/com/sun/jdi/ImmutableResourceTest.sh	Wed Jul 05 20:18:12 2017 +0200
@@ -92,7 +92,7 @@
 #
 echo "JDK under test is: $TESTJAVA"
 #
-CP="-classpath ${TESTCLASSES}${PATHSEP}${TESTJAVA}/lib/tools.jar"
+CP="-classpath ${TESTCLASSES}"
 # Compile the test class using the classpath we need:
 #
 env
--- a/jdk/test/com/sun/jdi/JITDebug.sh	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/com/sun/jdi/JITDebug.sh	Wed Jul 05 20:18:12 2017 +0200
@@ -103,15 +103,15 @@
    #if running standalone (no test harness of any kind), compile the
    #support files and the test case
    ${TESTJAVA}/bin/javac -d ${TESTCLASSES} \
-            -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}${TESTSRC}" \
+            -classpath "${TESTSRC}" \
             TestScaffold.java VMConnection.java TargetListener.java TargetAdapter.java
    ${TESTJAVA}/bin/javac  -d ${TESTCLASSES} \
-            -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}${TESTSRC}" -g \
+            -classpath "${TESTSRC}" -g \
             JITDebug.java
 fi
 echo "JDK under test is: $TESTJAVA"
 #
-CLASSPATH="$TESTJAVA/lib/tools.jar${PATHSEP}${TESTCLASSES}"
+CLASSPATH="${TESTCLASSES}"
 export CLASSPATH
 CP="-classpath \"${CLASSPATH}\""
 #
--- a/jdk/test/com/sun/jdi/JdbReadTwiceTest.sh	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/com/sun/jdi/JdbReadTwiceTest.sh	Wed Jul 05 20:18:12 2017 +0200
@@ -204,27 +204,37 @@
     clean
 fi
 
+echo
+echo "+++++++++++++++++++++++++++++++++++"
+echo "Read an unreadable file - verify the read fails."
 
-if [ ! -r c:/ ] ; then
-    # Can't make a file unreadable under MKS.
-    echo
-    echo "+++++++++++++++++++++++++++++++++++"
-    echo "Read an unreadable file - verify the read fails."
-    # If the file exists, we try to read it.  The
-    # read will fail.
-    mkFiles $HOME/jdb.ini
-    id > $HOME/jdb.ini
-    chmod a-r $HOME/jdb.ini
-    if grep -q "uid=" $HOME/jdb.ini  ; then
-      echo "Unable to make file unreadable, so test will fail. chmod: $HOME/jdb.ini"
-      if grep -q "uid=0" $HOME/jdb.ini  ; then
-        echo "The test is running as root. Fix infrastructure!"
-      fi
-    fi  
+canMakeUnreadable=No
+id > $HOME/jdb.ini
+if chmod a-r $HOME/jdb.ini 
+then
+  grep -q 'uid=0(' $HOME/jdb.ini 2> /dev/null
+  case $? in
+    0)
+      echo "Error! Can't make file unreadable running as root"
+    ;;
+    1)
+      echo "Error! Can't make file unreadable for some other reason (windows?)"
+    ;;
+    *)
+      echo "OK. the file is unreadable"
+      canMakeUnreadable=Yes 
+    ;;
+   esac
+else    
+  echo "Error! Can't create or chmod file"
+fi  
+
+if [ "$canMakeUnreadable" = "Yes" ]
+then
     doit
     failIfNot 1 "open: $HOME/jdb.ini"
-    clean
 fi
+clean
 
 
 echo
@@ -246,8 +256,8 @@
     doit
     failIfNot 1 "from $fred"
 
-    if [ ! -r c:/ ] ; then
-        # Can't make a file unreadable under MKS
+    if [ "$canMakeUnreadable" = "Yes" ]
+    then
         chmod a-r $fred
         doit
         failIfNot 1 "open: $fred"
--- a/jdk/test/com/sun/jdi/connect/spi/JdiLoadedByCustomLoader.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/com/sun/jdi/connect/spi/JdiLoadedByCustomLoader.java	Wed Jul 05 20:18:12 2017 +0200
@@ -22,9 +22,8 @@
  */
 
 /*
- * Creates a URLClassLoader from 2 file URLs. The first
- * file URL is constructed from the given argument. The
- * second is the SDK tools.jar. Once created the test
+ * Creates a URLClassLoader from a file URL. The file URL
+ * is constructed from the given argument. Once created the test
  * attempts to load another test case (ListConnectors)
  * using the class loader and then it invokes the list()
  * method.
@@ -39,13 +38,9 @@
     public static void main(String args[]) throws Exception {
         // create files from given arguments and tools.jar
         File f1 = new File(args[0]);
-        String home = System.getProperty("java.home");
-        String tools = ".." + File.separatorChar + "lib" +
-            File.separatorChar + "tools.jar";
-        File f2 = (new File(home, tools)).getCanonicalFile();
 
         // create class loader
-        URL[] urls = { f1.toURL(), f2.toURL() };
+        URL[] urls = { f1.toURL() };
         URLClassLoader cl = new URLClassLoader(urls);
 
         // load ListConnectors using the class loader
--- a/jdk/test/com/sun/jdi/connect/spi/JdiLoadedByCustomLoader.sh	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/com/sun/jdi/connect/spi/JdiLoadedByCustomLoader.sh	Wed Jul 05 20:18:12 2017 +0200
@@ -68,7 +68,7 @@
 $JAVAC -d "${TESTCLASSES}" "${TESTSRC}"/JdiLoadedByCustomLoader.java
 
 mkdir "${SOMEOTHERDIR}"
-$JAVAC -d "${SOMEOTHERDIR}" -classpath "${TESTSRC}${PS}${TESTJAVA}/lib/tools.jar" \
+$JAVAC -d "${SOMEOTHERDIR}" -classpath "${TESTSRC}" \
     "${TESTSRC}"/ListConnectors.java
 
 # Run the test
--- a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java	Wed Jul 05 20:18:12 2017 +0200
@@ -62,7 +62,7 @@
                     "-XX:+UseConcMarkSweepGC",  // this will cause UseParNewGC to be FLAG_SET_ERGO
                     "-XX:+PrintGCDetails",
                     "-XX:Flags=" + flagsFile.getAbsolutePath(),
-                    "-cp", System.getProperty("test.class.path") + File.pathSeparator + getToolsJarPath(),
+                    "-cp", System.getProperty("test.class.path"),
                     "CheckOrigin",
                     "-runtests");
 
@@ -137,8 +137,4 @@
         vm.detach();
     }
 
-    private static String getToolsJarPath() {
-        return System.getProperty("java.home") +
-            "/../lib/tools.jar".replace("/", File.separator);
-    }
 }
--- a/jdk/test/com/sun/tools/attach/BasicTests.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/com/sun/tools/attach/BasicTests.java	Wed Jul 05 20:18:12 2017 +0200
@@ -80,8 +80,7 @@
 
         // Need to add jdk/lib/tools.jar to classpath.
         String classpath =
-            System.getProperty("test.class.path", "") + File.pathSeparator +
-            System.getProperty("test.jdk", ".") + sep + "lib" + sep + "tools.jar";
+            System.getProperty("test.class.path", "");
         String testClassDir = System.getProperty("test.classes", "") + sep;
 
         // Argumenta : -classpath cp BasicTests$TestMain pid agent badagent redefineagent
--- a/jdk/test/com/sun/tools/attach/PermissionTest.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/com/sun/tools/attach/PermissionTest.java	Wed Jul 05 20:18:12 2017 +0200
@@ -71,10 +71,8 @@
     private static void runTests(long pid) throws Throwable {
         final String sep = File.separator;
 
-        // Need to add jdk/lib/tools.jar to classpath.
         String classpath =
-            System.getProperty("test.class.path", "") + File.pathSeparator +
-            System.getProperty("test.jdk", ".") + sep + "lib" + sep + "tools.jar";
+            System.getProperty("test.class.path", "");
         String testSrc = System.getProperty("test.src", "") + sep;
 
         // Use a policy that will NOT allow attach. Test will verify exception.
--- a/jdk/test/com/sun/tools/attach/ProviderTest.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/com/sun/tools/attach/ProviderTest.java	Wed Jul 05 20:18:12 2017 +0200
@@ -68,11 +68,10 @@
         String testClasses = System.getProperty("test.classes", "") + sep;
         String jdkLib = System.getProperty("test.jdk", ".") + sep + "lib" + sep;
 
-        // Need to add SimpleProvider.jar and tools.jar to classpath.
+        // Need to add SimpleProvider.jar to classpath.
         String classpath =
                 testClassPath + File.pathSeparator +
-                testClasses + "SimpleProvider.jar" + File.pathSeparator +
-                jdkLib + "tools.jar";
+                testClasses + "SimpleProvider.jar";
 
         String[] args = {
                 "-classpath",
--- a/jdk/test/com/sun/tools/attach/TempDirTest.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/com/sun/tools/attach/TempDirTest.java	Wed Jul 05 20:18:12 2017 +0200
@@ -120,10 +120,8 @@
     private static void launchTests(long pid, Path clientTmpDir) throws Throwable {
         final String sep = File.separator;
 
-        // Need to add jdk/lib/tools.jar to classpath.
         String classpath =
-            System.getProperty("test.class.path", "") + File.pathSeparator +
-            System.getProperty("test.jdk", ".") + sep + "lib" + sep + "tools.jar";
+            System.getProperty("test.class.path", "");
 
         String[] tmpDirArg = null;
         if (clientTmpDir != null) {
--- a/jdk/test/java/lang/instrument/IsModifiableClassAgent.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/java/lang/instrument/IsModifiableClassAgent.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,6 @@
 
 /**
  * @test
- * @ignore JDK-8068162
  * @bug 6331574
  * @summary test isModifiableClass
  * @author Robert Field, Sun Microsystems
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/channels/FileLock/FileLockConstructor.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.channels.AsynchronousFileChannel;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileLock;
+import java.nio.file.StandardOpenOption;
+
+/*
+ * @test
+ * @bug 6880737
+ * @summary Test FileLock constructor parameter validation.
+ */
+public class FileLockConstructor {
+    public static void main(String[] args) throws IOException {
+        FileLock fileLock = null;
+        int failures = 0;
+
+        // null FileChannel
+        boolean exceptionThrown = false;
+        try {
+            fileLock = new FileLockSub((FileChannel)null, 0, 0, false);
+        } catch (NullPointerException npe) {
+            exceptionThrown = true;
+        }
+        if (!exceptionThrown) {
+            System.err.println("FileLock constructor did not throw NPE for null FileChannel");
+            failures++;
+        }
+
+        // null AsynchronousFileChannel
+        exceptionThrown = false;
+        try {
+            fileLock = new FileLockSub((AsynchronousFileChannel)null, 0, 0, true);
+        } catch (NullPointerException npe) {
+            exceptionThrown = true;
+        }
+        if (!exceptionThrown) {
+            System.err.println("FileLock constructor did not throw NPE for null AsynchronousFileChannel");
+            failures++;
+        }
+
+        // create temporary file
+        File tmpFile = File.createTempFile("FileLock", "tmp");
+        tmpFile.deleteOnExit();
+
+        // position and size preconditions
+        long[][] posAndSize = new long[][] {
+            {0, 42},            // valid
+            {-1, 42},           // invalid: position < 0
+            {0, -1},            // invalid: size < 0
+            {Long.MAX_VALUE, 1} // invalid: position + size < 0
+        };
+
+        // test position and size preconditions for FileChannel case
+        try (FileChannel syncChannel = FileChannel.open(tmpFile.toPath(),
+                StandardOpenOption.READ, StandardOpenOption.WRITE)) {
+
+            for (int i = 0; i < posAndSize.length; i++) {
+                boolean preconditionsHold = i == 0;
+                exceptionThrown = false;
+                try {
+                    fileLock = new FileLockSub(syncChannel, posAndSize[i][0],
+                            posAndSize[i][1], true);
+                } catch (IllegalArgumentException iae) {
+                    exceptionThrown = true;
+                } catch (Exception e) {
+                    System.err.println("Unexpected exception \"" + e + "\" caught"
+                            + " for position " + posAndSize[i][0] + " and size "
+                            + posAndSize[i][1] + " for FileChannel variant");
+                    failures++;
+                    continue;
+                }
+                if (preconditionsHold && exceptionThrown) {
+                    System.err.println("FileLock constructor incorrectly threw IAE"
+                            + " for position " + posAndSize[i][0] + " and size "
+                            + posAndSize[i][1] + " for FileChannel variant");
+                    failures++;
+                } else if (!preconditionsHold && !exceptionThrown) {
+                    System.err.println("FileLock constructor did not throw IAE"
+                            + " for position " + posAndSize[i][0] + " and size "
+                            + posAndSize[i][1] + " for FileChannel variant");
+                    failures++;
+                }
+            }
+        }
+
+        // test position and size preconditions for AsynchronousFileChannel case
+        try (AsynchronousFileChannel asyncChannel
+                = AsynchronousFileChannel.open(tmpFile.toPath(),
+                        StandardOpenOption.READ, StandardOpenOption.WRITE)) {
+            for (int i = 0; i < posAndSize.length; i++) {
+                boolean preconditionsHold = i == 0;
+                exceptionThrown = false;
+                try {
+                    fileLock = new FileLockSub(asyncChannel, posAndSize[i][0],
+                            posAndSize[i][1], true);
+                } catch (IllegalArgumentException iae) {
+                    exceptionThrown = true;
+                } catch (Exception e) {
+                    System.err.println("Unexpected exception \"" + e + "\" caught"
+                            + " for position " + posAndSize[i][0] + " and size "
+                            + posAndSize[i][1] + " for AsynchronousFileChannel variant");
+                    failures++;
+                    continue;
+                }
+                if (preconditionsHold && exceptionThrown) {
+                    System.err.println("FileLock constructor incorrectly threw IAE"
+                            + " for position " + posAndSize[i][0] + " and size "
+                            + posAndSize[i][1] + " for AsynchronousFileChannel variant");
+                    failures++;
+                } else if (!preconditionsHold && !exceptionThrown) {
+                    System.err.println("FileLock constructor did not throw IAE"
+                            + " for position " + posAndSize[i][0] + " and size "
+                            + posAndSize[i][1] + " for AsynchronousFileChannel variant");
+                    failures++;
+                }
+            }
+        }
+
+        if (failures > 0) {
+            throw new RuntimeException("Incurred " + failures +
+                                       " failures while testing FileLock.");
+        }
+    }
+}
+
+class FileLockSub extends FileLock {
+    FileLockSub(FileChannel channel, long position, long size, boolean shared) {
+        super(channel, position, size, shared);
+    }
+
+    FileLockSub(AsynchronousFileChannel channel, long position, long size,
+                boolean shared) {
+        super(channel, position, size, shared);
+    }
+
+    @Override
+    public boolean isValid() {
+        return false;
+    }
+
+    @Override
+    public void release() throws IOException {
+        // do nothing
+    }
+}
--- a/jdk/test/java/time/tck/java/time/TCKLocalDateTime.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/java/time/tck/java/time/TCKLocalDateTime.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -292,7 +292,8 @@
             expected = LocalDateTime.now(Clock.system(zone));
             test = LocalDateTime.now(zone);
         }
-        assertEquals(test, expected);
+        assertEquals(test.truncatedTo(ChronoUnit.SECONDS),
+                     expected.truncatedTo(ChronoUnit.SECONDS));
     }
 
     //-----------------------------------------------------------------------
--- a/jdk/test/java/time/tck/java/time/TCKLocalTime.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/java/time/tck/java/time/TCKLocalTime.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -246,7 +246,8 @@
             expected = LocalTime.now(Clock.system(zone));
             test = LocalTime.now(zone);
         }
-        assertEquals(test, expected);
+        assertEquals(test.truncatedTo(ChronoUnit.SECONDS),
+                     expected.truncatedTo(ChronoUnit.SECONDS));
     }
 
     //-----------------------------------------------------------------------
--- a/jdk/test/java/time/tck/java/time/TCKZonedDateTime.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/java/time/tck/java/time/TCKZonedDateTime.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -260,7 +260,8 @@
             expected = ZonedDateTime.now(Clock.system(zone));
             test = ZonedDateTime.now(zone);
         }
-        assertEquals(test, expected);
+        assertEquals(test.truncatedTo(ChronoUnit.SECONDS),
+                     expected.truncatedTo(ChronoUnit.SECONDS));
     }
 
     //-----------------------------------------------------------------------
--- a/jdk/test/java/time/tck/java/time/chrono/TCKJapaneseEra.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/java/time/tck/java/time/chrono/TCKJapaneseEra.java	Wed Jul 05 20:18:12 2017 +0200
@@ -59,6 +59,7 @@
 import static java.time.temporal.ChronoField.ERA;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
 
 import java.time.chrono.Era;
 import java.time.chrono.JapaneseChronology;
@@ -69,7 +70,8 @@
 import org.testng.annotations.Test;
 
 /**
- * Test.
+ * Tests for JapaneseEra
+ * @bug 8068278
  */
 @Test
 public class TCKJapaneseEra {
@@ -84,6 +86,20 @@
         };
     }
 
+    @DataProvider(name = "InvalidJapaneseEras")
+    Object[][] data_of_invalid_eras() {
+        return new Object[][] {
+                {-2},
+                {-3},
+                {3},
+                {Integer.MIN_VALUE},
+                {Integer.MAX_VALUE},
+        };
+    }
+
+    //-----------------------------------------------------------------------
+    // JapaneseEra value test
+    //-----------------------------------------------------------------------
     @Test(dataProvider="JapaneseEras")
     public void test_valueOf(JapaneseEra era , String eraName, int eraValue) {
         assertEquals(era.getValue(), eraValue);
@@ -118,4 +134,11 @@
         }
     }
 
+    //-----------------------------------------------------------------------
+    // JapaneseChronology.INSTANCE.eraOf invalid era test
+    //-----------------------------------------------------------------------
+    @Test(dataProvider="InvalidJapaneseEras", expectedExceptions=java.time.DateTimeException.class)
+    public void test_outofrange(int era) {
+        JapaneseChronology.INSTANCE.eraOf(era);
+    }
 }
--- a/jdk/test/java/time/test/java/time/TestClock_System.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/java/time/test/java/time/TestClock_System.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -62,7 +62,9 @@
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertSame;
 
+import java.lang.reflect.Field;
 import java.time.Clock;
+import java.time.Instant;
 import java.time.ZoneId;
 
 import org.testng.annotations.Test;
@@ -87,4 +89,298 @@
         assertEquals(test.toString(), "SystemClock[Europe/Paris]");
     }
 
+    //-----------------------------------------------------------------------
+
+    private static String formatTime(String prefix, Instant time) {
+        return prefix + ": " + time + " - seconds: "
+                        + time.getEpochSecond() + ", nanos: "
+                        + time.getNano();
+    }
+
+    public void test_ClockResolution() {
+        Clock highestUTC = Clock.systemUTC();
+
+        Instant start = Instant.ofEpochMilli(System.currentTimeMillis());
+
+        try {
+            // smoke test
+            Instant system1 = Instant.ofEpochMilli(System.currentTimeMillis());
+            Instant system2 = Instant.ofEpochMilli(System.currentTimeMillis());
+            Instant highest1 = highestUTC.instant();
+            Instant highest2 = highestUTC.instant();
+            System.out.println(formatTime("\nsystemUTC #1            ", system1));
+            System.out.println(formatTime("systemUTC #2            ", system2));
+            System.out.println(formatTime("highestResolutionUTC #1 ", highest1));
+            System.out.println(formatTime("highestResolutionUTC #2 ", highest2));
+
+            if (system2.isBefore(system1)) {
+                System.err.println("system2 is before system1!");
+                System.err.println(formatTime("\n\tsystem1", system1));
+                System.err.println(formatTime("\n\tsystem2", system2));
+                throw new RuntimeException("system2 is before system1!"
+                        + formatTime("\n\tsystem1", system1)
+                        + formatTime("\n\tsystem2", system2));
+            }
+            if (highest2.isBefore(highest1)) {
+                System.err.println("highest2 is before highest1!");
+                System.err.println(formatTime("\n\thighest1", system1));
+                System.err.println(formatTime("\n\tsystem2", highest2));
+                throw new RuntimeException("highest2 is before system1!"
+                        + formatTime("\n\thighest1", system1)
+                        + formatTime("\n\tsystem2", highest2));
+            }
+
+            // better test - but depends on implementation details.
+            // we're not rounding - so highest1 should be greater or equal to
+            // system1
+            system1 = Instant.ofEpochMilli(System.currentTimeMillis());
+            highest1 = highestUTC.instant();
+
+            System.out.println(formatTime("\nsystemUTC            ", system1));
+            System.out.println(formatTime("highestResolutionUTC ", highest1));
+
+            if (highest1.isBefore(system1)) {
+                System.err.println("highest1 is before system1!");
+                System.err.println(formatTime("\n\tsystem1", system1));
+                System.err.println(formatTime("\n\thighest1", highest1));
+                throw new RuntimeException("highest1 is before system1!"
+                        + formatTime("\n\tsystem1", system1)
+                        + formatTime("\n\thighest1", highest1));
+            }
+
+            int count=0;
+            // let's preheat the system a bit:
+            for (int i = 0; i < 1000 ; i++) {
+                system1 = Instant.ofEpochMilli(System.currentTimeMillis());
+                highest1 = highestUTC.instant();
+                final int sysnan = system1.getNano();
+                final int nanos = highest1.getNano();
+                if ((nanos % 1000000) > 0) {
+                    count++; // we have micro seconds
+                }
+                if ((sysnan % 1000000) > 0) {
+                    throw new RuntimeException("Expected only millisecconds "
+                            + "precision for systemUTC, found "
+                            + (sysnan % 1000000) + " remainder.");
+                }
+            }
+            System.out.println("\nNumber of time stamps which had better than"
+                    + " millisecond precision: "+count+"/"+1000);
+            System.out.println(formatTime("\nsystemUTC            ", system1));
+            System.out.println(formatTime("highestResolutionUTC ", highest1));
+            if (count == 0) {
+                System.err.println("Something is strange: no microsecond "
+                        + "precision with highestResolutionUTC?");
+                throw new RuntimeException("Micro second preccision not reached");
+            }
+
+            // check again
+            if (highest1.isBefore(system1)) {
+                System.err.println("highest1 is before system1!");
+                System.err.println(formatTime("\n\tsystem1", system1));
+                System.err.println(formatTime("\n\thighest1", highest1));
+                throw new RuntimeException("highest1 is before system1!"
+                        + formatTime("\n\tsystem1", system1)
+                        + formatTime("\n\thighest1", highest1));
+            }
+
+            // leap of faith: ensure that highest1 is from within 10 secs of
+            //   system1
+            if (highest1.toEpochMilli() != system1.toEpochMilli()) {
+                long delta = highest1.getEpochSecond() - system1.getEpochSecond();
+                if (delta > 10) {
+                    throw new RuntimeException("Unexpected long delay between two clocks ("
+                            + delta + " seconds)"
+                            + formatTime("\n\t system1", system1)
+                            + formatTime("\n\t highest1", highest1));
+
+                }
+            } else {
+                System.out.println("You won the lottery: the two dates are within 1 millisecond!\n");
+            }
+
+        } finally {
+            Instant stop = Instant.ofEpochMilli(System.currentTimeMillis());
+            if (start.isAfter(stop)) {
+                // This should not happen - but can (un)probably be observed
+                // when switching to summer time, or if another application
+                // is switching the system date...
+                System.err.println("Cannot test - date was setback: "
+                        + formatTime("\n\tstarted at", start)
+                        + formatTime("\n\tstopped at", stop) + "\n");
+                return; // will prevent exceptions from being propagated.
+            }
+        }
+    }
+
+    static final long MAX_OFFSET = 0x0100000000L;
+    static final long MIN_OFFSET = -MAX_OFFSET;
+
+    // A helper class to test that SystemClock correctly recomputes
+    // its offset.
+    static class SystemClockOffset {
+
+        static final int MILLIS_IN_SECOND = 1000;
+        static final int NANOS_IN_MILLI = 1000_000;
+        static final int NANOS_IN_MICRO = 1000;
+        static final int NANOS_IN_SECOND = 1000_000_000;
+
+        static final boolean verbose = true;
+        static final Clock systemUTC = Clock.systemUTC();
+        static final Field offsetField;
+
+        static {
+            try {
+                offsetField = Class.forName("java.time.Clock$SystemClock").getDeclaredField("offset");
+                offsetField.setAccessible(true);
+            } catch (ClassNotFoundException | NoSuchFieldException ex) {
+                throw new ExceptionInInitializerError(ex);
+            }
+        }
+
+        static enum Answer {
+
+            YES, // isOffLimit = YES:   we must get -1
+            NO, // isOffLimit = NO:    we must not not get -1
+            MAYBE  // isOffLimit = MAYBE: we might get -1 or a valid adjustment.
+        };
+
+        static long distance(long one, long two) {
+            return one > two ? Math.subtractExact(one, two)
+                    : Math.subtractExact(two, one);
+        }
+
+        static Answer isOffLimits(long before, long after, long offset) {
+            long relativeDistanceBefore = distance(before, offset);
+            long relativeDistanceAfter = distance(after, offset);
+            if (relativeDistanceBefore >= MAX_OFFSET && relativeDistanceAfter >= MAX_OFFSET) {
+                return Answer.YES;
+            }
+            if (relativeDistanceBefore < MAX_OFFSET && relativeDistanceAfter < MAX_OFFSET) {
+                if (relativeDistanceBefore == 0 || relativeDistanceAfter == 0) {
+                    return Answer.MAYBE; // unlucky case where
+                }
+                return Answer.NO;
+            }
+            return Answer.MAYBE;
+        }
+
+        static void testWithOffset(String name, long offset)
+                throws IllegalAccessException {
+            testWithOffset(name, offset, systemUTC);
+        }
+
+        static void testWithOffset(String name, long offset, Clock clock)
+                throws IllegalAccessException {
+            offsetField.set(clock, offset);
+            long beforeMillis = System.currentTimeMillis();
+            final Instant instant = clock.instant();
+            long afterMillis = System.currentTimeMillis();
+            long actualOffset = offsetField.getLong(clock);
+            long instantMillis = instant.getEpochSecond() * MILLIS_IN_SECOND
+                    + instant.getNano() / NANOS_IN_MILLI;
+            if (instantMillis < beforeMillis || instantMillis > afterMillis) {
+                throw new RuntimeException(name
+                        + ": Invalid instant: " + instant
+                        + " (~" + instantMillis + "ms)"
+                        + " when time in millis is in ["
+                        + beforeMillis + ", " + afterMillis
+                        + "] and offset in seconds is " + offset);
+            }
+            Answer isOffLimits = isOffLimits(beforeMillis / MILLIS_IN_SECOND,
+                    afterMillis / MILLIS_IN_SECOND, offset);
+            switch (isOffLimits) {
+                case YES:
+                    if (actualOffset == offset) {
+                        throw new RuntimeException(name
+                                + ": offset was offlimit but was not recomputed "
+                                + " when time in millis is in ["
+                                + beforeMillis + ", " + afterMillis
+                                + "] and offset in seconds was " + offset);
+                    }
+                    break;
+                case NO:
+                    if (actualOffset != offset) {
+                        throw new RuntimeException(name
+                                + ": offset was not offlimit but was recomputed.");
+                    }
+                    break;
+                default:
+                    break;
+            }
+            if (distance(actualOffset, instant.getEpochSecond()) >= MAX_OFFSET) {
+                throw new RuntimeException(name + ": Actual offset is too far off:"
+                        + " offset=" + actualOffset
+                        + "instant.seconds=" + instant.getEpochSecond());
+            }
+            long adjustment = (instant.getEpochSecond() - actualOffset) * NANOS_IN_SECOND
+                    + instant.getNano();
+            validateAdjustment(name, actualOffset, beforeMillis, afterMillis, adjustment);
+        }
+
+        static void validateAdjustment(String name, long offset, long beforeMillis,
+                long afterMillis, long adjustment) {
+            System.out.println("Validating adjustment: " + adjustment);
+            long expectedMax = distance(offset, beforeMillis / MILLIS_IN_SECOND)
+                    * NANOS_IN_SECOND
+                    + (beforeMillis % MILLIS_IN_SECOND) * NANOS_IN_MILLI
+                    + (afterMillis - beforeMillis + 1) * NANOS_IN_MILLI;
+            long absoluteAdjustment = distance(0, adjustment);
+            if (absoluteAdjustment > expectedMax) {
+                long adjSec = absoluteAdjustment / NANOS_IN_SECOND;
+                long adjMil = (absoluteAdjustment % NANOS_IN_SECOND) / NANOS_IN_MILLI;
+                long adjMic = (absoluteAdjustment % NANOS_IN_MILLI) / NANOS_IN_MICRO;
+                long adjNan = (absoluteAdjustment % NANOS_IN_MICRO);
+                long expSec = expectedMax / NANOS_IN_SECOND;
+                long expMil = (expectedMax % NANOS_IN_SECOND) / NANOS_IN_MILLI;
+                long expMic = (expectedMax % NANOS_IN_MILLI) / NANOS_IN_MICRO;
+                long expNan = (expectedMax % NANOS_IN_MICRO);
+                System.err.println("Excessive adjustment: " + adjSec + "s, "
+                        + adjMil + "ms, " + adjMic + "mics, " + adjNan + "ns");
+                System.err.println("Epected max: " + expSec + "s, "
+                        + expMil + "ms, " + expMic + "mics, " + expNan + "ns");
+
+                throw new RuntimeException(name
+                        + ": Excessive adjustment: " + adjustment
+                        + " when time in millis is in ["
+                        + beforeMillis + ", " + afterMillis
+                        + "] and offset in seconds is " + offset);
+            }
+        }
+    }
+
+    public void test_OffsetRegular() throws IllegalAccessException {
+        System.out.println("*** Testing regular cases ***");
+        SystemClockOffset.testWithOffset("System.currentTimeMillis()/1000",
+                System.currentTimeMillis()/1000);
+        SystemClockOffset.testWithOffset("System.currentTimeMillis()/1000 - 1024",
+                System.currentTimeMillis()/1000 - 1024);
+        SystemClockOffset.testWithOffset("System.currentTimeMillis()/1000 + 1024",
+                System.currentTimeMillis()/1000 + 1024);
+    }
+
+    public void test_OffsetLimits() throws IllegalAccessException {
+        System.out.println("*** Testing limits ***");
+        SystemClockOffset.testWithOffset("System.currentTimeMillis()/1000 - MAX_OFFSET + 1",
+                System.currentTimeMillis()/1000 - MAX_OFFSET + 1);
+        SystemClockOffset.testWithOffset("System.currentTimeMillis()/1000 + MAX_OFFSET - 1",
+                System.currentTimeMillis()/1000 + MAX_OFFSET - 1);
+        SystemClockOffset.testWithOffset("System.currentTimeMillis()/1000 - MAX_OFFSET",
+                System.currentTimeMillis()/1000 - MAX_OFFSET);
+        SystemClockOffset.testWithOffset("System.currentTimeMillis()/1000 + MAX_OFFSET",
+                System.currentTimeMillis()/1000 + MAX_OFFSET);
+        SystemClockOffset.testWithOffset("System.currentTimeMillis()/1000 - MAX_OFFSET - 1024",
+                System.currentTimeMillis()/1000 - MAX_OFFSET - 1024);
+        SystemClockOffset.testWithOffset("System.currentTimeMillis()/1000 + MAX_OFFSET + 1024",
+                System.currentTimeMillis()/1000 + MAX_OFFSET + 1024);
+        SystemClockOffset.testWithOffset("0", 0);
+        SystemClockOffset.testWithOffset("-1", -1);
+        SystemClockOffset.testWithOffset("Integer.MAX_VALUE + System.currentTimeMillis()/1000",
+                ((long)Integer.MAX_VALUE) + System.currentTimeMillis()/1000);
+        SystemClockOffset.testWithOffset("System.currentTimeMillis()/1000 - Integer.MIN_VALUE",
+                System.currentTimeMillis()/1000 - Integer.MIN_VALUE);
+        SystemClockOffset.testWithOffset("Long.MAX_VALUE", Long.MAX_VALUE);
+        SystemClockOffset.testWithOffset("System.currentTimeMillis()/1000 - Long.MIN_VALUE",
+                (Long.MIN_VALUE + System.currentTimeMillis()/1000)*-1);
+    }
 }
--- a/jdk/test/java/time/test/java/util/TestFormatter.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/java/time/test/java/util/TestFormatter.java	Wed Jul 05 20:18:12 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -38,6 +38,7 @@
 import java.time.temporal.ChronoField;
 import java.time.temporal.TemporalQueries;
 import java.time.temporal.TemporalAccessor;
+import java.time.temporal.UnsupportedTemporalTypeException;
 
 import java.util.*;
 
@@ -153,6 +154,44 @@
         if (verbose) {
             System.out.printf("%-24s  : %s%n", getClassName(dt), out);
         }
+
+        // expected usually comes from Calendar which only has milliseconds
+        // precision. So we're going to replace it's N:[nanos] stamp with
+        // the correct value for nanos.
+        if ((dt instanceof TemporalAccessor) && expected != null) {
+            try {
+                // Get millis & nanos from the dt
+                final TemporalAccessor ta = (TemporalAccessor) dt;
+                final int nanos = ta.get(ChronoField.NANO_OF_SECOND);
+                final int millis = ta.get(ChronoField.MILLI_OF_SECOND);
+                final String nanstr = String.valueOf(nanos);
+                final String mistr = String.valueOf(millis);
+
+                // Compute the value of the N:[nanos] field that we expect
+                // to find in 'out'
+                final StringBuilder sb = new StringBuilder();
+                sb.append("N:[");
+                for (int i=nanstr.length(); i<9; i++) {
+                    sb.append('0');
+                }
+                sb.append(nanos).append("]");
+
+                // Compute the truncated value of N:[nanos] field that might
+                // be in 'expected' when expected was built from Calendar.
+                final StringBuilder sbm = new StringBuilder();
+                sbm.append("N:[");
+                for (int i=mistr.length(); i<3; i++) {
+                    sbm.append('0');
+                }
+                sbm.append(mistr).append("000000]");
+
+                // if expected contains the truncated value, replace it with
+                // the complete value.
+                expected = expected.replace(sbm.toString(), sb.toString());
+            } catch (UnsupportedTemporalTypeException e) {
+                // nano seconds unsupported - nothing to do...
+            }
+        }
         if (expected != null && !out.equals(expected)) {
             System.out.printf("%-24s  actual: %s%n                FAILED; expected: %s%n",
                               getClassName(dt), out, expected);
--- a/jdk/test/java/util/Optional/Basic.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/java/util/Optional/Basic.java	Wed Jul 05 20:18:12 2017 +0200
@@ -29,6 +29,7 @@
 
 import java.util.NoSuchElementException;
 import java.util.Optional;
+import java.util.stream.Stream;
 
 import static org.testng.Assert.*;
 import org.testng.annotations.Test;
@@ -54,8 +55,8 @@
         assertSame(null, empty.orElse(null));
         RuntimeException orElse = new RuntimeException() { };
         assertSame(Boolean.FALSE, empty.orElse(Boolean.FALSE));
-        assertSame(null, empty.orElseGet(()-> null));
-        assertSame(Boolean.FALSE, empty.orElseGet(()-> Boolean.FALSE));
+        assertSame(null, empty.orElseGet(() -> null));
+        assertSame(Boolean.FALSE, empty.orElseGet(() -> Boolean.FALSE));
     }
 
     @Test(expectedExceptions=NoSuchElementException.class)
@@ -104,15 +105,15 @@
         try {
             present.ifPresent(v -> { throw new ObscureException(); });
             fail();
-        } catch(ObscureException expected) {
+        } catch (ObscureException expected) {
 
         }
         assertSame(Boolean.TRUE, present.orElse(null));
         assertSame(Boolean.TRUE, present.orElse(Boolean.FALSE));
         assertSame(Boolean.TRUE, present.orElseGet(null));
-        assertSame(Boolean.TRUE, present.orElseGet(()-> null));
-        assertSame(Boolean.TRUE, present.orElseGet(()-> Boolean.FALSE));
-        assertSame(Boolean.TRUE, present.<RuntimeException>orElseThrow( null));
+        assertSame(Boolean.TRUE, present.orElseGet(() -> null));
+        assertSame(Boolean.TRUE, present.orElseGet(() -> Boolean.FALSE));
+        assertSame(Boolean.TRUE, present.<RuntimeException>orElseThrow(null));
         assertSame(Boolean.TRUE, present.<RuntimeException>orElseThrow(ObscureException::new));
     }
 
@@ -226,6 +227,26 @@
         assertSame(l, fixture);
     }
 
+    @Test(groups = "unit")
+    public void testStream() {
+        {
+            Stream<String> s = Optional.<String>empty().stream();
+            assertFalse(s.isParallel());
+
+            Object[] es = s.toArray();
+            assertEquals(es.length, 0);
+        }
+
+        {
+            Stream<String> s = Optional.of("Duke").stream();
+            assertFalse(s.isParallel());
+
+            String[] es = s.toArray(String[]::new);
+            assertEquals(es.length, 1);
+            assertEquals(es[0], "Duke");
+        }
+    }
+
     private static class ObscureException extends RuntimeException {
 
     }
--- a/jdk/test/java/util/Optional/BasicDouble.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/java/util/Optional/BasicDouble.java	Wed Jul 05 20:18:12 2017 +0200
@@ -29,6 +29,7 @@
 
 import java.util.NoSuchElementException;
 import java.util.OptionalDouble;
+import java.util.stream.DoubleStream;
 
 import static org.testng.Assert.*;
 import org.testng.annotations.Test;
@@ -109,6 +110,26 @@
         assertEquals(1.0, present.<RuntimeException>orElseThrow(ObscureException::new));
     }
 
+    @Test(groups = "unit")
+    public void testStream() {
+        {
+            DoubleStream s = OptionalDouble.empty().stream();
+            assertFalse(s.isParallel());
+
+            double[] es = s.toArray();
+            assertEquals(es.length, 0);
+        }
+
+        {
+            DoubleStream s = OptionalDouble.of(42.0).stream();
+            assertFalse(s.isParallel());
+
+            double[] es = s.toArray();
+            assertEquals(es.length, 1);
+            assertEquals(es[0], 42.0);
+        }
+    }
+
     private static class ObscureException extends RuntimeException {
 
     }
--- a/jdk/test/java/util/Optional/BasicInt.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/java/util/Optional/BasicInt.java	Wed Jul 05 20:18:12 2017 +0200
@@ -29,6 +29,7 @@
 
 import java.util.NoSuchElementException;
 import java.util.OptionalInt;
+import java.util.stream.IntStream;
 
 import static org.testng.Assert.*;
 import org.testng.annotations.Test;
@@ -53,36 +54,36 @@
         assertEquals(2, empty.orElseGet(()-> 2));
     }
 
-        @Test(expectedExceptions=NoSuchElementException.class)
-        public void testEmptyGet() {
-            OptionalInt empty = OptionalInt.empty();
+    @Test(expectedExceptions=NoSuchElementException.class)
+    public void testEmptyGet() {
+        OptionalInt empty = OptionalInt.empty();
 
-            int got = empty.getAsInt();
-        }
+        int got = empty.getAsInt();
+    }
 
-        @Test(expectedExceptions=NullPointerException.class)
-        public void testEmptyOrElseGetNull() {
-            OptionalInt empty = OptionalInt.empty();
+    @Test(expectedExceptions=NullPointerException.class)
+    public void testEmptyOrElseGetNull() {
+        OptionalInt empty = OptionalInt.empty();
 
-            int got = empty.orElseGet(null);
-        }
+        int got = empty.orElseGet(null);
+    }
 
-        @Test(expectedExceptions=NullPointerException.class)
-        public void testEmptyOrElseThrowNull() throws Throwable {
-            OptionalInt empty = OptionalInt.empty();
+    @Test(expectedExceptions=NullPointerException.class)
+    public void testEmptyOrElseThrowNull() throws Throwable {
+        OptionalInt empty = OptionalInt.empty();
 
-            int got = empty.orElseThrow(null);
-        }
+        int got = empty.orElseThrow(null);
+    }
 
-        @Test(expectedExceptions=ObscureException.class)
-        public void testEmptyOrElseThrow() throws Exception {
-            OptionalInt empty = OptionalInt.empty();
+    @Test(expectedExceptions=ObscureException.class)
+    public void testEmptyOrElseThrow() throws Exception {
+        OptionalInt empty = OptionalInt.empty();
 
-            int got = empty.orElseThrow(ObscureException::new);
-        }
+        int got = empty.orElseThrow(ObscureException::new);
+    }
 
-        @Test(groups = "unit")
-        public void testPresent() {
+    @Test(groups = "unit")
+    public void testPresent() {
         OptionalInt empty = OptionalInt.empty();
         OptionalInt present = OptionalInt.of(1);
 
@@ -109,6 +110,26 @@
         assertEquals(1, present.<RuntimeException>orElseThrow(ObscureException::new));
     }
 
+    @Test(groups = "unit")
+    public void testStream() {
+        {
+            IntStream s = OptionalInt.empty().stream();
+            assertFalse(s.isParallel());
+
+            int[] es = s.toArray();
+            assertEquals(es.length, 0);
+        }
+
+        {
+            IntStream s = OptionalInt.of(42).stream();
+            assertFalse(s.isParallel());
+
+            int[] es = OptionalInt.of(42).stream().toArray();
+            assertEquals(es.length, 1);
+            assertEquals(es[0], 42);
+        }
+    }
+
     private static class ObscureException extends RuntimeException {
 
     }
--- a/jdk/test/java/util/Optional/BasicLong.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/java/util/Optional/BasicLong.java	Wed Jul 05 20:18:12 2017 +0200
@@ -29,6 +29,7 @@
 
 import java.util.NoSuchElementException;
 import java.util.OptionalLong;
+import java.util.stream.LongStream;
 
 import static org.testng.Assert.*;
 import org.testng.annotations.Test;
@@ -109,6 +110,24 @@
         assertEquals(1, present.<RuntimeException>orElseThrow(ObscureException::new));
     }
 
+    @Test(groups = "unit")
+    public void testStream() {
+        {
+            LongStream s = OptionalLong.empty().stream();
+
+            long[] es = s.toArray();
+            assertEquals(es.length, 0);
+        }
+
+        {
+            LongStream s = OptionalLong.of(42L).stream();
+
+            long[] es = s.toArray();
+            assertEquals(es.length, 1);
+            assertEquals(es[0], 42L);
+        }
+    }
+
     private static class ObscureException extends RuntimeException {
 
     }
--- a/jdk/test/java/util/concurrent/CompletableFuture/ThenComposeExceptionTest.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/java/util/concurrent/CompletableFuture/ThenComposeExceptionTest.java	Wed Jul 05 20:18:12 2017 +0200
@@ -36,7 +36,7 @@
 
 /**
  * @test
- * @bug 8068432
+ * @bug 8068432 8072030
  * @run testng ThenComposeExceptionTest
  * @summary Test that CompletableFuture.thenCompose works correctly if the
  * composing future completes exceptionally
@@ -92,7 +92,8 @@
         Assert.assertNotSame(f_thenCompose, fe, "Composed CompletableFuture returned directly");
 
         AtomicReference<Throwable> eOnWhenComplete = new AtomicReference<>();
-        f_thenCompose.whenComplete((r, e) -> eOnWhenComplete.set(e));
+        CompletableFuture<String> f_whenComplete = f_thenCompose.
+                whenComplete((r, e) -> eOnWhenComplete.set(e));
 
         afterAction.accept(fe);
 
@@ -103,10 +104,20 @@
         catch (Throwable t) {
             eOnJoined = t;
         }
-
-        Assert.assertTrue(eOnWhenComplete.get() instanceof CompletionException,
-                          "Incorrect exception reported on whenComplete");
         Assert.assertTrue(eOnJoined instanceof CompletionException,
-                          "Incorrect exception reported when joined");
+                          "Incorrect exception reported when joined on thenCompose: " + eOnJoined);
+
+        // Need to wait for f_whenComplete to complete to avoid
+        // race condition when updating eOnWhenComplete
+        eOnJoined = null;
+        try {
+            f_whenComplete.join();
+        } catch (Throwable t) {
+            eOnJoined = t;
+        }
+        Assert.assertTrue(eOnJoined instanceof CompletionException,
+                          "Incorrect exception reported when joined on whenComplete: " + eOnJoined);
+        Assert.assertTrue(eOnWhenComplete.get() instanceof CompletionException,
+                          "Incorrect exception passed to whenComplete: " + eOnWhenComplete.get());
     }
-}
+}
\ No newline at end of file
--- a/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java	Wed Jul 05 20:18:12 2017 +0200
@@ -145,13 +145,7 @@
 
             ProcessBuilder client = ProcessTools.createJavaProcessBuilder(
                 "-cp",
-                TEST_CLASSPATH +
-                    File.pathSeparator +
-                    TEST_JDK +
-                    File.separator +
-                    "lib" +
-                    File.separator +
-                    "tools.jar",
+                TEST_CLASSPATH,
                 "TestManager",
                 String.valueOf(serverPrc.getPid()),
                 port.get(),
--- a/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java	Wed Jul 05 20:18:12 2017 +0200
@@ -132,13 +132,7 @@
 
             ProcessBuilder client = ProcessTools.createJavaProcessBuilder(
                 "-cp",
-                TEST_CLASSPATH +
-                    File.pathSeparator +
-                    TEST_JDK +
-                    File.separator +
-                    "lib" +
-                    File.separator +
-                    "tools.jar",
+                TEST_CLASSPATH,
                 "TestManager",
                 String.valueOf(serverPrc.getPid()),
                 port.get(),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/misc/VM/GetNanoTimeAdjustment.java	Wed Jul 05 20:18:12 2017 +0200
@@ -0,0 +1,249 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.util.Objects;
+import sun.misc.VM;
+
+/**
+ * @test
+ * @bug 8068730
+ * @summary tests that VM.getgetNanoTimeAdjustment() works as expected.
+ * @run main GetNanoTimeAdjustment
+ * @author danielfuchs
+ */
+public class GetNanoTimeAdjustment {
+
+    static final int MILLIS_IN_SECOND = 1000;
+    static final int NANOS_IN_MILLI = 1000_000;
+    static final int NANOS_IN_MICRO = 1000;
+    static final int NANOS_IN_SECOND = 1000_000_000;
+
+    static final boolean verbose = true;
+
+    static final class TestAssertException extends RuntimeException {
+        TestAssertException(String msg) { super(msg); }
+    }
+
+    private static void assertEquals(long expected, long received, String msg) {
+        if (expected != received) {
+            throw new TestAssertException("Unexpected result for " + msg
+                    + ".\n\texpected: " + expected
+                    +  "\n\tactual:   " + received);
+        } else if (verbose) {
+            System.out.println("Got expected " + msg + ": " + received);
+        }
+    }
+
+    private static void assertEquals(Object expected, Object received, String msg) {
+        if (!Objects.equals(expected, received)) {
+            throw new TestAssertException("Unexpected result for " + msg
+                    + ".\n\texpected: " + expected
+                    +  "\n\tactual:   " + received);
+        } else if (verbose) {
+            System.out.println("Got expected " + msg + ": " + received);
+        }
+    }
+
+    static final long MAX_OFFSET = 0x0100000000L;
+    static final long MIN_OFFSET = -MAX_OFFSET;
+    static enum Answer {
+        YES,   // isOffLimit = YES:   we must get -1
+        NO,    // isOffLimit = NO:    we must not not get -1
+        MAYBE  // isOffLimit = MAYBE: we might get -1 or a valid adjustment.
+    };
+    static long distance(long one, long two) {
+        return one > two ? Math.subtractExact(one, two)
+                : Math.subtractExact(two, one);
+    }
+
+
+    static Answer isOffLimits(long before, long after, long offset) {
+        long relativeDistanceBefore = distance(before, offset);
+        long relativeDistanceAfter  = distance(after, offset);
+        if (relativeDistanceBefore >= MAX_OFFSET && relativeDistanceAfter >= MAX_OFFSET) {
+            return Answer.YES;
+        }
+        if (relativeDistanceBefore < MAX_OFFSET && relativeDistanceAfter < MAX_OFFSET) {
+            if (relativeDistanceBefore == 0 || relativeDistanceAfter == 0) {
+                return Answer.MAYBE; // unlucky case where
+            }
+            return Answer.NO;
+        }
+        return Answer.MAYBE;
+    }
+
+    static void testWithOffset(String name, long offset) {
+        System.out.println("Testing with offset: " + name);
+        long beforeMillis = System.currentTimeMillis();
+        long adjustment = VM.getNanoTimeAdjustment(offset);
+        long afterMillis = System.currentTimeMillis();
+
+        if (offset >= beforeMillis/MILLIS_IN_SECOND
+                && offset <= afterMillis/MILLIS_IN_SECOND) {
+            if (adjustment == -1) {
+                // it's possible that we have fallen in the unlucky case
+                // where -1 was the genuine result. let's go backward a bit.
+                offset = offset - 10;
+                beforeMillis = System.currentTimeMillis();
+                adjustment = VM.getNanoTimeAdjustment(offset);
+                afterMillis = System.currentTimeMillis();
+                if (adjustment == -1) {
+                    throw new RuntimeException(name + ": VM says " + offset
+                            + " secs is too far off, "
+                            + " when time in seconds is in ["
+                            + beforeMillis/MILLIS_IN_SECOND + ", "
+                            + afterMillis/MILLIS_IN_SECOND
+                            + "]");
+                }
+            }
+        }
+
+        Answer isOffLimit = isOffLimits(beforeMillis/MILLIS_IN_SECOND,
+                afterMillis/MILLIS_IN_SECOND, offset);
+        switch (isOffLimit) {
+            case YES:
+                if (adjustment != -1) {
+                    throw new RuntimeException(name
+                        + ": VM should have returned -1 for "
+                        + offset
+                        + " when time in seconds is in ["
+                        + beforeMillis/MILLIS_IN_SECOND + ", "
+                        + afterMillis/MILLIS_IN_SECOND + "]");
+                }
+                System.out.println("Got expected exception value: " + adjustment);
+                break;
+            case NO:
+                if (adjustment == -1) {
+                    throw new RuntimeException(name
+                            + "VM says "  + offset
+                            + " secs is too far off, "
+                            + " when time in seconds is in ["
+                            + beforeMillis/MILLIS_IN_SECOND + ", "
+                            + afterMillis/MILLIS_IN_SECOND
+                            + "]");
+                }
+                break;
+            case MAYBE:
+                System.out.println("Adjustment: " + adjustment);
+                System.out.println("Can't assert for -1 with offset "
+                        + offset + "(" + name + ")"
+                        + " when time in seconds is in ["
+                        + beforeMillis/MILLIS_IN_SECOND + ", "
+                        + afterMillis/MILLIS_IN_SECOND
+                        + "]");
+                // not conclusive
+        }
+
+        if (isOffLimit == Answer.NO || adjustment != -1) {
+            System.out.println("Validating adjustment: " + adjustment);
+            long expectedMax = distance(offset, beforeMillis/MILLIS_IN_SECOND)
+                      * NANOS_IN_SECOND
+                    + (beforeMillis % MILLIS_IN_SECOND) * NANOS_IN_MILLI
+                    + (afterMillis - beforeMillis + 1) * NANOS_IN_MILLI;
+            long absoluteAdjustment = distance(0, adjustment);
+            if (absoluteAdjustment > expectedMax) {
+                long adjSec = absoluteAdjustment / NANOS_IN_SECOND;
+                long adjMil = (absoluteAdjustment % NANOS_IN_SECOND) / NANOS_IN_MILLI;
+                long adjMic = (absoluteAdjustment % NANOS_IN_MILLI) / NANOS_IN_MICRO;
+                long adjNan = (absoluteAdjustment % NANOS_IN_MICRO);
+                long expSec = expectedMax / NANOS_IN_SECOND;
+                long expMil = (expectedMax % NANOS_IN_SECOND) / NANOS_IN_MILLI;
+                long expMic = (expectedMax % NANOS_IN_MILLI) / NANOS_IN_MICRO;
+                long expNan = (expectedMax % NANOS_IN_MICRO);
+                System.err.println("Excessive adjustment: " + adjSec + "s, "
+                        + adjMil + "ms, " + adjMic + "mics, " + adjNan + "ns");
+                System.err.println("Epected max: " + expSec + "s, "
+                        + expMil + "ms, " + expMic + "mics, " + expNan + "ns");
+
+                throw new RuntimeException(name
+                    + ": Excessive adjustment: " + adjustment
+                    + " when time in millis is in ["
+                    + beforeMillis + ", " + afterMillis
+                    + "] and offset in seconds is " + offset);
+            }
+        }
+
+    }
+
+    static void regular() {
+        System.out.println("*** Testing regular cases ***");
+        final long start = System.currentTimeMillis();
+        long offset = start/1000;
+        long adjustment = VM.getNanoTimeAdjustment(offset);
+        if (start != offset*1000) {
+            if (adjustment == -1) {
+                throw new RuntimeException("VM says " + offset
+                        + " secs is too far off, but time millis is "
+                        + System.currentTimeMillis());
+            }
+        }
+        if (adjustment == -1) {
+            offset = System.currentTimeMillis()/1000 - 1024;
+            adjustment = VM.getNanoTimeAdjustment(offset);
+            if (adjustment == -1) {
+                throw new RuntimeException("VM says " + offset
+                        + " secs is too far off, but time millis is "
+                        + System.currentTimeMillis());
+            }
+        }
+        if (adjustment > (start/1000 - offset + 20)*NANOS_IN_SECOND) {
+            throw new RuntimeException("Excessive adjustment: " + adjustment);
+        }
+        testWithOffset("System.currentTimeMillis()/1000",
+                System.currentTimeMillis()/1000);
+        testWithOffset("System.currentTimeMillis()/1000 - 1024",
+                System.currentTimeMillis()/1000 - 1024);
+        testWithOffset("System.currentTimeMillis()/1000 + 1024",
+                System.currentTimeMillis()/1000 + 1024);
+    }
+
+    static void testLimits() {
+        System.out.println("*** Testing limits ***");
+        testWithOffset("System.currentTimeMillis()/1000 - MAX_OFFSET + 1",
+                System.currentTimeMillis()/1000 - MAX_OFFSET + 1);
+        testWithOffset("System.currentTimeMillis()/1000 + MAX_OFFSET - 1",
+                System.currentTimeMillis()/1000 + MAX_OFFSET - 1);
+        testWithOffset("System.currentTimeMillis()/1000 - MAX_OFFSET",
+                System.currentTimeMillis()/1000 - MAX_OFFSET);
+        testWithOffset("System.currentTimeMillis()/1000 + MAX_OFFSET",
+                System.currentTimeMillis()/1000 + MAX_OFFSET);
+        testWithOffset("System.currentTimeMillis()/1000 - MAX_OFFSET - 1024",
+                System.currentTimeMillis()/1000 - MAX_OFFSET - 1024);
+        testWithOffset("System.currentTimeMillis()/1000 + MAX_OFFSET + 1024",
+                System.currentTimeMillis()/1000 + MAX_OFFSET + 1024);
+        testWithOffset("0", 0);
+        testWithOffset("-1", -1);
+        testWithOffset("Integer.MAX_VALUE + System.currentTimeMillis()/1000",
+                ((long)Integer.MAX_VALUE) + System.currentTimeMillis()/1000);
+        testWithOffset("System.currentTimeMillis()/1000 - Integer.MIN_VALUE",
+                System.currentTimeMillis()/1000 - Integer.MIN_VALUE);
+        testWithOffset("Long.MAX_VALUE", Long.MAX_VALUE);
+        testWithOffset("System.currentTimeMillis()/1000 - Long.MIN_VALUE",
+                (Long.MIN_VALUE + System.currentTimeMillis()/1000)*-1);
+    }
+
+    public static void main(String[] args) throws Exception {
+        regular();
+        testLimits();
+    }
+
+}
--- a/jdk/test/sun/util/calendar/zi/tzdata/VERSION	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/sun/util/calendar/zi/tzdata/VERSION	Wed Jul 05 20:18:12 2017 +0200
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2014j
+tzdata2015a
--- a/jdk/test/sun/util/calendar/zi/tzdata/antarctica	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/sun/util/calendar/zi/tzdata/antarctica	Wed Jul 05 20:18:12 2017 +0200
@@ -70,8 +70,8 @@
 Rule	ChileAQ	2010	only	-	Apr	Sun>=1	3:00u	0	-
 Rule	ChileAQ	2011	only	-	May	Sun>=2	3:00u	0	-
 Rule	ChileAQ	2011	only	-	Aug	Sun>=16	4:00u	1:00	S
-Rule	ChileAQ	2012	max	-	Apr	Sun>=23	3:00u	0	-
-Rule	ChileAQ	2012	max	-	Sep	Sun>=2	4:00u	1:00	S
+Rule	ChileAQ	2012	2015	-	Apr	Sun>=23	3:00u	0	-
+Rule	ChileAQ	2012	2014	-	Sep	Sun>=2	4:00u	1:00	S
 
 # Argentina - year-round bases
 # Belgrano II, Confin Coast, -770227-0343737, since 1972-02-05
@@ -377,9 +377,10 @@
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Antarctica/Palmer	0	-	zzz	1965
-			-4:00	ArgAQ	AR%sT	1969 Oct 5
+			-4:00	ArgAQ	AR%sT	1969 Oct  5
 			-3:00	ArgAQ	AR%sT	1982 May
-			-4:00	ChileAQ	CL%sT
+			-4:00	ChileAQ	CL%sT	2015 Apr 26 3:00u
+			-3:00	-	CLT
 #
 #
 # McMurdo Station, Ross Island, since 1955-12
--- a/jdk/test/sun/util/calendar/zi/tzdata/asia	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/sun/util/calendar/zi/tzdata/asia	Wed Jul 05 20:18:12 2017 +0200
@@ -168,10 +168,7 @@
 			4:00	Azer	AZ%sT
 
 # Bahrain
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Bahrain	3:22:20 -	LMT	1920     # Manamah
-			4:00	-	GST	1972 Jun
-			3:00	-	AST
+# See Asia/Qatar.
 
 # Bangladesh
 # From Alexander Krivenyshev (2009-05-13):
@@ -1754,9 +1751,7 @@
 ###############################################################################
 
 # Kuwait
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Kuwait	3:11:56 -	LMT	1950
-			3:00	-	AST
+# See Asia/Riyadh.
 
 # Laos
 # See Asia/Bangkok.
@@ -1977,12 +1972,7 @@
 			5:45	-	NPT	# Nepal Time
 
 # Oman
-
-# Milne says 3:54:24 was the meridian of the Muscat Tidal Observatory.
-
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Muscat	3:54:24 -	LMT	1920
-			4:00	-	GST
+# See Asia/Dubai.
 
 # Pakistan
 
@@ -2476,6 +2466,7 @@
 Zone	Asia/Qatar	3:26:08 -	LMT	1920     # Al Dawhah / Doha
 			4:00	-	GST	1972 Jun
 			3:00	-	AST
+Link Asia/Qatar Asia/Bahrain
 
 # Saudi Arabia
 #
@@ -2502,6 +2493,8 @@
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Riyadh	3:06:52 -	LMT	1947 Mar 14
 			3:00	-	AST
+Link Asia/Riyadh Asia/Aden	# Yemen
+Link Asia/Riyadh Asia/Kuwait
 
 # Singapore
 # taken from Mok Ly Yng (2003-10-30)
@@ -2790,6 +2783,7 @@
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Dubai	3:41:12 -	LMT	1920
 			4:00	-	GST
+Link Asia/Dubai Asia/Muscat	# Oman
 
 # Uzbekistan
 # Byalokoz 1919 says Uzbekistan was 4:27:53.
@@ -2874,10 +2868,4 @@
 			7:00	-	ICT
 
 # Yemen
-
-# Milne says 2:59:54 was the meridian of the saluting battery at Aden,
-# and that Yemen was at 1:55:56, the meridian of the Hagia Sophia.
-
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Aden	2:59:54	-	LMT	1950
-			3:00	-	AST
+# See Asia/Riyadh.
--- a/jdk/test/sun/util/calendar/zi/tzdata/backward	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/sun/util/calendar/zi/tzdata/backward	Wed Jul 05 20:18:12 2017 +0200
@@ -28,7 +28,7 @@
 # and their old names.  Many names changed in late 1993.
 
 # Link	TARGET			LINK-NAME
-Link	Africa/Asmara		Africa/Asmera
+Link	Africa/Nairobi		Africa/Asmera
 Link	Africa/Abidjan		Africa/Timbuktu
 Link	America/Argentina/Catamarca	America/Argentina/ComodRivadavia
 Link	America/Adak		America/Atka
--- a/jdk/test/sun/util/calendar/zi/tzdata/europe	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/sun/util/calendar/zi/tzdata/europe	Wed Jul 05 20:18:12 2017 +0200
@@ -1430,35 +1430,32 @@
 # might be a reference to the Julian calendar as opposed to Gregorian, or it
 # might mean something else (???).
 #
-# From Paul Eggert (2006-03-22):
-# The Iceland Almanak, Shanks & Pottenger, and Whitman disagree on many points.
-# We go with the Almanak, except for one claim from Shanks & Pottenger, namely
-# that Reykavik was 21W57 from 1837 to 1908, local mean time before that.
+# From Paul Eggert (2014-11-22):
+# The information below is taken from the 1988 Almanak; see
+# http://www.almanak.hi.is/klukkan.html
 #
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
-Rule	Iceland	1917	1918	-	Feb	19	23:00	1:00	S
+Rule	Iceland	1917	1919	-	Feb	19	23:00	1:00	S
 Rule	Iceland	1917	only	-	Oct	21	 1:00	0	-
-Rule	Iceland	1918	only	-	Nov	16	 1:00	0	-
+Rule	Iceland	1918	1919	-	Nov	16	 1:00	0	-
+Rule	Iceland	1921	only	-	Mar	19	23:00	1:00	S
+Rule	Iceland	1921	only	-	Jun	23	 1:00	0	-
 Rule	Iceland	1939	only	-	Apr	29	23:00	1:00	S
-Rule	Iceland	1939	only	-	Nov	29	 2:00	0	-
+Rule	Iceland	1939	only	-	Oct	29	 2:00	0	-
 Rule	Iceland	1940	only	-	Feb	25	 2:00	1:00	S
-Rule	Iceland	1940	only	-	Nov	 3	 2:00	0	-
-Rule	Iceland	1941	only	-	Mar	 2	 1:00s	1:00	S
-Rule	Iceland	1941	only	-	Nov	 2	 1:00s	0	-
-Rule	Iceland	1942	only	-	Mar	 8	 1:00s	1:00	S
-Rule	Iceland	1942	only	-	Oct	25	 1:00s	0	-
+Rule	Iceland	1940	1941	-	Nov	Sun>=2	 1:00s	0	-
+Rule	Iceland	1941	1942	-	Mar	Sun>=2	 1:00s	1:00	S
 # 1943-1946 - first Sunday in March until first Sunday in winter
 Rule	Iceland	1943	1946	-	Mar	Sun>=1	 1:00s	1:00	S
-Rule	Iceland	1943	1948	-	Oct	Sun>=22	 1:00s	0	-
+Rule	Iceland	1942	1948	-	Oct	Sun>=22	 1:00s	0	-
 # 1947-1967 - first Sunday in April until first Sunday in winter
 Rule	Iceland	1947	1967	-	Apr	Sun>=1	 1:00s	1:00	S
-# 1949 Oct transition delayed by 1 week
+# 1949 and 1967 Oct transitions delayed by 1 week
 Rule	Iceland	1949	only	-	Oct	30	 1:00s	0	-
 Rule	Iceland	1950	1966	-	Oct	Sun>=22	 1:00s	0	-
 Rule	Iceland	1967	only	-	Oct	29	 1:00s	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Atlantic/Reykjavik	-1:27:24 -	LMT	1837
-			-1:27:48 -	RMT	1908 # Reykjavik Mean Time?
+Zone Atlantic/Reykjavik	-1:28	-	LMT	1908
 			-1:00	Iceland	IS%sT	1968 Apr  7  1:00s
 			 0:00	-	GMT
 
--- a/jdk/test/sun/util/calendar/zi/tzdata/leapseconds	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/sun/util/calendar/zi/tzdata/leapseconds	Wed Jul 05 20:18:12 2017 +0200
@@ -77,3 +77,7 @@
 Leap	2005	Dec	31	23:59:60	+	S
 Leap	2008	Dec	31	23:59:60	+	S
 Leap	2012	Jun	30	23:59:60	+	S
+Leap	2015	Jun	30	23:59:60	+	S
+
+#	Updated through IERS Bulletin C49
+#	File expires on:  28 December 2015
--- a/jdk/test/sun/util/calendar/zi/tzdata/northamerica	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/sun/util/calendar/zi/tzdata/northamerica	Wed Jul 05 20:18:12 2017 +0200
@@ -147,7 +147,7 @@
 Rule	US	1918	1919	-	Oct	lastSun	2:00	0	S
 Rule	US	1942	only	-	Feb	9	2:00	1:00	W # War
 Rule	US	1945	only	-	Aug	14	23:00u	1:00	P # Peace
-Rule	US	1945	only	-	Sep	30	2:00	0	S
+Rule	US	1945	only	-	Sep	lastSun	2:00	0	S
 Rule	US	1967	2006	-	Oct	lastSun	2:00	0	S
 Rule	US	1967	1973	-	Apr	lastSun	2:00	1:00	D
 Rule	US	1974	only	-	Jan	6	2:00	1:00	D
@@ -2147,11 +2147,11 @@
 
 # Mexico
 
-# From Paul Eggert (2001-03-05):
+# From Paul Eggert (2014-12-07):
 # The Investigation and Analysis Service of the
 # Mexican Library of Congress (MLoC) has published a
 # history of Mexican local time (in Spanish)
-# http://www.cddhcu.gob.mx/bibliot/publica/inveyana/polisoc/horver/
+# http://www.diputados.gob.mx/bibliot/publica/inveyana/polisoc/horver/index.htm
 #
 # Here are the discrepancies between Shanks & Pottenger (S&P) and the MLoC.
 # (In all cases we go with the MLoC.)
@@ -2320,6 +2320,24 @@
 # efecto desde las dos horas del segundo domingo de marzo y concluirá a
 # las dos horas del primer domingo de noviembre.
 
+# From Steffen Thorsen (2014-12-08), translated by Gwillim Law:
+# The Mexican state of Quintana Roo will likely change to EST in 2015.
+#
+# http://www.unioncancun.mx/articulo/2014/12/04/medio-ambiente/congreso-aprueba-una-hora-mas-de-sol-en-qroo
+# "With this change, the time conflict that has existed between the municipios
+# of Quintana Roo and the municipio of Felipe Carrillo Puerto may come to an
+# end. The latter declared itself in rebellion 15 years ago when a time change
+# was initiated in Mexico, and since then it has refused to change its time
+# zone along with the rest of the country."
+#
+# From Steffen Thorsen (2015-01-14), translated by Gwillim Law:
+# http://sipse.com/novedades/confirman-aplicacion-de-nueva-zona-horaria-para-quintana-roo-132331.html
+# "...the new time zone will come into effect at two o'clock on the first Sunday
+# of February, when we will have to advance the clock one hour from its current
+# time..."
+#
+# Also, the new zone will not use DST.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Mexico	1939	only	-	Feb	5	0:00	1:00	D
 Rule	Mexico	1939	only	-	Jun	25	0:00	0	S
@@ -2340,7 +2358,8 @@
 Zone America/Cancun	-5:47:04 -	LMT	1922 Jan  1  0:12:56
 			-6:00	-	CST	1981 Dec 23
 			-5:00	Mexico	E%sT	1998 Aug  2  2:00
-			-6:00	Mexico	C%sT
+			-6:00	Mexico	C%sT	2015 Feb  1  2:00
+			-5:00	-	EST
 # Campeche, Yucatán; represented by Mérida
 Zone America/Merida	-5:58:28 -	LMT	1922 Jan  1  0:01:32
 			-6:00	-	CST	1981 Dec 23
--- a/jdk/test/sun/util/calendar/zi/tzdata/southamerica	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/sun/util/calendar/zi/tzdata/southamerica	Wed Jul 05 20:18:12 2017 +0200
@@ -1229,6 +1229,11 @@
 # DST Start: first Saturday of September 2014 (Sun 07 Sep 2014 04:00 UTC)
 # http://www.diariooficial.interior.gob.cl//media/2014/02/19/do-20140219.pdf
 
+# From Juan Correa (2015-01-28):
+# ... today the Ministry of Energy announced that Chile will drop DST, will keep
+# "summer time" (UTC -3 / UTC -5) all year round....
+# http://www.minenergia.cl/ministerio/noticias/generales/ministerio-de-energia-anuncia.html
+
 # NOTE: ChileAQ rules for Antarctic bases are stored separately in the
 # 'antarctica' file.
 
@@ -1270,8 +1275,8 @@
 Rule	Chile	2010	only	-	Apr	Sun>=1	3:00u	0	-
 Rule	Chile	2011	only	-	May	Sun>=2	3:00u	0	-
 Rule	Chile	2011	only	-	Aug	Sun>=16	4:00u	1:00	S
-Rule	Chile	2012	max	-	Apr	Sun>=23	3:00u	0	-
-Rule	Chile	2012	max	-	Sep	Sun>=2	4:00u	1:00	S
+Rule	Chile	2012	2015	-	Apr	Sun>=23	3:00u	0	-
+Rule	Chile	2012	2014	-	Sep	Sun>=2	4:00u	1:00	S
 # IATA SSIM anomalies: (1992-02) says 1992-03-14;
 # (1996-09) says 1998-03-08.  Ignore these.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -1282,11 +1287,13 @@
 			-4:00	-	CLT	1919 Jul  1 # Chile Time
 			-4:42:46 -	SMT	1927 Sep  1 # Santiago Mean Time
 			-5:00	Chile	CL%sT	1947 May 22 # Chile Time
-			-4:00	Chile	CL%sT
+			-4:00	Chile	CL%sT	2015 Apr 26  3:00u
+			-3:00	-	CLT
 Zone Pacific/Easter	-7:17:44 -	LMT	1890
 			-7:17:28 -	EMT	1932 Sep    # Easter Mean Time
-			-7:00	Chile	EAS%sT	1982 Mar 13 21:00 # Easter Time
-			-6:00	Chile	EAS%sT
+			-7:00	Chile	EAS%sT	1982 Mar 13 3:00u # Easter Time
+			-6:00	Chile	EAS%sT	2015 Apr 26 3:00u
+			-5:00	-	EAST
 #
 # Salas y Gómez Island is uninhabited.
 # Other Chilean locations, including Juan Fernández Is, Desventuradas Is,
--- a/jdk/test/sun/util/calendar/zi/tzdata/zone.tab	Thu Feb 05 11:43:29 2015 -0800
+++ b/jdk/test/sun/util/calendar/zi/tzdata/zone.tab	Wed Jul 05 20:18:12 2017 +0200
@@ -297,7 +297,7 @@
 MV	+0410+07330	Indian/Maldives
 MW	-1547+03500	Africa/Blantyre
 MX	+1924-09909	America/Mexico_City	Central Time - most locations
-MX	+2105-08646	America/Cancun	Central Time - Quintana Roo
+MX	+2105-08646	America/Cancun	Eastern Standard Time - Quintana Roo
 MX	+2058-08937	America/Merida	Central Time - Campeche, Yucatan
 MX	+2540-10019	America/Monterrey	Mexican Central Time - Coahuila, Durango, Nuevo Leon, Tamaulipas away from US border
 MX	+2550-09730	America/Matamoros	US Central Time - Coahuila, Durango, Nuevo Leon, Tamaulipas near US border
--- a/modules.xml	Thu Feb 05 11:43:29 2015 -0800
+++ b/modules.xml	Wed Jul 05 20:18:12 2017 +0200
@@ -108,6 +108,9 @@
       <name>java.security</name>
     </export>
     <export>
+      <name>java.security.acl</name>
+    </export>
+    <export>
       <name>java.security.cert</name>
     </export>
     <export>
@@ -446,7 +449,6 @@
     <depend re-exports="true">java.management</depend>
     <depend re-exports="true">java.naming</depend>
     <depend re-exports="true">java.prefs</depend>
-    <depend re-exports="true">java.security.acl</depend>
     <depend re-exports="true">java.security.jgss</depend>
     <depend re-exports="true">java.security.sasl</depend>
     <depend re-exports="true">java.sql.rowset</depend>
@@ -891,13 +893,6 @@
     <depend re-exports="true">java.xml.ws</depend>
   </module>
   <module>
-    <name>java.security.acl</name>
-    <depend>java.base</depend>
-    <export>
-      <name>java.security.acl</name>
-    </export>
-  </module>
-  <module>
     <name>java.security.jgss</name>
     <depend>java.base</depend>
     <depend>java.naming</depend>