Merge
authorduke
Wed, 05 Jul 2017 19:26:45 +0200
changeset 22145 7bf6ee33a412
parent 22144 e8046d3ee0ee (current diff)
parent 22142 53565ae5ac0f (diff)
child 22172 7897c70becec
Merge
jdk/make/src/classes/build/tools/classfile/RemoveMethods.java
jdk/src/share/classes/com/sun/security/auth/callback/DialogCallbackHandler.java
jdk/src/share/classes/sun/awt/AWTPermissionFactory.java
jdk/test/com/sun/security/auth/callback/DialogCallbackHandler/Default.java
jdk/test/java/lang/management/MemoryMXBean/LowMemoryTestConcMarkSweepGC.sh
jdk/test/java/lang/management/MemoryMXBean/LowMemoryTestParallelGC.sh
jdk/test/java/lang/management/MemoryMXBean/LowMemoryTestSerialGC.sh
jdk/test/java/util/logging/Listeners.java
jdk/test/java/util/logging/ListenersWithSM.java
jdk/test/java/util/logging/java.policy
jdk/test/sun/security/krb5/TimeInCCache.java
jdk/test/sun/security/ssl/javax/net/ssl/SSLContextVersion.java
jdk/test/tools/pack200/NoBeans.java
jdk/test/tools/pack200/Reflect.java
--- a/.hgtags-top-repo	Fri Dec 13 09:35:35 2013 -0800
+++ b/.hgtags-top-repo	Wed Jul 05 19:26:45 2017 +0200
@@ -242,3 +242,4 @@
 0a6db1aac998cdc88e52f9adb97d40ca5b0f1da6 jdk8-b118
 9e90215673be68a3e77a9e444e4232076373734d jdk8-b119
 cd3825b2983045784d6fc6d1729c799b08215752 jdk8-b120
+1e1f86d5d4e22c15a9bf9f1581acddb8c59abae2 jdk9-b00
--- a/.jcheck/conf	Fri Dec 13 09:35:35 2013 -0800
+++ b/.jcheck/conf	Wed Jul 05 19:26:45 2017 +0200
@@ -1,1 +1,1 @@
-project=jdk8
+project=jdk9
--- a/Makefile	Fri Dec 13 09:35:35 2013 -0800
+++ b/Makefile	Wed Jul 05 19:26:45 2017 +0200
@@ -66,7 +66,7 @@
     # First, find out the valid targets
     # Run the makefile with an arbitrary SPEC using -p -q (quiet dry-run and dump rules) to find
     # available PHONY targets. Use this list as valid targets to pass on to the repeated calls.
-    all_phony_targets=$(filter-out $(global_targets) bundles bundles-only final-images-only, $(strip $(shell \
+    all_phony_targets=$(filter-out $(global_targets), $(strip $(shell \
         cd $(root_dir) && $(MAKE) -p -q FRC SPEC=$(firstword $(SPEC)) | \
         grep ^.PHONY: | head -n 1 | cut -d " " -f 2-)))
 
@@ -79,10 +79,6 @@
   endif
 endif
 
-# Include this after a potential spec file has been included so that the bundles target
-# has access to the spec variables.
-include $(root_dir)/make/Jprt.gmk
-
 # Here are "global" targets, i.e. targets that can be executed without specifying a single configuration.
 # If you addd more global targets, please update the variable global_targets in MakeHelpers.
 
--- a/common/autoconf/generated-configure.sh	Fri Dec 13 09:35:35 2013 -0800
+++ b/common/autoconf/generated-configure.sh	Wed Jul 05 19:26:45 2017 +0200
@@ -3865,7 +3865,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1384422786
+DATE_WHEN_GENERATED=1389186094
 
 ###############################################################################
 #
@@ -29625,7 +29625,7 @@
   fi
 
   CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY"
-  CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DRELEASE='\"$RELEASE\"'"
+  CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DRELEASE='\"\$(RELEASE)\"'"
 
   CCXXFLAGS_JDK="$CCXXFLAGS_JDK \
       -I${JDK_OUTPUTDIR}/include \
--- a/common/autoconf/toolchain.m4	Fri Dec 13 09:35:35 2013 -0800
+++ b/common/autoconf/toolchain.m4	Wed Jul 05 19:26:45 2017 +0200
@@ -936,7 +936,7 @@
   fi
 
   CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY"
-  CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DRELEASE='\"$RELEASE\"'"
+  CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DRELEASE='\"\$(RELEASE)\"'"
 
   CCXXFLAGS_JDK="$CCXXFLAGS_JDK \
       -I${JDK_OUTPUTDIR}/include \
--- a/common/autoconf/version-numbers	Fri Dec 13 09:35:35 2013 -0800
+++ b/common/autoconf/version-numbers	Wed Jul 05 19:26:45 2017 +0200
@@ -24,7 +24,7 @@
 #
 
 JDK_MAJOR_VERSION=1
-JDK_MINOR_VERSION=8
+JDK_MINOR_VERSION=9
 JDK_MICRO_VERSION=0
 JDK_UPDATE_VERSION=
 LAUNCHER_NAME=openjdk
--- a/corba/.hgtags	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/.hgtags	Wed Jul 05 19:26:45 2017 +0200
@@ -242,3 +242,4 @@
 d6820a414f182a011a53a29a52370c696cd58dab jdk8-b118
 379fc7609beb7a3d85ebc0cc21a8a51c60d3c7d3 jdk8-b119
 53fd772d28c8a9f0f43adfc06f75f6b3cfa93cb5 jdk8-b120
+a7d3638deb2f4e33217b1ecf889479e90f9e5b50 jdk9-b00
--- a/corba/.jcheck/conf	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/.jcheck/conf	Wed Jul 05 19:26:45 2017 +0200
@@ -1,1 +1,1 @@
-project=jdk8
+project=jdk9
--- a/corba/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
--- a/corba/src/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
--- a/corba/src/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
--- a/corba/src/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
--- a/corba/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
--- a/corba/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/StubDelegateImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/StubDelegateImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_de.properties	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_de.properties	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 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
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_es.properties	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_es.properties	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 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
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_fr.properties	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_fr.properties	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 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
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_it.properties	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_it.properties	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 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
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ja.properties	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ja.properties	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 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
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ko.properties	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ko.properties	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 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
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_pt_BR.properties	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_pt_BR.properties	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 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
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_sv.properties	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_sv.properties	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 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
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_CN.properties	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_CN.properties	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 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
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 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
--- a/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLNameTranslatorImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLNameTranslatorImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
--- a/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/InvocationHandlerFactoryImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/InvocationHandlerFactoryImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
--- a/corba/src/share/classes/com/sun/corba/se/impl/transport/DefaultSocketFactoryImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/corba/se/impl/transport/DefaultSocketFactoryImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
--- a/corba/src/share/classes/com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandlerImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandlerImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
--- a/corba/src/share/classes/com/sun/tools/corba/se/idl/idl_ja.prp	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/tools/corba/se/idl/idl_ja.prp	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 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
--- a/corba/src/share/classes/com/sun/tools/corba/se/idl/idl_zh_CN.prp	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/tools/corba/se/idl/idl_zh_CN.prp	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 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
--- a/corba/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_ja.prp	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_ja.prp	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 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
--- a/corba/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_zh_CN.prp	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_zh_CN.prp	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 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
--- a/corba/src/share/classes/javax/rmi/CORBA/Stub.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/javax/rmi/CORBA/Stub.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * 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
--- a/corba/src/share/classes/javax/rmi/CORBA/Util.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/javax/rmi/CORBA/Util.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * 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
--- a/corba/src/share/classes/javax/rmi/PortableRemoteObject.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/javax/rmi/PortableRemoteObject.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * 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
--- a/corba/src/share/classes/sun/rmi/rmic/iiop/CompoundType.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/corba/src/share/classes/sun/rmi/rmic/iiop/CompoundType.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * 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
--- a/hotspot/.hgtags	Fri Dec 13 09:35:35 2013 -0800
+++ b/hotspot/.hgtags	Wed Jul 05 19:26:45 2017 +0200
@@ -402,3 +402,4 @@
 ce42d815dd2130250acf6132b51b624001638f0d jdk8-b119
 05fedd51e40da22c9460bf17c7185889e435db3d hs25-b62
 fca262db9c4309f99d2f5542ab0780e45c2f1578 jdk8-b120
+ce2d7e46f3c7e41241f3b407705a4071323a11ab jdk9-b00
--- a/hotspot/.jcheck/conf	Fri Dec 13 09:35:35 2013 -0800
+++ b/hotspot/.jcheck/conf	Wed Jul 05 19:26:45 2017 +0200
@@ -1,1 +1,1 @@
-project=jdk8
+project=jdk9
--- a/jaxp/.hgtags	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/.hgtags	Wed Jul 05 19:26:45 2017 +0200
@@ -242,3 +242,4 @@
 e4e5069250e717defcb556e2f6be291460988c51 jdk8-b118
 69a930376c70beb9877970128bad0f04cb0c6eb1 jdk8-b119
 64d8b228a72cf9082b1a9a881c81188ccffde234 jdk8-b120
+4045edd35e8ba73bfdc23ce8961b9640d4145fe5 jdk9-b00
--- a/jaxp/.jcheck/conf	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/.jcheck/conf	Wed Jul 05 19:26:45 2017 +0200
@@ -1,1 +1,1 @@
-project=jdk8
+project=jdk9
--- a/jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
--- a/jaxp/src/com/sun/org/apache/xalan/internal/utils/FeatureManager.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/FeatureManager.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
--- a/jaxp/src/com/sun/org/apache/xalan/internal/utils/FeaturePropertyBase.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/FeaturePropertyBase.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/Constants.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/Constants.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/PropertyManager.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/PropertyManager.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java	Wed Jul 05 19:26:45 2017 +0200
@@ -61,14 +61,13 @@
 
 package com.sun.org.apache.xerces.internal.impl;
 
-import java.io.IOException;
-
 import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
+import com.sun.org.apache.xerces.internal.util.XML11Char;
 import com.sun.org.apache.xerces.internal.util.XMLChar;
-import com.sun.org.apache.xerces.internal.util.XML11Char;
 import com.sun.org.apache.xerces.internal.util.XMLStringBuffer;
 import com.sun.org.apache.xerces.internal.xni.QName;
 import com.sun.org.apache.xerces.internal.xni.XMLString;
+import java.io.IOException;
 
 /**
  * Implements the entity scanner methods in
@@ -78,6 +77,7 @@
  *
  * @author Michael Glavassevich, IBM
  * @author Neil Graham, IBM
+ * @version $Id: XML11EntityScanner.java,v 1.5 2010-11-01 04:39:40 joehw Exp $
  */
 
 public class XML11EntityScanner
@@ -108,7 +108,7 @@
 
         // load more characters, if needed
         if (fCurrentEntity.position == fCurrentEntity.count) {
-            load(0, true);
+            load(0, true, true);
         }
 
         // peek at character
@@ -136,7 +136,7 @@
 
         // load more characters, if needed
         if (fCurrentEntity.position == fCurrentEntity.count) {
-            load(0, true);
+            load(0, true, true);
         }
 
         // scan character
@@ -148,7 +148,7 @@
             fCurrentEntity.columnNumber = 1;
             if (fCurrentEntity.position == fCurrentEntity.count) {
                 fCurrentEntity.ch[0] = (char)c;
-                load(1, false);
+                load(1, false, true);
             }
             if (c == '\r' && external) {
                 int cc = fCurrentEntity.ch[fCurrentEntity.position++];
@@ -183,7 +183,7 @@
     public String scanNmtoken() throws IOException {
         // load more characters, if needed
         if (fCurrentEntity.position == fCurrentEntity.count) {
-            load(0, true);
+            load(0, true, true);
         }
 
         // scan nmtoken
@@ -194,6 +194,7 @@
             if (XML11Char.isXML11Name(ch)) {
                 if (++fCurrentEntity.position == fCurrentEntity.count) {
                     int length = fCurrentEntity.position - offset;
+                    invokeListeners(length);
                     if (length == fCurrentEntity.ch.length) {
                         // bad luck we have to resize our buffer
                         char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -206,7 +207,7 @@
                                          fCurrentEntity.ch, 0, length);
                     }
                     offset = 0;
-                    if (load(length, false)) {
+                    if (load(length, false, false)) {
                         break;
                     }
                 }
@@ -214,6 +215,7 @@
             else if (XML11Char.isXML11NameHighSurrogate(ch)) {
                 if (++fCurrentEntity.position == fCurrentEntity.count) {
                     int length = fCurrentEntity.position - offset;
+                    invokeListeners(length);
                     if (length == fCurrentEntity.ch.length) {
                         // bad luck we have to resize our buffer
                         char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -226,7 +228,7 @@
                                          fCurrentEntity.ch, 0, length);
                     }
                     offset = 0;
-                    if (load(length, false)) {
+                    if (load(length, false, false)) {
                         --fCurrentEntity.startPosition;
                         --fCurrentEntity.position;
                         break;
@@ -240,6 +242,7 @@
                 }
                 if (++fCurrentEntity.position == fCurrentEntity.count) {
                     int length = fCurrentEntity.position - offset;
+                    invokeListeners(length);
                     if (length == fCurrentEntity.ch.length) {
                         // bad luck we have to resize our buffer
                         char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -252,7 +255,7 @@
                                          fCurrentEntity.ch, 0, length);
                     }
                     offset = 0;
-                    if (load(length, false)) {
+                    if (load(length, false, false)) {
                         break;
                     }
                 }
@@ -294,7 +297,7 @@
     public String scanName() throws IOException {
         // load more characters, if needed
         if (fCurrentEntity.position == fCurrentEntity.count) {
-            load(0, true);
+            load(0, true, true);
         }
 
         // scan name
@@ -305,7 +308,7 @@
             if (++fCurrentEntity.position == fCurrentEntity.count) {
                 fCurrentEntity.ch[0] = ch;
                 offset = 0;
-                if (load(1, false)) {
+                if (load(1, false, true)) {
                     fCurrentEntity.columnNumber++;
                     String symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 1);
                     return symbol;
@@ -316,7 +319,7 @@
             if (++fCurrentEntity.position == fCurrentEntity.count) {
                 fCurrentEntity.ch[0] = ch;
                 offset = 0;
-                if (load(1, false)) {
+                if (load(1, false, true)) {
                     --fCurrentEntity.position;
                     --fCurrentEntity.startPosition;
                     return null;
@@ -332,7 +335,7 @@
                 fCurrentEntity.ch[0] = ch;
                 fCurrentEntity.ch[1] = ch2;
                 offset = 0;
-                if (load(2, false)) {
+                if (load(2, false, true)) {
                     fCurrentEntity.columnNumber += 2;
                     String symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 2);
                     return symbol;
@@ -348,6 +351,7 @@
             if (XML11Char.isXML11Name(ch)) {
                 if (++fCurrentEntity.position == fCurrentEntity.count) {
                     int length = fCurrentEntity.position - offset;
+                    invokeListeners(length);
                     if (length == fCurrentEntity.ch.length) {
                         // bad luck we have to resize our buffer
                         char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -360,7 +364,7 @@
                                          fCurrentEntity.ch, 0, length);
                     }
                     offset = 0;
-                    if (load(length, false)) {
+                    if (load(length, false, false)) {
                         break;
                     }
                 }
@@ -368,6 +372,7 @@
             else if (XML11Char.isXML11NameHighSurrogate(ch)) {
                 if (++fCurrentEntity.position == fCurrentEntity.count) {
                     int length = fCurrentEntity.position - offset;
+                    invokeListeners(length);
                     if (length == fCurrentEntity.ch.length) {
                         // bad luck we have to resize our buffer
                         char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -380,7 +385,7 @@
                                          fCurrentEntity.ch, 0, length);
                     }
                     offset = 0;
-                    if (load(length, false)) {
+                    if (load(length, false, false)) {
                         --fCurrentEntity.position;
                         --fCurrentEntity.startPosition;
                         break;
@@ -394,6 +399,7 @@
                 }
                 if (++fCurrentEntity.position == fCurrentEntity.count) {
                     int length = fCurrentEntity.position - offset;
+                    invokeListeners(length);
                     if (length == fCurrentEntity.ch.length) {
                         // bad luck we have to resize our buffer
                         char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -406,7 +412,7 @@
                                          fCurrentEntity.ch, 0, length);
                     }
                     offset = 0;
-                    if (load(length, false)) {
+                    if (load(length, false, false)) {
                         break;
                     }
                 }
@@ -449,7 +455,7 @@
 
         // load more characters, if needed
         if (fCurrentEntity.position == fCurrentEntity.count) {
-            load(0, true);
+            load(0, true, true);
         }
 
         // scan name
@@ -460,7 +466,7 @@
             if (++fCurrentEntity.position == fCurrentEntity.count) {
                 fCurrentEntity.ch[0] = ch;
                 offset = 0;
-                if (load(1, false)) {
+                if (load(1, false, true)) {
                     fCurrentEntity.columnNumber++;
                     String symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 1);
                     return symbol;
@@ -471,7 +477,7 @@
             if (++fCurrentEntity.position == fCurrentEntity.count) {
                 fCurrentEntity.ch[0] = ch;
                 offset = 0;
-                if (load(1, false)) {
+                if (load(1, false, true)) {
                     --fCurrentEntity.position;
                     --fCurrentEntity.startPosition;
                     return null;
@@ -487,7 +493,7 @@
                 fCurrentEntity.ch[0] = ch;
                 fCurrentEntity.ch[1] = ch2;
                 offset = 0;
-                if (load(2, false)) {
+                if (load(2, false, true)) {
                     fCurrentEntity.columnNumber += 2;
                     String symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 2);
                     return symbol;
@@ -503,6 +509,7 @@
             if (XML11Char.isXML11NCName(ch)) {
                 if (++fCurrentEntity.position == fCurrentEntity.count) {
                     int length = fCurrentEntity.position - offset;
+                    invokeListeners(length);
                     if (length == fCurrentEntity.ch.length) {
                         // bad luck we have to resize our buffer
                         char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -515,7 +522,7 @@
                                          fCurrentEntity.ch, 0, length);
                     }
                     offset = 0;
-                    if (load(length, false)) {
+                    if (load(length, false, false)) {
                         break;
                     }
                 }
@@ -523,6 +530,7 @@
             else if (XML11Char.isXML11NameHighSurrogate(ch)) {
                 if (++fCurrentEntity.position == fCurrentEntity.count) {
                     int length = fCurrentEntity.position - offset;
+                    invokeListeners(length);
                     if (length == fCurrentEntity.ch.length) {
                         // bad luck we have to resize our buffer
                         char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -535,7 +543,7 @@
                                          fCurrentEntity.ch, 0, length);
                     }
                     offset = 0;
-                    if (load(length, false)) {
+                    if (load(length, false, false)) {
                         --fCurrentEntity.startPosition;
                         --fCurrentEntity.position;
                         break;
@@ -549,6 +557,7 @@
                 }
                 if (++fCurrentEntity.position == fCurrentEntity.count) {
                     int length = fCurrentEntity.position - offset;
+                    invokeListeners(length);
                     if (length == fCurrentEntity.ch.length) {
                         // bad luck we have to resize our buffer
                         char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -561,7 +570,7 @@
                                          fCurrentEntity.ch, 0, length);
                     }
                     offset = 0;
-                    if (load(length, false)) {
+                    if (load(length, false, false)) {
                         break;
                     }
                 }
@@ -610,7 +619,7 @@
 
         // load more characters, if needed
         if (fCurrentEntity.position == fCurrentEntity.count) {
-            load(0, true);
+            load(0, true, true);
         }
 
         // scan qualified name
@@ -621,7 +630,7 @@
             if (++fCurrentEntity.position == fCurrentEntity.count) {
                 fCurrentEntity.ch[0] = ch;
                 offset = 0;
-                if (load(1, false)) {
+                if (load(1, false, true)) {
                     fCurrentEntity.columnNumber++;
                     String name = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 1);
                     qname.setValues(null, name, name, null);
@@ -633,7 +642,7 @@
             if (++fCurrentEntity.position == fCurrentEntity.count) {
                 fCurrentEntity.ch[0] = ch;
                 offset = 0;
-                if (load(1, false)) {
+                if (load(1, false, true)) {
                     --fCurrentEntity.startPosition;
                     --fCurrentEntity.position;
                     return false;
@@ -649,7 +658,7 @@
                 fCurrentEntity.ch[0] = ch;
                 fCurrentEntity.ch[1] = ch2;
                 offset = 0;
-                if (load(2, false)) {
+                if (load(2, false, true)) {
                     fCurrentEntity.columnNumber += 2;
                     String name = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 2);
                     qname.setValues(null, name, name, null);
@@ -674,6 +683,7 @@
                 }
                 if (++fCurrentEntity.position == fCurrentEntity.count) {
                     int length = fCurrentEntity.position - offset;
+                    invokeListeners(length);
                     if (length == fCurrentEntity.ch.length) {
                         // bad luck we have to resize our buffer
                         char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -689,7 +699,7 @@
                         index = index - offset;
                     }
                     offset = 0;
-                    if (load(length, false)) {
+                    if (load(length, false, false)) {
                         break;
                     }
                 }
@@ -697,6 +707,7 @@
             else if (XML11Char.isXML11NameHighSurrogate(ch)) {
                 if (++fCurrentEntity.position == fCurrentEntity.count) {
                     int length = fCurrentEntity.position - offset;
+                    invokeListeners(length);
                     if (length == fCurrentEntity.ch.length) {
                         // bad luck we have to resize our buffer
                         char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -712,7 +723,7 @@
                         index = index - offset;
                     }
                     offset = 0;
-                    if (load(length, false)) {
+                    if (load(length, false, false)) {
                         sawIncompleteSurrogatePair = true;
                         --fCurrentEntity.startPosition;
                         --fCurrentEntity.position;
@@ -728,6 +739,7 @@
                 }
                 if (++fCurrentEntity.position == fCurrentEntity.count) {
                     int length = fCurrentEntity.position - offset;
+                    invokeListeners(length);
                     if (length == fCurrentEntity.ch.length) {
                         // bad luck we have to resize our buffer
                         char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -743,7 +755,7 @@
                         index = index - offset;
                     }
                     offset = 0;
-                    if (load(length, false)) {
+                    if (load(length, false, false)) {
                         break;
                     }
                 }
@@ -820,11 +832,11 @@
 
         // load more characters, if needed
         if (fCurrentEntity.position == fCurrentEntity.count) {
-            load(0, true);
+            load(0, true, true);
         }
         else if (fCurrentEntity.position == fCurrentEntity.count - 1) {
             fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1];
-            load(1, false);
+            load(1, false, true);
             fCurrentEntity.position = 0;
             fCurrentEntity.startPosition = 0;
         }
@@ -846,7 +858,7 @@
                         fCurrentEntity.baseCharOffset += (fCurrentEntity.position - fCurrentEntity.startPosition);
                         fCurrentEntity.position = newlines;
                         fCurrentEntity.startPosition = newlines;
-                        if (load(newlines, false)) {
+                        if (load(newlines, false, true)) {
                             break;
                         }
                     }
@@ -869,7 +881,7 @@
                         fCurrentEntity.baseCharOffset += (fCurrentEntity.position - fCurrentEntity.startPosition);
                         fCurrentEntity.position = newlines;
                         fCurrentEntity.startPosition = newlines;
-                        if (load(newlines, false)) {
+                        if (load(newlines, false, true)) {
                             break;
                         }
                     }
@@ -961,11 +973,11 @@
         throws IOException {
         // load more characters, if needed
         if (fCurrentEntity.position == fCurrentEntity.count) {
-            load(0, true);
+            load(0, true, true);
         }
         else if (fCurrentEntity.position == fCurrentEntity.count - 1) {
             fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1];
-            load(1, false);
+            load(1, false, true);
             fCurrentEntity.startPosition = 0;
             fCurrentEntity.position = 0;
         }
@@ -987,7 +999,7 @@
                         fCurrentEntity.baseCharOffset += (fCurrentEntity.position - fCurrentEntity.startPosition);
                         fCurrentEntity.position = newlines;
                         fCurrentEntity.startPosition = newlines;
-                        if (load(newlines, false)) {
+                        if (load(newlines, false, true)) {
                             break;
                         }
                     }
@@ -1010,7 +1022,7 @@
                         fCurrentEntity.baseCharOffset += (fCurrentEntity.position - fCurrentEntity.startPosition);
                         fCurrentEntity.position = newlines;
                         fCurrentEntity.startPosition = newlines;
-                        if (load(newlines, false)) {
+                        if (load(newlines, false, true)) {
                             break;
                         }
                     }
@@ -1113,7 +1125,7 @@
         do {
             // load more characters, if needed
             if (fCurrentEntity.position == fCurrentEntity.count) {
-                load(0, true);
+                load(0, true, false);
             }
 
             boolean bNextEntity = false;
@@ -1127,7 +1139,7 @@
                                0,
                                fCurrentEntity.count - fCurrentEntity.position);
 
-              bNextEntity = load(fCurrentEntity.count - fCurrentEntity.position, false);
+              bNextEntity = load(fCurrentEntity.count - fCurrentEntity.position, false, false);
               fCurrentEntity.position = 0;
               fCurrentEntity.startPosition = 0;
             }
@@ -1140,7 +1152,7 @@
                 fCurrentEntity.baseCharOffset += (fCurrentEntity.position - fCurrentEntity.startPosition);
                 fCurrentEntity.position = fCurrentEntity.count;
                 fCurrentEntity.startPosition = fCurrentEntity.count;
-                load(0,true);
+                load(0,true, false);
                 return false;
             }
 
@@ -1160,7 +1172,7 @@
                             fCurrentEntity.baseCharOffset += (fCurrentEntity.position - fCurrentEntity.startPosition);
                             fCurrentEntity.position = newlines;
                             fCurrentEntity.startPosition = newlines;
-                            if (load(newlines, false)) {
+                            if (load(newlines, false, true)) {
                                 break;
                             }
                         }
@@ -1184,7 +1196,7 @@
                             fCurrentEntity.position = newlines;
                             fCurrentEntity.startPosition = newlines;
                             fCurrentEntity.count = newlines;
-                            if (load(newlines, false)) {
+                            if (load(newlines, false, true)) {
                                 break;
                             }
                         }
@@ -1309,7 +1321,7 @@
 
         // load more characters, if needed
         if (fCurrentEntity.position == fCurrentEntity.count) {
-            load(0, true);
+            load(0, true, true);
         }
 
         // skip character
@@ -1335,7 +1347,7 @@
             // handle newlines
             if (fCurrentEntity.position == fCurrentEntity.count) {
                 fCurrentEntity.ch[0] = (char)cc;
-                load(1, false);
+                load(1, false, true);
             }
             int ccc = fCurrentEntity.ch[++fCurrentEntity.position];
             if (ccc == '\n' || ccc == 0x85) {
@@ -1369,7 +1381,7 @@
 
         // load more characters, if needed
         if (fCurrentEntity.position == fCurrentEntity.count) {
-            load(0, true);
+            load(0, true, true);
         }
 
 
@@ -1397,7 +1409,7 @@
                         fCurrentEntity.columnNumber = 1;
                         if (fCurrentEntity.position == fCurrentEntity.count - 1) {
                             fCurrentEntity.ch[0] = (char)c;
-                            entityChanged = load(1, true);
+                            entityChanged = load(1, true, true);
                             if (!entityChanged) {
                                 // the load change the position to be 1,
                                 // need to restore it when entity not changed
@@ -1424,7 +1436,7 @@
                     if (!entityChanged)
                         fCurrentEntity.position++;
                     if (fCurrentEntity.position == fCurrentEntity.count) {
-                        load(0, true);
+                        load(0, true, true);
 
                         if(fCurrentEntity == null){
                         return true ;
@@ -1445,7 +1457,7 @@
                     fCurrentEntity.columnNumber = 1;
                     if (fCurrentEntity.position == fCurrentEntity.count - 1) {
                         fCurrentEntity.ch[0] = (char)c;
-                        entityChanged = load(1, true);
+                        entityChanged = load(1, true, true);
                         if (!entityChanged) {
                             // the load change the position to be 1,
                             // need to restore it when entity not changed
@@ -1463,7 +1475,7 @@
                 if (!entityChanged)
                     fCurrentEntity.position++;
                 if (fCurrentEntity.position == fCurrentEntity.count) {
-                    load(0, true);
+                    load(0, true, true);
 
                     if(fCurrentEntity == null){
                         return true ;
@@ -1496,7 +1508,7 @@
 
         // load more characters, if needed
         if (fCurrentEntity.position == fCurrentEntity.count) {
-            load(0, true);
+            load(0, true, true);
         }
 
         // skip string
@@ -1508,10 +1520,11 @@
                 return false;
             }
             if (i < length - 1 && fCurrentEntity.position == fCurrentEntity.count) {
+                invokeListeners(0);
                 System.arraycopy(fCurrentEntity.ch, fCurrentEntity.count - i - 1, fCurrentEntity.ch, 0, i + 1);
                 // REVISIT: Can a string to be skipped cross an
                 //          entity boundary? -Ac
-                if (load(i + 1, false)) {
+                if (load(i + 1, false, false)) {
                     fCurrentEntity.startPosition -= i + 1;
                     fCurrentEntity.position -= i + 1;
                     return false;
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java	Wed Jul 05 19:26:45 2017 +0200
@@ -20,34 +20,28 @@
 
 package com.sun.org.apache.xerces.internal.impl;
 
-import java.io.EOFException;
-import java.io.IOException;
-import java.util.Locale;
-import java.util.Vector;
-
-import com.sun.xml.internal.stream.Entity;
-import com.sun.xml.internal.stream.XMLBufferListener;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
 
 
 import com.sun.org.apache.xerces.internal.impl.io.ASCIIReader;
 import com.sun.org.apache.xerces.internal.impl.io.UCSReader;
 import com.sun.org.apache.xerces.internal.impl.io.UTF8Reader;
-
-
 import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
 import com.sun.org.apache.xerces.internal.util.EncodingMap;
-
 import com.sun.org.apache.xerces.internal.util.SymbolTable;
 import com.sun.org.apache.xerces.internal.util.XMLChar;
 import com.sun.org.apache.xerces.internal.util.XMLStringBuffer;
-import com.sun.org.apache.xerces.internal.xni.QName;
-import com.sun.org.apache.xerces.internal.xni.XMLString;
+import com.sun.org.apache.xerces.internal.xni.*;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
-import com.sun.org.apache.xerces.internal.xni.*;
+import com.sun.xml.internal.stream.Entity;
+import com.sun.xml.internal.stream.XMLBufferListener;
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.Locale;
+import java.util.Vector;
 
 /**
  * Implements the entity scanner methods.
@@ -493,8 +487,7 @@
 
         // load more characters, if needed
         if (fCurrentEntity.position == fCurrentEntity.count) {
-            invokeListeners(0);
-            load(0, true);
+            load(0, true, true);
         }
 
         // peek at character
@@ -535,8 +528,7 @@
 
         // load more characters, if needed
         if (fCurrentEntity.position == fCurrentEntity.count) {
-            invokeListeners(0);
-            load(0, true);
+            load(0, true, true);
         }
 
         // scan character
@@ -546,9 +538,8 @@
             fCurrentEntity.lineNumber++;
             fCurrentEntity.columnNumber = 1;
             if (fCurrentEntity.position == fCurrentEntity.count) {
-                invokeListeners(1);
                 fCurrentEntity.ch[0] = (char)c;
-                load(1, false);
+                load(1, false, true);
             }
             if (c == '\r' && isExternal) {
                 if (fCurrentEntity.ch[fCurrentEntity.position++] != '\n') {
@@ -593,8 +584,7 @@
 
         // load more characters, if needed
         if (fCurrentEntity.position == fCurrentEntity.count) {
-            invokeListeners(0);
-            load(0, true);
+            load(0, true, true);
         }
 
         // scan nmtoken
@@ -626,7 +616,7 @@
                             fCurrentEntity.ch, 0, length);
                 }
                 offset = 0;
-                if (load(length, false)) {
+                if (load(length, false, false)) {
                     break;
                 }
             }
@@ -673,18 +663,16 @@
 
         // load more characters, if needed
         if (fCurrentEntity.position == fCurrentEntity.count) {
-            invokeListeners(0);
-            load(0, true);
+            load(0, true, true);
         }
 
         // scan name
         int offset = fCurrentEntity.position;
         if (XMLChar.isNameStart(fCurrentEntity.ch[offset])) {
             if (++fCurrentEntity.position == fCurrentEntity.count) {
-                invokeListeners(1);
                 fCurrentEntity.ch[0] = fCurrentEntity.ch[offset];
                 offset = 0;
-                if (load(1, false)) {
+                if (load(1, false, true)) {
                     fCurrentEntity.columnNumber++;
                     String symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 1);
 
@@ -721,7 +709,7 @@
                                 fCurrentEntity.ch, 0, length);
                     }
                     offset = 0;
-                    if (load(length, false)) {
+                    if (load(length, false, false)) {
                         break;
                     }
                 }
@@ -776,8 +764,7 @@
 
         // load more characters, if needed
         if (fCurrentEntity.position == fCurrentEntity.count) {
-            invokeListeners(0);
-            load(0, true);
+            load(0, true, true);
         }
 
         // scan qualified name
@@ -789,11 +776,10 @@
 
         if (XMLChar.isNameStart(fCurrentEntity.ch[offset])) {
             if (++fCurrentEntity.position == fCurrentEntity.count) {
-                invokeListeners(1);
                 fCurrentEntity.ch[0] = fCurrentEntity.ch[offset];
                 offset = 0;
 
-                if (load(1, false)) {
+                if (load(1, false, true)) {
                     fCurrentEntity.columnNumber++;
                     //adding into symbol table.
                     //XXX We are trying to add single character in SymbolTable??????
@@ -843,7 +829,7 @@
                         index = index - offset;
                     }
                     offset = 0;
-                    if (load(length, false)) {
+                    if (load(length, false, false)) {
                         break;
                     }
                 }
@@ -918,12 +904,10 @@
 
         // load more characters, if needed
         if (fCurrentEntity.position == fCurrentEntity.count) {
-            invokeListeners(0);
-            load(0, true);
+            load(0, true, true);
         } else if (fCurrentEntity.position == fCurrentEntity.count - 1) {
-            invokeListeners(0);
             fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1];
-            load(1, false);
+            load(1, false, true);
             fCurrentEntity.position = 0;
         }
 
@@ -945,9 +929,8 @@
                     fCurrentEntity.columnNumber = 1;
                     if (fCurrentEntity.position == fCurrentEntity.count) {
                         offset = 0;
-                        invokeListeners(newlines);
                         fCurrentEntity.position = newlines;
-                        if (load(newlines, false)) {
+                        if (load(newlines, false, true)) {
                             break;
                         }
                     }
@@ -965,9 +948,8 @@
                     fCurrentEntity.columnNumber = 1;
                     if (fCurrentEntity.position == fCurrentEntity.count) {
                         offset = 0;
-                        invokeListeners(newlines);
                         fCurrentEntity.position = newlines;
-                        if (load(newlines, false)) {
+                        if (load(newlines, false, true)) {
                             break;
                         }
                     }
@@ -1070,13 +1052,10 @@
         }
         // load more characters, if needed
         if (fCurrentEntity.position == fCurrentEntity.count) {
-            invokeListeners(0);
-            load(0, true);
+            load(0, true, true);
         } else if (fCurrentEntity.position == fCurrentEntity.count - 1) {
-            invokeListeners(0);
             fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1];
-
-            load(1, false);
+            load(1, false, true);
             fCurrentEntity.position = 0;
         }
 
@@ -1099,10 +1078,9 @@
                     fCurrentEntity.lineNumber++;
                     fCurrentEntity.columnNumber = 1;
                     if (fCurrentEntity.position == fCurrentEntity.count) {
-                        invokeListeners(newlines);
                         offset = 0;
                         fCurrentEntity.position = newlines;
-                        if (load(newlines, false)) {
+                        if (load(newlines, false, true)) {
                             break;
                         }
                     }
@@ -1121,9 +1099,8 @@
                     fCurrentEntity.columnNumber = 1;
                     if (fCurrentEntity.position == fCurrentEntity.count) {
                         offset = 0;
-                        invokeListeners(newlines);
                         fCurrentEntity.position = newlines;
-                        if (load(newlines, false)) {
+                        if (load(newlines, false, true)) {
                             break;
                         }
                     }
@@ -1142,7 +1119,7 @@
             int i=0;
             for ( i = offset; i < fCurrentEntity.position; i++) {
                 fCurrentEntity.ch[i] = '\n';
-                whiteSpaceLookup[whiteSpaceLen++]=i;
+                storeWhiteSpace(i);
             }
 
             int length = fCurrentEntity.position - offset;
@@ -1163,25 +1140,15 @@
         }
 
         // scan literal value
-        while (fCurrentEntity.position < fCurrentEntity.count) {
-            c = fCurrentEntity.ch[fCurrentEntity.position++];
+        for (; fCurrentEntity.position<fCurrentEntity.count; fCurrentEntity.position++) {
+            c = fCurrentEntity.ch[fCurrentEntity.position];
             if ((c == quote &&
-                 (!fCurrentEntity.literal || isExternal))
-                || c == '%' || !XMLChar.isContent(c)) {
-                fCurrentEntity.position--;
+                    (!fCurrentEntity.literal || isExternal)) ||
+                    c == '%' || !XMLChar.isContent(c)) {
                 break;
             }
-            if(whiteSpaceInfoNeeded){
-                if(c == 0x20 || c == 0x9){
-                    if(whiteSpaceLen < whiteSpaceLookup.length){
-                        whiteSpaceLookup[whiteSpaceLen++]= fCurrentEntity.position-1;
-                    }else{
-                        int [] tmp = new int[whiteSpaceLookup.length*2];
-                        System.arraycopy(whiteSpaceLookup,0,tmp,0,whiteSpaceLookup.length);
-                        whiteSpaceLookup = tmp;
-                        whiteSpaceLookup[whiteSpaceLen++]= fCurrentEntity.position - 1;
-                    }
-                }
+            if (whiteSpaceInfoNeeded && c == '\t') {
+                storeWhiteSpace(fCurrentEntity.position);
             }
         }
         int length = fCurrentEntity.position - offset;
@@ -1209,6 +1176,24 @@
 
     } // scanLiteral(int,XMLString):int
 
+    /**
+     * Save whitespace information. Increase the whitespace buffer by 100
+     * when needed.
+     *
+     * For XML 1.0, legal characters below 0x20 are 0x09 (TAB), 0x0A (LF) and 0x0D (CR).
+     *
+     * @param whiteSpacePos position of a whitespace in the scanner entity buffer
+     */
+    private void storeWhiteSpace(int whiteSpacePos) {
+        if (whiteSpaceLen >= whiteSpaceLookup.length) {
+            int [] tmp = new int[whiteSpaceLookup.length + 100];
+            System.arraycopy(whiteSpaceLookup, 0, tmp, 0, whiteSpaceLookup.length);
+            whiteSpaceLookup = tmp;
+        }
+
+        whiteSpaceLookup[whiteSpaceLen++] = whiteSpacePos;
+    }
+
     //CHANGED:
     /**
      * Scans a range of character data up to the specified delimiter,
@@ -1249,7 +1234,7 @@
             // load more characters, if needed
 
             if (fCurrentEntity.position == fCurrentEntity.count) {
-                load(0, true);
+                load(0, true, false);
             }
 
             boolean bNextEntity = false;
@@ -1263,7 +1248,7 @@
                                0,
                                fCurrentEntity.count - fCurrentEntity.position);
 
-              bNextEntity = load(fCurrentEntity.count - fCurrentEntity.position, false);
+              bNextEntity = load(fCurrentEntity.count - fCurrentEntity.position, false, false);
               fCurrentEntity.position = 0;
               fCurrentEntity.startPosition = 0;
             }
@@ -1276,7 +1261,7 @@
                 fCurrentEntity.baseCharOffset += (fCurrentEntity.position - fCurrentEntity.startPosition);
                 fCurrentEntity.position = fCurrentEntity.count;
                 fCurrentEntity.startPosition = fCurrentEntity.count;
-                load(0, true);
+                load(0, true, false);
                 return false;
             }
 
@@ -1298,9 +1283,8 @@
                         fCurrentEntity.columnNumber = 1;
                         if (fCurrentEntity.position == fCurrentEntity.count) {
                             offset = 0;
-                            invokeListeners(newlines);
                             fCurrentEntity.position = newlines;
-                            if (load(newlines, false)) {
+                            if (load(newlines, false, true)) {
                                 break;
                             }
                         }
@@ -1318,10 +1302,9 @@
                         fCurrentEntity.columnNumber = 1;
                         if (fCurrentEntity.position == fCurrentEntity.count) {
                             offset = 0;
-                            invokeListeners(newlines);
                             fCurrentEntity.position = newlines;
                             fCurrentEntity.count = newlines;
-                            if (load(newlines, false)) {
+                            if (load(newlines, false, true)) {
                                 break;
                             }
                         }
@@ -1422,8 +1405,7 @@
 
         // load more characters, if needed
         if (fCurrentEntity.position == fCurrentEntity.count) {
-            invokeListeners(0);
-            load(0, true);
+            load(0, true, true);
         }
 
         // skip character
@@ -1445,9 +1427,8 @@
         } else if (c == '\n' && cc == '\r' && isExternal) {
             // handle newlines
             if (fCurrentEntity.position == fCurrentEntity.count) {
-                invokeListeners(1);
                 fCurrentEntity.ch[0] = (char)cc;
-                load(1, false);
+                load(1, false, true);
             }
             fCurrentEntity.position++;
             if (fCurrentEntity.ch[fCurrentEntity.position] == '\n') {
@@ -1498,8 +1479,7 @@
         //boolean entityChanged = false;
         // load more characters, if needed
         if (fCurrentEntity.position == fCurrentEntity.count) {
-            invokeListeners(0);
-            load(0, true);
+            load(0, true, true);
         }
 
         //we are doing this check only in skipSpace() because it is called by
@@ -1522,9 +1502,8 @@
                     fCurrentEntity.lineNumber++;
                     fCurrentEntity.columnNumber = 1;
                     if (fCurrentEntity.position == fCurrentEntity.count - 1) {
-                        invokeListeners(0);
                         fCurrentEntity.ch[0] = (char)c;
-                        entityChanged = load(1, true);
+                        entityChanged = load(1, true, true);
                         if (!entityChanged){
                             // the load change the position to be 1,
                             // need to restore it when entity not changed
@@ -1549,8 +1528,7 @@
                 }
 
                 if (fCurrentEntity.position == fCurrentEntity.count) {
-                    invokeListeners(0);
-                    load(0, true);
+                    load(0, true, true);
 
                     //we are doing this check only in skipSpace() because it is called by
                     //fMiscDispatcher and we want the parser to exit gracefully when document
@@ -1626,7 +1604,7 @@
             if((fCurrentEntity.count - fCurrentEntity.position) < length){
                 int pos = fCurrentEntity.position;
                 invokeListeners(pos);
-                entityChanged = load(fCurrentEntity.count, changeEntity);
+                entityChanged = load(fCurrentEntity.count, changeEntity, false);
                 fCurrentEntity.position = pos;
                 if(entityChanged)break;
             }
@@ -1731,17 +1709,22 @@
      *                     the current entity in place and the entity
      *                     boundary will be signaled by the return
      *                     value.
+     * @param notify       Determine whether to notify listeners of
+     *                     the event
      *
      * @returns Returns true if the entity changed as a result of this
      *          load operation.
      */
-    final boolean load(int offset, boolean changeEntity)
+    final boolean load(int offset, boolean changeEntity, boolean notify)
     throws IOException {
         if (DEBUG_BUFFER) {
             System.out.print("(load, "+offset+": ");
             print();
             System.out.println();
         }
+        if (notify) {
+            invokeListeners(offset);
+        }
         //maintaing the count till last load
         fCurrentEntity.fTotalCountTillLastLoad = fCurrentEntity.fTotalCountTillLastLoad + fCurrentEntity.fLastCount ;
         // read characters
@@ -1778,7 +1761,7 @@
                 }
                 // handle the trailing edges
                 if (fCurrentEntity.position == fCurrentEntity.count) {
-                    load(0, true);
+                    load(0, true, false);
                 }
             }
 
@@ -2075,7 +2058,7 @@
      *
      * @param loadPos Starting position from which new data is being loaded into scanner buffer.
      */
-    private void invokeListeners(int loadPos){
+    public void invokeListeners(int loadPos){
         for(int i=0;i<listeners.size();i++){
             XMLBufferListener listener =(XMLBufferListener) listeners.get(i);
             listener.refresh(loadPos);
@@ -2108,7 +2091,7 @@
 
         // load more characters, if needed
         if (fCurrentEntity.position == fCurrentEntity.count) {
-            load(0, true);
+            load(0, true, false);
         }
 
         // skip spaces
@@ -2123,7 +2106,7 @@
                     fCurrentEntity.columnNumber = 1;
                     if (fCurrentEntity.position == fCurrentEntity.count - 1) {
                         fCurrentEntity.ch[0] = (char)c;
-                        entityChanged = load(1, true);
+                        entityChanged = load(1, true, false);
                         if (!entityChanged)
                             // the load change the position to be 1,
                             // need to restore it when entity not changed
@@ -2151,7 +2134,7 @@
                 if (!entityChanged)
                     fCurrentEntity.position++;
                 if (fCurrentEntity.position == fCurrentEntity.count) {
-                    load(0, true);
+                    load(0, true, false);
                 }
             } while (XMLChar.isSpace(c = fCurrentEntity.ch[fCurrentEntity.position]));
             if (DEBUG_BUFFER) {
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StAXValidatorHelper.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StAXValidatorHelper.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
--- a/jaxp/src/com/sun/org/apache/xerces/internal/util/SymbolTable.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/util/SymbolTable.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*
--- a/jaxp/src/com/sun/xml/internal/stream/Entity.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/com/sun/xml/internal/stream/Entity.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*
--- a/jaxp/src/com/sun/xml/internal/stream/StaxXMLInputSource.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/com/sun/xml/internal/stream/StaxXMLInputSource.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
--- a/jaxp/src/com/sun/xml/internal/stream/XMLEntityStorage.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/com/sun/xml/internal/stream/XMLEntityStorage.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
--- a/jaxp/src/com/sun/xml/internal/stream/writers/WriterUtility.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/com/sun/xml/internal/stream/writers/WriterUtility.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
--- a/jaxp/src/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
--- a/jaxp/src/javax/xml/XMLConstants.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/javax/xml/XMLConstants.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
--- a/jaxp/src/javax/xml/parsers/SAXParser.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/javax/xml/parsers/SAXParser.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
--- a/jaxp/src/javax/xml/stream/XMLOutputFactory.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/javax/xml/stream/XMLOutputFactory.java	Wed Jul 05 19:26:45 2017 +0200
@@ -241,11 +241,10 @@
    * factory class name that provides implementation of the factory.
    *
    * <p>
-   * Note that this is a new method that replaces the deprecated
+   *   Note that this is a new method that replaces the deprecated
    *   {@link #newInstance(java.lang.String, java.lang.ClassLoader)
    *   newInstance(String factoryId, ClassLoader classLoader)} method.
-   * No changes in behavior are defined by this replacement method relative
-   * to the deprecated method.
+   *   The original method was incorrectly defined to return XMLInputFactory.
    * </p>
    *
    * @param factoryId             Name of the factory to find, same as
--- a/jaxp/src/javax/xml/validation/Validator.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/javax/xml/validation/Validator.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
--- a/jaxp/src/javax/xml/xpath/XPathException.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/javax/xml/xpath/XPathException.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
--- a/jaxp/src/javax/xml/xpath/XPathFactory.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/javax/xml/xpath/XPathFactory.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
--- a/jaxp/src/org/xml/sax/helpers/NewInstance.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/org/xml/sax/helpers/NewInstance.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
--- a/jaxp/src/org/xml/sax/helpers/ParserAdapter.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/org/xml/sax/helpers/ParserAdapter.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
--- a/jaxp/src/org/xml/sax/helpers/ParserFactory.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/org/xml/sax/helpers/ParserFactory.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
--- a/jaxp/src/org/xml/sax/helpers/SecuritySupport.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/org/xml/sax/helpers/SecuritySupport.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
--- a/jaxp/src/org/xml/sax/helpers/XMLReaderFactory.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jaxp/src/org/xml/sax/helpers/XMLReaderFactory.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
--- a/jdk/.hgtags	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/.hgtags	Wed Jul 05 19:26:45 2017 +0200
@@ -242,3 +242,4 @@
 28ca338366ff2774ac9002f9f6eaff4101a3ea3b jdk8-b118
 e4499a6529e8c3e762ba86f45cdd774c92a8e7bc jdk8-b119
 d31cd980e1da31fa496a359caaf1a165aeb5791a jdk8-b120
+27b384262cba51dd0fe3e3534820189b46abc8cb jdk9-b00
--- a/jdk/.jcheck/conf	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/.jcheck/conf	Wed Jul 05 19:26:45 2017 +0200
@@ -1,1 +1,1 @@
-project=jdk8
+project=jdk9
--- a/jdk/make/CompileDemos.gmk	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/make/CompileDemos.gmk	Wed Jul 05 19:26:45 2017 +0200
@@ -195,9 +195,6 @@
   $(JDK_OUTPUTDIR)/demo/nbproject/%: $(JDK_TOPDIR)/src/closed/share/demo/nbproject/%
 	$(call install-file)
 	$(CHMOD) -f ug+w $@
-    ifeq ($(OPENJDK_TARGET_OS), solaris)
-	  $(RM) -r $(JDK_OUTPUTDIR)/demo/nbproject/jfc/SwingApplet
-    endif
 endif
 
 ##################################################################################################
@@ -365,9 +362,16 @@
 ##################################################################################################
 
 # The netbeans project files are copied into the demo directory.
-BUILD_DEMOS += $(patsubst $(JDK_TOPDIR)/src/share/demo/nbproject/%, \
+ifeq ($(OPENJDK_TARGET_OS), solaris)
+  BUILD_DEMOS += $(patsubst $(JDK_TOPDIR)/src/share/demo/nbproject/%, \
+    $(JDK_OUTPUTDIR)/demo/nbproject/%, \
+    $(filter-out $(JDK_TOPDIR)/src/share/demo/nbproject/jfc/SwingApplet%, \
+    $(call CacheFind, $(JDK_TOPDIR)/src/share/demo/nbproject)))
+else
+  BUILD_DEMOS += $(patsubst $(JDK_TOPDIR)/src/share/demo/nbproject/%, \
     $(JDK_OUTPUTDIR)/demo/nbproject/%, \
     $(call CacheFind, $(JDK_TOPDIR)/src/share/demo/nbproject))
+endif
 
 $(JDK_OUTPUTDIR)/demo/nbproject/%: $(JDK_TOPDIR)/src/share/demo/nbproject/%
 	$(call install-file)
--- a/jdk/make/CreateJars.gmk	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/make/CreateJars.gmk	Wed Jul 05 19:26:45 2017 +0200
@@ -298,29 +298,6 @@
 	@$(JAVAC) -d $(@D)/../../ $(@D)/$(VERSION_JAVA_FILE)
 
 
-# Support for removing the addPropertyChangeListener and removePropertyChangeListener
-# methods from classes that only go into the profile builds.
-BEANLESS_CLASSES = $(IMAGES_OUTPUTDIR)/beanless
-
-# When there are $ characters in filenames we have some very subtle interactions between
-# make expansion and shell expansion. In this particular case $< will contain a single $ while
-# $@ will contain \$. So we have to pass $< in single-quotes to avoid shell expansion
-$(BEANLESS_CLASSES)/%: $(JDK_OUTPUTDIR)/classes/%
-	$(MKDIR) -p $(@D)
-	$(TOOL_REMOVEMETHODS) '$<' $@ addPropertyChangeListener removePropertyChangeListener
-
-CLASSES_TO_DEBEAN = \
-    java/util/logging/LogManager.class \
-    java/util/jar/Pack200\$$Packer.class \
-    java/util/jar/Pack200\$$Unpacker.class \
-    com/sun/java/util/jar/pack/PackerImpl.class \
-    com/sun/java/util/jar/pack/UnpackerImpl.class
-
-ifneq ($(PROFILE), )
-  BEANLESS_CLASSES_TARGETS := $(addprefix $(BEANLESS_CLASSES)/, $(CLASSES_TO_DEBEAN))
-endif
-
-
 RT_JAR_CREATE_OPTIONS := c0fm
 RT_JAR_UPDATE_OPTIONS := u0f
 ifeq ($(COMPRESS_JARS), true)
@@ -333,7 +310,7 @@
 $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/rt.jar: \
     CLASS_FILE = $(if $(PROFILE), $(strip $(foreach class, $(PROFILE_VERSION_CLASS_TARGETS), $(if $(findstring $(PROFILE), $(class)), $(class)))), NO_SUCH_FILE)
 # This is the real target
-$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/rt.jar: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar.contents $(RT_JAR_MANIFEST_FILE) $(PROFILE_VERSION_CLASS_TARGETS) $(BEANLESS_CLASSES_TARGETS)
+$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/rt.jar: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar.contents $(RT_JAR_MANIFEST_FILE) $(PROFILE_VERSION_CLASS_TARGETS)
 	$(ECHO) Creating rt.jar $(PROFILE) Compressed=$(COMPRESS_JARS)
 	$(MKDIR) -p $(@D)
 	$(RM) $@ $@.tmp
@@ -344,8 +321,6 @@
 	  $(ECHO) Updating rt.jar $(PROFILE) && \
 	  $(CD) $(patsubst %$(VERSION_CLASS_PATH), %, $(CLASS_FILE)) && \
 	  $(JAR) $(RT_JAR_UPDATE_OPTIONS) $@.tmp $(VERSION_CLASS_PATH); \
-	  $(CD) $(BEANLESS_CLASSES) && \
-	  $(JAR) $(RT_JAR_UPDATE_OPTIONS) $@.tmp $(CLASSES_TO_DEBEAN); \
 	fi
 	$(MV) $@.tmp $@
 
--- a/jdk/make/Images.gmk	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/make/Images.gmk	Wed Jul 05 19:26:45 2017 +0200
@@ -190,26 +190,6 @@
 $(foreach f,$(filter $(OVERLAY_FILTER),$(JDKJRE_BIN_LIST)), \
     $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_OVERLAY_IMAGE_DIR)/jre,$f,JDKJRE_BIN_TARGETS)))
 
-ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_BITS),solaris-64)
-  define AddIsadirLink
-    # Param 1 - src file
-    # Param 2 - variable to add targets to
-
-    $1_LINK := $$(dir $1)$(OPENJDK_TARGET_CPU_ISADIR)/$$(notdir $1)
-
-    $$($1_LINK):
-	$(ECHO) $(LOG_INFO) Creating link $$(patsubst $(OUTPUT_ROOT)/%,%,$$@)
-	$(MKDIR) -p $$(@D)
-	$(LN) -s ../$$(@F) $$@
-
-    $2 += $$($1_LINK)
-  endef
-
-  $(foreach f,$(JRE_BIN_TARGETS),$(eval $(call AddIsadirLink,$f,JRE_BIN_ISADIR_LINK_TARGETS)))
-  $(foreach f,$(JDK_BIN_TARGETS),$(eval $(call AddIsadirLink,$f,JDK_BIN_ISADIR_LINK_TARGETS)))
-  $(foreach f,$(JDKJRE_BIN_TARGETS),$(eval $(call AddIsadirLink,$f,JDKJRE_BIN_ISADIR_LINK_TARGETS)))
-endif
-
 ################################################################################
 # /lib dir
 ifneq ($(OPENJDK_TARGET_OS), macosx)
--- a/jdk/make/Tools.gmk	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/make/Tools.gmk	Wed Jul 05 19:26:45 2017 +0200
@@ -122,10 +122,6 @@
 TOOL_CLDRCONVERTER = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.cldrconverter.CLDRConverter
 
-TOOL_REMOVEMETHODS = $(JAVA) -Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar \
-    -cp $(JDK_OUTPUTDIR)/btclasses:$(JDK_OUTPUTDIR) \
-    build.tools.classfile.RemoveMethods
-
 TOOL_CHECKDEPS = $(JAVA) -Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar \
     -cp $(JDK_OUTPUTDIR)/btclasses:$(JDK_OUTPUTDIR) \
     build.tools.deps.CheckDeps
--- a/jdk/make/profile-rtjar-includes.txt	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/make/profile-rtjar-includes.txt	Wed Jul 05 19:26:45 2017 +0200
@@ -26,8 +26,8 @@
 # Included or excluded types must take one of two forms
 # - *.class to indicate all classes; or else
 # - a full single type name e.g.
-#     com/sun/security/auth/callback/DialogCallbackHandler$$1.class
-# You can not use arbitrary wildcards like DialogCallbackHandler*.class.
+#     javax/management/remote/rmi/_RMIServer_Stub.class
+# You can not use arbitrary wildcards like _RMI*.class.
 #
 # Notes:
 # - Nested types must use $$ in place of $ as $ is the make meta-character
@@ -149,11 +149,6 @@
 PROFILE_3_RTJAR_INCLUDE_TYPES :=
 
 PROFILE_3_RTJAR_EXCLUDE_TYPES := \
-    com/sun/security/auth/callback/DialogCallbackHandler$$1.class \
-    com/sun/security/auth/callback/DialogCallbackHandler$$2.class \
-    com/sun/security/auth/callback/DialogCallbackHandler$$Action.class \
-    com/sun/security/auth/callback/DialogCallbackHandler$$ConfirmationInfo.class \
-    com/sun/security/auth/callback/DialogCallbackHandler.class \
     javax/management/remote/rmi/_RMIConnectionImpl_Tie.class \
     javax/management/remote/rmi/_RMIConnection_Stub.class \
     javax/management/remote/rmi/_RMIServerImpl_Tie.class \
@@ -225,11 +220,6 @@
     sun/tools/jar
 
 FULL_JRE_RTJAR_INCLUDE_TYPES := \
-    com/sun/security/auth/callback/DialogCallbackHandler$$1.class \
-    com/sun/security/auth/callback/DialogCallbackHandler$$2.class \
-    com/sun/security/auth/callback/DialogCallbackHandler$$Action.class \
-    com/sun/security/auth/callback/DialogCallbackHandler$$ConfirmationInfo.class \
-    com/sun/security/auth/callback/DialogCallbackHandler.class \
     javax/annotation/*.class \
     javax/management/remote/rmi/_RMIConnectionImpl_Tie.class \
     javax/management/remote/rmi/_RMIConnection_Stub.class \
--- a/jdk/make/src/classes/build/tools/classfile/RemoveMethods.java	Fri Dec 13 09:35:35 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 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 build.tools.classfile;
-
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Set;
-import java.util.HashSet;
-
-import com.sun.tools.classfile.AccessFlags;
-import com.sun.tools.classfile.Attributes;
-import com.sun.tools.classfile.ClassFile;
-import com.sun.tools.classfile.ClassWriter;
-import com.sun.tools.classfile.ConstantPool;
-import com.sun.tools.classfile.Field;
-import com.sun.tools.classfile.Method;
-
-public class RemoveMethods {
-
-    public static void main(String[] args) throws Exception {
-        if (args.length < 2) {
-            System.err.println("Usage: java RemoveMethods classfile output [method...]");
-            System.exit(-1);
-        }
-
-        // class file to read
-        Path input = Paths.get(args[0]);
-
-        // class file to write, if directory then use the name of the input
-        Path output = Paths.get(args[1]);
-        if (Files.isDirectory(output))
-            output = output.resolve(input.getFileName());
-
-        // the methods to remove
-        Set<String> methodsToRemove = new HashSet<>();
-        int i = 2;
-        while (i < args.length)
-            methodsToRemove.add(args[i++]);
-
-        // read class file
-        ClassFile cf;
-        try (InputStream in = Files.newInputStream(input)) {
-             cf = ClassFile.read(in);
-        }
-
-        final int magic = cf.magic;
-        final int major_version = cf.major_version;
-        final int minor_version = cf.minor_version;
-        final ConstantPool cp = cf.constant_pool;
-        final AccessFlags access_flags = cf.access_flags;
-        final int this_class = cf.this_class;
-        final int super_class = cf.super_class;
-        final int[] interfaces = cf.interfaces;
-        final Field[] fields = cf.fields;
-        final Attributes class_attrs = cf.attributes;
-
-        // remove the requested methods, no signature check at this time
-        Method[] methods = cf.methods;
-        i = 0;
-        while (i < methods.length) {
-            Method m = methods[i];
-            String name = m.getName(cp);
-            if (methodsToRemove.contains(name)) {
-                int len = methods.length;
-                Method[] newMethods = new Method[len-1];
-                if (i > 0)
-                    System.arraycopy(methods, 0, newMethods, 0, i);
-                int after = methods.length - i - 1;
-                if (after > 0)
-                    System.arraycopy(methods, i+1, newMethods, i, after);
-                methods = newMethods;
-                String paramTypes = m.descriptor.getParameterTypes(cp);
-                System.out.format("Removed method %s%s from %s%n",
-                    name, paramTypes, cf.getName());
-                continue;
-            }
-            i++;
-        }
-
-        // TBD, prune constant pool of entries that are no longer referenced
-
-        // re-write class file
-        cf = new ClassFile(magic, minor_version, major_version, cp, access_flags,
-                this_class, super_class, interfaces, fields, methods, class_attrs);
-        try (OutputStream out = Files.newOutputStream(output)) {
-             new ClassWriter().write(cf, out);
-        }
-    }
-}
--- a/jdk/src/macosx/classes/apple/security/AppleProvider.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/macosx/classes/apple/security/AppleProvider.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -43,7 +43,7 @@
 
     public AppleProvider() {
         /* We are the Apple provider */
-        super("Apple", 1.8d, info);
+        super("Apple", 1.9d, info);
 
         AccessController.<Object>doPrivileged(new java.security.PrivilegedAction<Object>() {
             public Object run() {
--- a/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java	Wed Jul 05 19:26:45 2017 +0200
@@ -38,7 +38,6 @@
 import sun.awt.*;
 import sun.lwawt.macosx.*;
 import sun.print.*;
-import sun.security.util.SecurityConstants;
 
 public abstract class LWToolkit extends SunToolkit implements Runnable {
 
@@ -503,7 +502,7 @@
     public Clipboard getSystemClipboard() {
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
-            security.checkPermission(SecurityConstants.AWT.ACCESS_CLIPBOARD_PERMISSION);
+            security.checkPermission(AWTPermissions.ACCESS_CLIPBOARD_PERMISSION);
         }
 
         synchronized (this) {
--- a/jdk/src/share/classes/com/sun/crypto/provider/SunJCE.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/com/sun/crypto/provider/SunJCE.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -104,7 +104,7 @@
 
     public SunJCE() {
         /* We are the "SunJCE" provider */
-        super("SunJCE", 1.8d, info);
+        super("SunJCE", 1.9d, info);
 
         final String BLOCK_MODES = "ECB|CBC|PCBC|CTR|CTS|CFB|OFB" +
             "|CFB8|CFB16|CFB24|CFB32|CFB40|CFB48|CFB56|CFB64" +
--- a/jdk/src/share/classes/com/sun/java/util/jar/pack/PackerImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/PackerImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -26,7 +26,6 @@
 package com.sun.java.util.jar.pack;
 
 import com.sun.java.util.jar.pack.Attribute.Layout;
-import java.beans.PropertyChangeListener;
 import java.io.BufferedInputStream;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -136,23 +135,6 @@
             in.close();
         }
     }
-    /**
-     * Register a listener for changes to options.
-     * @param listener  An object to be invoked when a property is changed.
-     */
-    public void addPropertyChangeListener(PropertyChangeListener listener) {
-        props.addListener(listener);
-    }
-
-    /**
-     * Remove a listener for the PropertyChange event.
-     * @param listener  The PropertyChange listener to be removed.
-     */
-    public void removePropertyChangeListener(PropertyChangeListener listener) {
-        props.removeListener(listener);
-    }
-
-
 
     // All the worker bees.....
     // The packer worker.
--- a/jdk/src/share/classes/com/sun/java/util/jar/pack/PropMap.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/PropMap.java	Wed Jul 05 19:26:45 2017 +0200
@@ -40,9 +40,6 @@
 import java.util.SortedMap;
 import java.util.TreeMap;
 import java.util.jar.Pack200;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
 
 /**
  * Control block for publishing Pack200 options to the other classes.
@@ -51,30 +48,9 @@
 final class PropMap implements SortedMap<String, String>  {
     private final TreeMap<String, String> theMap = new TreeMap<>();;
 
-    // type is erased, elements are of type java.beans.PropertyChangeListener
-    private final List<Object> listenerList = new ArrayList<>(1);
-
-    void addListener(Object listener) {
-        assert Beans.isPropertyChangeListener(listener);
-        listenerList.add(listener);
-    }
-
-    void removeListener(Object listener) {
-        assert Beans.isPropertyChangeListener(listener);
-        listenerList.remove(listener);
-    }
-
     // Override:
     public String put(String key, String value) {
         String oldValue = theMap.put(key, value);
-        if (value != oldValue && !listenerList.isEmpty()) {
-            assert Beans.isBeansPresent();
-            // Post the property change event.
-            Object event = Beans.newPropertyChangeEvent(this, key, oldValue, value);
-            for (Object listener : listenerList) {
-                Beans.invokePropertyChange(listener, event);
-            }
-        }
         return oldValue;
     }
 
@@ -341,113 +317,4 @@
     public String lastKey() {
        return theMap.lastKey();
     }
-
-    /**
-     * A class that provides access to the java.beans.PropertyChangeListener
-     * and java.beans.PropertyChangeEvent without creating a static dependency
-     * on java.beans. This class can be removed once the addPropertyChangeListener
-     * and removePropertyChangeListener methods are removed from Packer and
-     * Unpacker.
-     */
-    private static class Beans {
-        private static final Class<?> propertyChangeListenerClass =
-            getClass("java.beans.PropertyChangeListener");
-
-        private static final Class<?> propertyChangeEventClass =
-            getClass("java.beans.PropertyChangeEvent");
-
-        private static final Method propertyChangeMethod =
-            getMethod(propertyChangeListenerClass,
-                      "propertyChange",
-                      propertyChangeEventClass);
-
-        private static final Constructor<?> propertyEventCtor =
-            getConstructor(propertyChangeEventClass,
-                           Object.class,
-                           String.class,
-                           Object.class,
-                           Object.class);
-
-        private static Class<?> getClass(String name) {
-            try {
-                return Class.forName(name, true, Beans.class.getClassLoader());
-            } catch (ClassNotFoundException e) {
-                return null;
-            }
-        }
-        private static Constructor<?> getConstructor(Class<?> c, Class<?>... types) {
-            try {
-                return (c == null) ? null : c.getDeclaredConstructor(types);
-            } catch (NoSuchMethodException x) {
-                throw new AssertionError(x);
-            }
-        }
-
-        private static Method getMethod(Class<?> c, String name, Class<?>... types) {
-            try {
-                return (c == null) ? null : c.getMethod(name, types);
-            } catch (NoSuchMethodException e) {
-                throw new AssertionError(e);
-            }
-        }
-
-        /**
-         * Returns {@code true} if java.beans is present.
-         */
-        static boolean isBeansPresent() {
-            return propertyChangeListenerClass != null &&
-                   propertyChangeEventClass != null;
-        }
-
-        /**
-         * Returns {@code true} if the given object is a PropertyChangeListener
-         */
-        static boolean isPropertyChangeListener(Object obj) {
-            if (propertyChangeListenerClass == null) {
-                return false;
-            } else {
-                return propertyChangeListenerClass.isInstance(obj);
-            }
-        }
-
-        /**
-         * Returns a new PropertyChangeEvent with the given source, property
-         * name, old and new values.
-         */
-        static Object newPropertyChangeEvent(Object source, String prop,
-                                             Object oldValue, Object newValue)
-        {
-            try {
-                return propertyEventCtor.newInstance(source, prop, oldValue, newValue);
-            } catch (InstantiationException | IllegalAccessException x) {
-                throw new AssertionError(x);
-            } catch (InvocationTargetException x) {
-                Throwable cause = x.getCause();
-                if (cause instanceof Error)
-                    throw (Error)cause;
-                if (cause instanceof RuntimeException)
-                    throw (RuntimeException)cause;
-                throw new AssertionError(x);
-            }
-        }
-
-        /**
-         * Invokes the given PropertyChangeListener's propertyChange method
-         * with the given event.
-         */
-        static void invokePropertyChange(Object listener, Object ev) {
-            try {
-                propertyChangeMethod.invoke(listener, ev);
-            } catch (IllegalAccessException x) {
-                throw new AssertionError(x);
-            } catch (InvocationTargetException x) {
-                Throwable cause = x.getCause();
-                if (cause instanceof Error)
-                    throw (Error)cause;
-                if (cause instanceof RuntimeException)
-                    throw (RuntimeException)cause;
-                throw new AssertionError(x);
-            }
-        }
-    }
 }
--- a/jdk/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -25,7 +25,6 @@
 
 package com.sun.java.util.jar.pack;
 
-import java.beans.PropertyChangeListener;
 import java.io.BufferedInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
@@ -55,24 +54,6 @@
 
 public class UnpackerImpl extends TLGlobals implements Pack200.Unpacker {
 
-
-    /**
-     * Register a listener for changes to options.
-     * @param listener  An object to be invoked when a property is changed.
-     */
-    public void addPropertyChangeListener(PropertyChangeListener listener) {
-        props.addListener(listener);
-    }
-
-
-    /**
-     * Remove a listener for the PropertyChange event.
-     * @param listener  The PropertyChange listener to be removed.
-     */
-    public void removePropertyChangeListener(PropertyChangeListener listener) {
-        props.removeListener(listener);
-    }
-
     public UnpackerImpl() {}
 
 
--- a/jdk/src/share/classes/com/sun/naming/internal/ResourceManager.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/com/sun/naming/internal/ResourceManager.java	Wed Jul 05 19:26:45 2017 +0200
@@ -67,6 +67,14 @@
     private static final String JRELIB_PROPERTY_FILE_NAME = "jndi.properties";
 
     /*
+     * Internal environment property, that when set to "true", disables
+     * application resource files lookup to prevent recursion issues
+     * when validating signed JARs.
+     */
+    private static final String DISABLE_APP_RESOURCE_FILES =
+        "com.sun.naming.disable.app.resource.files";
+
+    /*
      * The standard JNDI properties that specify colon-separated lists.
      */
     private static final String[] listProperties = {
@@ -224,6 +232,13 @@
             }
         }
 
+        // Return without merging if application resource files lookup
+        // is disabled.
+        String disableAppRes = (String)env.get(DISABLE_APP_RESOURCE_FILES);
+        if (disableAppRes != null && disableAppRes.equalsIgnoreCase("true")) {
+            return env;
+        }
+
         // Merge the above with the values read from all application
         // resource files.  Colon-separated lists are concatenated.
         mergeTables((Hashtable<Object, Object>)env, getApplicationResources());
--- a/jdk/src/share/classes/com/sun/security/auth/callback/DialogCallbackHandler.java	Fri Dec 13 09:35:35 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,319 +0,0 @@
-/*
- * Copyright (c) 2000, 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 com.sun.security.auth.callback;
-
-/* JAAS imports */
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.ConfirmationCallback;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.TextOutputCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-
-/* Java imports */
-import java.awt.Component;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import javax.swing.Box;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPasswordField;
-import javax.swing.JTextField;
-
-/**
- * <p>
- * Uses a Swing dialog window to query the user for answers to
- * authentication questions.
- * This can be used by a JAAS application to instantiate a
- * CallbackHandler
- * @see javax.security.auth.callback
- * @deprecated This class will be removed in a future release.
- */
-@jdk.Exported(false)
-@Deprecated
-public class DialogCallbackHandler implements CallbackHandler {
-
-    /* -- Fields -- */
-
-    /* The parent window, or null if using the default parent */
-    private Component parentComponent;
-    private static final int JPasswordFieldLen = 8 ;
-    private static final int JTextFieldLen = 8 ;
-
-    /* -- Methods -- */
-
-    /**
-     * Creates a callback dialog with the default parent window.
-     */
-    public DialogCallbackHandler() { }
-
-    /**
-     * Creates a callback dialog and specify the parent window.
-     *
-     * @param parentComponent the parent window -- specify <code>null</code>
-     * for the default parent
-     */
-    public DialogCallbackHandler(Component parentComponent) {
-        this.parentComponent = parentComponent;
-    }
-
-    /*
-     * An interface for recording actions to carry out if the user
-     * clicks OK for the dialog.
-     */
-    private static interface Action {
-         void perform();
-    }
-
-    /**
-     * Handles the specified set of callbacks.
-     *
-     * @param callbacks the callbacks to handle
-     * @throws UnsupportedCallbackException if the callback is not an
-     * instance  of NameCallback or PasswordCallback
-     */
-
-    public void handle(Callback[] callbacks)
-        throws UnsupportedCallbackException
-    {
-        /* Collect messages to display in the dialog */
-        final List<Object> messages = new ArrayList<>(3);
-
-        /* Collection actions to perform if the user clicks OK */
-        final List<Action> okActions = new ArrayList<>(2);
-
-        ConfirmationInfo confirmation = new ConfirmationInfo();
-
-        for (int i = 0; i < callbacks.length; i++) {
-            if (callbacks[i] instanceof TextOutputCallback) {
-                TextOutputCallback tc = (TextOutputCallback) callbacks[i];
-
-                switch (tc.getMessageType()) {
-                case TextOutputCallback.INFORMATION:
-                    confirmation.messageType = JOptionPane.INFORMATION_MESSAGE;
-                    break;
-                case TextOutputCallback.WARNING:
-                    confirmation.messageType = JOptionPane.WARNING_MESSAGE;
-                    break;
-                case TextOutputCallback.ERROR:
-                    confirmation.messageType = JOptionPane.ERROR_MESSAGE;
-                    break;
-                default:
-                    throw new UnsupportedCallbackException(
-                        callbacks[i], "Unrecognized message type");
-                }
-
-                messages.add(tc.getMessage());
-
-            } else if (callbacks[i] instanceof NameCallback) {
-                final NameCallback nc = (NameCallback) callbacks[i];
-
-                JLabel prompt = new JLabel(nc.getPrompt());
-
-                final JTextField name = new JTextField(JTextFieldLen);
-                String defaultName = nc.getDefaultName();
-                if (defaultName != null) {
-                    name.setText(defaultName);
-                }
-
-                /*
-                 * Put the prompt and name in a horizontal box,
-                 * and add that to the set of messages.
-                 */
-                Box namePanel = Box.createHorizontalBox();
-                namePanel.add(prompt);
-                namePanel.add(name);
-                messages.add(namePanel);
-
-                /* Store the name back into the callback if OK */
-                okActions.add(new Action() {
-                    public void perform() {
-                        nc.setName(name.getText());
-                    }
-                });
-
-            } else if (callbacks[i] instanceof PasswordCallback) {
-                final PasswordCallback pc = (PasswordCallback) callbacks[i];
-
-                JLabel prompt = new JLabel(pc.getPrompt());
-
-                final JPasswordField password =
-                                        new JPasswordField(JPasswordFieldLen);
-                if (!pc.isEchoOn()) {
-                    password.setEchoChar('*');
-                }
-
-                Box passwordPanel = Box.createHorizontalBox();
-                passwordPanel.add(prompt);
-                passwordPanel.add(password);
-                messages.add(passwordPanel);
-
-                okActions.add(new Action() {
-                    public void perform() {
-                        pc.setPassword(password.getPassword());
-                    }
-                });
-
-            } else if (callbacks[i] instanceof ConfirmationCallback) {
-                ConfirmationCallback cc = (ConfirmationCallback)callbacks[i];
-
-                confirmation.setCallback(cc);
-                if (cc.getPrompt() != null) {
-                    messages.add(cc.getPrompt());
-                }
-
-            } else {
-                throw new UnsupportedCallbackException(
-                    callbacks[i], "Unrecognized Callback");
-            }
-        }
-
-        /* Display the dialog */
-        int result = JOptionPane.showOptionDialog(
-            parentComponent,
-            messages.toArray(),
-            "Confirmation",                     /* title */
-            confirmation.optionType,
-            confirmation.messageType,
-            null,                               /* icon */
-            confirmation.options,               /* options */
-            confirmation.initialValue);         /* initialValue */
-
-        /* Perform the OK actions */
-        if (result == JOptionPane.OK_OPTION
-            || result == JOptionPane.YES_OPTION)
-        {
-            Iterator<Action> iterator = okActions.iterator();
-            while (iterator.hasNext()) {
-                iterator.next().perform();
-            }
-        }
-        confirmation.handleResult(result);
-    }
-
-    /*
-     * Provides assistance with translating between JAAS and Swing
-     * confirmation dialogs.
-     */
-    private static class ConfirmationInfo {
-
-        private int[] translations;
-
-        int optionType = JOptionPane.OK_CANCEL_OPTION;
-        Object[] options = null;
-        Object initialValue = null;
-
-        int messageType = JOptionPane.QUESTION_MESSAGE;
-
-        private ConfirmationCallback callback;
-
-        /* Set the confirmation callback handler */
-        void setCallback(ConfirmationCallback callback)
-            throws UnsupportedCallbackException
-        {
-            this.callback = callback;
-
-            int confirmationOptionType = callback.getOptionType();
-            switch (confirmationOptionType) {
-            case ConfirmationCallback.YES_NO_OPTION:
-                optionType = JOptionPane.YES_NO_OPTION;
-                translations = new int[] {
-                    JOptionPane.YES_OPTION, ConfirmationCallback.YES,
-                    JOptionPane.NO_OPTION, ConfirmationCallback.NO,
-                    JOptionPane.CLOSED_OPTION, ConfirmationCallback.NO
-                };
-                break;
-            case ConfirmationCallback.YES_NO_CANCEL_OPTION:
-                optionType = JOptionPane.YES_NO_CANCEL_OPTION;
-                translations = new int[] {
-                    JOptionPane.YES_OPTION, ConfirmationCallback.YES,
-                    JOptionPane.NO_OPTION, ConfirmationCallback.NO,
-                    JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL,
-                    JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL
-                };
-                break;
-            case ConfirmationCallback.OK_CANCEL_OPTION:
-                optionType = JOptionPane.OK_CANCEL_OPTION;
-                translations = new int[] {
-                    JOptionPane.OK_OPTION, ConfirmationCallback.OK,
-                    JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL,
-                    JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL
-                };
-                break;
-            case ConfirmationCallback.UNSPECIFIED_OPTION:
-                options = callback.getOptions();
-                /*
-                 * There's no way to know if the default option means
-                 * to cancel the login, but there isn't a better way
-                 * to guess this.
-                 */
-                translations = new int[] {
-                    JOptionPane.CLOSED_OPTION, callback.getDefaultOption()
-                };
-                break;
-            default:
-                throw new UnsupportedCallbackException(
-                    callback,
-                    "Unrecognized option type: " + confirmationOptionType);
-            }
-
-            int confirmationMessageType = callback.getMessageType();
-            switch (confirmationMessageType) {
-            case ConfirmationCallback.WARNING:
-                messageType = JOptionPane.WARNING_MESSAGE;
-                break;
-            case ConfirmationCallback.ERROR:
-                messageType = JOptionPane.ERROR_MESSAGE;
-                break;
-            case ConfirmationCallback.INFORMATION:
-                messageType = JOptionPane.INFORMATION_MESSAGE;
-                break;
-            default:
-                throw new UnsupportedCallbackException(
-                    callback,
-                    "Unrecognized message type: " + confirmationMessageType);
-            }
-        }
-
-
-        /* Process the result returned by the Swing dialog */
-        void handleResult(int result) {
-            if (callback == null) {
-                return;
-            }
-
-            for (int i = 0; i < translations.length; i += 2) {
-                if (translations[i] == result) {
-                    result = translations[i + 1];
-                    break;
-                }
-            }
-            callback.setSelectedIndex(result);
-        }
-    }
-}
--- a/jdk/src/share/classes/com/sun/security/sasl/Provider.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/com/sun/security/sasl/Provider.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -53,7 +53,7 @@
         " server mechanisms for: DIGEST-MD5, GSSAPI, CRAM-MD5, NTLM)";
 
     public Provider() {
-        super("SunSASL", 1.8d, info);
+        super("SunSASL", 1.9d, info);
 
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
             public Void run() {
--- a/jdk/src/share/classes/com/sun/tools/example/debug/expr/Expr.jj	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/Expr.jj	Wed Jul 05 19:26:45 2017 +0200
@@ -539,10 +539,10 @@
 }
 
 void UnaryExpression() :
-{}
+{Token tok;}
 {
-  ( "+" | "-" ) UnaryExpression()
-                        { throw new ParseException("operation not yet supported"); }
+  ( tok = "+" | tok = "-" ) UnaryExpression()
+                { push( LValue.operation(vm, tok, pop(), frameGetter) ); }
 |
   PreIncrementExpression()
 |
@@ -566,10 +566,10 @@
 }
 
 void UnaryExpressionNotPlusMinus() :
-{}
+{Token tok;}
 {
-  ( "~" | "!" ) UnaryExpression()
-                        { throw new ParseException("operation not yet supported"); }
+  ( tok = "~" | tok = "!" ) UnaryExpression()
+                { push( LValue.operation(vm, tok, pop(), frameGetter) ); }
 |
   LOOKAHEAD( CastLookahead() )
   CastExpression()
--- a/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParser.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParser.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -23,38 +23,28 @@
  * questions.
  */
 
-/*
- * This source code is provided to illustrate the usage of a given feature
- * or technique and has been deliberately simplified. Additional steps
- * required for a production-quality application, such as security checks,
- * input validation and proper error handling, might not be present in
- * this sample code.
- */
-
-
 /* Generated By:JavaCC: Do not edit this line. ExpressionParser.java */
 package com.sun.tools.example.debug.expr;
 
 import com.sun.jdi.*;
-
 import java.util.Stack;
 import java.util.List;
 import java.util.ArrayList;
 
 public class ExpressionParser implements ExpressionParserConstants {
 
-   Stack<LValue> stack = new Stack<LValue>();
+  Stack stack = new Stack();
   VirtualMachine vm = null;
   GetFrame frameGetter = null;
   private static GetFrame lastFrameGetter;
   private static LValue lastLValue;
 
   LValue peek() {
-      return stack.peek();
+    return (LValue)stack.peek();
   }
 
   LValue pop() {
-      return stack.pop();
+    return (LValue)stack.pop();
   }
 
   void push(LValue lval) {
@@ -62,7 +52,7 @@
   }
 
   public static Value getMassagedValue() throws ParseException {
-       return lastLValue.getMassagedValue(lastFrameGetter);
+        return lastLValue.getMassagedValue(lastFrameGetter);
   }
 
   public interface GetFrame {
@@ -70,14 +60,17 @@
   }
 
   public static Value evaluate(String expr, VirtualMachine vm,
-         GetFrame frameGetter) throws ParseException, InvocationException,
-         InvalidTypeException, ClassNotLoadedException,
+                               GetFrame frameGetter) throws ParseException,
+                                            InvocationException,
+                                            InvalidTypeException,
+                                            ClassNotLoadedException,
                                             IncompatibleThreadStateException {
         // TODO StringBufferInputStream is deprecated.
         java.io.InputStream in = new java.io.StringBufferInputStream(expr);
         ExpressionParser parser = new ExpressionParser(in);
         parser.vm = vm;
         parser.frameGetter = frameGetter;
+        Value value = null;
         parser.Expression();
         lastFrameGetter = frameGetter;
         lastLValue = parser.pop();
@@ -95,8 +88,8 @@
       try {
         parser = new ExpressionParser(new java.io.FileInputStream(args[0]));
       } catch (java.io.FileNotFoundException e) {
-            System.out.println("Java Parser Version 1.0.2:  File " + args[0]
-                  + " not found.");
+        System.out.println("Java Parser Version 1.0.2:  File " +
+                           args[0] + " not found.");
         return;
       }
     } else {
@@ -143,7 +136,8 @@
       jj_consume_token(-1);
       throw new ParseException();
     }
-      label_1: while (true) {
+    label_1:
+    while (true) {
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case LBRACKET:
         ;
@@ -194,7 +188,8 @@
  StringBuffer sb = new StringBuffer();
     jj_consume_token(IDENTIFIER);
                  sb.append(token);
-      label_2: while (true) {
+    label_2:
+    while (true) {
       if (jj_2_1(2)) {
         ;
       } else {
@@ -202,18 +197,16 @@
       }
       jj_consume_token(DOT);
       jj_consume_token(IDENTIFIER);
-         sb.append('.');
-         sb.append(token);
-      }
-      if (true) {
-         return sb.toString();
-      }
+                                    sb.append('.'); sb.append(token);
+    }
+          {if (true) return sb.toString();}
     throw new Error("Missing return statement in function");
   }
 
   final public void NameList() throws ParseException {
     Name();
-      label_3: while (true) {
+    label_3:
+    while (true) {
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case COMMA:
         ;
@@ -267,9 +260,7 @@
     PrimaryExpression();
     AssignmentOperator();
     Expression();
-      LValue exprVal = pop();
-      pop().setValue(exprVal);
-      push(exprVal);
+          LValue exprVal = pop(); pop().setValue(exprVal); push(exprVal);
   }
 
   final public void AssignmentOperator() throws ParseException {
@@ -325,18 +316,13 @@
       Expression();
       jj_consume_token(COLON);
       ConditionalExpression();
-         LValue falseBranch = pop();
-         LValue trueBranch = pop();
+                  LValue falseBranch = pop(); LValue trueBranch = pop();
                   Value cond = pop().interiorGetValue();
                   if (cond instanceof BooleanValue) {
-            push(((BooleanValue) cond).booleanValue() ? trueBranch
-                  : falseBranch);
+                        push(((BooleanValue)cond).booleanValue()?
+                                        trueBranch : falseBranch);
                   } else {
-            {
-               if (true) {
-                  throw new ParseException("Condition must be boolean");
-               }
-            }
+                        {if (true) throw new ParseException("Condition must be boolean");}
                   }
       break;
     default:
@@ -347,7 +333,8 @@
 
   final public void ConditionalOrExpression() throws ParseException {
     ConditionalAndExpression();
-      label_4: while (true) {
+    label_4:
+    while (true) {
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case SC_OR:
         ;
@@ -358,17 +345,14 @@
       }
       jj_consume_token(SC_OR);
       ConditionalAndExpression();
-         {
-            if (true) {
-               throw new ParseException("operation not yet supported");
-            }
-         }
+                          {if (true) throw new ParseException("operation not yet supported");}
     }
   }
 
   final public void ConditionalAndExpression() throws ParseException {
     InclusiveOrExpression();
-      label_5: while (true) {
+    label_5:
+    while (true) {
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case SC_AND:
         ;
@@ -379,17 +363,14 @@
       }
       jj_consume_token(SC_AND);
       InclusiveOrExpression();
-         {
-            if (true) {
-               throw new ParseException("operation not yet supported");
-            }
-         }
+                          {if (true) throw new ParseException("operation not yet supported");}
     }
   }
 
   final public void InclusiveOrExpression() throws ParseException {
     ExclusiveOrExpression();
-      label_6: while (true) {
+    label_6:
+    while (true) {
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case BIT_OR:
         ;
@@ -400,17 +381,14 @@
       }
       jj_consume_token(BIT_OR);
       ExclusiveOrExpression();
-         {
-            if (true) {
-               throw new ParseException("operation not yet supported");
-            }
-         }
+                          {if (true) throw new ParseException("operation not yet supported");}
     }
   }
 
   final public void ExclusiveOrExpression() throws ParseException {
     AndExpression();
-      label_7: while (true) {
+    label_7:
+    while (true) {
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case XOR:
         ;
@@ -421,17 +399,14 @@
       }
       jj_consume_token(XOR);
       AndExpression();
-         {
-            if (true) {
-               throw new ParseException("operation not yet supported");
-            }
-         }
+                          {if (true) throw new ParseException("operation not yet supported");}
     }
   }
 
   final public void AndExpression() throws ParseException {
     EqualityExpression();
-      label_8: while (true) {
+    label_8:
+    while (true) {
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case BIT_AND:
         ;
@@ -442,18 +417,15 @@
       }
       jj_consume_token(BIT_AND);
       EqualityExpression();
-         {
-            if (true) {
-               throw new ParseException("operation not yet supported");
-            }
-         }
+                          {if (true) throw new ParseException("operation not yet supported");}
     }
   }
 
   final public void EqualityExpression() throws ParseException {
  Token tok;
     InstanceOfExpression();
-      label_9: while (true) {
+    label_9:
+    while (true) {
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case EQ:
       case NE:
@@ -487,11 +459,7 @@
     case INSTANCEOF:
       jj_consume_token(INSTANCEOF);
       Type();
-         {
-            if (true) {
-               throw new ParseException("operation not yet supported");
-            }
-         }
+                          {if (true) throw new ParseException("operation not yet supported");}
       break;
     default:
       jj_la1[14] = jj_gen;
@@ -502,7 +470,8 @@
   final public void RelationalExpression() throws ParseException {
  Token tok;
     ShiftExpression();
-      label_10: while (true) {
+    label_10:
+    while (true) {
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case GT:
       case LT:
@@ -540,7 +509,8 @@
 
   final public void ShiftExpression() throws ParseException {
     AdditiveExpression();
-      label_11: while (true) {
+    label_11:
+    while (true) {
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case LSHIFT:
       case RSIGNEDSHIFT:
@@ -567,18 +537,15 @@
         throw new ParseException();
       }
       AdditiveExpression();
-         {
-            if (true) {
-               throw new ParseException("operation not yet supported");
-            }
-         }
+                          {if (true) throw new ParseException("operation not yet supported");}
     }
   }
 
   final public void AdditiveExpression() throws ParseException {
  Token tok;
     MultiplicativeExpression();
-      label_12: while (true) {
+    label_12:
+    while (true) {
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case PLUS:
       case MINUS:
@@ -609,7 +576,8 @@
   final public void MultiplicativeExpression() throws ParseException {
  Token tok;
     UnaryExpression();
-      label_13: while (true) {
+    label_13:
+    while (true) {
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case STAR:
       case SLASH:
@@ -642,15 +610,16 @@
   }
 
   final public void UnaryExpression() throws ParseException {
+ Token tok;
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case PLUS:
     case MINUS:
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case PLUS:
-        jj_consume_token(PLUS);
+        tok = jj_consume_token(PLUS);
         break;
       case MINUS:
-        jj_consume_token(MINUS);
+        tok = jj_consume_token(MINUS);
         break;
       default:
         jj_la1[23] = jj_gen;
@@ -658,11 +627,7 @@
         throw new ParseException();
       }
       UnaryExpression();
-         {
-            if (true) {
-               throw new ParseException("operation not yet supported");
-            }
-         }
+                  push( LValue.operation(vm, tok, pop(), frameGetter) );
       break;
     case INCR:
       PreIncrementExpression();
@@ -696,33 +661,26 @@
   final public void PreIncrementExpression() throws ParseException {
     jj_consume_token(INCR);
     PrimaryExpression();
-      {
-         if (true) {
-            throw new ParseException("operation not yet supported");
-         }
-      }
+                          {if (true) throw new ParseException("operation not yet supported");}
   }
 
   final public void PreDecrementExpression() throws ParseException {
     jj_consume_token(DECR);
     PrimaryExpression();
-      {
-         if (true) {
-            throw new ParseException("operation not yet supported");
-         }
-      }
+                          {if (true) throw new ParseException("operation not yet supported");}
   }
 
   final public void UnaryExpressionNotPlusMinus() throws ParseException {
+ Token tok;
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case BANG:
     case TILDE:
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case TILDE:
-        jj_consume_token(TILDE);
+        tok = jj_consume_token(TILDE);
         break;
       case BANG:
-        jj_consume_token(BANG);
+        tok = jj_consume_token(BANG);
         break;
       default:
         jj_la1[25] = jj_gen;
@@ -730,11 +688,7 @@
         throw new ParseException();
       }
       UnaryExpression();
-         {
-            if (true) {
-               throw new ParseException("operation not yet supported");
-            }
-         }
+                  push( LValue.operation(vm, tok, pop(), frameGetter) );
       break;
     default:
       jj_la1[26] = jj_gen;
@@ -765,10 +719,8 @@
     }
   }
 
-   // This production is to determine lookahead only. The LOOKAHEAD
-   // specifications
-   // below are not used, but they are there just to indicate that we know
-   // about
+// This production is to determine lookahead only.  The LOOKAHEAD specifications
+// below are not used, but they are there just to indicate that we know about
 // this.
   final public void CastLookahead() throws ParseException {
     if (jj_2_4(2)) {
@@ -841,11 +793,7 @@
         break;
       case DECR:
         jj_consume_token(DECR);
-            {
-               if (true) {
-                  throw new ParseException("operation not yet supported");
-               }
-            }
+                          {if (true) throw new ParseException("operation not yet supported");}
         break;
       default:
         jj_la1[30] = jj_gen;
@@ -863,7 +811,8 @@
     if (jj_2_6(2)) {
       jj_consume_token(LPAREN);
       PrimitiveType();
-         label_14: while (true) {
+      label_14:
+      while (true) {
         switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
         case LBRACKET:
           ;
@@ -882,7 +831,8 @@
       case LPAREN:
         jj_consume_token(LPAREN);
         Name();
-            label_15: while (true) {
+        label_15:
+        while (true) {
           switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
           case LBRACKET:
             ;
@@ -907,7 +857,8 @@
 
   final public void PrimaryExpression() throws ParseException {
     PrimaryPrefix();
-      label_16: while (true) {
+    label_16:
+    while (true) {
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case LPAREN:
       case LBRACKET:
@@ -946,11 +897,7 @@
       jj_consume_token(SUPER);
       jj_consume_token(DOT);
       jj_consume_token(IDENTIFIER);
-         {
-            if (true) {
-               throw new ParseException("operation not yet supported");
-            }
-         }
+                          {if (true) throw new ParseException("operation not yet supported");}
       break;
     case LPAREN:
       jj_consume_token(LPAREN);
@@ -968,7 +915,7 @@
   }
 
   final public void PrimarySuffix() throws ParseException {
-      List<Value> argList;
+ List argList;
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case LBRACKET:
       jj_consume_token(LBRACKET);
@@ -1046,8 +993,8 @@
     jj_consume_token(NULL);
   }
 
-   final public List<Value> Arguments() throws ParseException {
-      List<Value> argList = new ArrayList<Value>();
+  final public List Arguments() throws ParseException {
+ List argList = new ArrayList();
     jj_consume_token(LPAREN);
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case FALSE:
@@ -1075,18 +1022,15 @@
       ;
     }
     jj_consume_token(RPAREN);
-      {
-         if (true) {
-            return argList;
-         }
-      }
+    {if (true) return argList;}
     throw new Error("Missing return statement in function");
   }
 
-   final public void ArgumentList(List<Value> argList) throws ParseException {
+  final public void ArgumentList(List argList) throws ParseException {
     Expression();
                 argList.add(pop().interiorGetValue());
-      label_17: while (true) {
+    label_17:
+    while (true) {
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case COMMA:
         ;
@@ -1102,8 +1046,7 @@
   }
 
   final public void AllocationExpression() throws ParseException {
-      List<Value> argList;
-      String className;
+ List argList; String className;
     if (jj_2_7(2)) {
       jj_consume_token(NEW);
       PrimitiveType();
@@ -1120,11 +1063,7 @@
           break;
         case LBRACKET:
           ArrayDimensions();
-               {
-                  if (true) {
-                     throw new ParseException("operation not yet supported");
-                  }
-               }
+                          {if (true) throw new ParseException("operation not yet supported");}
           break;
         default:
           jj_la1[42] = jj_gen;
@@ -1141,11 +1080,12 @@
   }
 
 /*
-    * The second LOOKAHEAD specification below is to parse to PrimarySuffix if
-    * there is an expression between the "[...]".
+ * The second LOOKAHEAD specification below is to parse to PrimarySuffix
+ * if there is an expression between the "[...]".
  */
   final public void ArrayDimensions() throws ParseException {
-      label_18: while (true) {
+    label_18:
+    while (true) {
       jj_consume_token(LBRACKET);
       Expression();
       jj_consume_token(RBRACKET);
@@ -1155,7 +1095,8 @@
         break label_18;
       }
     }
-      label_19: while (true) {
+    label_19:
+    while (true) {
       if (jj_2_9(2)) {
         ;
       } else {
@@ -1166,2230 +1107,636 @@
     }
   }
 
-  final private boolean jj_2_1(int xla) {
-      jj_la = xla;
-      jj_lastpos = jj_scanpos = token;
-    boolean retval = !jj_3_1();
-    jj_save(0, xla);
-    return retval;
-  }
-
-  final private boolean jj_2_2(int xla) {
-      jj_la = xla;
-      jj_lastpos = jj_scanpos = token;
-    boolean retval = !jj_3_2();
-    jj_save(1, xla);
-    return retval;
-  }
-
-  final private boolean jj_2_3(int xla) {
-      jj_la = xla;
-      jj_lastpos = jj_scanpos = token;
-    boolean retval = !jj_3_3();
-    jj_save(2, xla);
-    return retval;
-  }
-
-  final private boolean jj_2_4(int xla) {
-      jj_la = xla;
-      jj_lastpos = jj_scanpos = token;
-    boolean retval = !jj_3_4();
-    jj_save(3, xla);
-    return retval;
-  }
-
-  final private boolean jj_2_5(int xla) {
-      jj_la = xla;
-      jj_lastpos = jj_scanpos = token;
-    boolean retval = !jj_3_5();
-    jj_save(4, xla);
-    return retval;
-  }
-
-  final private boolean jj_2_6(int xla) {
-      jj_la = xla;
-      jj_lastpos = jj_scanpos = token;
-    boolean retval = !jj_3_6();
-    jj_save(5, xla);
-    return retval;
+  private boolean jj_2_1(int xla) {
+    jj_la = xla; jj_lastpos = jj_scanpos = token;
+    try { return !jj_3_1(); }
+    catch(LookaheadSuccess ls) { return true; }
+    finally { jj_save(0, xla); }
   }
 
-  final private boolean jj_2_7(int xla) {
-      jj_la = xla;
-      jj_lastpos = jj_scanpos = token;
-    boolean retval = !jj_3_7();
-    jj_save(6, xla);
-    return retval;
-  }
-
-  final private boolean jj_2_8(int xla) {
-      jj_la = xla;
-      jj_lastpos = jj_scanpos = token;
-    boolean retval = !jj_3_8();
-    jj_save(7, xla);
-    return retval;
-  }
-
-  final private boolean jj_2_9(int xla) {
-      jj_la = xla;
-      jj_lastpos = jj_scanpos = token;
-    boolean retval = !jj_3_9();
-    jj_save(8, xla);
-    return retval;
+  private boolean jj_2_2(int xla) {
+    jj_la = xla; jj_lastpos = jj_scanpos = token;
+    try { return !jj_3_2(); }
+    catch(LookaheadSuccess ls) { return true; }
+    finally { jj_save(1, xla); }
   }
 
-  final private boolean jj_3R_154() {
-      if (jj_scan_token(INCR)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
+  private boolean jj_2_3(int xla) {
+    jj_la = xla; jj_lastpos = jj_scanpos = token;
+    try { return !jj_3_3(); }
+    catch(LookaheadSuccess ls) { return true; }
+    finally { jj_save(2, xla); }
   }
 
-  final private boolean jj_3R_151() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_154()) {
-    jj_scanpos = xsp;
-         if (jj_3R_155()) {
-            return true;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
+  private boolean jj_2_4(int xla) {
+    jj_la = xla; jj_lastpos = jj_scanpos = token;
+    try { return !jj_3_4(); }
+    catch(LookaheadSuccess ls) { return true; }
+    finally { jj_save(3, xla); }
   }
 
-  final private boolean jj_3R_148() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3_6()) {
-    jj_scanpos = xsp;
-         if (jj_3R_150()) {
-            return true;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
+  private boolean jj_2_5(int xla) {
+    jj_la = xla; jj_lastpos = jj_scanpos = token;
+    try { return !jj_3_5(); }
+    catch(LookaheadSuccess ls) { return true; }
+    finally { jj_save(4, xla); }
+  }
+
+  private boolean jj_2_6(int xla) {
+    jj_la = xla; jj_lastpos = jj_scanpos = token;
+    try { return !jj_3_6(); }
+    catch(LookaheadSuccess ls) { return true; }
+    finally { jj_save(5, xla); }
   }
 
-  final private boolean jj_3_6() {
-      if (jj_scan_token(LPAREN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_23()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    Token xsp;
-    while (true) {
-      xsp = jj_scanpos;
-         if (jj_3R_152()) {
-            jj_scanpos = xsp;
-            break;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      }
-      if (jj_scan_token(RPAREN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_115()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
+  private boolean jj_2_7(int xla) {
+    jj_la = xla; jj_lastpos = jj_scanpos = token;
+    try { return !jj_3_7(); }
+    catch(LookaheadSuccess ls) { return true; }
+    finally { jj_save(6, xla); }
   }
 
-  final private boolean jj_3R_25() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_50()) {
-    jj_scanpos = xsp;
-         if (jj_3R_51()) {
-            return true;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
+  private boolean jj_2_8(int xla) {
+    jj_la = xla; jj_lastpos = jj_scanpos = token;
+    try { return !jj_3_8(); }
+    catch(LookaheadSuccess ls) { return true; }
+    finally { jj_save(7, xla); }
   }
 
-  final private boolean jj_3R_50() {
-      if (jj_3R_67()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
+  private boolean jj_2_9(int xla) {
+    jj_la = xla; jj_lastpos = jj_scanpos = token;
+    try { return !jj_3_9(); }
+    catch(LookaheadSuccess ls) { return true; }
+    finally { jj_save(8, xla); }
   }
 
-  final private boolean jj_3_5() {
-      if (jj_scan_token(LPAREN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_24()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_scan_token(LBRACKET)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_94() {
+    if (jj_scan_token(DECR)) return true;
+    if (jj_3R_20()) return true;
     return false;
   }
 
-  final private boolean jj_3R_149() {
-      if (jj_3R_20()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    Token xsp;
-    xsp = jj_scanpos;
-      if (jj_3R_151()) {
-         jj_scanpos = xsp;
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_86() {
+    if (jj_3R_24()) return true;
     return false;
   }
 
-  final private boolean jj_3R_41() {
-      if (jj_scan_token(LPAREN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_24()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_scan_token(RPAREN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_59()) {
-    jj_scanpos = xsp;
-    if (jj_3R_60()) {
-    jj_scanpos = xsp;
-    if (jj_3R_61()) {
-    jj_scanpos = xsp;
-    if (jj_3R_62()) {
-    jj_scanpos = xsp;
-    if (jj_3R_63()) {
-    jj_scanpos = xsp;
-    if (jj_3R_64()) {
-    jj_scanpos = xsp;
-    if (jj_3R_65()) {
-    jj_scanpos = xsp;
-                           if (jj_3R_66()) {
-                              return true;
-                           }
-                           if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                              return false;
-                           }
-                        } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                           return false;
-                        }
-                     } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                        return false;
-                     }
-                  } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                     return false;
-                  }
-               } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                  return false;
-               }
-            } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-               return false;
-            }
-         } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_93() {
+    if (jj_scan_token(INCR)) return true;
+    if (jj_3R_20()) return true;
+    return false;
+  }
+
+  private boolean jj_3R_91() {
+    if (jj_3R_95()) return true;
     return false;
   }
 
-  final private boolean jj_3R_40() {
-      if (jj_scan_token(LPAREN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_24()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_scan_token(LBRACKET)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_scan_token(RBRACKET)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_123() {
-      if (jj_scan_token(LBRACKET)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_scan_token(RBRACKET)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3_1() {
-      if (jj_scan_token(DOT)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_scan_token(IDENTIFIER)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3_4() {
-      if (jj_scan_token(LPAREN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_23()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_22() {
+  private boolean jj_3R_23() {
     Token xsp;
     xsp = jj_scanpos;
-    if (jj_3_4()) {
+    if (jj_scan_token(10)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(15)) {
     jj_scanpos = xsp;
-    if (jj_3R_40()) {
+    if (jj_scan_token(12)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(45)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(34)) {
     jj_scanpos = xsp;
-            if (jj_3R_41()) {
-               return true;
-            }
-            if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-               return false;
-            }
-         } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3_3() {
-      if (jj_3R_22()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_24() {
-      if (jj_scan_token(IDENTIFIER)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    Token xsp;
-    while (true) {
-      xsp = jj_scanpos;
-         if (jj_3_1()) {
-            jj_scanpos = xsp;
-            break;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
+    if (jj_scan_token(36)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(27)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(21)) return true;
+    }
+    }
+    }
+    }
+    }
+    }
     }
     return false;
   }
 
-  final private boolean jj_3R_147() {
-      if (jj_scan_token(BANG)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_142() {
-      if (jj_3R_149()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_122() {
-      if (jj_3R_24()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_90() {
+    if (jj_3R_94()) return true;
     return false;
   }
 
-  final private boolean jj_3R_49() {
-      if (jj_scan_token(DOUBLE)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_141() {
-      if (jj_3R_148()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_48() {
-      if (jj_scan_token(FLOAT)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_146() {
-      if (jj_scan_token(TILDE)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_89() {
+    if (jj_3R_93()) return true;
     return false;
   }
 
-  final private boolean jj_3R_47() {
-      if (jj_scan_token(LONG)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_140() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_146()) {
-    jj_scanpos = xsp;
-         if (jj_3R_147()) {
-            return true;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_115()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_85() {
+    if (jj_3R_23()) return true;
     return false;
   }
 
-  final private boolean jj_3R_136() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_140()) {
-    jj_scanpos = xsp;
-    if (jj_3R_141()) {
-    jj_scanpos = xsp;
-            if (jj_3R_142()) {
-               return true;
-            }
-            if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-               return false;
-            }
-         } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_60() {
+    if (jj_3R_58()) return true;
     return false;
   }
 
-  final private boolean jj_3R_46() {
-      if (jj_scan_token(INT)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_145() {
-      if (jj_scan_token(REM)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_45() {
-      if (jj_scan_token(SHORT)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_88() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_scan_token(94)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(95)) return true;
+    }
+    if (jj_3R_83()) return true;
     return false;
   }
 
-  final private boolean jj_3R_44() {
-      if (jj_scan_token(BYTE)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_135() {
-      if (jj_scan_token(DECR)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_20()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_43() {
-      if (jj_scan_token(CHAR)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_23() {
+  private boolean jj_3R_83() {
     Token xsp;
     xsp = jj_scanpos;
-    if (jj_3R_42()) {
-    jj_scanpos = xsp;
-    if (jj_3R_43()) {
-    jj_scanpos = xsp;
-    if (jj_3R_44()) {
+    if (jj_3R_88()) {
     jj_scanpos = xsp;
-    if (jj_3R_45()) {
-    jj_scanpos = xsp;
-    if (jj_3R_46()) {
-    jj_scanpos = xsp;
-    if (jj_3R_47()) {
-    jj_scanpos = xsp;
-    if (jj_3R_48()) {
+    if (jj_3R_89()) {
     jj_scanpos = xsp;
-                           if (jj_3R_49()) {
-                              return true;
-                           }
-                           if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                              return false;
-                           }
-                        } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                           return false;
-                        }
-                     } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                        return false;
-                     }
-                  } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                     return false;
-                  }
-               } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                  return false;
-               }
-            } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-               return false;
-            }
-         } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+    if (jj_3R_90()) {
+    jj_scanpos = xsp;
+    if (jj_3R_91()) return true;
+    }
+    }
+    }
     return false;
   }
 
-  final private boolean jj_3R_42() {
-      if (jj_scan_token(BOOLEAN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_82() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_85()) {
+    jj_scanpos = xsp;
+    if (jj_3R_86()) return true;
+    }
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3R_87()) { jj_scanpos = xsp; break; }
+    }
     return false;
   }
 
-  final private boolean jj_3_9() {
-      if (jj_scan_token(LBRACKET)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_scan_token(RBRACKET)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_121() {
-      if (jj_3R_23()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_59() {
+    if (jj_3R_55()) return true;
     return false;
   }
 
-  final private boolean jj_3R_144() {
-      if (jj_scan_token(SLASH)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_96() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_scan_token(96)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(97)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(101)) return true;
+    }
+    }
+    if (jj_3R_83()) return true;
     return false;
   }
 
-  final private boolean jj_3R_134() {
-      if (jj_scan_token(INCR)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_20()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_114() {
+  private boolean jj_3R_80() {
+    if (jj_3R_83()) return true;
     Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_121()) {
-    jj_scanpos = xsp;
-         if (jj_3R_122()) {
-            return true;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
     while (true) {
       xsp = jj_scanpos;
-         if (jj_3R_123()) {
-            jj_scanpos = xsp;
-            break;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
+      if (jj_3R_96()) { jj_scanpos = xsp; break; }
     }
     return false;
   }
 
-  final private boolean jj_3R_120() {
-      if (jj_scan_token(GE)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_133() {
-      if (jj_scan_token(MINUS)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_127() {
-      if (jj_3R_136()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_126() {
-      if (jj_3R_135()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_139() {
-      if (jj_scan_token(MINUS)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_125() {
-      if (jj_3R_134()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_132() {
-      if (jj_scan_token(PLUS)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_143() {
-      if (jj_scan_token(STAR)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_124() {
+  private boolean jj_3R_92() {
     Token xsp;
     xsp = jj_scanpos;
-    if (jj_3R_132()) {
+    if (jj_scan_token(94)) {
     jj_scanpos = xsp;
-         if (jj_3R_133()) {
-            return true;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_115()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+    if (jj_scan_token(95)) return true;
+    }
+    if (jj_3R_80()) return true;
     return false;
   }
 
-  final private boolean jj_3R_115() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_124()) {
-    jj_scanpos = xsp;
-    if (jj_3R_125()) {
-    jj_scanpos = xsp;
-    if (jj_3R_126()) {
-    jj_scanpos = xsp;
-               if (jj_3R_127()) {
-                  return true;
-               }
-               if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                  return false;
-               }
-            } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-               return false;
-            }
-         } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3_8() {
+    if (jj_scan_token(LBRACKET)) return true;
+    if (jj_3R_25()) return true;
+    if (jj_scan_token(RBRACKET)) return true;
     return false;
   }
 
-  final private boolean jj_3R_137() {
+  private boolean jj_3R_58() {
     Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_143()) {
-    jj_scanpos = xsp;
-    if (jj_3R_144()) {
-    jj_scanpos = xsp;
-            if (jj_3R_145()) {
-               return true;
-            }
-            if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-               return false;
-            }
-         } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_115()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_131() {
-      if (jj_scan_token(RUNSIGNEDSHIFT)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_119() {
-      if (jj_scan_token(LE)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_138() {
-      if (jj_scan_token(PLUS)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_112() {
-      if (jj_3R_115()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    Token xsp;
+    if (jj_3_8()) return true;
     while (true) {
       xsp = jj_scanpos;
-         if (jj_3R_137()) {
-            jj_scanpos = xsp;
-            break;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
+      if (jj_3_8()) { jj_scanpos = xsp; break; }
+    }
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3_9()) { jj_scanpos = xsp; break; }
     }
     return false;
   }
 
-  final private boolean jj_3R_88() {
-      if (jj_3R_86()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_130() {
-      if (jj_scan_token(RSIGNEDSHIFT)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_84() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_scan_token(102)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(103)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(104)) return true;
+    }
+    }
+    if (jj_3R_78()) return true;
     return false;
   }
 
-  final private boolean jj_3R_128() {
+  private boolean jj_3R_78() {
+    if (jj_3R_80()) return true;
     Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_138()) {
-    jj_scanpos = xsp;
-         if (jj_3R_139()) {
-            return true;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_112()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_87() {
-      if (jj_3R_82()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3R_92()) { jj_scanpos = xsp; break; }
+    }
     return false;
   }
 
-  final private boolean jj_3R_118() {
-      if (jj_scan_token(GT)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_54() {
+    if (jj_scan_token(NEW)) return true;
+    if (jj_3R_24()) return true;
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_59()) {
+    jj_scanpos = xsp;
+    if (jj_3R_60()) return true;
+    }
     return false;
   }
 
-  final private boolean jj_3R_129() {
-      if (jj_scan_token(LSHIFT)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_76() {
+    if (jj_3R_78()) return true;
+    Token xsp;
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3R_84()) { jj_scanpos = xsp; break; }
+    }
     return false;
   }
 
-  final private boolean jj_3R_116() {
+  private boolean jj_3R_81() {
     Token xsp;
     xsp = jj_scanpos;
-    if (jj_3R_129()) {
+    if (jj_scan_token(81)) {
     jj_scanpos = xsp;
-    if (jj_3R_130()) {
+    if (jj_scan_token(80)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(87)) {
     jj_scanpos = xsp;
-            if (jj_3R_131()) {
-               return true;
-            }
-            if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-               return false;
-            }
-         } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_108()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+    if (jj_scan_token(88)) return true;
+    }
+    }
+    }
+    if (jj_3R_76()) return true;
     return false;
   }
 
-  final private boolean jj_3R_108() {
-      if (jj_3R_112()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_43() {
     Token xsp;
-    while (true) {
-      xsp = jj_scanpos;
-         if (jj_3R_128()) {
-            jj_scanpos = xsp;
-            break;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
+    xsp = jj_scanpos;
+    if (jj_3_7()) {
+    jj_scanpos = xsp;
+    if (jj_3R_54()) return true;
     }
     return false;
   }
 
-  final private boolean jj_3_8() {
-      if (jj_scan_token(LBRACKET)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_25()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_scan_token(RBRACKET)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3_7() {
+    if (jj_scan_token(NEW)) return true;
+    if (jj_3R_23()) return true;
+    if (jj_3R_58()) return true;
     return false;
   }
 
-  final private boolean jj_3R_86() {
+  private boolean jj_3R_67() {
+    if (jj_scan_token(COMMA)) return true;
+    if (jj_3R_25()) return true;
+    return false;
+  }
+
+  private boolean jj_3R_64() {
+    if (jj_3R_25()) return true;
     Token xsp;
-      if (jj_3_8()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
     while (true) {
       xsp = jj_scanpos;
-         if (jj_3_8()) {
-            jj_scanpos = xsp;
-            break;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-    }
-    while (true) {
-      xsp = jj_scanpos;
-         if (jj_3_9()) {
-            jj_scanpos = xsp;
-            break;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
+      if (jj_3R_67()) { jj_scanpos = xsp; break; }
     }
     return false;
   }
 
-  final private boolean jj_3R_117() {
-      if (jj_scan_token(LT)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_106() {
-      if (jj_3R_108()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    Token xsp;
-    while (true) {
-      xsp = jj_scanpos;
-         if (jj_3R_116()) {
-            jj_scanpos = xsp;
-            break;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-    }
+  private boolean jj_3R_61() {
+    if (jj_3R_64()) return true;
     return false;
   }
 
-  final private boolean jj_3R_113() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_117()) {
-    jj_scanpos = xsp;
-    if (jj_3R_118()) {
-    jj_scanpos = xsp;
-    if (jj_3R_119()) {
-    jj_scanpos = xsp;
-               if (jj_3R_120()) {
-                  return true;
-               }
-               if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                  return false;
-               }
-            } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-               return false;
-            }
-         } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_106()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_79() {
+    if (jj_scan_token(INSTANCEOF)) return true;
+    if (jj_3R_82()) return true;
     return false;
   }
 
-  final private boolean jj_3R_111() {
-      if (jj_scan_token(NE)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_109() {
-      if (jj_scan_token(INSTANCEOF)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_114()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_104() {
-      if (jj_3R_106()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_74() {
+    if (jj_3R_76()) return true;
     Token xsp;
     while (true) {
       xsp = jj_scanpos;
-         if (jj_3R_113()) {
-            jj_scanpos = xsp;
-            break;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
+      if (jj_3R_81()) { jj_scanpos = xsp; break; }
     }
     return false;
   }
 
-  final private boolean jj_3R_81() {
-      if (jj_scan_token(NEW)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_24()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_55() {
+    if (jj_scan_token(LPAREN)) return true;
     Token xsp;
     xsp = jj_scanpos;
-    if (jj_3R_87()) {
-    jj_scanpos = xsp;
-         if (jj_3R_88()) {
-            return true;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+    if (jj_3R_61()) jj_scanpos = xsp;
+    if (jj_scan_token(RPAREN)) return true;
     return false;
   }
 
-  final private boolean jj_3_7() {
-      if (jj_scan_token(NEW)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_23()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_86()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_70() {
+  private boolean jj_3R_72() {
+    if (jj_3R_74()) return true;
     Token xsp;
     xsp = jj_scanpos;
-    if (jj_3_7()) {
-    jj_scanpos = xsp;
-         if (jj_3R_81()) {
-            return true;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+    if (jj_3R_79()) jj_scanpos = xsp;
     return false;
   }
 
-  final private boolean jj_3R_97() {
-      if (jj_scan_token(COMMA)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_25()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_39() {
-      if (jj_scan_token(ORASSIGN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_110() {
-      if (jj_scan_token(EQ)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_77() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_scan_token(86)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(89)) return true;
+    }
+    if (jj_3R_72()) return true;
     return false;
   }
 
-  final private boolean jj_3R_102() {
-      if (jj_3R_104()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    Token xsp;
-    xsp = jj_scanpos;
-      if (jj_3R_109()) {
-         jj_scanpos = xsp;
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_75() {
+    if (jj_scan_token(BIT_AND)) return true;
+    if (jj_3R_70()) return true;
     return false;
   }
 
-  final private boolean jj_3R_107() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_110()) {
-    jj_scanpos = xsp;
-         if (jj_3R_111()) {
-            return true;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_102()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_94() {
-      if (jj_3R_25()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_70() {
+    if (jj_3R_72()) return true;
     Token xsp;
     while (true) {
       xsp = jj_scanpos;
-         if (jj_3R_97()) {
-            jj_scanpos = xsp;
-            break;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
+      if (jj_3R_77()) { jj_scanpos = xsp; break; }
     }
     return false;
   }
 
-  final private boolean jj_3R_89() {
-      if (jj_3R_94()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_38() {
-      if (jj_scan_token(XORASSIGN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_82() {
-      if (jj_scan_token(LPAREN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_57() {
     Token xsp;
     xsp = jj_scanpos;
-      if (jj_3R_89()) {
-         jj_scanpos = xsp;
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_scan_token(RPAREN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_105() {
-      if (jj_scan_token(BIT_AND)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_100()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_100() {
-      if (jj_3R_102()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    Token xsp;
-    while (true) {
-      xsp = jj_scanpos;
-         if (jj_3R_107()) {
-            jj_scanpos = xsp;
-            break;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
+    if (jj_scan_token(54)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(24)) return true;
     }
     return false;
   }
 
-  final private boolean jj_3R_37() {
-      if (jj_scan_token(ANDASSIGN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_85() {
-      if (jj_scan_token(NULL)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_53() {
+    if (jj_scan_token(39)) return true;
     return false;
   }
 
-  final private boolean jj_3R_103() {
-      if (jj_scan_token(XOR)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_98()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_39() {
+    if (jj_3R_42()) return true;
     return false;
   }
 
-  final private boolean jj_3R_98() {
-      if (jj_3R_100()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_68() {
+    if (jj_3R_70()) return true;
     Token xsp;
     while (true) {
       xsp = jj_scanpos;
-         if (jj_3R_105()) {
-            jj_scanpos = xsp;
-            break;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
+      if (jj_3R_75()) { jj_scanpos = xsp; break; }
     }
     return false;
   }
 
-  final private boolean jj_3R_92() {
-      if (jj_scan_token(FALSE)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_73() {
+    if (jj_scan_token(XOR)) return true;
+    if (jj_3R_68()) return true;
     return false;
   }
 
-  final private boolean jj_3R_36() {
-      if (jj_scan_token(RUNSIGNEDSHIFTASSIGN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_91() {
-      if (jj_scan_token(TRUE)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_52() {
+    if (jj_3R_57()) return true;
     return false;
   }
 
-  final private boolean jj_3R_84() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_91()) {
-    jj_scanpos = xsp;
-         if (jj_3R_92()) {
-            return true;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_51() {
+    if (jj_scan_token(STRING_LITERAL)) return true;
     return false;
   }
 
-  final private boolean jj_3R_101() {
-      if (jj_scan_token(BIT_OR)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_95()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_50() {
+    if (jj_scan_token(CHARACTER_LITERAL)) return true;
     return false;
   }
 
-  final private boolean jj_3R_95() {
-      if (jj_3R_98()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_65() {
+    if (jj_3R_68()) return true;
     Token xsp;
     while (true) {
       xsp = jj_scanpos;
-         if (jj_3R_103()) {
-            jj_scanpos = xsp;
-            break;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
+      if (jj_3R_73()) { jj_scanpos = xsp; break; }
     }
     return false;
   }
 
-  final private boolean jj_3R_35() {
-      if (jj_scan_token(RSIGNEDSHIFTASSIGN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_71() {
+    if (jj_scan_token(BIT_OR)) return true;
+    if (jj_3R_65()) return true;
     return false;
   }
 
-  final private boolean jj_3R_80() {
-      if (jj_3R_85()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_66() {
-      if (jj_3R_69()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_79() {
-      if (jj_3R_84()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_49() {
+    if (jj_scan_token(FLOATING_POINT_LITERAL)) return true;
     return false;
   }
 
-  final private boolean jj_3R_78() {
-      if (jj_scan_token(STRING_LITERAL)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_99() {
-      if (jj_scan_token(SC_AND)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_90()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_90() {
-      if (jj_3R_95()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_42() {
     Token xsp;
-    while (true) {
-      xsp = jj_scanpos;
-         if (jj_3R_101()) {
-            jj_scanpos = xsp;
-            break;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
+    xsp = jj_scanpos;
+    if (jj_3R_48()) {
+    jj_scanpos = xsp;
+    if (jj_3R_49()) {
+    jj_scanpos = xsp;
+    if (jj_3R_50()) {
+    jj_scanpos = xsp;
+    if (jj_3R_51()) {
+    jj_scanpos = xsp;
+    if (jj_3R_52()) {
+    jj_scanpos = xsp;
+    if (jj_3R_53()) return true;
+    }
+    }
+    }
+    }
     }
     return false;
   }
 
-  final private boolean jj_3R_34() {
-      if (jj_scan_token(LSHIFTASSIGN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_65() {
-      if (jj_scan_token(NEW)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_77() {
-      if (jj_scan_token(CHARACTER_LITERAL)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_76() {
-      if (jj_scan_token(FLOATING_POINT_LITERAL)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_33() {
-      if (jj_scan_token(MINUSASSIGN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_48() {
+    if (jj_scan_token(INTEGER_LITERAL)) return true;
     return false;
   }
 
-  final private boolean jj_3R_69() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_75()) {
-    jj_scanpos = xsp;
-    if (jj_3R_76()) {
-    jj_scanpos = xsp;
-    if (jj_3R_77()) {
-    jj_scanpos = xsp;
-    if (jj_3R_78()) {
-    jj_scanpos = xsp;
-    if (jj_3R_79()) {
-    jj_scanpos = xsp;
-                     if (jj_3R_80()) {
-                        return true;
-                     }
-                     if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                        return false;
-                     }
-                  } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                     return false;
-                  }
-               } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                  return false;
-               }
-            } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-               return false;
-            }
-         } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_75() {
-      if (jj_scan_token(INTEGER_LITERAL)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_96() {
-      if (jj_scan_token(SC_OR)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_83()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_83() {
-      if (jj_3R_90()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_62() {
+    if (jj_3R_65()) return true;
     Token xsp;
     while (true) {
       xsp = jj_scanpos;
-         if (jj_3R_99()) {
-            jj_scanpos = xsp;
-            break;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
+      if (jj_3R_71()) { jj_scanpos = xsp; break; }
     }
     return false;
   }
 
-  final private boolean jj_3R_64() {
-      if (jj_scan_token(SUPER)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_69() {
+    if (jj_scan_token(SC_AND)) return true;
+    if (jj_3R_62()) return true;
     return false;
   }
 
-  final private boolean jj_3R_32() {
-      if (jj_scan_token(PLUSASSIGN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_73() {
-      if (jj_3R_82()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_46() {
+    if (jj_3R_55()) return true;
     return false;
   }
 
-  final private boolean jj_3R_72() {
-      if (jj_scan_token(DOT)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_scan_token(IDENTIFIER)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_45() {
+    if (jj_scan_token(DOT)) return true;
+    if (jj_scan_token(IDENTIFIER)) return true;
     return false;
   }
 
-  final private boolean jj_3R_74() {
-      if (jj_3R_83()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_56() {
+    if (jj_3R_62()) return true;
     Token xsp;
     while (true) {
       xsp = jj_scanpos;
-         if (jj_3R_96()) {
-            jj_scanpos = xsp;
-            break;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
+      if (jj_3R_69()) { jj_scanpos = xsp; break; }
     }
     return false;
   }
 
-  final private boolean jj_3R_63() {
-      if (jj_scan_token(THIS)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_31() {
-      if (jj_scan_token(REMASSIGN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_66() {
+    if (jj_scan_token(SC_OR)) return true;
+    if (jj_3R_56()) return true;
     return false;
   }
 
-  final private boolean jj_3R_58() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_71()) {
-    jj_scanpos = xsp;
-    if (jj_3R_72()) {
-    jj_scanpos = xsp;
-            if (jj_3R_73()) {
-               return true;
-            }
-            if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-               return false;
-            }
-         } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_71() {
-      if (jj_scan_token(LBRACKET)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_25()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_scan_token(RBRACKET)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_44() {
+    if (jj_scan_token(LBRACKET)) return true;
+    if (jj_3R_25()) return true;
+    if (jj_scan_token(RBRACKET)) return true;
     return false;
   }
 
-  final private boolean jj_3R_93() {
-      if (jj_scan_token(HOOK)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_25()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_scan_token(COLON)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_68()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_57() {
-      if (jj_3R_70()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_38() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_44()) {
+    jj_scanpos = xsp;
+    if (jj_3R_45()) {
+    jj_scanpos = xsp;
+    if (jj_3R_46()) return true;
+    }
+    }
     return false;
   }
 
-  final private boolean jj_3R_30() {
-      if (jj_scan_token(SLASHASSIGN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_27() {
-      if (jj_3R_58()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_37() {
+    if (jj_3R_43()) return true;
     return false;
   }
 
-  final private boolean jj_3R_56() {
-      if (jj_scan_token(LPAREN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_25()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_scan_token(RPAREN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_27() {
+    if (jj_3R_38()) return true;
+    return false;
+  }
+
+  private boolean jj_3R_36() {
+    if (jj_scan_token(LPAREN)) return true;
+    if (jj_3R_25()) return true;
+    if (jj_scan_token(RPAREN)) return true;
     return false;
   }
 
-  final private boolean jj_3R_152() {
-      if (jj_scan_token(LBRACKET)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_scan_token(RBRACKET)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_55() {
-      if (jj_scan_token(SUPER)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_scan_token(DOT)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_scan_token(IDENTIFIER)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_47() {
+    if (jj_3R_56()) return true;
+    Token xsp;
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3R_66()) { jj_scanpos = xsp; break; }
+    }
     return false;
   }
 
-  final private boolean jj_3R_29() {
-      if (jj_scan_token(STARASSIGN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_104() {
+    if (jj_scan_token(LBRACKET)) return true;
+    if (jj_scan_token(RBRACKET)) return true;
     return false;
   }
 
-  final private boolean jj_3R_68() {
-      if (jj_3R_74()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    Token xsp;
-    xsp = jj_scanpos;
-      if (jj_3R_93()) {
-         jj_scanpos = xsp;
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_35() {
+    if (jj_scan_token(SUPER)) return true;
+    if (jj_scan_token(DOT)) return true;
+    if (jj_scan_token(IDENTIFIER)) return true;
     return false;
   }
 
-  final private boolean jj_3R_54() {
-      if (jj_scan_token(THIS)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_62() {
-      if (jj_scan_token(IDENTIFIER)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_34() {
+    if (jj_scan_token(THIS)) return true;
     return false;
   }
 
-  final private boolean jj_3R_53() {
-      if (jj_3R_24()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_63() {
+    if (jj_scan_token(HOOK)) return true;
+    if (jj_3R_25()) return true;
+    if (jj_scan_token(COLON)) return true;
+    if (jj_3R_41()) return true;
     return false;
   }
 
-  final private boolean jj_3R_153() {
-      if (jj_scan_token(LBRACKET)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_scan_token(RBRACKET)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_33() {
+    if (jj_3R_24()) return true;
     return false;
   }
 
-  final private boolean jj_3R_26() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_52()) {
-    jj_scanpos = xsp;
-    if (jj_3R_53()) {
-    jj_scanpos = xsp;
-    if (jj_3R_54()) {
-    jj_scanpos = xsp;
-    if (jj_3R_55()) {
-    jj_scanpos = xsp;
-    if (jj_3R_56()) {
-    jj_scanpos = xsp;
-                     if (jj_3R_57()) {
-                        return true;
-                     }
-                     if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                        return false;
-                     }
-                  } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                     return false;
-                  }
-               } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                  return false;
-               }
-            } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-               return false;
-            }
-         } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_105() {
+    if (jj_scan_token(LBRACKET)) return true;
+    if (jj_scan_token(RBRACKET)) return true;
     return false;
   }
 
-  final private boolean jj_3R_52() {
-      if (jj_3R_69()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_32() {
+    if (jj_3R_42()) return true;
     return false;
   }
 
-  final private boolean jj_3R_21() {
+  private boolean jj_3R_26() {
     Token xsp;
     xsp = jj_scanpos;
-    if (jj_3R_28()) {
-    jj_scanpos = xsp;
-    if (jj_3R_29()) {
-    jj_scanpos = xsp;
-    if (jj_3R_30()) {
-    jj_scanpos = xsp;
-    if (jj_3R_31()) {
-    jj_scanpos = xsp;
     if (jj_3R_32()) {
     jj_scanpos = xsp;
     if (jj_3R_33()) {
@@ -3400,318 +1747,420 @@
     jj_scanpos = xsp;
     if (jj_3R_36()) {
     jj_scanpos = xsp;
-    if (jj_3R_37()) {
-    jj_scanpos = xsp;
-    if (jj_3R_38()) {
-    jj_scanpos = xsp;
-                                       if (jj_3R_39()) {
-                                          return true;
-                                       }
-                                       if (jj_la == 0
-                                             && jj_scanpos == jj_lastpos) {
-                                          return false;
-                                       }
-                                    } else if (jj_la == 0
-                                          && jj_scanpos == jj_lastpos) {
-                                       return false;
-                                    }
-                                 } else if (jj_la == 0
-                                       && jj_scanpos == jj_lastpos) {
-                                    return false;
-                                 }
-                              } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                                 return false;
-                              }
-                           } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                              return false;
-                           }
-                        } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                           return false;
-                        }
-                     } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                        return false;
-                     }
-                  } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                     return false;
-                  }
-               } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-                  return false;
-               }
-            } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-               return false;
-            }
-         } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      } else if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+    if (jj_3R_37()) return true;
+    }
+    }
+    }
+    }
+    }
+    return false;
+  }
+
+  private boolean jj_3R_20() {
+    if (jj_3R_26()) return true;
+    Token xsp;
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3R_27()) { jj_scanpos = xsp; break; }
+    }
+    return false;
+  }
+
+  private boolean jj_3R_41() {
+    if (jj_3R_47()) return true;
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_63()) jj_scanpos = xsp;
+    return false;
+  }
+
+  private boolean jj_3R_106() {
+    if (jj_scan_token(DECR)) return true;
+    return false;
+  }
+
+  private boolean jj_3R_102() {
+    if (jj_scan_token(LPAREN)) return true;
+    if (jj_3R_24()) return true;
+    Token xsp;
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3R_105()) { jj_scanpos = xsp; break; }
+    }
+    if (jj_scan_token(RPAREN)) return true;
+    if (jj_3R_95()) return true;
     return false;
   }
 
-  final private boolean jj_3R_28() {
-      if (jj_scan_token(ASSIGN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_21() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_scan_token(79)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(107)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(108)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(112)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(105)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(106)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(113)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(114)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(115)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(109)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(111)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(110)) return true;
+    }
+    }
+    }
+    }
+    }
+    }
+    }
+    }
+    }
+    }
+    }
     return false;
   }
 
-  final private boolean jj_3R_61() {
-      if (jj_scan_token(LPAREN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_103() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_scan_token(92)) {
+    jj_scanpos = xsp;
+    if (jj_3R_106()) return true;
+    }
     return false;
   }
 
-  final private boolean jj_3_2() {
-      if (jj_3R_20()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_21()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_100() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3_6()) {
+    jj_scanpos = xsp;
+    if (jj_3R_102()) return true;
+    }
+    return false;
+  }
+
+  private boolean jj_3_6() {
+    if (jj_scan_token(LPAREN)) return true;
+    if (jj_3R_23()) return true;
+    Token xsp;
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3R_104()) { jj_scanpos = xsp; break; }
+    }
+    if (jj_scan_token(RPAREN)) return true;
+    if (jj_3R_83()) return true;
+    return false;
+  }
+
+  private boolean jj_3_2() {
+    if (jj_3R_20()) return true;
+    if (jj_3R_21()) return true;
     return false;
   }
 
-  final private boolean jj_3R_20() {
-      if (jj_3R_26()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_40() {
+    if (jj_3R_20()) return true;
+    if (jj_3R_21()) return true;
+    if (jj_3R_25()) return true;
+    return false;
+  }
+
+  private boolean jj_3_5() {
+    if (jj_scan_token(LPAREN)) return true;
+    if (jj_3R_24()) return true;
+    if (jj_scan_token(LBRACKET)) return true;
+    return false;
+  }
+
+  private boolean jj_3R_101() {
+    if (jj_3R_20()) return true;
     Token xsp;
-    while (true) {
-      xsp = jj_scanpos;
-         if (jj_3R_27()) {
-            jj_scanpos = xsp;
-            break;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
+    xsp = jj_scanpos;
+    if (jj_3R_103()) jj_scanpos = xsp;
+    return false;
+  }
+
+  private boolean jj_3R_31() {
+    if (jj_3R_41()) return true;
+    return false;
+  }
+
+  private boolean jj_3R_30() {
+    if (jj_3R_40()) return true;
+    return false;
+  }
+
+  private boolean jj_3R_25() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_30()) {
+    jj_scanpos = xsp;
+    if (jj_3R_31()) return true;
     }
     return false;
   }
 
-  final private boolean jj_3R_60() {
-      if (jj_scan_token(BANG)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_29() {
+    if (jj_scan_token(LPAREN)) return true;
+    if (jj_3R_24()) return true;
+    if (jj_scan_token(RPAREN)) return true;
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_scan_token(83)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(82)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(70)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(67)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(50)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(47)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(38)) {
+    jj_scanpos = xsp;
+    if (jj_3R_39()) return true;
+    }
+    }
+    }
+    }
+    }
+    }
+    }
     return false;
   }
 
-  final private boolean jj_3R_155() {
-      if (jj_scan_token(DECR)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3R_28() {
+    if (jj_scan_token(LPAREN)) return true;
+    if (jj_3R_24()) return true;
+    if (jj_scan_token(LBRACKET)) return true;
+    if (jj_scan_token(RBRACKET)) return true;
+    return false;
+  }
+
+  private boolean jj_3_4() {
+    if (jj_scan_token(LPAREN)) return true;
+    if (jj_3R_23()) return true;
+    return false;
+  }
+
+  private boolean jj_3R_22() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3_4()) {
+    jj_scanpos = xsp;
+    if (jj_3R_28()) {
+    jj_scanpos = xsp;
+    if (jj_3R_29()) return true;
+    }
+    }
     return false;
   }
 
-  final private boolean jj_3R_67() {
-      if (jj_3R_20()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_21()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_25()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3_3() {
+    if (jj_3R_22()) return true;
+    return false;
+  }
+
+  private boolean jj_3R_99() {
+    if (jj_3R_101()) return true;
+    return false;
+  }
+
+  private boolean jj_3R_87() {
+    if (jj_scan_token(LBRACKET)) return true;
+    if (jj_scan_token(RBRACKET)) return true;
+    return false;
+  }
+
+  private boolean jj_3R_98() {
+    if (jj_3R_100()) return true;
+    return false;
+  }
+
+  private boolean jj_3_1() {
+    if (jj_scan_token(DOT)) return true;
+    if (jj_scan_token(IDENTIFIER)) return true;
     return false;
   }
 
-  final private boolean jj_3R_150() {
-      if (jj_scan_token(LPAREN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_24()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+  private boolean jj_3_9() {
+    if (jj_scan_token(LBRACKET)) return true;
+    if (jj_scan_token(RBRACKET)) return true;
+    return false;
+  }
+
+  private boolean jj_3R_97() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_scan_token(83)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(82)) return true;
+    }
+    if (jj_3R_83()) return true;
+    return false;
+  }
+
+  private boolean jj_3R_95() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_97()) {
+    jj_scanpos = xsp;
+    if (jj_3R_98()) {
+    jj_scanpos = xsp;
+    if (jj_3R_99()) return true;
+    }
+    }
+    return false;
+  }
+
+  private boolean jj_3R_24() {
+    if (jj_scan_token(IDENTIFIER)) return true;
     Token xsp;
     while (true) {
       xsp = jj_scanpos;
-         if (jj_3R_153()) {
-            jj_scanpos = xsp;
-            break;
-         }
-         if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-            return false;
-         }
-      }
-      if (jj_scan_token(RPAREN)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-      if (jj_3R_136()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
-  final private boolean jj_3R_59() {
-      if (jj_scan_token(TILDE)) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
+      if (jj_3_1()) { jj_scanpos = xsp; break; }
+    }
     return false;
   }
 
-  final private boolean jj_3R_51() {
-      if (jj_3R_68()) {
-         return true;
-      }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) {
-         return false;
-      }
-    return false;
-  }
-
+  /** Generated Token Manager. */
   public ExpressionParserTokenManager token_source;
-  ASCII_UCodeESC_CharStream jj_input_stream;
-  public Token token, jj_nt;
+  JavaCharStream jj_input_stream;
+  /** Current token. */
+  public Token token;
+  /** Next token. */
+  public Token jj_nt;
   private int jj_ntk;
   private Token jj_scanpos, jj_lastpos;
   private int jj_la;
-  public boolean lookingAhead = false;
   private int jj_gen;
   final private int[] jj_la1 = new int[44];
-   final private int[] jj_la1_0 = { 0x8209400, 0x0, 0x8209400, 0x0, 0x1000000,
-         0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-         0x0, 0x0, 0x0, 0x0, 0x0, 0x1000000, 0x0, 0x0, 0x1000000, 0x1000000,
-         0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1000000, 0x0, 0x1000000,
-         0x1000000, 0x1000000, 0x0, 0x0, 0x0, };
-   final private int[] jj_la1_1 = { 0x2014, 0x0, 0x2014, 0x0, 0x884480c0, 0x0,
-         0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0,
-         0x0, 0x0, 0x0, 0x0, 0x884480c0, 0x0, 0x0, 0x884480c0, 0x884480c0, 0x0,
-         0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x884480c0, 0x0, 0x88400080, 0x400000,
-         0x884480c0, 0x0, 0x0, 0x40, };
-   final private int[] jj_la1_2 = { 0x8, 0x400, 0x0, 0x2000, 0xf00c004e,
-         0x8000, 0x100000, 0x4000000, 0x8000000, 0x0, 0x0, 0x0, 0x2400000,
-         0x2400000, 0x0, 0x1830000, 0x1830000, 0x0, 0x0, 0xc0000000,
-         0xc0000000, 0x0, 0x0, 0xc0000000, 0xf00c004e, 0xc0000, 0xc0000, 0x4e,
-         0xc004e, 0x40, 0x30000000, 0x30000000, 0x400, 0x400, 0x40, 0x4440,
-         0x4e, 0x4440, 0x6, 0x0, 0xf00c004e, 0x2000, 0x440, 0x0, };
-   final private int[] jj_la1_3 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0xffe00, 0x0, 0x0,
-         0x0, 0x8, 0x10, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1c0, 0x1c0, 0x0, 0x0,
-         0x23, 0x23, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-         0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, };
-  final private JJExpressionParserCalls[] jj_2_rtns = new JJExpressionParserCalls[9];
+  static private int[] jj_la1_0;
+  static private int[] jj_la1_1;
+  static private int[] jj_la1_2;
+  static private int[] jj_la1_3;
+  static {
+      jj_la1_init_0();
+      jj_la1_init_1();
+      jj_la1_init_2();
+      jj_la1_init_3();
+   }
+   private static void jj_la1_init_0() {
+      jj_la1_0 = new int[] {0x8209400,0x0,0x8209400,0x0,0x1000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x0,0x1000000,0x1000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x1000000,0x1000000,0x1000000,0x0,0x0,0x0,};
+   }
+   private static void jj_la1_init_1() {
+      jj_la1_1 = new int[] {0x2014,0x0,0x2014,0x0,0x884480c0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x884480c0,0x0,0x0,0x884480c0,0x884480c0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x884480c0,0x0,0x88400080,0x400000,0x884480c0,0x0,0x0,0x40,};
+   }
+   private static void jj_la1_init_2() {
+      jj_la1_2 = new int[] {0x8,0x400,0x0,0x2000,0xf00c004e,0x8000,0x100000,0x4000000,0x8000000,0x0,0x0,0x0,0x2400000,0x2400000,0x0,0x1830000,0x1830000,0x0,0x0,0xc0000000,0xc0000000,0x0,0x0,0xc0000000,0xf00c004e,0xc0000,0xc0000,0x4e,0xc004e,0x40,0x30000000,0x30000000,0x400,0x400,0x40,0x4440,0x4e,0x4440,0x6,0x0,0xf00c004e,0x2000,0x440,0x0,};
+   }
+   private static void jj_la1_init_3() {
+      jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0xffe00,0x0,0x0,0x0,0x8,0x10,0x4,0x0,0x0,0x0,0x0,0x0,0x1c0,0x1c0,0x0,0x0,0x23,0x23,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
+   }
+  final private JJCalls[] jj_2_rtns = new JJCalls[9];
   private boolean jj_rescan = false;
   private int jj_gc = 0;
 
+  /** Constructor with InputStream. */
   public ExpressionParser(java.io.InputStream stream) {
-    jj_input_stream = new ASCII_UCodeESC_CharStream(stream, 1, 1);
+     this(stream, null);
+  }
+  /** Constructor with InputStream and supplied encoding */
+  public ExpressionParser(java.io.InputStream stream, String encoding) {
+    try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
     token_source = new ExpressionParserTokenManager(jj_input_stream);
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-      for (int i = 0; i < 44; i++) {
-         jj_la1[i] = -1;
-      }
-      for (int i = 0; i < jj_2_rtns.length; i++) {
-         jj_2_rtns[i] = new JJExpressionParserCalls();
-      }
+    for (int i = 0; i < 44; i++) jj_la1[i] = -1;
+    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
+  /** Reinitialise. */
   public void ReInit(java.io.InputStream stream) {
+     ReInit(stream, null);
+  }
+  /** Reinitialise. */
+  public void ReInit(java.io.InputStream stream, String encoding) {
+    try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
+    token_source.ReInit(jj_input_stream);
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 44; i++) jj_la1[i] = -1;
+    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+  }
+
+  /** Constructor. */
+  public ExpressionParser(java.io.Reader stream) {
+    jj_input_stream = new JavaCharStream(stream, 1, 1);
+    token_source = new ExpressionParserTokenManager(jj_input_stream);
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 44; i++) jj_la1[i] = -1;
+    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+  }
+
+  /** Reinitialise. */
+  public void ReInit(java.io.Reader stream) {
     jj_input_stream.ReInit(stream, 1, 1);
     token_source.ReInit(jj_input_stream);
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-      for (int i = 0; i < 44; i++) {
-         jj_la1[i] = -1;
-      }
-      for (int i = 0; i < jj_2_rtns.length; i++) {
-         jj_2_rtns[i] = new JJExpressionParserCalls();
-      }
+    for (int i = 0; i < 44; i++) jj_la1[i] = -1;
+    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
+  /** Constructor with generated Token Manager. */
   public ExpressionParser(ExpressionParserTokenManager tm) {
     token_source = tm;
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-      for (int i = 0; i < 44; i++) {
-         jj_la1[i] = -1;
-      }
-      for (int i = 0; i < jj_2_rtns.length; i++) {
-         jj_2_rtns[i] = new JJExpressionParserCalls();
-      }
+    for (int i = 0; i < 44; i++) jj_la1[i] = -1;
+    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
+  /** Reinitialise. */
   public void ReInit(ExpressionParserTokenManager tm) {
     token_source = tm;
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-      for (int i = 0; i < 44; i++) {
-         jj_la1[i] = -1;
-      }
-      for (int i = 0; i < jj_2_rtns.length; i++) {
-         jj_2_rtns[i] = new JJExpressionParserCalls();
-      }
+    for (int i = 0; i < 44; i++) jj_la1[i] = -1;
+    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
-  final private Token jj_consume_token(int kind) throws ParseException {
+  private Token jj_consume_token(int kind) throws ParseException {
     Token oldToken;
-      if ((oldToken = token).next != null) {
-         token = token.next;
-      } else {
-         token = token.next = token_source.getNextToken();
-      }
+    if ((oldToken = token).next != null) token = token.next;
+    else token = token.next = token_source.getNextToken();
     jj_ntk = -1;
     if (token.kind == kind) {
       jj_gen++;
       if (++jj_gc > 100) {
         jj_gc = 0;
-            for (JJExpressionParserCalls jj_2_rtn : jj_2_rtns) {
-               JJExpressionParserCalls c = jj_2_rtn;
+        for (int i = 0; i < jj_2_rtns.length; i++) {
+          JJCalls c = jj_2_rtns[i];
           while (c != null) {
-                  if (c.gen < jj_gen) {
-                     c.first = null;
-                  }
+            if (c.gen < jj_gen) c.first = null;
             c = c.next;
           }
         }
@@ -3723,12 +2172,13 @@
     throw generateParseException();
   }
 
-  final private boolean jj_scan_token(int kind) {
+  static private final class LookaheadSuccess extends java.lang.Error { }
+  final private LookaheadSuccess jj_ls = new LookaheadSuccess();
+  private boolean jj_scan_token(int kind) {
     if (jj_scanpos == jj_lastpos) {
       jj_la--;
       if (jj_scanpos.next == null) {
-            jj_lastpos = jj_scanpos = jj_scanpos.next = token_source
-                  .getNextToken();
+        jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
       } else {
         jj_lastpos = jj_scanpos = jj_scanpos.next;
       }
@@ -3736,60 +2186,50 @@
       jj_scanpos = jj_scanpos.next;
     }
     if (jj_rescan) {
-         int i = 0;
-         Token tok = token;
-         while (tok != null && tok != jj_scanpos) {
-            i++;
-            tok = tok.next;
-         }
-         if (tok != null) {
-            jj_add_error_token(kind, i);
-         }
+      int i = 0; Token tok = token;
+      while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
+      if (tok != null) jj_add_error_token(kind, i);
     }
-    return (jj_scanpos.kind != kind);
+    if (jj_scanpos.kind != kind) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
+    return false;
   }
 
+
+/** Get the next Token. */
   final public Token getNextToken() {
-      if (token.next != null) {
-         token = token.next;
-      } else {
-         token = token.next = token_source.getNextToken();
-      }
+    if (token.next != null) token = token.next;
+    else token = token.next = token_source.getNextToken();
     jj_ntk = -1;
     jj_gen++;
     return token;
   }
 
+/** Get the specific Token. */
   final public Token getToken(int index) {
-    Token t = lookingAhead ? jj_scanpos : token;
+    Token t = token;
     for (int i = 0; i < index; i++) {
-         if (t.next != null) {
-            t = t.next;
-         } else {
-            t = t.next = token_source.getNextToken();
-         }
+      if (t.next != null) t = t.next;
+      else t = t.next = token_source.getNextToken();
     }
     return t;
   }
 
-  final private int jj_ntk() {
-      if ((jj_nt = token.next) == null) {
+  private int jj_ntk() {
+    if ((jj_nt=token.next) == null)
       return (jj_ntk = (token.next=token_source.getNextToken()).kind);
-      } else {
+    else
       return (jj_ntk = jj_nt.kind);
   }
-   }
 
-   private java.util.Vector<int[]> jj_expentries = new java.util.Vector<int[]>();
+  private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
   private int[] jj_expentry;
   private int jj_kind = -1;
   private int[] jj_lasttokens = new int[100];
   private int jj_endpos;
 
   private void jj_add_error_token(int kind, int pos) {
-      if (pos >= 100) {
-         return;
-      }
+    if (pos >= 100) return;
     if (pos == jj_endpos + 1) {
       jj_lasttokens[jj_endpos++] = kind;
     } else if (jj_endpos != 0) {
@@ -3797,38 +2237,26 @@
       for (int i = 0; i < jj_endpos; i++) {
         jj_expentry[i] = jj_lasttokens[i];
       }
-      boolean exists = false;
-         for (java.util.Enumeration<int[]> enum_ = jj_expentries.elements(); enum_
-               .hasMoreElements();) {
-            int[] oldentry = (enum_.nextElement());
+      jj_entries_loop: for (java.util.Iterator<?> it = jj_expentries.iterator(); it.hasNext();) {
+        int[] oldentry = (int[])(it.next());
         if (oldentry.length == jj_expentry.length) {
-          exists = true;
           for (int i = 0; i < jj_expentry.length; i++) {
             if (oldentry[i] != jj_expentry[i]) {
-              exists = false;
-              break;
+              continue jj_entries_loop;
             }
           }
-               if (exists) {
-                  break;
-               }
-            }
-         }
-         if (!exists) {
-            jj_expentries.addElement(jj_expentry);
-         }
-         if (pos != 0) {
-            jj_lasttokens[(jj_endpos = pos) - 1] = kind;
-         }
+          jj_expentries.add(jj_expentry);
+          break jj_entries_loop;
+        }
+      }
+      if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
     }
   }
 
-  final public ParseException generateParseException() {
-    jj_expentries.removeAllElements();
+  /** Generate ParseException. */
+  public ParseException generateParseException() {
+    jj_expentries.clear();
     boolean[] la1tokens = new boolean[116];
-    for (int i = 0; i < 116; i++) {
-      la1tokens[i] = false;
-    }
     if (jj_kind >= 0) {
       la1tokens[jj_kind] = true;
       jj_kind = -1;
@@ -3855,7 +2283,7 @@
       if (la1tokens[i]) {
         jj_expentry = new int[1];
         jj_expentry[0] = i;
-        jj_expentries.addElement(jj_expentry);
+        jj_expentries.add(jj_expentry);
       }
     }
     jj_endpos = 0;
@@ -3863,80 +2291,60 @@
     jj_add_error_token(0, 0);
     int[][] exptokseq = new int[jj_expentries.size()][];
     for (int i = 0; i < jj_expentries.size(); i++) {
-         exptokseq[i] = jj_expentries.elementAt(i);
+      exptokseq[i] = jj_expentries.get(i);
     }
     return new ParseException(token, exptokseq, tokenImage);
   }
 
+  /** Enable tracing. */
   final public void enable_tracing() {
   }
 
+  /** Disable tracing. */
   final public void disable_tracing() {
   }
 
-  final private void jj_rescan_token() {
+  private void jj_rescan_token() {
     jj_rescan = true;
     for (int i = 0; i < 9; i++) {
-      JJExpressionParserCalls p = jj_2_rtns[i];
+    try {
+      JJCalls p = jj_2_rtns[i];
       do {
         if (p.gen > jj_gen) {
-               jj_la = p.arg;
-               jj_lastpos = jj_scanpos = p.first;
+          jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
           switch (i) {
-               case 0:
-                  jj_3_1();
-                  break;
-               case 1:
-                  jj_3_2();
-                  break;
-               case 2:
-                  jj_3_3();
-                  break;
-               case 3:
-                  jj_3_4();
-                  break;
-               case 4:
-                  jj_3_5();
-                  break;
-               case 5:
-                  jj_3_6();
-                  break;
-               case 6:
-                  jj_3_7();
-                  break;
-               case 7:
-                  jj_3_8();
-                  break;
-               case 8:
-                  jj_3_9();
-                  break;
+            case 0: jj_3_1(); break;
+            case 1: jj_3_2(); break;
+            case 2: jj_3_3(); break;
+            case 3: jj_3_4(); break;
+            case 4: jj_3_5(); break;
+            case 5: jj_3_6(); break;
+            case 6: jj_3_7(); break;
+            case 7: jj_3_8(); break;
+            case 8: jj_3_9(); break;
           }
         }
         p = p.next;
       } while (p != null);
+      } catch(LookaheadSuccess ls) { }
     }
     jj_rescan = false;
   }
 
-  final private void jj_save(int index, int xla) {
-    JJExpressionParserCalls p = jj_2_rtns[index];
+  private void jj_save(int index, int xla) {
+    JJCalls p = jj_2_rtns[index];
     while (p.gen > jj_gen) {
-         if (p.next == null) {
-            p = p.next = new JJExpressionParserCalls();
-            break;
-         }
+      if (p.next == null) { p = p.next = new JJCalls(); break; }
       p = p.next;
     }
-      p.gen = jj_gen + xla - jj_la;
-      p.first = token;
-      p.arg = xla;
+    p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
+  }
+
+  static final class JJCalls {
+    int gen;
+    Token first;
+    int arg;
+    JJCalls next;
   }
 
 }
-
-final class JJExpressionParserCalls {
-  int gen;
-  Token first;
-  int arg;
-  JJExpressionParserCalls next;
-}
--- a/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParserConstants.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParserConstants.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -23,134 +23,243 @@
  * questions.
  */
 
-/*
- * This source code is provided to illustrate the usage of a given feature
- * or technique and has been deliberately simplified. Additional steps
- * required for a production-quality application, such as security checks,
- * input validation and proper error handling, might not be present in
- * this sample code.
- */
-
-
 /* Generated By:JavaCC: Do not edit this line. ExpressionParserConstants.java */
 package com.sun.tools.example.debug.expr;
 
+
+/**
+ * Token literal values and constants.
+ * Generated by org.javacc.parser.OtherFilesGen#start()
+ */
 public interface ExpressionParserConstants {
 
+  /** End of File. */
   int EOF = 0;
+  /** RegularExpression Id. */
   int SINGLE_LINE_COMMENT = 6;
+  /** RegularExpression Id. */
   int FORMAL_COMMENT = 7;
+  /** RegularExpression Id. */
   int MULTI_LINE_COMMENT = 8;
+  /** RegularExpression Id. */
   int ABSTRACT = 9;
+  /** RegularExpression Id. */
   int BOOLEAN = 10;
+  /** RegularExpression Id. */
   int BREAK = 11;
+  /** RegularExpression Id. */
   int BYTE = 12;
+  /** RegularExpression Id. */
   int CASE = 13;
+  /** RegularExpression Id. */
   int CATCH = 14;
+  /** RegularExpression Id. */
   int CHAR = 15;
+  /** RegularExpression Id. */
   int CLASS = 16;
+  /** RegularExpression Id. */
   int CONST = 17;
+  /** RegularExpression Id. */
   int CONTINUE = 18;
+  /** RegularExpression Id. */
   int _DEFAULT = 19;
+  /** RegularExpression Id. */
   int DO = 20;
+  /** RegularExpression Id. */
   int DOUBLE = 21;
+  /** RegularExpression Id. */
   int ELSE = 22;
+  /** RegularExpression Id. */
   int EXTENDS = 23;
+  /** RegularExpression Id. */
   int FALSE = 24;
+  /** RegularExpression Id. */
   int FINAL = 25;
+  /** RegularExpression Id. */
   int FINALLY = 26;
+  /** RegularExpression Id. */
   int FLOAT = 27;
+  /** RegularExpression Id. */
   int FOR = 28;
+  /** RegularExpression Id. */
   int GOTO = 29;
+  /** RegularExpression Id. */
   int IF = 30;
+  /** RegularExpression Id. */
   int IMPLEMENTS = 31;
+  /** RegularExpression Id. */
   int IMPORT = 32;
+  /** RegularExpression Id. */
   int INSTANCEOF = 33;
+  /** RegularExpression Id. */
   int INT = 34;
+  /** RegularExpression Id. */
   int INTERFACE = 35;
+  /** RegularExpression Id. */
   int LONG = 36;
+  /** RegularExpression Id. */
   int NATIVE = 37;
+  /** RegularExpression Id. */
   int NEW = 38;
+  /** RegularExpression Id. */
   int NULL = 39;
+  /** RegularExpression Id. */
   int PACKAGE = 40;
+  /** RegularExpression Id. */
   int PRIVATE = 41;
+  /** RegularExpression Id. */
   int PROTECTED = 42;
+  /** RegularExpression Id. */
   int PUBLIC = 43;
+  /** RegularExpression Id. */
   int RETURN = 44;
+  /** RegularExpression Id. */
   int SHORT = 45;
+  /** RegularExpression Id. */
   int STATIC = 46;
+  /** RegularExpression Id. */
   int SUPER = 47;
+  /** RegularExpression Id. */
   int SWITCH = 48;
+  /** RegularExpression Id. */
   int SYNCHRONIZED = 49;
+  /** RegularExpression Id. */
   int THIS = 50;
+  /** RegularExpression Id. */
   int THROW = 51;
+  /** RegularExpression Id. */
   int THROWS = 52;
+  /** RegularExpression Id. */
   int TRANSIENT = 53;
+  /** RegularExpression Id. */
   int TRUE = 54;
+  /** RegularExpression Id. */
   int TRY = 55;
+  /** RegularExpression Id. */
   int VOID = 56;
+  /** RegularExpression Id. */
   int VOLATILE = 57;
+  /** RegularExpression Id. */
   int WHILE = 58;
+  /** RegularExpression Id. */
   int INTEGER_LITERAL = 59;
+  /** RegularExpression Id. */
   int DECIMAL_LITERAL = 60;
+  /** RegularExpression Id. */
   int HEX_LITERAL = 61;
+  /** RegularExpression Id. */
   int OCTAL_LITERAL = 62;
+  /** RegularExpression Id. */
   int FLOATING_POINT_LITERAL = 63;
+  /** RegularExpression Id. */
   int EXPONENT = 64;
+  /** RegularExpression Id. */
   int CHARACTER_LITERAL = 65;
+  /** RegularExpression Id. */
   int STRING_LITERAL = 66;
+  /** RegularExpression Id. */
   int IDENTIFIER = 67;
+  /** RegularExpression Id. */
   int LETTER = 68;
+  /** RegularExpression Id. */
   int DIGIT = 69;
+  /** RegularExpression Id. */
   int LPAREN = 70;
+  /** RegularExpression Id. */
   int RPAREN = 71;
+  /** RegularExpression Id. */
   int LBRACE = 72;
+  /** RegularExpression Id. */
   int RBRACE = 73;
+  /** RegularExpression Id. */
   int LBRACKET = 74;
+  /** RegularExpression Id. */
   int RBRACKET = 75;
+  /** RegularExpression Id. */
   int SEMICOLON = 76;
+  /** RegularExpression Id. */
   int COMMA = 77;
+  /** RegularExpression Id. */
   int DOT = 78;
+  /** RegularExpression Id. */
   int ASSIGN = 79;
+  /** RegularExpression Id. */
   int GT = 80;
+  /** RegularExpression Id. */
   int LT = 81;
+  /** RegularExpression Id. */
   int BANG = 82;
+  /** RegularExpression Id. */
   int TILDE = 83;
+  /** RegularExpression Id. */
   int HOOK = 84;
+  /** RegularExpression Id. */
   int COLON = 85;
+  /** RegularExpression Id. */
   int EQ = 86;
+  /** RegularExpression Id. */
   int LE = 87;
+  /** RegularExpression Id. */
   int GE = 88;
+  /** RegularExpression Id. */
   int NE = 89;
+  /** RegularExpression Id. */
   int SC_OR = 90;
+  /** RegularExpression Id. */
   int SC_AND = 91;
+  /** RegularExpression Id. */
   int INCR = 92;
+  /** RegularExpression Id. */
   int DECR = 93;
+  /** RegularExpression Id. */
   int PLUS = 94;
+  /** RegularExpression Id. */
   int MINUS = 95;
+  /** RegularExpression Id. */
   int STAR = 96;
+  /** RegularExpression Id. */
   int SLASH = 97;
+  /** RegularExpression Id. */
   int BIT_AND = 98;
+  /** RegularExpression Id. */
   int BIT_OR = 99;
+  /** RegularExpression Id. */
   int XOR = 100;
+  /** RegularExpression Id. */
   int REM = 101;
+  /** RegularExpression Id. */
   int LSHIFT = 102;
+  /** RegularExpression Id. */
   int RSIGNEDSHIFT = 103;
+  /** RegularExpression Id. */
   int RUNSIGNEDSHIFT = 104;
+  /** RegularExpression Id. */
   int PLUSASSIGN = 105;
+  /** RegularExpression Id. */
   int MINUSASSIGN = 106;
+  /** RegularExpression Id. */
   int STARASSIGN = 107;
+  /** RegularExpression Id. */
   int SLASHASSIGN = 108;
+  /** RegularExpression Id. */
   int ANDASSIGN = 109;
+  /** RegularExpression Id. */
   int ORASSIGN = 110;
+  /** RegularExpression Id. */
   int XORASSIGN = 111;
+  /** RegularExpression Id. */
   int REMASSIGN = 112;
+  /** RegularExpression Id. */
   int LSHIFTASSIGN = 113;
+  /** RegularExpression Id. */
   int RSIGNEDSHIFTASSIGN = 114;
+  /** RegularExpression Id. */
   int RUNSIGNEDSHIFTASSIGN = 115;
 
+  /** Lexical state. */
   int DEFAULT = 0;
 
+  /** Literal token values. */
   String[] tokenImage = {
     "<EOF>",
     "\" \"",
--- a/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParserTokenManager.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParserTokenManager.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -23,38 +23,39 @@
  * questions.
  */
 
-/*
- * This source code is provided to illustrate the usage of a given feature
- * or technique and has been deliberately simplified. Additional steps
- * required for a production-quality application, such as security checks,
- * input validation and proper error handling, might not be present in
- * this sample code.
- */
-
-
 /* Generated By:JavaCC: Do not edit this line. ExpressionParserTokenManager.java */
 package com.sun.tools.example.debug.expr;
+import com.sun.jdi.*;
+import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
 
+/** Token Manager. */
 public class ExpressionParserTokenManager implements ExpressionParserConstants
 {
+
+  /** Debug output. */
+  public  java.io.PrintStream debugStream = System.out;
+  /** Set debug output. */
+  public  void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
 private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1)
 {
    switch (pos)
    {
       case 0:
-         if ((active1 & 0x4000L) != 0L) {
+         if ((active1 & 0x100200000000L) != 0L)
+            return 49;
+         if ((active1 & 0x4000L) != 0L)
             return 4;
-         }
          if ((active0 & 0x7fffffffffffe00L) != 0L)
          {
             jjmatchedKind = 67;
             return 28;
          }
-         if ((active1 & 0x100200000000L) != 0L) {
-            return 49;
-         }
          return -1;
       case 1:
+         if ((active0 & 0x40300000L) != 0L)
+            return 28;
          if ((active0 & 0x7ffffffbfcffe00L) != 0L)
          {
             if (jjmatchedPos != 1)
@@ -64,11 +65,10 @@
             }
             return 28;
          }
-         if ((active0 & 0x40300000L) != 0L) {
-            return 28;
-         }
          return -1;
       case 2:
+         if ((active0 & 0x80004c10000000L) != 0L)
+            return 28;
          if ((active0 & 0x77fffb3afeffe00L) != 0L)
          {
             if (jjmatchedPos != 2)
@@ -78,9 +78,6 @@
             }
             return 28;
          }
-         if ((active0 & 0x80004c10000000L) != 0L) {
-            return 28;
-         }
          return -1;
       case 3:
          if ((active0 & 0x63bff2b8faf4e00L) != 0L)
@@ -89,11 +86,12 @@
             jjmatchedPos = 3;
             return 28;
          }
-         if ((active0 & 0x14400902040b000L) != 0L) {
+         if ((active0 & 0x14400902040b000L) != 0L)
             return 28;
-         }
          return -1;
       case 4:
+         if ((active0 & 0x418a0000f034800L) != 0L)
+            return 28;
          if ((active0 & 0x2235f2b80ac0600L) != 0L)
          {
             if (jjmatchedPos != 4)
@@ -103,20 +101,16 @@
             }
             return 28;
          }
-         if ((active0 & 0x418a0000f034800L) != 0L) {
-            return 28;
-         }
          return -1;
       case 5:
+         if ((active0 & 0x11582100200000L) != 0L)
+            return 28;
          if ((active0 & 0x222070a848c0600L) != 0L)
          {
             jjmatchedKind = 67;
             jjmatchedPos = 5;
             return 28;
          }
-         if ((active0 & 0x11582100200000L) != 0L) {
-            return 28;
-         }
          return -1;
       case 6:
          if ((active0 & 0x222040a80040200L) != 0L)
@@ -125,31 +119,28 @@
             jjmatchedPos = 6;
             return 28;
          }
-         if ((active0 & 0x30004880400L) != 0L) {
+         if ((active0 & 0x30004880400L) != 0L)
             return 28;
-         }
          return -1;
       case 7:
+         if ((active0 & 0x200000000040200L) != 0L)
+            return 28;
          if ((active0 & 0x22040a80000000L) != 0L)
          {
             jjmatchedKind = 67;
             jjmatchedPos = 7;
             return 28;
          }
-         if ((active0 & 0x200000000040200L) != 0L) {
-            return 28;
-         }
          return -1;
       case 8:
+         if ((active0 & 0x20040800000000L) != 0L)
+            return 28;
          if ((active0 & 0x2000280000000L) != 0L)
          {
             jjmatchedKind = 67;
             jjmatchedPos = 8;
             return 28;
          }
-         if ((active0 & 0x20040800000000L) != 0L) {
-            return 28;
-         }
          return -1;
       case 9:
          if ((active0 & 0x2000000000000L) != 0L)
@@ -158,9 +149,8 @@
             jjmatchedPos = 9;
             return 28;
          }
-         if ((active0 & 0x280000000L) != 0L) {
+         if ((active0 & 0x280000000L) != 0L)
             return 28;
-         }
          return -1;
       case 10:
          if ((active0 & 0x2000000000000L) != 0L)
@@ -178,21 +168,13 @@
 {
    return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0, active1), pos + 1);
 }
-private final int jjStopAtPos(int pos, int kind)
+private int jjStopAtPos(int pos, int kind)
 {
    jjmatchedKind = kind;
    jjmatchedPos = pos;
    return pos + 1;
 }
-private final int jjStartNfaWithStates_0(int pos, int kind, int state)
-{
-   jjmatchedKind = kind;
-   jjmatchedPos = pos;
-   try { curChar = input_stream.readChar(); }
-   catch(java.io.IOException e) { return pos + 1; }
-   return jjMoveNfa_0(state, pos + 1);
-}
-private final int jjMoveStringLiteralDfa0_0()
+private int jjMoveStringLiteralDfa0_0()
 {
    switch(curChar)
    {
@@ -292,7 +274,7 @@
          return jjMoveNfa_0(0, 0);
    }
 }
-private final int jjMoveStringLiteralDfa1_0(long active0, long active1)
+private int jjMoveStringLiteralDfa1_0(long active0, long active1)
 {
    try { curChar = input_stream.readChar(); }
    catch(java.io.IOException e) {
@@ -302,19 +284,16 @@
    switch(curChar)
    {
       case 38:
-         if ((active1 & 0x8000000L) != 0L) {
+         if ((active1 & 0x8000000L) != 0L)
             return jjStopAtPos(1, 91);
-         }
          break;
       case 43:
-         if ((active1 & 0x10000000L) != 0L) {
+         if ((active1 & 0x10000000L) != 0L)
             return jjStopAtPos(1, 92);
-         }
          break;
       case 45:
-         if ((active1 & 0x20000000L) != 0L) {
+         if ((active1 & 0x20000000L) != 0L)
             return jjStopAtPos(1, 93);
-         }
          break;
       case 60:
          if ((active1 & 0x4000000000L) != 0L)
@@ -324,31 +303,30 @@
          }
          return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x2000000000000L);
       case 61:
-         if ((active1 & 0x400000L) != 0L) {
+         if ((active1 & 0x400000L) != 0L)
             return jjStopAtPos(1, 86);
-         } else if ((active1 & 0x800000L) != 0L) {
+         else if ((active1 & 0x800000L) != 0L)
             return jjStopAtPos(1, 87);
-         } else if ((active1 & 0x1000000L) != 0L) {
+         else if ((active1 & 0x1000000L) != 0L)
             return jjStopAtPos(1, 88);
-         } else if ((active1 & 0x2000000L) != 0L) {
+         else if ((active1 & 0x2000000L) != 0L)
             return jjStopAtPos(1, 89);
-         } else if ((active1 & 0x20000000000L) != 0L) {
+         else if ((active1 & 0x20000000000L) != 0L)
             return jjStopAtPos(1, 105);
-         } else if ((active1 & 0x40000000000L) != 0L) {
+         else if ((active1 & 0x40000000000L) != 0L)
             return jjStopAtPos(1, 106);
-         } else if ((active1 & 0x80000000000L) != 0L) {
+         else if ((active1 & 0x80000000000L) != 0L)
             return jjStopAtPos(1, 107);
-         } else if ((active1 & 0x100000000000L) != 0L) {
+         else if ((active1 & 0x100000000000L) != 0L)
             return jjStopAtPos(1, 108);
-         } else if ((active1 & 0x200000000000L) != 0L) {
+         else if ((active1 & 0x200000000000L) != 0L)
             return jjStopAtPos(1, 109);
-         } else if ((active1 & 0x400000000000L) != 0L) {
+         else if ((active1 & 0x400000000000L) != 0L)
             return jjStopAtPos(1, 110);
-         } else if ((active1 & 0x800000000000L) != 0L) {
+         else if ((active1 & 0x800000000000L) != 0L)
             return jjStopAtPos(1, 111);
-         } else if ((active1 & 0x1000000000000L) != 0L) {
+         else if ((active1 & 0x1000000000000L) != 0L)
             return jjStopAtPos(1, 112);
-         }
          break;
       case 62:
          if ((active1 & 0x8000000000L) != 0L)
@@ -364,9 +342,8 @@
       case 101:
          return jjMoveStringLiteralDfa2_0(active0, 0x104000080000L, active1, 0L);
       case 102:
-         if ((active0 & 0x40000000L) != 0L) {
+         if ((active0 & 0x40000000L) != 0L)
             return jjStartNfaWithStates_0(1, 30, 28);
-         }
          break;
       case 104:
          return jjMoveStringLiteralDfa2_0(active0, 0x41c200000008000L, active1, 0L);
@@ -398,20 +375,18 @@
       case 121:
          return jjMoveStringLiteralDfa2_0(active0, 0x2000000001000L, active1, 0L);
       case 124:
-         if ((active1 & 0x4000000L) != 0L) {
+         if ((active1 & 0x4000000L) != 0L)
             return jjStopAtPos(1, 90);
-         }
          break;
       default :
          break;
    }
    return jjStartNfa_0(0, active0, active1);
 }
-private final int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1)
+private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1)
 {
-   if (((active0 &= old0) | (active1 &= old1)) == 0L) {
+   if (((active0 &= old0) | (active1 &= old1)) == 0L)
       return jjStartNfa_0(0, old0, old1);
-   }
    try { curChar = input_stream.readChar(); }
    catch(java.io.IOException e) {
       jjStopStringLiteralDfa_0(1, active0, active1);
@@ -420,11 +395,10 @@
    switch(curChar)
    {
       case 61:
-         if ((active1 & 0x2000000000000L) != 0L) {
+         if ((active1 & 0x2000000000000L) != 0L)
             return jjStopAtPos(2, 113);
-         } else if ((active1 & 0x4000000000000L) != 0L) {
+         else if ((active1 & 0x4000000000000L) != 0L)
             return jjStopAtPos(2, 114);
-         }
          break;
       case 62:
          if ((active1 & 0x10000000000L) != 0L)
@@ -454,9 +428,8 @@
       case 112:
          return jjMoveStringLiteralDfa3_0(active0, 0x800180000000L, active1, 0L);
       case 114:
-         if ((active0 & 0x10000000L) != 0L) {
+         if ((active0 & 0x10000000L) != 0L)
             return jjStartNfaWithStates_0(2, 28, 28);
-         }
          return jjMoveStringLiteralDfa3_0(active0, 0x18000000000000L, active1, 0L);
       case 115:
          return jjMoveStringLiteralDfa3_0(active0, 0x200402200L, active1, 0L);
@@ -470,25 +443,22 @@
       case 117:
          return jjMoveStringLiteralDfa3_0(active0, 0x40000000200000L, active1, 0L);
       case 119:
-         if ((active0 & 0x4000000000L) != 0L) {
+         if ((active0 & 0x4000000000L) != 0L)
             return jjStartNfaWithStates_0(2, 38, 28);
-         }
          break;
       case 121:
-         if ((active0 & 0x80000000000000L) != 0L) {
+         if ((active0 & 0x80000000000000L) != 0L)
             return jjStartNfaWithStates_0(2, 55, 28);
-         }
          break;
       default :
          break;
    }
    return jjStartNfa_0(1, active0, active1);
 }
-private final int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1)
+private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1)
 {
-   if (((active0 &= old0) | (active1 &= old1)) == 0L) {
+   if (((active0 &= old0) | (active1 &= old1)) == 0L)
       return jjStartNfa_0(1, old0, old1);
-   }
    try { curChar = input_stream.readChar(); }
    catch(java.io.IOException e) {
       jjStopStringLiteralDfa_0(2, active0, active1);
@@ -497,9 +467,8 @@
    switch(curChar)
    {
       case 61:
-         if ((active1 & 0x8000000000000L) != 0L) {
+         if ((active1 & 0x8000000000000L) != 0L)
             return jjStopAtPos(3, 115);
-         }
          break;
       case 97:
          return jjMoveStringLiteralDfa4_0(active0, 0x20000000e080800L, active1, 0L);
@@ -508,51 +477,44 @@
       case 99:
          return jjMoveStringLiteralDfa4_0(active0, 0x2000000004000L, active1, 0L);
       case 100:
-         if ((active0 & 0x100000000000000L) != 0L) {
+         if ((active0 & 0x100000000000000L) != 0L)
             return jjStartNfaWithStates_0(3, 56, 28);
-         }
          break;
       case 101:
-         if ((active0 & 0x1000L) != 0L) {
+         if ((active0 & 0x1000L) != 0L)
             return jjStartNfaWithStates_0(3, 12, 28);
-         } else if ((active0 & 0x2000L) != 0L) {
+         else if ((active0 & 0x2000L) != 0L)
             return jjStartNfaWithStates_0(3, 13, 28);
-         } else if ((active0 & 0x400000L) != 0L) {
+         else if ((active0 & 0x400000L) != 0L)
             return jjStartNfaWithStates_0(3, 22, 28);
-         } else if ((active0 & 0x40000000000000L) != 0L) {
+         else if ((active0 & 0x40000000000000L) != 0L)
             return jjStartNfaWithStates_0(3, 54, 28);
-         }
          return jjMoveStringLiteralDfa4_0(active0, 0x800800800000L, active1, 0L);
       case 103:
-         if ((active0 & 0x1000000000L) != 0L) {
+         if ((active0 & 0x1000000000L) != 0L)
             return jjStartNfaWithStates_0(3, 36, 28);
-         }
          break;
       case 105:
          return jjMoveStringLiteralDfa4_0(active0, 0x2000000000L, active1, 0L);
       case 107:
          return jjMoveStringLiteralDfa4_0(active0, 0x10000000000L, active1, 0L);
       case 108:
-         if ((active0 & 0x8000000000L) != 0L) {
+         if ((active0 & 0x8000000000L) != 0L)
             return jjStartNfaWithStates_0(3, 39, 28);
-         }
          return jjMoveStringLiteralDfa4_0(active0, 0x400080080000400L, active1, 0L);
       case 110:
          return jjMoveStringLiteralDfa4_0(active0, 0x20000000000000L, active1, 0L);
       case 111:
-         if ((active0 & 0x20000000L) != 0L) {
+         if ((active0 & 0x20000000L) != 0L)
             return jjStartNfaWithStates_0(3, 29, 28);
-         }
          return jjMoveStringLiteralDfa4_0(active0, 0x18000100000000L, active1, 0L);
       case 114:
-         if ((active0 & 0x8000L) != 0L) {
+         if ((active0 & 0x8000L) != 0L)
             return jjStartNfaWithStates_0(3, 15, 28);
-         }
          return jjMoveStringLiteralDfa4_0(active0, 0x200000000000L, active1, 0L);
       case 115:
-         if ((active0 & 0x4000000000000L) != 0L) {
+         if ((active0 & 0x4000000000000L) != 0L)
             return jjStartNfaWithStates_0(3, 50, 28);
-         }
          return jjMoveStringLiteralDfa4_0(active0, 0x1030000L, active1, 0L);
       case 116:
          return jjMoveStringLiteralDfa4_0(active0, 0x1440200040200L, active1, 0L);
@@ -565,11 +527,10 @@
    }
    return jjStartNfa_0(2, active0, active1);
 }
-private final int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1)
+private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1)
 {
-   if (((active0 &= old0) | (active1 &= old1)) == 0L) {
+   if (((active0 &= old0) | (active1 &= old1)) == 0L)
       return jjStartNfa_0(2, old0, old1);
-   }
    try { curChar = input_stream.readChar(); }
    catch(java.io.IOException e) {
       jjStopStringLiteralDfa_0(3, active0, 0L);
@@ -582,23 +543,20 @@
       case 99:
          return jjMoveStringLiteralDfa5_0(active0, 0x1000000000000L);
       case 101:
-         if ((active0 & 0x1000000L) != 0L) {
+         if ((active0 & 0x1000000L) != 0L)
             return jjStartNfaWithStates_0(4, 24, 28);
-         } else if ((active0 & 0x400000000000000L) != 0L) {
+         else if ((active0 & 0x400000000000000L) != 0L)
             return jjStartNfaWithStates_0(4, 58, 28);
-         }
          return jjMoveStringLiteralDfa5_0(active0, 0x40080000400L);
       case 104:
-         if ((active0 & 0x4000L) != 0L) {
+         if ((active0 & 0x4000L) != 0L)
             return jjStartNfaWithStates_0(4, 14, 28);
-         }
          return jjMoveStringLiteralDfa5_0(active0, 0x2000000000000L);
       case 105:
          return jjMoveStringLiteralDfa5_0(active0, 0x480000040000L);
       case 107:
-         if ((active0 & 0x800L) != 0L) {
+         if ((active0 & 0x800L) != 0L)
             return jjStartNfaWithStates_0(4, 11, 28);
-         }
          break;
       case 108:
          if ((active0 & 0x2000000L) != 0L)
@@ -610,23 +568,20 @@
       case 110:
          return jjMoveStringLiteralDfa5_0(active0, 0x800000L);
       case 114:
-         if ((active0 & 0x800000000000L) != 0L) {
+         if ((active0 & 0x800000000000L) != 0L)
             return jjStartNfaWithStates_0(4, 47, 28);
-         }
          return jjMoveStringLiteralDfa5_0(active0, 0x100900000200L);
       case 115:
-         if ((active0 & 0x10000L) != 0L) {
+         if ((active0 & 0x10000L) != 0L)
             return jjStartNfaWithStates_0(4, 16, 28);
-         }
          return jjMoveStringLiteralDfa5_0(active0, 0x20000000000000L);
       case 116:
-         if ((active0 & 0x20000L) != 0L) {
+         if ((active0 & 0x20000L) != 0L)
             return jjStartNfaWithStates_0(4, 17, 28);
-         } else if ((active0 & 0x8000000L) != 0L) {
+         else if ((active0 & 0x8000000L) != 0L)
             return jjStartNfaWithStates_0(4, 27, 28);
-         } else if ((active0 & 0x200000000000L) != 0L) {
+         else if ((active0 & 0x200000000000L) != 0L)
             return jjStartNfaWithStates_0(4, 45, 28);
-         }
          return jjMoveStringLiteralDfa5_0(active0, 0x200000000000000L);
       case 117:
          return jjMoveStringLiteralDfa5_0(active0, 0x80000L);
@@ -644,11 +599,10 @@
    }
    return jjStartNfa_0(3, active0, 0L);
 }
-private final int jjMoveStringLiteralDfa5_0(long old0, long active0)
+private int jjMoveStringLiteralDfa5_0(long old0, long active0)
 {
-   if (((active0 &= old0)) == 0L) {
+   if (((active0 &= old0)) == 0L)
       return jjStartNfa_0(3, old0, 0L);
-   }
    try { curChar = input_stream.readChar(); }
    catch(java.io.IOException e) {
       jjStopStringLiteralDfa_0(4, active0, 0L);
@@ -659,29 +613,26 @@
       case 97:
          return jjMoveStringLiteralDfa6_0(active0, 0x600L);
       case 99:
-         if ((active0 & 0x80000000000L) != 0L) {
+         if ((active0 & 0x80000000000L) != 0L)
             return jjStartNfaWithStates_0(5, 43, 28);
-         } else if ((active0 & 0x400000000000L) != 0L) {
+         else if ((active0 & 0x400000000000L) != 0L)
             return jjStartNfaWithStates_0(5, 46, 28);
-         }
          return jjMoveStringLiteralDfa6_0(active0, 0x40000000000L);
       case 100:
          return jjMoveStringLiteralDfa6_0(active0, 0x800000L);
       case 101:
-         if ((active0 & 0x200000L) != 0L) {
+         if ((active0 & 0x200000L) != 0L)
             return jjStartNfaWithStates_0(5, 21, 28);
-         } else if ((active0 & 0x2000000000L) != 0L) {
+         else if ((active0 & 0x2000000000L) != 0L)
             return jjStartNfaWithStates_0(5, 37, 28);
-         }
          break;
       case 102:
          return jjMoveStringLiteralDfa6_0(active0, 0x800000000L);
       case 103:
          return jjMoveStringLiteralDfa6_0(active0, 0x10000000000L);
       case 104:
-         if ((active0 & 0x1000000000000L) != 0L) {
+         if ((active0 & 0x1000000000000L) != 0L)
             return jjStartNfaWithStates_0(5, 48, 28);
-         }
          break;
       case 105:
          return jjMoveStringLiteralDfa6_0(active0, 0x220000000000000L);
@@ -690,32 +641,28 @@
       case 109:
          return jjMoveStringLiteralDfa6_0(active0, 0x80000000L);
       case 110:
-         if ((active0 & 0x100000000000L) != 0L) {
+         if ((active0 & 0x100000000000L) != 0L)
             return jjStartNfaWithStates_0(5, 44, 28);
-         }
          return jjMoveStringLiteralDfa6_0(active0, 0x200040000L);
       case 114:
          return jjMoveStringLiteralDfa6_0(active0, 0x2000000000000L);
       case 115:
-         if ((active0 & 0x10000000000000L) != 0L) {
+         if ((active0 & 0x10000000000000L) != 0L)
             return jjStartNfaWithStates_0(5, 52, 28);
-         }
          break;
       case 116:
-         if ((active0 & 0x100000000L) != 0L) {
+         if ((active0 & 0x100000000L) != 0L)
             return jjStartNfaWithStates_0(5, 32, 28);
-         }
          return jjMoveStringLiteralDfa6_0(active0, 0x20000000000L);
       default :
          break;
    }
    return jjStartNfa_0(4, active0, 0L);
 }
-private final int jjMoveStringLiteralDfa6_0(long old0, long active0)
+private int jjMoveStringLiteralDfa6_0(long old0, long active0)
 {
-   if (((active0 &= old0)) == 0L) {
+   if (((active0 &= old0)) == 0L)
       return jjStartNfa_0(4, old0, 0L);
-   }
    try { curChar = input_stream.readChar(); }
    catch(java.io.IOException e) {
       jjStopStringLiteralDfa_0(5, active0, 0L);
@@ -728,48 +675,42 @@
       case 99:
          return jjMoveStringLiteralDfa7_0(active0, 0x200000200L);
       case 101:
-         if ((active0 & 0x10000000000L) != 0L) {
+         if ((active0 & 0x10000000000L) != 0L)
             return jjStartNfaWithStates_0(6, 40, 28);
-         } else if ((active0 & 0x20000000000L) != 0L) {
+         else if ((active0 & 0x20000000000L) != 0L)
             return jjStartNfaWithStates_0(6, 41, 28);
-         }
          return jjMoveStringLiteralDfa7_0(active0, 0x20000080000000L);
       case 108:
          return jjMoveStringLiteralDfa7_0(active0, 0x200000000000000L);
       case 110:
-         if ((active0 & 0x400L) != 0L) {
+         if ((active0 & 0x400L) != 0L)
             return jjStartNfaWithStates_0(6, 10, 28);
-         }
          break;
       case 111:
          return jjMoveStringLiteralDfa7_0(active0, 0x2000000000000L);
       case 115:
-         if ((active0 & 0x800000L) != 0L) {
+         if ((active0 & 0x800000L) != 0L)
             return jjStartNfaWithStates_0(6, 23, 28);
-         }
          break;
       case 116:
-         if ((active0 & 0x80000L) != 0L) {
+         if ((active0 & 0x80000L) != 0L)
             return jjStartNfaWithStates_0(6, 19, 28);
-         }
          return jjMoveStringLiteralDfa7_0(active0, 0x40000000000L);
       case 117:
          return jjMoveStringLiteralDfa7_0(active0, 0x40000L);
       case 121:
-         if ((active0 & 0x4000000L) != 0L) {
+         if ((active0 & 0x4000000L) != 0L)
             return jjStartNfaWithStates_0(6, 26, 28);
-         }
          break;
       default :
          break;
    }
    return jjStartNfa_0(5, active0, 0L);
 }
-private final int jjMoveStringLiteralDfa7_0(long old0, long active0)
+private int jjMoveStringLiteralDfa7_0(long old0, long active0)
 {
-   if (((active0 &= old0)) == 0L) {
+   if (((active0 &= old0)) == 0L)
       return jjStartNfa_0(5, old0, 0L);
-   }
    try { curChar = input_stream.readChar(); }
    catch(java.io.IOException e) {
       jjStopStringLiteralDfa_0(6, active0, 0L);
@@ -780,29 +721,26 @@
       case 99:
          return jjMoveStringLiteralDfa8_0(active0, 0x800000000L);
       case 101:
-         if ((active0 & 0x40000L) != 0L) {
+         if ((active0 & 0x40000L) != 0L)
             return jjStartNfaWithStates_0(7, 18, 28);
-         } else if ((active0 & 0x200000000000000L) != 0L) {
+         else if ((active0 & 0x200000000000000L) != 0L)
             return jjStartNfaWithStates_0(7, 57, 28);
-         }
          return jjMoveStringLiteralDfa8_0(active0, 0x40200000000L);
       case 110:
          return jjMoveStringLiteralDfa8_0(active0, 0x22000080000000L);
       case 116:
-         if ((active0 & 0x200L) != 0L) {
+         if ((active0 & 0x200L) != 0L)
             return jjStartNfaWithStates_0(7, 9, 28);
-         }
          break;
       default :
          break;
    }
    return jjStartNfa_0(6, active0, 0L);
 }
-private final int jjMoveStringLiteralDfa8_0(long old0, long active0)
+private int jjMoveStringLiteralDfa8_0(long old0, long active0)
 {
-   if (((active0 &= old0)) == 0L) {
+   if (((active0 &= old0)) == 0L)
       return jjStartNfa_0(6, old0, 0L);
-   }
    try { curChar = input_stream.readChar(); }
    catch(java.io.IOException e) {
       jjStopStringLiteralDfa_0(7, active0, 0L);
@@ -811,34 +749,30 @@
    switch(curChar)
    {
       case 100:
-         if ((active0 & 0x40000000000L) != 0L) {
+         if ((active0 & 0x40000000000L) != 0L)
             return jjStartNfaWithStates_0(8, 42, 28);
-         }
          break;
       case 101:
-         if ((active0 & 0x800000000L) != 0L) {
+         if ((active0 & 0x800000000L) != 0L)
             return jjStartNfaWithStates_0(8, 35, 28);
-         }
          break;
       case 105:
          return jjMoveStringLiteralDfa9_0(active0, 0x2000000000000L);
       case 111:
          return jjMoveStringLiteralDfa9_0(active0, 0x200000000L);
       case 116:
-         if ((active0 & 0x20000000000000L) != 0L) {
+         if ((active0 & 0x20000000000000L) != 0L)
             return jjStartNfaWithStates_0(8, 53, 28);
-         }
          return jjMoveStringLiteralDfa9_0(active0, 0x80000000L);
       default :
          break;
    }
    return jjStartNfa_0(7, active0, 0L);
 }
-private final int jjMoveStringLiteralDfa9_0(long old0, long active0)
+private int jjMoveStringLiteralDfa9_0(long old0, long active0)
 {
-   if (((active0 &= old0)) == 0L) {
+   if (((active0 &= old0)) == 0L)
       return jjStartNfa_0(7, old0, 0L);
-   }
    try { curChar = input_stream.readChar(); }
    catch(java.io.IOException e) {
       jjStopStringLiteralDfa_0(8, active0, 0L);
@@ -847,14 +781,12 @@
    switch(curChar)
    {
       case 102:
-         if ((active0 & 0x200000000L) != 0L) {
+         if ((active0 & 0x200000000L) != 0L)
             return jjStartNfaWithStates_0(9, 33, 28);
-         }
          break;
       case 115:
-         if ((active0 & 0x80000000L) != 0L) {
+         if ((active0 & 0x80000000L) != 0L)
             return jjStartNfaWithStates_0(9, 31, 28);
-         }
          break;
       case 122:
          return jjMoveStringLiteralDfa10_0(active0, 0x2000000000000L);
@@ -863,11 +795,10 @@
    }
    return jjStartNfa_0(8, active0, 0L);
 }
-private final int jjMoveStringLiteralDfa10_0(long old0, long active0)
+private int jjMoveStringLiteralDfa10_0(long old0, long active0)
 {
-   if (((active0 &= old0)) == 0L) {
+   if (((active0 &= old0)) == 0L)
       return jjStartNfa_0(8, old0, 0L);
-   }
    try { curChar = input_stream.readChar(); }
    catch(java.io.IOException e) {
       jjStopStringLiteralDfa_0(9, active0, 0L);
@@ -882,11 +813,10 @@
    }
    return jjStartNfa_0(9, active0, 0L);
 }
-private final int jjMoveStringLiteralDfa11_0(long old0, long active0)
+private int jjMoveStringLiteralDfa11_0(long old0, long active0)
 {
-   if (((active0 &= old0)) == 0L) {
+   if (((active0 &= old0)) == 0L)
       return jjStartNfa_0(9, old0, 0L);
-   }
    try { curChar = input_stream.readChar(); }
    catch(java.io.IOException e) {
       jjStopStringLiteralDfa_0(10, active0, 0L);
@@ -895,44 +825,21 @@
    switch(curChar)
    {
       case 100:
-         if ((active0 & 0x2000000000000L) != 0L) {
+         if ((active0 & 0x2000000000000L) != 0L)
             return jjStartNfaWithStates_0(11, 49, 28);
-         }
          break;
       default :
          break;
    }
    return jjStartNfa_0(10, active0, 0L);
 }
-private final void jjCheckNAdd(int state)
-{
-   if (jjrounds[state] != jjround)
-   {
-      jjstateSet[jjnewStateCnt++] = state;
-      jjrounds[state] = jjround;
-   }
-}
-private final void jjAddStates(int start, int end)
+private int jjStartNfaWithStates_0(int pos, int kind, int state)
 {
-   do {
-      jjstateSet[jjnewStateCnt++] = jjnextStates[start];
-   } while (start++ != end);
-}
-private final void jjCheckNAddTwoStates(int state1, int state2)
-{
-   jjCheckNAdd(state1);
-   jjCheckNAdd(state2);
-}
-private final void jjCheckNAddStates(int start, int end)
-{
-   do {
-      jjCheckNAdd(jjnextStates[start]);
-   } while (start++ != end);
-}
-private final void jjCheckNAddStates(int start)
-{
-   jjCheckNAdd(jjnextStates[start]);
-   jjCheckNAdd(jjnextStates[start + 1]);
+   jjmatchedKind = kind;
+   jjmatchedPos = pos;
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) { return pos + 1; }
+   return jjMoveNfa_0(state, pos + 1);
 }
 static final long[] jjbitVec0 = {
    0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
@@ -958,7 +865,7 @@
 static final long[] jjbitVec8 = {
    0x3fffffffffffL, 0x0L, 0x0L, 0x0L
 };
-private final int jjMoveNfa_0(int startState, int curPos)
+private int jjMoveNfa_0(int startState, int curPos)
 {
    int startsAt = 0;
    jjnewStateCnt = 67;
@@ -967,388 +874,312 @@
    int kind = 0x7fffffff;
    for (;;)
    {
-      if (++jjround == 0x7fffffff) {
+      if (++jjround == 0x7fffffff)
          ReInitRounds();
-      }
       if (curChar < 64)
       {
          long l = 1L << curChar;
-         //MatchLoop
          do
          {
             switch(jjstateSet[--i])
             {
+               case 49:
+                  if (curChar == 42)
+                     jjCheckNAddTwoStates(62, 63);
+                  else if (curChar == 47)
+                     jjCheckNAddStates(0, 2);
+                  if (curChar == 42)
+                     jjstateSet[jjnewStateCnt++] = 54;
+                  break;
                case 0:
-                  if ((0x3ff000000000000L & l) != 0L) {
-                     jjCheckNAddStates(0, 6);
-                  } else if (curChar == 47) {
-                     jjAddStates(7, 9);
-                  } else if (curChar == 36)
+                  if ((0x3ff000000000000L & l) != 0L)
+                     jjCheckNAddStates(3, 9);
+                  else if (curChar == 47)
+                     jjAddStates(10, 12);
+                  else if (curChar == 36)
                   {
-                     if (kind > 67) {
+                     if (kind > 67)
                         kind = 67;
-                     }
                      jjCheckNAdd(28);
                   }
-                  else if (curChar == 34) {
-                     jjCheckNAddStates(10, 12);
-                  } else if (curChar == 39) {
-                     jjAddStates(13, 14);
-                  } else if (curChar == 46) {
+                  else if (curChar == 34)
+                     jjCheckNAddStates(13, 15);
+                  else if (curChar == 39)
+                     jjAddStates(16, 17);
+                  else if (curChar == 46)
                      jjCheckNAdd(4);
-                  }
                   if ((0x3fe000000000000L & l) != 0L)
                   {
-                     if (kind > 59) {
+                     if (kind > 59)
                         kind = 59;
-                     }
                      jjCheckNAddTwoStates(1, 2);
                   }
                   else if (curChar == 48)
                   {
-                     if (kind > 59) {
+                     if (kind > 59)
                         kind = 59;
-                     }
-                     jjCheckNAddStates(15, 17);
-                  }
-                  break;
-               case 49:
-                  if (curChar == 42) {
-                     jjCheckNAddTwoStates(62, 63);
-                  } else if (curChar == 47) {
                      jjCheckNAddStates(18, 20);
                   }
-                  if (curChar == 42) {
-                     jjstateSet[jjnewStateCnt++] = 54;
-                  }
                   break;
                case 1:
-                  if ((0x3ff000000000000L & l) == 0L) {
+                  if ((0x3ff000000000000L & l) == 0L)
                      break;
-                  }
-                  if (kind > 59) {
+                  if (kind > 59)
                      kind = 59;
-                  }
                   jjCheckNAddTwoStates(1, 2);
                   break;
                case 3:
-                  if (curChar == 46) {
+                  if (curChar == 46)
                      jjCheckNAdd(4);
-                  }
                   break;
                case 4:
-                  if ((0x3ff000000000000L & l) == 0L) {
+                  if ((0x3ff000000000000L & l) == 0L)
                      break;
-                  }
-                  if (kind > 63) {
+                  if (kind > 63)
                      kind = 63;
-                  }
                   jjCheckNAddStates(21, 23);
                   break;
                case 6:
-                  if ((0x280000000000L & l) != 0L) {
+                  if ((0x280000000000L & l) != 0L)
                      jjCheckNAdd(7);
-                  }
                   break;
                case 7:
-                  if ((0x3ff000000000000L & l) == 0L) {
+                  if ((0x3ff000000000000L & l) == 0L)
                      break;
-                  }
-                  if (kind > 63) {
+                  if (kind > 63)
                      kind = 63;
-                  }
                   jjCheckNAddTwoStates(7, 8);
                   break;
                case 9:
-                  if (curChar == 39) {
-                     jjAddStates(13, 14);
-                  }
+                  if (curChar == 39)
+                     jjAddStates(16, 17);
                   break;
                case 10:
-                  if ((0xffffff7fffffdbffL & l) != 0L) {
+                  if ((0xffffff7fffffdbffL & l) != 0L)
                      jjCheckNAdd(11);
-                  }
                   break;
                case 11:
-                  if (curChar == 39 && kind > 65) {
+                  if (curChar == 39 && kind > 65)
                      kind = 65;
-                  }
                   break;
                case 13:
-                  if ((0x8400000000L & l) != 0L) {
+                  if ((0x8400000000L & l) != 0L)
                      jjCheckNAdd(11);
-                  }
                   break;
                case 14:
-                  if ((0xff000000000000L & l) != 0L) {
+                  if ((0xff000000000000L & l) != 0L)
                      jjCheckNAddTwoStates(15, 11);
-                  }
                   break;
                case 15:
-                  if ((0xff000000000000L & l) != 0L) {
+                  if ((0xff000000000000L & l) != 0L)
                      jjCheckNAdd(11);
-                  }
                   break;
                case 16:
-                  if ((0xf000000000000L & l) != 0L) {
+                  if ((0xf000000000000L & l) != 0L)
                      jjstateSet[jjnewStateCnt++] = 17;
-                  }
                   break;
                case 17:
-                  if ((0xff000000000000L & l) != 0L) {
+                  if ((0xff000000000000L & l) != 0L)
                      jjCheckNAdd(15);
-                  }
                   break;
                case 18:
-                  if (curChar == 34) {
-                     jjCheckNAddStates(10, 12);
-                  }
+                  if (curChar == 34)
+                     jjCheckNAddStates(13, 15);
                   break;
                case 19:
-                  if ((0xfffffffbffffdbffL & l) != 0L) {
-                     jjCheckNAddStates(10, 12);
-                  }
+                  if ((0xfffffffbffffdbffL & l) != 0L)
+                     jjCheckNAddStates(13, 15);
                   break;
                case 21:
-                  if ((0x8400000000L & l) != 0L) {
-                     jjCheckNAddStates(10, 12);
-                  }
+                  if ((0x8400000000L & l) != 0L)
+                     jjCheckNAddStates(13, 15);
                   break;
                case 22:
-                  if (curChar == 34 && kind > 66) {
+                  if (curChar == 34 && kind > 66)
                      kind = 66;
-                  }
                   break;
                case 23:
-                  if ((0xff000000000000L & l) != 0L) {
+                  if ((0xff000000000000L & l) != 0L)
                      jjCheckNAddStates(24, 27);
-                  }
                   break;
                case 24:
-                  if ((0xff000000000000L & l) != 0L) {
-                     jjCheckNAddStates(10, 12);
-                  }
+                  if ((0xff000000000000L & l) != 0L)
+                     jjCheckNAddStates(13, 15);
                   break;
                case 25:
-                  if ((0xf000000000000L & l) != 0L) {
+                  if ((0xf000000000000L & l) != 0L)
                      jjstateSet[jjnewStateCnt++] = 26;
-                  }
                   break;
                case 26:
-                  if ((0xff000000000000L & l) != 0L) {
+                  if ((0xff000000000000L & l) != 0L)
                      jjCheckNAdd(24);
-                  }
                   break;
                case 27:
-                  if (curChar != 36) {
+                  if (curChar != 36)
                      break;
-                  }
-                  if (kind > 67) {
+                  if (kind > 67)
                      kind = 67;
-                  }
                   jjCheckNAdd(28);
                   break;
                case 28:
-                  if ((0x3ff001000000000L & l) == 0L) {
+                  if ((0x3ff001000000000L & l) == 0L)
                      break;
-                  }
-                  if (kind > 67) {
+                  if (kind > 67)
                      kind = 67;
-                  }
                   jjCheckNAdd(28);
                   break;
                case 29:
-                  if ((0x3ff000000000000L & l) != 0L) {
-                     jjCheckNAddStates(0, 6);
-                  }
+                  if ((0x3ff000000000000L & l) != 0L)
+                     jjCheckNAddStates(3, 9);
                   break;
                case 30:
-                  if ((0x3ff000000000000L & l) != 0L) {
+                  if ((0x3ff000000000000L & l) != 0L)
                      jjCheckNAddTwoStates(30, 31);
-                  }
                   break;
                case 31:
-                  if (curChar != 46) {
+                  if (curChar != 46)
                      break;
-                  }
-                  if (kind > 63) {
+                  if (kind > 63)
                      kind = 63;
-                  }
                   jjCheckNAddStates(28, 30);
                   break;
                case 32:
-                  if ((0x3ff000000000000L & l) == 0L) {
+                  if ((0x3ff000000000000L & l) == 0L)
                      break;
-                  }
-                  if (kind > 63) {
+                  if (kind > 63)
                      kind = 63;
-                  }
                   jjCheckNAddStates(28, 30);
                   break;
                case 34:
-                  if ((0x280000000000L & l) != 0L) {
+                  if ((0x280000000000L & l) != 0L)
                      jjCheckNAdd(35);
-                  }
                   break;
                case 35:
-                  if ((0x3ff000000000000L & l) == 0L) {
+                  if ((0x3ff000000000000L & l) == 0L)
                      break;
-                  }
-                  if (kind > 63) {
+                  if (kind > 63)
                      kind = 63;
-                  }
                   jjCheckNAddTwoStates(35, 8);
                   break;
                case 36:
-                  if ((0x3ff000000000000L & l) != 0L) {
+                  if ((0x3ff000000000000L & l) != 0L)
                      jjCheckNAddTwoStates(36, 37);
-                  }
                   break;
                case 38:
-                  if ((0x280000000000L & l) != 0L) {
+                  if ((0x280000000000L & l) != 0L)
                      jjCheckNAdd(39);
-                  }
                   break;
                case 39:
-                  if ((0x3ff000000000000L & l) == 0L) {
+                  if ((0x3ff000000000000L & l) == 0L)
                      break;
-                  }
-                  if (kind > 63) {
+                  if (kind > 63)
                      kind = 63;
-                  }
                   jjCheckNAddTwoStates(39, 8);
                   break;
                case 40:
-                  if ((0x3ff000000000000L & l) != 0L) {
+                  if ((0x3ff000000000000L & l) != 0L)
                      jjCheckNAddStates(31, 33);
-                  }
                   break;
                case 42:
-                  if ((0x280000000000L & l) != 0L) {
+                  if ((0x280000000000L & l) != 0L)
                      jjCheckNAdd(43);
-                  }
                   break;
                case 43:
-                  if ((0x3ff000000000000L & l) != 0L) {
+                  if ((0x3ff000000000000L & l) != 0L)
                      jjCheckNAddTwoStates(43, 8);
-                  }
                   break;
                case 44:
-                  if (curChar != 48) {
+                  if (curChar != 48)
                      break;
-                  }
-                  if (kind > 59) {
+                  if (kind > 59)
                      kind = 59;
-                  }
-                  jjCheckNAddStates(15, 17);
+                  jjCheckNAddStates(18, 20);
                   break;
                case 46:
-                  if ((0x3ff000000000000L & l) == 0L) {
+                  if ((0x3ff000000000000L & l) == 0L)
                      break;
-                  }
-                  if (kind > 59) {
+                  if (kind > 59)
                      kind = 59;
-                  }
                   jjCheckNAddTwoStates(46, 2);
                   break;
                case 47:
-                  if ((0xff000000000000L & l) == 0L) {
+                  if ((0xff000000000000L & l) == 0L)
                      break;
-                  }
-                  if (kind > 59) {
+                  if (kind > 59)
                      kind = 59;
-                  }
                   jjCheckNAddTwoStates(47, 2);
                   break;
                case 48:
-                  if (curChar == 47) {
-                     jjAddStates(7, 9);
-                  }
+                  if (curChar == 47)
+                     jjAddStates(10, 12);
                   break;
                case 50:
-                  if ((0xffffffffffffdbffL & l) != 0L) {
-                     jjCheckNAddStates(18, 20);
-                  }
+                  if ((0xffffffffffffdbffL & l) != 0L)
+                     jjCheckNAddStates(0, 2);
                   break;
                case 51:
-                  if ((0x2400L & l) != 0L && kind > 6) {
+                  if ((0x2400L & l) != 0L && kind > 6)
                      kind = 6;
-                  }
                   break;
                case 52:
-                  if (curChar == 10 && kind > 6) {
+                  if (curChar == 10 && kind > 6)
                      kind = 6;
-                  }
                   break;
                case 53:
-                  if (curChar == 13) {
+                  if (curChar == 13)
                      jjstateSet[jjnewStateCnt++] = 52;
-                  }
                   break;
                case 54:
-                  if (curChar == 42) {
+                  if (curChar == 42)
                      jjCheckNAddTwoStates(55, 56);
-                  }
                   break;
                case 55:
-                  if ((0xfffffbffffffffffL & l) != 0L) {
+                  if ((0xfffffbffffffffffL & l) != 0L)
                      jjCheckNAddTwoStates(55, 56);
-                  }
                   break;
                case 56:
-                  if (curChar == 42) {
+                  if (curChar == 42)
                      jjCheckNAddStates(34, 36);
-                  }
                   break;
                case 57:
-                  if ((0xffff7bffffffffffL & l) != 0L) {
+                  if ((0xffff7bffffffffffL & l) != 0L)
                      jjCheckNAddTwoStates(58, 56);
-                  }
                   break;
                case 58:
-                  if ((0xfffffbffffffffffL & l) != 0L) {
+                  if ((0xfffffbffffffffffL & l) != 0L)
                      jjCheckNAddTwoStates(58, 56);
-                  }
                   break;
                case 59:
-                  if (curChar == 47 && kind > 7) {
+                  if (curChar == 47 && kind > 7)
                      kind = 7;
-                  }
                   break;
                case 60:
-                  if (curChar == 42) {
+                  if (curChar == 42)
                      jjstateSet[jjnewStateCnt++] = 54;
-                  }
                   break;
                case 61:
-                  if (curChar == 42) {
+                  if (curChar == 42)
                      jjCheckNAddTwoStates(62, 63);
-                  }
                   break;
                case 62:
-                  if ((0xfffffbffffffffffL & l) != 0L) {
+                  if ((0xfffffbffffffffffL & l) != 0L)
                      jjCheckNAddTwoStates(62, 63);
-                  }
                   break;
                case 63:
-                  if (curChar == 42) {
+                  if (curChar == 42)
                      jjCheckNAddStates(37, 39);
-                  }
                   break;
                case 64:
-                  if ((0xffff7bffffffffffL & l) != 0L) {
+                  if ((0xffff7bffffffffffL & l) != 0L)
                      jjCheckNAddTwoStates(65, 63);
-                  }
                   break;
                case 65:
-                  if ((0xfffffbffffffffffL & l) != 0L) {
+                  if ((0xfffffbffffffffffL & l) != 0L)
                      jjCheckNAddTwoStates(65, 63);
-                  }
                   break;
                case 66:
-                  if (curChar == 47 && kind > 8) {
+                  if (curChar == 47 && kind > 8)
                      kind = 8;
-                  }
                   break;
                default : break;
             }
@@ -1357,97 +1188,79 @@
       else if (curChar < 128)
       {
          long l = 1L << (curChar & 077);
-         //MatchLoop
          do
          {
             switch(jjstateSet[--i])
             {
                case 0:
                case 28:
-                  if ((0x7fffffe87fffffeL & l) == 0L) {
+                  if ((0x7fffffe87fffffeL & l) == 0L)
                      break;
-                  }
-                  if (kind > 67) {
+                  if (kind > 67)
                      kind = 67;
-                  }
                   jjCheckNAdd(28);
                   break;
                case 2:
-                  if ((0x100000001000L & l) != 0L && kind > 59) {
+                  if ((0x100000001000L & l) != 0L && kind > 59)
                      kind = 59;
-                  }
                   break;
                case 5:
-                  if ((0x2000000020L & l) != 0L) {
+                  if ((0x2000000020L & l) != 0L)
                      jjAddStates(40, 41);
-                  }
                   break;
                case 8:
-                  if ((0x5000000050L & l) != 0L && kind > 63) {
+                  if ((0x5000000050L & l) != 0L && kind > 63)
                      kind = 63;
-                  }
                   break;
                case 10:
-                  if ((0xffffffffefffffffL & l) != 0L) {
+                  if ((0xffffffffefffffffL & l) != 0L)
                      jjCheckNAdd(11);
-                  }
                   break;
                case 12:
-                  if (curChar == 92) {
+                  if (curChar == 92)
                      jjAddStates(42, 44);
-                  }
                   break;
                case 13:
-                  if ((0x14404410000000L & l) != 0L) {
+                  if ((0x14404410000000L & l) != 0L)
                      jjCheckNAdd(11);
-                  }
                   break;
                case 19:
-                  if ((0xffffffffefffffffL & l) != 0L) {
-                     jjCheckNAddStates(10, 12);
-                  }
+                  if ((0xffffffffefffffffL & l) != 0L)
+                     jjCheckNAddStates(13, 15);
                   break;
                case 20:
-                  if (curChar == 92) {
+                  if (curChar == 92)
                      jjAddStates(45, 47);
-                  }
                   break;
                case 21:
-                  if ((0x14404410000000L & l) != 0L) {
-                     jjCheckNAddStates(10, 12);
-                  }
+                  if ((0x14404410000000L & l) != 0L)
+                     jjCheckNAddStates(13, 15);
                   break;
                case 33:
-                  if ((0x2000000020L & l) != 0L) {
+                  if ((0x2000000020L & l) != 0L)
                      jjAddStates(48, 49);
-                  }
                   break;
                case 37:
-                  if ((0x2000000020L & l) != 0L) {
+                  if ((0x2000000020L & l) != 0L)
                      jjAddStates(50, 51);
-                  }
                   break;
                case 41:
-                  if ((0x2000000020L & l) != 0L) {
+                  if ((0x2000000020L & l) != 0L)
                      jjAddStates(52, 53);
-                  }
                   break;
                case 45:
-                  if ((0x100000001000000L & l) != 0L) {
+                  if ((0x100000001000000L & l) != 0L)
                      jjCheckNAdd(46);
-                  }
                   break;
                case 46:
-                  if ((0x7e0000007eL & l) == 0L) {
+                  if ((0x7e0000007eL & l) == 0L)
                      break;
-                  }
-                  if (kind > 59) {
+                  if (kind > 59)
                      kind = 59;
-                  }
                   jjCheckNAddTwoStates(46, 2);
                   break;
                case 50:
-                  jjAddStates(18, 20);
+                  jjAddStates(0, 2);
                   break;
                case 55:
                   jjCheckNAddTwoStates(55, 56);
@@ -1474,57 +1287,47 @@
          long l1 = 1L << (hiByte & 077);
          int i2 = (curChar & 0xff) >> 6;
          long l2 = 1L << (curChar & 077);
-         //MatchLoop
          do
          {
             switch(jjstateSet[--i])
             {
                case 0:
                case 28:
-                  if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) {
+                  if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
                      break;
-                  }
-                  if (kind > 67) {
+                  if (kind > 67)
                      kind = 67;
-                  }
                   jjCheckNAdd(28);
                   break;
                case 10:
-                  if (jjCanMove_0(hiByte, i1, i2, l1, l2)) {
+                  if (jjCanMove_0(hiByte, i1, i2, l1, l2))
                      jjstateSet[jjnewStateCnt++] = 11;
-                  }
                   break;
                case 19:
-                  if (jjCanMove_0(hiByte, i1, i2, l1, l2)) {
-                     jjAddStates(10, 12);
-                  }
+                  if (jjCanMove_0(hiByte, i1, i2, l1, l2))
+                     jjAddStates(13, 15);
                   break;
                case 50:
-                  if (jjCanMove_0(hiByte, i1, i2, l1, l2)) {
-                     jjAddStates(18, 20);
-                  }
+                  if (jjCanMove_0(hiByte, i1, i2, l1, l2))
+                     jjAddStates(0, 2);
                   break;
                case 55:
-                  if (jjCanMove_0(hiByte, i1, i2, l1, l2)) {
+                  if (jjCanMove_0(hiByte, i1, i2, l1, l2))
                      jjCheckNAddTwoStates(55, 56);
-                  }
                   break;
                case 57:
                case 58:
-                  if (jjCanMove_0(hiByte, i1, i2, l1, l2)) {
+                  if (jjCanMove_0(hiByte, i1, i2, l1, l2))
                      jjCheckNAddTwoStates(58, 56);
-                  }
                   break;
                case 62:
-                  if (jjCanMove_0(hiByte, i1, i2, l1, l2)) {
+                  if (jjCanMove_0(hiByte, i1, i2, l1, l2))
                      jjCheckNAddTwoStates(62, 63);
-                  }
                   break;
                case 64:
                case 65:
-                  if (jjCanMove_0(hiByte, i1, i2, l1, l2)) {
+                  if (jjCanMove_0(hiByte, i1, i2, l1, l2))
                      jjCheckNAddTwoStates(65, 63);
-                  }
                   break;
                default : break;
             }
@@ -1537,16 +1340,15 @@
          kind = 0x7fffffff;
       }
       ++curPos;
-      if ((i = jjnewStateCnt) == (startsAt = 67 - (jjnewStateCnt = startsAt))) {
+      if ((i = jjnewStateCnt) == (startsAt = 67 - (jjnewStateCnt = startsAt)))
          return curPos;
-      }
       try { curChar = input_stream.readChar(); }
       catch(java.io.IOException e) { return curPos; }
    }
 }
 static final int[] jjnextStates = {
-   30, 31, 36, 37, 40, 41, 8, 49, 60, 61, 19, 20, 22, 10, 12, 45,
-   47, 2, 50, 51, 53, 4, 5, 8, 19, 20, 24, 22, 32, 33, 8, 40,
+   50, 51, 53, 30, 31, 36, 37, 40, 41, 8, 49, 60, 61, 19, 20, 22,
+   10, 12, 45, 47, 2, 4, 5, 8, 19, 20, 24, 22, 32, 33, 8, 40,
    41, 8, 56, 57, 59, 63, 64, 66, 6, 7, 13, 14, 16, 21, 23, 25,
    34, 35, 38, 39, 42, 43,
 };
@@ -1557,9 +1359,8 @@
       case 0:
          return ((jjbitVec2[i2] & l2) != 0L);
       default :
-         if ((jjbitVec0[i1] & l1) != 0L) {
+         if ((jjbitVec0[i1] & l1) != 0L)
             return true;
-         }
          return false;
    }
 }
@@ -1578,12 +1379,13 @@
       case 61:
          return ((jjbitVec8[i2] & l2) != 0L);
       default :
-         if ((jjbitVec3[i1] & l1) != 0L) {
+         if ((jjbitVec3[i1] & l1) != 0L)
             return true;
-         }
          return false;
    }
 }
+
+/** Token literal values. */
 public static final String[] jjstrLiteralImages = {
 "", null, null, null, null, null, null, null, null,
 "\141\142\163\164\162\141\143\164", "\142\157\157\154\145\141\156", "\142\162\145\141\153", "\142\171\164\145",
@@ -1606,6 +1408,8 @@
 "\46\46", "\53\53", "\55\55", "\53", "\55", "\52", "\57", "\46", "\174", "\136", "\45",
 "\74\74", "\76\76", "\76\76\76", "\53\75", "\55\75", "\52\75", "\57\75", "\46\75",
 "\174\75", "\136\75", "\45\75", "\74\74\75", "\76\76\75", "\76\76\76\75", };
+
+/** Lexer state names. */
 public static final String[] lexStateNames = {
    "DEFAULT",
 };
@@ -1618,61 +1422,76 @@
 static final long[] jjtoSpecial = {
    0x1c0L, 0x0L,
 };
-private ASCII_UCodeESC_CharStream input_stream;
+protected JavaCharStream input_stream;
 private final int[] jjrounds = new int[67];
 private final int[] jjstateSet = new int[134];
 protected char curChar;
-public ExpressionParserTokenManager(ASCII_UCodeESC_CharStream stream)
-{
-   if (ASCII_UCodeESC_CharStream.staticFlag) {
+/** Constructor. */
+public ExpressionParserTokenManager(JavaCharStream stream){
+   if (JavaCharStream.staticFlag)
       throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
-   }
    input_stream = stream;
 }
-public ExpressionParserTokenManager(ASCII_UCodeESC_CharStream stream, int lexState)
-{
+
+/** Constructor. */
+public ExpressionParserTokenManager(JavaCharStream stream, int lexState){
    this(stream);
    SwitchTo(lexState);
 }
-public void ReInit(ASCII_UCodeESC_CharStream stream)
+
+/** Reinitialise parser. */
+public void ReInit(JavaCharStream stream)
 {
    jjmatchedPos = jjnewStateCnt = 0;
    curLexState = defaultLexState;
    input_stream = stream;
    ReInitRounds();
 }
-private final void ReInitRounds()
+private void ReInitRounds()
 {
    int i;
    jjround = 0x80000001;
-   for (i = 67; i-- > 0;) {
+   for (i = 67; i-- > 0;)
       jjrounds[i] = 0x80000000;
 }
-}
-public void ReInit(ASCII_UCodeESC_CharStream stream, int lexState)
+
+/** Reinitialise parser. */
+public void ReInit(JavaCharStream stream, int lexState)
 {
    ReInit(stream);
    SwitchTo(lexState);
 }
+
+/** Switch to specified lex state. */
 public void SwitchTo(int lexState)
 {
-   if (lexState >= 1 || lexState < 0) {
+   if (lexState >= 1 || lexState < 0)
       throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
-   } else {
+   else
       curLexState = lexState;
 }
-}
 
-private final Token jjFillToken()
+protected Token jjFillToken()
 {
-   Token t = Token.newToken(jjmatchedKind);
-   t.kind = jjmatchedKind;
+   final Token t;
+   final String curTokenImage;
+   final int beginLine;
+   final int endLine;
+   final int beginColumn;
+   final int endColumn;
    String im = jjstrLiteralImages[jjmatchedKind];
-   t.image = (im == null) ? input_stream.GetImage() : im;
-   t.beginLine = input_stream.getBeginLine();
-   t.beginColumn = input_stream.getBeginColumn();
-   t.endLine = input_stream.getEndLine();
-   t.endColumn = input_stream.getEndColumn();
+   curTokenImage = (im == null) ? input_stream.GetImage() : im;
+   beginLine = input_stream.getBeginLine();
+   beginColumn = input_stream.getBeginColumn();
+   endLine = input_stream.getEndLine();
+   endColumn = input_stream.getEndColumn();
+   t = Token.newToken(jjmatchedKind, curTokenImage);
+
+   t.beginLine = beginLine;
+   t.endLine = endLine;
+   t.beginColumn = beginColumn;
+   t.endColumn = endColumn;
+
    return t;
 }
 
@@ -1683,7 +1502,8 @@
 int jjmatchedPos;
 int jjmatchedKind;
 
-public final Token getNextToken()
+/** Get the next Token. */
+public Token getNextToken()
 {
   Token specialToken = null;
   Token matchedToken;
@@ -1704,20 +1524,18 @@
       return matchedToken;
    }
 
-   try {
-      while (curChar <= 32 && (0x100003600L & (1L << curChar)) != 0L) {
+   try { input_stream.backup(0);
+      while (curChar <= 32 && (0x100003600L & (1L << curChar)) != 0L)
          curChar = input_stream.BeginToken();
    }
-   }
    catch (java.io.IOException e1) { continue EOFLoop; }
    jjmatchedKind = 0x7fffffff;
    jjmatchedPos = 0;
    curPos = jjMoveStringLiteralDfa0_0();
    if (jjmatchedKind != 0x7fffffff)
    {
-      if (jjmatchedPos + 1 < curPos) {
+      if (jjmatchedPos + 1 < curPos)
          input_stream.backup(curPos - jjmatchedPos - 1);
-      }
       if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
       {
          matchedToken = jjFillToken();
@@ -1729,9 +1547,9 @@
          if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
          {
             matchedToken = jjFillToken();
-            if (specialToken == null) {
+            if (specialToken == null)
                specialToken = matchedToken;
-            } else
+            else
             {
                matchedToken.specialToken = specialToken;
                specialToken = (specialToken.next = matchedToken);
@@ -1751,9 +1569,9 @@
       if (curChar == '\n' || curChar == '\r') {
          error_line++;
          error_column = 0;
-      } else {
+      }
+      else
          error_column++;
-      }
    }
    if (!EOFSeen) {
       input_stream.backup(1);
@@ -1763,4 +1581,31 @@
   }
 }
 
+private void jjCheckNAdd(int state)
+{
+   if (jjrounds[state] != jjround)
+   {
+      jjstateSet[jjnewStateCnt++] = state;
+      jjrounds[state] = jjround;
+   }
 }
+private void jjAddStates(int start, int end)
+{
+   do {
+      jjstateSet[jjnewStateCnt++] = jjnextStates[start];
+   } while (start++ != end);
+}
+private void jjCheckNAddTwoStates(int state1, int state2)
+{
+   jjCheckNAdd(state1);
+   jjCheckNAdd(state2);
+}
+
+private void jjCheckNAddStates(int start, int end)
+{
+   do {
+      jjCheckNAdd(jjnextStates[start]);
+   } while (start++ != end);
+}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/JavaCharStream.java	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,642 @@
+/*
+ * Copyright (c) 1999, 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.
+ */
+
+/* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 5.0 */
+/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
+package com.sun.tools.example.debug.expr;
+
+/**
+ * An implementation of interface CharStream, where the stream is assumed to
+ * contain only ASCII characters (with java-like unicode escape processing).
+ */
+
+public
+class JavaCharStream
+{
+  /** Whether parser is static. */
+  public static final boolean staticFlag = false;
+
+  static final int hexval(char c) throws java.io.IOException {
+    switch(c)
+    {
+       case '0' :
+          return 0;
+       case '1' :
+          return 1;
+       case '2' :
+          return 2;
+       case '3' :
+          return 3;
+       case '4' :
+          return 4;
+       case '5' :
+          return 5;
+       case '6' :
+          return 6;
+       case '7' :
+          return 7;
+       case '8' :
+          return 8;
+       case '9' :
+          return 9;
+
+       case 'a' :
+       case 'A' :
+          return 10;
+       case 'b' :
+       case 'B' :
+          return 11;
+       case 'c' :
+       case 'C' :
+          return 12;
+       case 'd' :
+       case 'D' :
+          return 13;
+       case 'e' :
+       case 'E' :
+          return 14;
+       case 'f' :
+       case 'F' :
+          return 15;
+    }
+
+    throw new java.io.IOException(); // Should never come here
+  }
+
+/** Position in buffer. */
+  public int bufpos = -1;
+  int bufsize;
+  int available;
+  int tokenBegin;
+  protected int bufline[];
+  protected int bufcolumn[];
+
+  protected int column = 0;
+  protected int line = 1;
+
+  protected boolean prevCharIsCR = false;
+  protected boolean prevCharIsLF = false;
+
+  protected java.io.Reader inputStream;
+
+  protected char[] nextCharBuf;
+  protected char[] buffer;
+  protected int maxNextCharInd = 0;
+  protected int nextCharInd = -1;
+  protected int inBuf = 0;
+  protected int tabSize = 8;
+
+  protected void setTabSize(int i) { tabSize = i; }
+  protected int getTabSize(int i) { return tabSize; }
+
+  protected void ExpandBuff(boolean wrapAround)
+  {
+    char[] newbuffer = new char[bufsize + 2048];
+    int newbufline[] = new int[bufsize + 2048];
+    int newbufcolumn[] = new int[bufsize + 2048];
+
+    try
+    {
+      if (wrapAround)
+      {
+        System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+        System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos);
+        buffer = newbuffer;
+
+        System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+        System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
+        bufline = newbufline;
+
+        System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+        System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
+        bufcolumn = newbufcolumn;
+
+        bufpos += (bufsize - tokenBegin);
+    }
+    else
+    {
+        System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+        buffer = newbuffer;
+
+        System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+        bufline = newbufline;
+
+        System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+        bufcolumn = newbufcolumn;
+
+        bufpos -= tokenBegin;
+      }
+    }
+    catch (Throwable t)
+    {
+      throw new Error(t.getMessage());
+    }
+
+    available = (bufsize += 2048);
+    tokenBegin = 0;
+  }
+
+  protected void FillBuff() throws java.io.IOException
+  {
+    int i;
+    if (maxNextCharInd == 4096)
+      maxNextCharInd = nextCharInd = 0;
+
+    try {
+      if ((i = inputStream.read(nextCharBuf, maxNextCharInd,
+                                          4096 - maxNextCharInd)) == -1)
+      {
+        inputStream.close();
+        throw new java.io.IOException();
+      }
+      else
+         maxNextCharInd += i;
+      return;
+    }
+    catch(java.io.IOException e) {
+      if (bufpos != 0)
+      {
+        --bufpos;
+        backup(0);
+      }
+      else
+      {
+        bufline[bufpos] = line;
+        bufcolumn[bufpos] = column;
+      }
+      throw e;
+    }
+  }
+
+  protected char ReadByte() throws java.io.IOException
+  {
+    if (++nextCharInd >= maxNextCharInd)
+      FillBuff();
+
+    return nextCharBuf[nextCharInd];
+  }
+
+/** @return starting character for token. */
+  public char BeginToken() throws java.io.IOException
+  {
+    if (inBuf > 0)
+    {
+      --inBuf;
+
+      if (++bufpos == bufsize)
+        bufpos = 0;
+
+      tokenBegin = bufpos;
+      return buffer[bufpos];
+    }
+
+    tokenBegin = 0;
+    bufpos = -1;
+
+    return readChar();
+  }
+
+  protected void AdjustBuffSize()
+  {
+    if (available == bufsize)
+    {
+      if (tokenBegin > 2048)
+      {
+        bufpos = 0;
+        available = tokenBegin;
+      }
+      else
+        ExpandBuff(false);
+    }
+    else if (available > tokenBegin)
+      available = bufsize;
+    else if ((tokenBegin - available) < 2048)
+      ExpandBuff(true);
+    else
+      available = tokenBegin;
+  }
+
+  protected void UpdateLineColumn(char c)
+  {
+    column++;
+
+    if (prevCharIsLF)
+    {
+      prevCharIsLF = false;
+      line += (column = 1);
+    }
+    else if (prevCharIsCR)
+    {
+      prevCharIsCR = false;
+      if (c == '\n')
+      {
+        prevCharIsLF = true;
+      }
+      else
+        line += (column = 1);
+    }
+
+    switch (c)
+    {
+      case '\r' :
+        prevCharIsCR = true;
+        break;
+      case '\n' :
+        prevCharIsLF = true;
+        break;
+      case '\t' :
+        column--;
+        column += (tabSize - (column % tabSize));
+        break;
+      default :
+        break;
+    }
+
+    bufline[bufpos] = line;
+    bufcolumn[bufpos] = column;
+  }
+
+/** Read a character. */
+  public char readChar() throws java.io.IOException
+  {
+    if (inBuf > 0)
+    {
+      --inBuf;
+
+      if (++bufpos == bufsize)
+        bufpos = 0;
+
+      return buffer[bufpos];
+    }
+
+    char c;
+
+    if (++bufpos == available)
+      AdjustBuffSize();
+
+    if ((buffer[bufpos] = c = ReadByte()) == '\\')
+    {
+      UpdateLineColumn(c);
+
+      int backSlashCnt = 1;
+
+      for (;;) // Read all the backslashes
+      {
+        if (++bufpos == available)
+          AdjustBuffSize();
+
+        try
+        {
+          if ((buffer[bufpos] = c = ReadByte()) != '\\')
+          {
+            UpdateLineColumn(c);
+            // found a non-backslash char.
+            if ((c == 'u') && ((backSlashCnt & 1) == 1))
+            {
+              if (--bufpos < 0)
+                bufpos = bufsize - 1;
+
+              break;
+            }
+
+            backup(backSlashCnt);
+            return '\\';
+          }
+        }
+        catch(java.io.IOException e)
+        {
+      // We are returning one backslash so we should only backup (count-1)
+          if (backSlashCnt > 1)
+            backup(backSlashCnt-1);
+
+          return '\\';
+        }
+
+        UpdateLineColumn(c);
+        backSlashCnt++;
+      }
+
+      // Here, we have seen an odd number of backslash's followed by a 'u'
+      try
+      {
+        while ((c = ReadByte()) == 'u')
+          ++column;
+
+        buffer[bufpos] = c = (char)(hexval(c) << 12 |
+                                    hexval(ReadByte()) << 8 |
+                                    hexval(ReadByte()) << 4 |
+                                    hexval(ReadByte()));
+
+        column += 4;
+      }
+      catch(java.io.IOException e)
+      {
+        throw new Error("Invalid escape character at line " + line +
+                                         " column " + column + ".");
+      }
+
+      if (backSlashCnt == 1)
+        return c;
+      else
+      {
+        backup(backSlashCnt - 1);
+        return '\\';
+      }
+    }
+    else
+    {
+      UpdateLineColumn(c);
+      return c;
+    }
+  }
+
+  @Deprecated
+  /**
+   * @deprecated
+   * @see #getEndColumn
+   */
+  public int getColumn() {
+    return bufcolumn[bufpos];
+  }
+
+  @Deprecated
+  /**
+   * @deprecated
+   * @see #getEndLine
+   */
+  public int getLine() {
+    return bufline[bufpos];
+  }
+
+/** Get end column. */
+  public int getEndColumn() {
+    return bufcolumn[bufpos];
+  }
+
+/** Get end line. */
+  public int getEndLine() {
+    return bufline[bufpos];
+  }
+
+/** @return column of token start */
+  public int getBeginColumn() {
+    return bufcolumn[tokenBegin];
+  }
+
+/** @return line number of token start */
+  public int getBeginLine() {
+    return bufline[tokenBegin];
+  }
+
+/** Retreat. */
+  public void backup(int amount) {
+
+    inBuf += amount;
+    if ((bufpos -= amount) < 0)
+      bufpos += bufsize;
+  }
+
+/** Constructor. */
+  public JavaCharStream(java.io.Reader dstream,
+                 int startline, int startcolumn, int buffersize)
+  {
+    inputStream = dstream;
+    line = startline;
+    column = startcolumn - 1;
+
+    available = bufsize = buffersize;
+    buffer = new char[buffersize];
+    bufline = new int[buffersize];
+    bufcolumn = new int[buffersize];
+    nextCharBuf = new char[4096];
+  }
+
+/** Constructor. */
+  public JavaCharStream(java.io.Reader dstream,
+                                        int startline, int startcolumn)
+  {
+    this(dstream, startline, startcolumn, 4096);
+  }
+
+/** Constructor. */
+  public JavaCharStream(java.io.Reader dstream)
+  {
+    this(dstream, 1, 1, 4096);
+  }
+/** Reinitialise. */
+  public void ReInit(java.io.Reader dstream,
+                 int startline, int startcolumn, int buffersize)
+  {
+    inputStream = dstream;
+    line = startline;
+    column = startcolumn - 1;
+
+    if (buffer == null || buffersize != buffer.length)
+    {
+      available = bufsize = buffersize;
+      buffer = new char[buffersize];
+      bufline = new int[buffersize];
+      bufcolumn = new int[buffersize];
+      nextCharBuf = new char[4096];
+    }
+    prevCharIsLF = prevCharIsCR = false;
+    tokenBegin = inBuf = maxNextCharInd = 0;
+    nextCharInd = bufpos = -1;
+  }
+
+/** Reinitialise. */
+  public void ReInit(java.io.Reader dstream,
+                                        int startline, int startcolumn)
+  {
+    ReInit(dstream, startline, startcolumn, 4096);
+  }
+
+/** Reinitialise. */
+  public void ReInit(java.io.Reader dstream)
+  {
+    ReInit(dstream, 1, 1, 4096);
+  }
+/** Constructor. */
+  public JavaCharStream(java.io.InputStream dstream, String encoding, int startline,
+  int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
+  {
+    this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
+  }
+
+/** Constructor. */
+  public JavaCharStream(java.io.InputStream dstream, int startline,
+  int startcolumn, int buffersize)
+  {
+    this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+  }
+
+/** Constructor. */
+  public JavaCharStream(java.io.InputStream dstream, String encoding, int startline,
+                        int startcolumn) throws java.io.UnsupportedEncodingException
+  {
+    this(dstream, encoding, startline, startcolumn, 4096);
+  }
+
+/** Constructor. */
+  public JavaCharStream(java.io.InputStream dstream, int startline,
+                        int startcolumn)
+  {
+    this(dstream, startline, startcolumn, 4096);
+  }
+
+/** Constructor. */
+  public JavaCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
+  {
+    this(dstream, encoding, 1, 1, 4096);
+  }
+
+/** Constructor. */
+  public JavaCharStream(java.io.InputStream dstream)
+  {
+    this(dstream, 1, 1, 4096);
+  }
+
+/** Reinitialise. */
+  public void ReInit(java.io.InputStream dstream, String encoding, int startline,
+  int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
+  {
+    ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
+  }
+
+/** Reinitialise. */
+  public void ReInit(java.io.InputStream dstream, int startline,
+  int startcolumn, int buffersize)
+  {
+    ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
+  }
+/** Reinitialise. */
+  public void ReInit(java.io.InputStream dstream, String encoding, int startline,
+                     int startcolumn) throws java.io.UnsupportedEncodingException
+  {
+    ReInit(dstream, encoding, startline, startcolumn, 4096);
+  }
+/** Reinitialise. */
+  public void ReInit(java.io.InputStream dstream, int startline,
+                     int startcolumn)
+  {
+    ReInit(dstream, startline, startcolumn, 4096);
+  }
+/** Reinitialise. */
+  public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
+  {
+    ReInit(dstream, encoding, 1, 1, 4096);
+  }
+
+/** Reinitialise. */
+  public void ReInit(java.io.InputStream dstream)
+  {
+    ReInit(dstream, 1, 1, 4096);
+  }
+
+  /** @return token image as String */
+  public String GetImage()
+  {
+    if (bufpos >= tokenBegin)
+      return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
+    else
+      return new String(buffer, tokenBegin, bufsize - tokenBegin) +
+                              new String(buffer, 0, bufpos + 1);
+  }
+
+  /** @return suffix */
+  public char[] GetSuffix(int len)
+  {
+    char[] ret = new char[len];
+
+    if ((bufpos + 1) >= len)
+      System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
+    else
+    {
+      System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
+                                                        len - bufpos - 1);
+      System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
+    }
+
+    return ret;
+  }
+
+  /** Set buffers back to null when finished. */
+  public void Done()
+  {
+    nextCharBuf = null;
+    buffer = null;
+    bufline = null;
+    bufcolumn = null;
+  }
+
+  /**
+   * Method to adjust line and column numbers for the start of a token.
+   */
+  public void adjustBeginLineColumn(int newLine, int newCol)
+  {
+    int start = tokenBegin;
+    int len;
+
+    if (bufpos >= tokenBegin)
+    {
+      len = bufpos - tokenBegin + inBuf + 1;
+    }
+    else
+    {
+      len = bufsize - tokenBegin + bufpos + 1 + inBuf;
+    }
+
+    int i = 0, j = 0, k = 0;
+    int nextColDiff = 0, columnDiff = 0;
+
+    while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
+    {
+      bufline[j] = newLine;
+      nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
+      bufcolumn[j] = newCol + columnDiff;
+      columnDiff = nextColDiff;
+      i++;
+    }
+
+    if (i < len)
+    {
+      bufline[j] = newLine++;
+      bufcolumn[j] = newCol + columnDiff;
+
+      while (i++ < len)
+      {
+        if (bufline[j = start % bufsize] != bufline[++start % bufsize])
+          bufline[j] = newLine++;
+        else
+          bufline[j] = newLine;
+      }
+    }
+
+    line = bufline[j];
+    column = bufcolumn[j];
+  }
+
+}
+/* JavaCC - OriginalChecksum=17a580b005f6229e8445521923427bab (do not edit this line) */
--- a/jdk/src/share/classes/com/sun/tools/example/debug/expr/LValue.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/LValue.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -740,7 +740,30 @@
     }
 
     static LValue makeInteger(VirtualMachine vm, Token token) {
-        return make(vm, Integer.parseInt(token.image));
+        String image = token.image;
+
+        // Here we have to deal with the fact that an INTEGER_LITERAL
+        // can be DECIMAL_LITERAL, HEX_LITERAL or OCTAL_LITERAL. All of these
+        // can have an optional "L" or "l" at the end signifying that it is
+        // a long value. Otherwise, we treat values that are in range for an
+        // int as int and anything else as long.
+
+        if (image.endsWith("L") || image.endsWith("l")) {
+          // This is a long without doubt - drop the final "Ll" and decode
+          image = image.substring(0, image.length() - 1);
+          return make(vm, Long.decode(image));
+        }
+
+        long longValue = Long.decode(image);
+        int intValue = (int) longValue;
+        if (intValue == longValue) {
+          // the value fits in an integer, lets return it as an integer
+          return make(vm, intValue);
+        }
+        else {
+          // otherwise treat it as a long
+          return make(vm, longValue);
+        }
     }
 
     static LValue makeShort(VirtualMachine vm, Token token) {
@@ -1062,4 +1085,76 @@
             return make(vm, res);
         }
     }
+
+    static LValue operation(VirtualMachine vm, Token token, LValue rightL,
+            ExpressionParser.GetFrame frameGetter)
+            throws ParseException {
+        String op = token.image;
+        Value right = rightL.interiorGetValue();
+        if (right instanceof ObjectReference) {
+            throw new ParseException("Invalid operation '" + op
+                    + "' on an Object");
+        }
+        if (right instanceof BooleanValue) {
+            if (op.equals("!")) {
+                boolean rr = ((BooleanValue) right).value();
+                return make(vm, !rr);
+            }
+            throw new ParseException("Invalid operation '" + op
+                    + "' on a Boolean");
+        }
+        // from here on, we know it is a integer kind of type
+        PrimitiveValue primRight = (PrimitiveValue) right;
+        if (primRight instanceof DoubleValue) {
+            double rr = primRight.doubleValue();
+            double res;
+            if (op.equals("+")) {
+                res = rr;
+            } else if (op.equals("-")) {
+                res = -rr;
+            } else {
+                throw new ParseException("Unknown operation: " + op);
+            }
+            return make(vm, res);
+        }
+        if (primRight instanceof FloatValue) {
+            float rr = primRight.floatValue();
+            float res;
+            if (op.equals("+")) {
+                res = rr;
+            } else if (op.equals("-")) {
+                res = -rr;
+            } else {
+                throw new ParseException("Unknown operation: " + op);
+            }
+            return make(vm, res);
+        }
+        if (primRight instanceof LongValue) {
+            long rr = primRight.longValue();
+            long res;
+            if (op.equals("+")) {
+                res = rr;
+            } else if (op.equals("-")) {
+                res = -rr;
+            } else if (op.equals("~")) {
+                res = ~rr;
+            } else {
+                throw new ParseException("Unknown operation: " + op);
+            }
+            return make(vm, res);
+        } else {
+            int rr = primRight.intValue();
+            int res;
+            if (op.equals("+")) {
+                res = rr;
+            } else if (op.equals("-")) {
+                res = -rr;
+            } else if (op.equals("~")) {
+                res = ~rr;
+            } else {
+                throw new ParseException("Unknown operation: " + op);
+            }
+            return make(vm, res);
+        }
+    }
 }
--- a/jdk/src/share/classes/com/sun/tools/example/debug/expr/ParseException.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/ParseException.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -23,16 +23,8 @@
  * questions.
  */
 
-/*
- * This source code is provided to illustrate the usage of a given feature
- * or technique and has been deliberately simplified. Additional steps
- * required for a production-quality application, such as security checks,
- * input validation and proper error handling, might not be present in
- * this sample code.
- */
-
-
-/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 0.7pre6 */
+/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */
+/* JavaCCOptions:KEEP_LINE_COL=null */
 package com.sun.tools.example.debug.expr;
 
 /**
@@ -46,27 +38,25 @@
  */
 public class ParseException extends Exception {
 
-  private static final long serialVersionUID = 7978489144303647901L;
+  /**
+   * The version identifier for this Serializable class.
+   * Increment only if the <i>serialized</i> form of the
+   * class changes.
+   */
+  private static final long serialVersionUID = 1L;
 
   /**
    * This constructor is used by the method "generateParseException"
    * in the generated parser.  Calling this constructor generates
    * a new object of this type with the fields "currentToken",
-   * "expectedTokenSequences", and "tokenImage" set.  The boolean
-   * flag "specialConstructor" is also set to true to indicate that
-   * this constructor was used to create this object.
-   * This constructor calls its super class with the empty string
-   * to force the "toString" method of parent class "Throwable" to
-   * print the error message in the form:
-   *     ParseException: <result of getMessage>
+   * "expectedTokenSequences", and "tokenImage" set.
    */
   public ParseException(Token currentTokenVal,
                         int[][] expectedTokenSequencesVal,
                         String[] tokenImageVal
                        )
   {
-    super("");
-    specialConstructor = true;
+    super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal));
     currentToken = currentTokenVal;
     expectedTokenSequences = expectedTokenSequencesVal;
     tokenImage = tokenImageVal;
@@ -84,20 +74,13 @@
 
   public ParseException() {
     super();
-    specialConstructor = false;
   }
 
+  /** Constructor with message. */
   public ParseException(String message) {
     super(message);
-    specialConstructor = false;
   }
 
-  /**
-   * This variable determines which constructor was used to create
-   * this object and thereby affects the semantics of the
-   * "getMessage" method (see below).
-   */
-  protected boolean specialConstructor;
 
   /**
    * This is the last token that has been consumed successfully.  If
@@ -121,54 +104,52 @@
   public String[] tokenImage;
 
   /**
-   * This method has the standard behavior when this object has been
-   * created using the standard constructors.  Otherwise, it uses
-   * "currentToken" and "expectedTokenSequences" to generate a parse
+   * It uses "currentToken" and "expectedTokenSequences" to generate a parse
    * error message and returns it.  If this object has been created
    * due to a parse error, and you do not catch it (it gets thrown
-   * from the parser), then this method is called during the printing
-   * of the final stack trace, and hence the correct error message
+   * from the parser) the correct error message
    * gets displayed.
    */
-  @Override
-  public String getMessage() {
-    if (!specialConstructor) {
-      return super.getMessage();
-    }
-    String expected = "";
+  private static String initialise(Token currentToken,
+                           int[][] expectedTokenSequences,
+                           String[] tokenImage) {
+    String eol = System.getProperty("line.separator", "\n");
+    StringBuffer expected = new StringBuffer();
     int maxSize = 0;
-    for (int[] expectedTokenSequence : expectedTokenSequences) {
-      if (maxSize < expectedTokenSequence.length) {
-        maxSize = expectedTokenSequence.length;
+    for (int i = 0; i < expectedTokenSequences.length; i++) {
+      if (maxSize < expectedTokenSequences[i].length) {
+        maxSize = expectedTokenSequences[i].length;
       }
-      for (int j = 0; j < expectedTokenSequence.length; j++) {
-        expected += tokenImage[expectedTokenSequence[j]] + " ";
+      for (int j = 0; j < expectedTokenSequences[i].length; j++) {
+        expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' ');
       }
-      if (expectedTokenSequence[expectedTokenSequence.length - 1] != 0) {
-        expected += "...";
+      if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
+        expected.append("...");
       }
-      expected += eol + "    ";
+      expected.append(eol).append("    ");
     }
     String retval = "Encountered \"";
     Token tok = currentToken.next;
     for (int i = 0; i < maxSize; i++) {
-      if (i != 0) {
-         retval += " ";
-      }
+      if (i != 0) retval += " ";
       if (tok.kind == 0) {
         retval += tokenImage[0];
         break;
       }
+      retval += " " + tokenImage[tok.kind];
+      retval += " \"";
       retval += add_escapes(tok.image);
+      retval += " \"";
       tok = tok.next;
     }
-    retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn + "." + eol;
+    retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
+    retval += "." + eol;
     if (expectedTokenSequences.length == 1) {
       retval += "Was expecting:" + eol + "    ";
     } else {
       retval += "Was expecting one of:" + eol + "    ";
     }
-    retval += expected;
+    retval += expected.toString();
     return retval;
   }
 
@@ -182,7 +163,7 @@
    * when these raw version cannot be used as part of an ASCII
    * string literal.
    */
-  protected String add_escapes(String str) {
+  static String add_escapes(String str) {
       StringBuffer retval = new StringBuffer();
       char ch;
       for (int i = 0; i < str.length(); i++) {
@@ -228,3 +209,4 @@
    }
 
 }
+/* JavaCC - OriginalChecksum=3c9f049ed2bb6ade635c5bf58a386169 (do not edit this line) */
--- a/jdk/src/share/classes/com/sun/tools/example/debug/expr/Token.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/Token.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -23,23 +23,22 @@
  * questions.
  */
 
-/*
- * This source code is provided to illustrate the usage of a given feature
- * or technique and has been deliberately simplified. Additional steps
- * required for a production-quality application, such as security checks,
- * input validation and proper error handling, might not be present in
- * this sample code.
- */
-
-
-/* Generated By:JavaCC: Do not edit this line. Token.java Version 0.7pre3 */
+/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */
+/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
 package com.sun.tools.example.debug.expr;
 
 /**
  * Describes the input token stream.
  */
 
-public class Token {
+public class Token implements java.io.Serializable {
+
+  /**
+   * The version identifier for this Serializable class.
+   * Increment only if the <i>serialized</i> form of the
+   * class changes.
+   */
+  private static final long serialVersionUID = 1L;
 
   /**
    * An integer that describes the kind of this token.  This numbering
@@ -48,12 +47,14 @@
    */
   public int kind;
 
-  /**
-   * beginLine and beginColumn describe the position of the first character
-   * of this token; endLine and endColumn describe the position of the
-   * last character of this token.
-   */
-  public int beginLine, beginColumn, endLine, endColumn;
+  /** The line number of the first character of this Token. */
+  public int beginLine;
+  /** The column number of the first character of this Token. */
+  public int beginColumn;
+  /** The line number of the last character of this Token. */
+  public int endLine;
+  /** The column number of the last character of this Token. */
+  public int endColumn;
 
   /**
    * The string image of the token.
@@ -85,12 +86,45 @@
   public Token specialToken;
 
   /**
+   * An optional attribute value of the Token.
+   * Tokens which are not used as syntactic sugar will often contain
+   * meaningful values that will be used later on by the compiler or
+   * interpreter. This attribute value is often different from the image.
+   * Any subclass of Token that actually wants to return a non-null value can
+   * override this method as appropriate.
+   */
+  public Object getValue() {
+    return null;
+  }
+
+  /**
+   * No-argument constructor
+   */
+  public Token() {}
+
+  /**
+   * Constructs a new token for the specified Image.
+   */
+  public Token(int kind)
+  {
+    this(kind, null);
+  }
+
+  /**
+   * Constructs a new token for the specified Image and Kind.
+   */
+  public Token(int kind, String image)
+  {
+    this.kind = kind;
+    this.image = image;
+  }
+
+  /**
    * Returns the image.
    */
-  @Override
-  public final String toString()
+  public String toString()
   {
-     return image;
+    return image;
   }
 
   /**
@@ -98,19 +132,25 @@
    * can create and return subclass objects based on the value of ofKind.
    * Simply add the cases to the switch for all those special cases.
    * For example, if you have a subclass of Token called IDToken that
-   * you want to create if ofKind is ID, simlpy add something like :
+   * you want to create if ofKind is ID, simply add something like :
    *
-   *    case MyParserConstants.ID : return new IDToken();
+   *    case MyParserConstants.ID : return new IDToken(ofKind, image);
    *
    * to the following switch statement. Then you can cast matchedToken
-   * variable to the appropriate type and use it in your lexical actions.
+   * variable to the appropriate type and use sit in your lexical actions.
    */
-  public static final Token newToken(int ofKind)
+  public static Token newToken(int ofKind, String image)
   {
-     switch(ofKind)
-     {
-       default : return new Token();
-     }
+    switch(ofKind)
+    {
+      default : return new Token(ofKind, image);
+    }
+  }
+
+  public static Token newToken(int ofKind)
+  {
+    return newToken(ofKind, null);
   }
 
 }
+/* JavaCC - OriginalChecksum=1f1783cae2d4cc94bc225889842dfa8b (do not edit this line) */
--- a/jdk/src/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -23,148 +23,150 @@
  * questions.
  */
 
-/*
- * This source code is provided to illustrate the usage of a given feature
- * or technique and has been deliberately simplified. Additional steps
- * required for a production-quality application, such as security checks,
- * input validation and proper error handling, might not be present in
- * this sample code.
- */
-
-
-/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 0.7pre2 */
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */
+/* JavaCCOptions: */
 package com.sun.tools.example.debug.expr;
 
+/** Token Manager Error. */
 public class TokenMgrError extends Error
 {
-   /*
-    * Ordinals for various reasons why an Error of this type can be thrown.
-    */
 
-    private static final long serialVersionUID = -6236440836177601522L;
+  /**
+   * The version identifier for this Serializable class.
+   * Increment only if the <i>serialized</i> form of the
+   * class changes.
+   */
+  private static final long serialVersionUID = 1L;
 
-   /**
-    * Lexical error occurred.
-    */
-   static final int LEXICAL_ERROR = 0;
+  /*
+   * Ordinals for various reasons why an Error of this type can be thrown.
+   */
 
-   /**
-    * An attempt wass made to create a second instance of a static token manager.
-    */
-   static final int STATIC_LEXER_ERROR = 1;
+  /**
+   * Lexical error occurred.
+   */
+  static final int LEXICAL_ERROR = 0;
 
-   /**
-    * Tried to change to an invalid lexical state.
-    */
-   static final int INVALID_LEXICAL_STATE = 2;
+  /**
+   * An attempt was made to create a second instance of a static token manager.
+   */
+  static final int STATIC_LEXER_ERROR = 1;
+
+  /**
+   * Tried to change to an invalid lexical state.
+   */
+  static final int INVALID_LEXICAL_STATE = 2;
 
-   /**
-    * Detected (and bailed out of) an infinite loop in the token manager.
-    */
-   static final int LOOP_DETECTED = 3;
+  /**
+   * Detected (and bailed out of) an infinite loop in the token manager.
+   */
+  static final int LOOP_DETECTED = 3;
 
-   /**
-    * Indicates the reason why the exception is thrown. It will have
-    * one of the above 4 values.
-    */
-   int errorCode;
+  /**
+   * Indicates the reason why the exception is thrown. It will have
+   * one of the above 4 values.
+   */
+  int errorCode;
 
-   /**
-    * Replaces unprintable characters by their espaced (or unicode escaped)
-    * equivalents in the given string
-    */
-   protected static final String addEscapes(String str) {
-      StringBuffer retval = new StringBuffer();
-      char ch;
-      for (int i = 0; i < str.length(); i++) {
-        switch (str.charAt(i))
-        {
-           case 0 :
-              continue;
-           case '\b':
-              retval.append("\\b");
-              continue;
-           case '\t':
-              retval.append("\\t");
-              continue;
-           case '\n':
-              retval.append("\\n");
-              continue;
-           case '\f':
-              retval.append("\\f");
-              continue;
-           case '\r':
-              retval.append("\\r");
-              continue;
-           case '\"':
-              retval.append("\\\"");
-              continue;
-           case '\'':
-              retval.append("\\\'");
-              continue;
-           case '\\':
-              retval.append("\\\\");
-              continue;
-           default:
-              if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
-                 String s = "0000" + Integer.toString(ch, 16);
-                 retval.append("\\u" + s.substring(s.length() - 4, s.length()));
-              } else {
-                 retval.append(ch);
-              }
-              continue;
-        }
+  /**
+   * Replaces unprintable characters by their escaped (or unicode escaped)
+   * equivalents in the given string
+   */
+  protected static final String addEscapes(String str) {
+    StringBuffer retval = new StringBuffer();
+    char ch;
+    for (int i = 0; i < str.length(); i++) {
+      switch (str.charAt(i))
+      {
+        case 0 :
+          continue;
+        case '\b':
+          retval.append("\\b");
+          continue;
+        case '\t':
+          retval.append("\\t");
+          continue;
+        case '\n':
+          retval.append("\\n");
+          continue;
+        case '\f':
+          retval.append("\\f");
+          continue;
+        case '\r':
+          retval.append("\\r");
+          continue;
+        case '\"':
+          retval.append("\\\"");
+          continue;
+        case '\'':
+          retval.append("\\\'");
+          continue;
+        case '\\':
+          retval.append("\\\\");
+          continue;
+        default:
+          if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+            String s = "0000" + Integer.toString(ch, 16);
+            retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+          } else {
+            retval.append(ch);
+          }
+          continue;
       }
-      return retval.toString();
-   }
+    }
+    return retval.toString();
+  }
 
-   /**
-    * Returns a detailed message for the Error when it is thrown by the
-    * token manager to indicate a lexical error.
-    * Parameters :
-    *    EOFSeen     : indicates if EOF caused the lexicl error
-    *    curLexState : lexical state in which this error occurred
-    *    errorLine   : line number when the error occurred
-    *    errorColumn : column number when the error occurred
-    *    errorAfter  : prefix that was seen before this error occurred
-    *    curchar     : the offending character
-    * Note: You can customize the lexical error message by modifying this method.
-    */
-   private static final String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
-      return("Lexical error at line " +
-           errorLine + ", column " +
-           errorColumn + ".  Encountered: " +
-           (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
-           "after : \"" + addEscapes(errorAfter) + "\"");
-   }
+  /**
+   * Returns a detailed message for the Error when it is thrown by the
+   * token manager to indicate a lexical error.
+   * Parameters :
+   *    EOFSeen     : indicates if EOF caused the lexical error
+   *    curLexState : lexical state in which this error occurred
+   *    errorLine   : line number when the error occurred
+   *    errorColumn : column number when the error occurred
+   *    errorAfter  : prefix that was seen before this error occurred
+   *    curchar     : the offending character
+   * Note: You can customize the lexical error message by modifying this method.
+   */
+  protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
+    return("Lexical error at line " +
+          errorLine + ", column " +
+          errorColumn + ".  Encountered: " +
+          (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
+          "after : \"" + addEscapes(errorAfter) + "\"");
+  }
 
-   /**
-    * You can also modify the body of this method to customize your error messages.
-    * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
-    * of end-users concern, so you can return something like :
-    *
-    *     "Internal Error : Please file a bug report .... "
-    *
-    * from this method for such cases in the release version of your parser.
-    */
-   @Override
-   public String getMessage() {
-      return super.getMessage();
-   }
+  /**
+   * You can also modify the body of this method to customize your error messages.
+   * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+   * of end-users concern, so you can return something like :
+   *
+   *     "Internal Error : Please file a bug report .... "
+   *
+   * from this method for such cases in the release version of your parser.
+   */
+  public String getMessage() {
+    return super.getMessage();
+  }
+
+  /*
+   * Constructors of various flavors follow.
+   */
 
-   /*
-    * Constructors of various flavors follow.
-    */
-
-   public TokenMgrError() {
-   }
+  /** No arg constructor. */
+  public TokenMgrError() {
+  }
 
-   public TokenMgrError(String message, int reason) {
-      super(message);
-      errorCode = reason;
-   }
+  /** Constructor with message and reason. */
+  public TokenMgrError(String message, int reason) {
+    super(message);
+    errorCode = reason;
+  }
 
-   public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
-      this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
-   }
+  /** Full Constructor. */
+  public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
+    this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
+  }
 }
+/* JavaCC - OriginalChecksum=9b5d040f247411cad7f77688386c48e7 (do not edit this line) */
--- a/jdk/src/share/classes/com/sun/tools/jdi/ArrayTypeImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/com/sun/tools/jdi/ArrayTypeImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -31,6 +31,7 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Set;
 
 public class ArrayTypeImpl extends ReferenceTypeImpl
     implements ArrayType
@@ -61,7 +62,8 @@
         return findType(componentSignature());
     }
 
-    void addVisibleMethods(Map<String, Method> map) {
+    @Override
+    void addVisibleMethods(Map<String, Method> map, Set<InterfaceType> seenInterfaces) {
         // arrays don't have methods
     }
 
--- a/jdk/src/share/classes/com/sun/tools/jdi/ClassTypeImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/com/sun/tools/jdi/ClassTypeImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -382,7 +382,8 @@
         }
     }
 
-    void addVisibleMethods(Map<String, Method> methodMap) {
+    @Override
+    void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
         /*
          * Add methods from
          * parent types first, so that the methods in this class will
@@ -392,12 +393,15 @@
         Iterator<InterfaceType> iter = interfaces().iterator();
         while (iter.hasNext()) {
             InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
-            interfaze.addVisibleMethods(methodMap);
+            if (!seenInterfaces.contains(interfaze)) {
+                interfaze.addVisibleMethods(methodMap, seenInterfaces);
+                seenInterfaces.add(interfaze);
+            }
         }
 
         ClassTypeImpl clazz = (ClassTypeImpl)superclass();
         if (clazz != null) {
-            clazz.addVisibleMethods(methodMap);
+            clazz.addVisibleMethods(methodMap, seenInterfaces);
         }
 
         addToMethodMap(methodMap, methods());
--- a/jdk/src/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -32,6 +32,7 @@
 import java.util.Map;
 import java.util.Iterator;
 import java.util.Collections;
+import java.util.Set;
 import java.lang.ref.SoftReference;
 
 public class InterfaceTypeImpl extends ReferenceTypeImpl
@@ -80,7 +81,8 @@
         return implementors;
     }
 
-    void addVisibleMethods(Map<String, Method> methodMap) {
+    @Override
+    void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
         /*
          * Add methods from
          * parent types first, so that the methods in this class will
@@ -88,7 +90,10 @@
          */
 
         for (InterfaceType interfaze : superinterfaces()) {
-            ((InterfaceTypeImpl)interfaze).addVisibleMethods(methodMap);
+            if (!seenInterfaces.contains(interfaze)) {
+                ((InterfaceTypeImpl)interfaze).addVisibleMethods(methodMap, seenInterfaces);
+                seenInterfaces.add(interfaze);
+            }
         }
 
         addToMethodMap(methodMap, methods());
--- a/jdk/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -511,7 +511,7 @@
             methodMap.put(method.name().concat(method.signature()), method);
         }
 
-    abstract void addVisibleMethods(Map<String, Method> methodMap);
+    abstract void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces);
 
     public List<Method> visibleMethods() {
         /*
@@ -520,7 +520,7 @@
          * concatenation of name and signature.
          */
         Map<String, Method> map = new HashMap<String, Method>();
-        addVisibleMethods(map);
+        addVisibleMethods(map, new HashSet<InterfaceType>());
 
         /*
          * ... but the hash map destroys order. Methods should be
--- a/jdk/src/share/classes/java/awt/Dialog.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Dialog.java	Wed Jul 05 19:26:45 2017 +0200
@@ -34,11 +34,11 @@
 import java.security.PrivilegedAction;
 import javax.accessibility.*;
 import sun.awt.AppContext;
+import sun.awt.AWTPermissions;
 import sun.awt.SunToolkit;
 import sun.awt.PeerEvent;
 import sun.awt.util.IdentityArrayList;
 import sun.awt.util.IdentityLinkedList;
-import sun.security.util.SecurityConstants;
 import java.security.AccessControlException;
 
 /**
@@ -1611,9 +1611,7 @@
         if (mt == ModalityType.TOOLKIT_MODAL) {
             SecurityManager sm = System.getSecurityManager();
             if (sm != null) {
-                sm.checkPermission(
-                    SecurityConstants.AWT.TOOLKIT_MODALITY_PERMISSION
-                );
+                sm.checkPermission(AWTPermissions.TOOLKIT_MODALITY_PERMISSION);
             }
         }
     }
--- a/jdk/src/share/classes/java/awt/MouseInfo.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/awt/MouseInfo.java	Wed Jul 05 19:26:45 2017 +0200
@@ -25,7 +25,8 @@
 
 package java.awt;
 
-import sun.security.util.SecurityConstants;
+import sun.awt.AWTPermissions;
+
 /**
  * <code>MouseInfo</code>  provides methods for getting information about the mouse,
  * such as mouse pointer location and the number of mouse buttons.
@@ -76,7 +77,7 @@
 
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
-            security.checkPermission(SecurityConstants.AWT.WATCH_MOUSE_PERMISSION);
+            security.checkPermission(AWTPermissions.WATCH_MOUSE_PERMISSION);
         }
 
         Point point = new Point(0, 0);
--- a/jdk/src/share/classes/java/awt/Robot.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Robot.java	Wed Jul 05 19:26:45 2017 +0200
@@ -34,10 +34,10 @@
 import java.awt.image.WritableRaster;
 import java.awt.peer.RobotPeer;
 import java.lang.reflect.InvocationTargetException;
+import sun.awt.AWTPermissions;
 import sun.awt.ComponentFactory;
 import sun.awt.SunToolkit;
 import sun.awt.image.SunWritableRaster;
-import sun.security.util.SecurityConstants;
 
 /**
  * This class is used to generate native system input events
@@ -167,7 +167,7 @@
     private void checkRobotAllowed() {
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
-            security.checkPermission(SecurityConstants.AWT.CREATE_ROBOT_PERMISSION);
+            security.checkPermission(AWTPermissions.CREATE_ROBOT_PERMISSION);
         }
     }
 
@@ -465,8 +465,7 @@
     private static void checkScreenCaptureAllowed() {
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
-            security.checkPermission(
-                SecurityConstants.AWT.READ_DISPLAY_PIXELS_PERMISSION);
+            security.checkPermission(AWTPermissions.READ_DISPLAY_PIXELS_PERMISSION);
         }
     }
 
--- a/jdk/src/share/classes/java/awt/SystemTray.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/awt/SystemTray.java	Wed Jul 05 19:26:45 2017 +0200
@@ -32,8 +32,8 @@
 import sun.awt.AppContext;
 import sun.awt.SunToolkit;
 import sun.awt.HeadlessToolkit;
-import sun.security.util.SecurityConstants;
 import sun.awt.AWTAccessor;
+import sun.awt.AWTPermissions;
 
 /**
  * The <code>SystemTray</code> class represents the system tray for a
@@ -503,7 +503,7 @@
     static void checkSystemTrayAllowed() {
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
-            security.checkPermission(SecurityConstants.AWT.ACCESS_SYSTEM_TRAY_PERMISSION);
+            security.checkPermission(AWTPermissions.ACCESS_SYSTEM_TRAY_PERMISSION);
         }
     }
 
--- a/jdk/src/share/classes/java/awt/TextComponent.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/awt/TextComponent.java	Wed Jul 05 19:26:45 2017 +0200
@@ -30,12 +30,12 @@
 import java.io.ObjectOutputStream;
 import java.io.ObjectInputStream;
 import java.io.IOException;
-import sun.awt.InputMethodSupport;
 import java.text.BreakIterator;
 import javax.swing.text.AttributeSet;
 import javax.accessibility.*;
 import java.awt.im.InputMethodRequests;
-import sun.security.util.SecurityConstants;
+import sun.awt.AWTPermissions;
+import sun.awt.InputMethodSupport;
 
 /**
  * The <code>TextComponent</code> class is the superclass of
@@ -729,7 +729,7 @@
         SecurityManager sm = System.getSecurityManager();
         if (sm == null) return true;
         try {
-            sm.checkPermission(SecurityConstants.AWT.ACCESS_CLIPBOARD_PERMISSION);
+            sm.checkPermission(AWTPermissions.ACCESS_CLIPBOARD_PERMISSION);
             return true;
         } catch (SecurityException e) {}
         return false;
--- a/jdk/src/share/classes/java/awt/Toolkit.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Toolkit.java	Wed Jul 05 19:26:45 2017 +0200
@@ -57,7 +57,7 @@
 import sun.awt.PeerEvent;
 import sun.awt.SunToolkit;
 import sun.awt.AWTAccessor;
-import sun.security.util.SecurityConstants;
+import sun.awt.AWTPermissions;
 
 import sun.util.CoreResourceBundleControl;
 
@@ -1731,7 +1731,7 @@
     public final EventQueue getSystemEventQueue() {
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
-            security.checkPermission(SecurityConstants.AWT.CHECK_AWT_EVENTQUEUE_PERMISSION);
+            security.checkPermission(AWTPermissions.CHECK_AWT_EVENTQUEUE_PERMISSION);
         }
         return getSystemEventQueueImpl();
     }
@@ -2063,7 +2063,7 @@
         }
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
-          security.checkPermission(SecurityConstants.AWT.ALL_AWT_EVENTS_PERMISSION);
+          security.checkPermission(AWTPermissions.ALL_AWT_EVENTS_PERMISSION);
         }
         synchronized (this) {
             SelectiveAWTEventListener selectiveListener =
@@ -2132,7 +2132,7 @@
         }
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
-            security.checkPermission(SecurityConstants.AWT.ALL_AWT_EVENTS_PERMISSION);
+            security.checkPermission(AWTPermissions.ALL_AWT_EVENTS_PERMISSION);
         }
 
         synchronized (this) {
@@ -2197,7 +2197,7 @@
     public AWTEventListener[] getAWTEventListeners() {
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
-            security.checkPermission(SecurityConstants.AWT.ALL_AWT_EVENTS_PERMISSION);
+            security.checkPermission(AWTPermissions.ALL_AWT_EVENTS_PERMISSION);
         }
         synchronized (this) {
             EventListener[] la = ToolkitEventMulticaster.getListeners(eventListener,AWTEventListener.class);
@@ -2249,7 +2249,7 @@
     public AWTEventListener[] getAWTEventListeners(long eventMask) {
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
-            security.checkPermission(SecurityConstants.AWT.ALL_AWT_EVENTS_PERMISSION);
+            security.checkPermission(AWTPermissions.ALL_AWT_EVENTS_PERMISSION);
         }
         synchronized (this) {
             EventListener[] la = ToolkitEventMulticaster.getListeners(eventListener,AWTEventListener.class);
--- a/jdk/src/share/classes/java/awt/Window.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Window.java	Wed Jul 05 19:26:45 2017 +0200
@@ -51,6 +51,7 @@
 import java.util.concurrent.atomic.AtomicBoolean;
 import javax.accessibility.*;
 import sun.awt.AWTAccessor;
+import sun.awt.AWTPermissions;
 import sun.awt.AppContext;
 import sun.awt.CausedFocusEvent;
 import sun.awt.SunToolkit;
@@ -58,7 +59,6 @@
 import sun.java2d.Disposer;
 import sun.java2d.pipe.Region;
 import sun.security.action.GetPropertyAction;
-import sun.security.util.SecurityConstants;
 import sun.util.logging.PlatformLogger;
 
 /**
@@ -1386,7 +1386,7 @@
         SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
             try {
-                sm.checkPermission(SecurityConstants.AWT.TOPLEVEL_WINDOW_PERMISSION);
+                sm.checkPermission(AWTPermissions.TOPLEVEL_WINDOW_PERMISSION);
             } catch (SecurityException se) {
                 // make sure the privileged action is only
                 // for getting the property! We don't want the
@@ -1680,7 +1680,7 @@
         if (exclusionType == Dialog.ModalExclusionType.TOOLKIT_EXCLUDE) {
             SecurityManager sm = System.getSecurityManager();
             if (sm != null) {
-                sm.checkPermission(SecurityConstants.AWT.TOOLKIT_MODALITY_PERMISSION);
+                sm.checkPermission(AWTPermissions.TOOLKIT_MODALITY_PERMISSION);
             }
         }
         modalExclusionType = exclusionType;
@@ -2228,7 +2228,7 @@
     public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException {
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
-            security.checkPermission(SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION);
+            security.checkPermission(AWTPermissions.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION);
         }
 
         boolean oldAlwaysOnTop;
--- a/jdk/src/share/classes/java/awt/event/InputEvent.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/awt/event/InputEvent.java	Wed Jul 05 19:26:45 2017 +0200
@@ -32,8 +32,8 @@
 import java.util.Arrays;
 
 import sun.awt.AWTAccessor;
+import sun.awt.AWTPermissions;
 import sun.util.logging.PlatformLogger;
-import sun.security.util.SecurityConstants;
 
 /**
  * The root event class for all component-level input events.
@@ -351,7 +351,7 @@
             SecurityManager sm = System.getSecurityManager();
             if (sm != null) {
                 try {
-                    sm.checkPermission(SecurityConstants.AWT.ACCESS_CLIPBOARD_PERMISSION);
+                    sm.checkPermission(AWTPermissions.ACCESS_CLIPBOARD_PERMISSION);
                     b = true;
                 } catch (SecurityException se) {
                     if (logger.isLoggable(PlatformLogger.Level.FINE)) {
--- a/jdk/src/share/classes/java/lang/Enum.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/lang/Enum.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -52,6 +52,8 @@
  * @see     java.util.EnumMap
  * @since   1.5
  */
+@SuppressWarnings("serial") // No serialVersionUID needed due to
+                            // special-casing of enum types.
 public abstract class Enum<E extends Enum<E>>
         implements Comparable<E>, Serializable {
     /**
--- a/jdk/src/share/classes/java/lang/Integer.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/lang/Integer.java	Wed Jul 05 19:26:45 2017 +0200
@@ -376,9 +376,6 @@
         // JIT case the dispatch overhead doesn't exist and the
         // "trick" is considerably faster than the classic code.
         //
-        // TODO-FIXME: convert (x * 52429) into the equiv shift-add
-        // sequence.
-        //
         // RE:  Division by Invariant Integers using Multiplication
         //      T Gralund, P Montgomery
         //      ACM PLDI 1994
--- a/jdk/src/share/classes/java/lang/SecurityManager.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/lang/SecurityManager.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -29,7 +29,6 @@
 import java.io.FileDescriptor;
 import java.io.File;
 import java.io.FilePermission;
-import java.awt.AWTPermission;
 import java.util.PropertyPermission;
 import java.lang.RuntimePermission;
 import java.net.SocketPermission;
@@ -67,9 +66,7 @@
  * completion of the operation by throwing an exception. A security
  * manager routine simply returns if the operation is permitted, but
  * throws a <code>SecurityException</code> if the operation is not
- * permitted. The only exception to this convention is
- * <code>checkTopLevelWindow</code>, which returns a
- * <code>boolean</code> value.
+ * permitted.
  * <p>
  * The current security manager is set by the
  * <code>setSecurityManager</code> method in class
@@ -202,8 +199,6 @@
  *
  * @see     java.lang.ClassLoader
  * @see     java.lang.SecurityException
- * @see     java.lang.SecurityManager#checkTopLevelWindow(java.lang.Object)
- *  checkTopLevelWindow
  * @see     java.lang.System#getSecurityManager() getSecurityManager
  * @see     java.lang.System#setSecurityManager(java.lang.SecurityManager)
  *  setSecurityManager
@@ -246,8 +241,7 @@
     /**
      * returns true if the current context has been granted AllPermission
      */
-    private boolean hasAllPermission()
-    {
+    private boolean hasAllPermission() {
         try {
             checkPermission(SecurityConstants.ALL_PERMISSION);
             return true;
@@ -313,7 +307,7 @@
      *
      * @return  the execution stack.
      */
-    protected native Class[] getClassContext();
+    protected native Class<?>[] getClassContext();
 
     /**
      * Returns the class loader of the most recently executing method from
@@ -352,8 +346,7 @@
      * @see  #checkPermission(java.security.Permission) checkPermission
      */
     @Deprecated
-    protected ClassLoader currentClassLoader()
-    {
+    protected ClassLoader currentClassLoader() {
         ClassLoader cl = currentClassLoader0();
         if ((cl != null) && hasAllPermission())
             cl = null;
@@ -457,8 +450,7 @@
      * @see   #checkPermission(java.security.Permission) checkPermission
      */
     @Deprecated
-    protected int classLoaderDepth()
-    {
+    protected int classLoaderDepth() {
         int depth = classLoaderDepth0();
         if (depth != -1) {
             if (hasAllPermission())
@@ -1303,45 +1295,16 @@
     }
 
     /**
-     * Returns <code>false</code> if the calling
-     * thread is not trusted to bring up the top-level window indicated
-     * by the <code>window</code> argument. In this case, the caller can
-     * still decide to show the window, but the window should include
-     * some sort of visual warning. If the method returns
-     * <code>true</code>, then the window can be shown without any
-     * special restrictions.
-     * <p>
-     * See class <code>Window</code> for more information on trusted and
-     * untrusted windows.
-     * <p>
-     * This method calls
-     * <code>checkPermission</code> with the
-     * <code>AWTPermission("showWindowWithoutWarningBanner")</code> permission,
-     * and returns <code>true</code> if a SecurityException is not thrown,
-     * otherwise it returns <code>false</code>.
-     * In the case of subset Profiles of Java SE that do not include the
-     * {@code java.awt} package, {@code checkPermission} is instead called
-     * to check the permission {@code java.security.AllPermission}.
-     * <p>
-     * If you override this method, then you should make a call to
-     * <code>super.checkTopLevelWindow</code>
-     * at the point the overridden method would normally return
-     * <code>false</code>, and the value of
-     * <code>super.checkTopLevelWindow</code> should
-     * be returned.
+     * Returns {@code true} if the calling thread has {@code AllPermission}.
      *
-     * @param      window   the new window that is being created.
-     * @return     <code>true</code> if the calling thread is trusted to put up
-     *             top-level windows; <code>false</code> otherwise.
-     * @exception  NullPointerException if the <code>window</code> argument is
-     *             <code>null</code>.
-     * @deprecated The dependency on {@code AWTPermission} creates an
-     *             impediment to future modularization of the Java platform.
-     *             Users of this method should instead invoke
-     *             {@link #checkPermission} directly.
-     *             This method will be changed in a future release to check
-     *             the permission {@code java.security.AllPermission}.
-     * @see        java.awt.Window
+     * @param      window   not used except to check if it is {@code null}.
+     * @return     {@code true} if the calling thread has {@code AllPermission}.
+     * @exception  NullPointerException if the {@code window} argument is
+     *             {@code null}.
+     * @deprecated This method was originally used to check if the calling thread
+     *             was trusted to bring up a top-level window. The method has been
+     *             obsoleted and code should instead use {@link #checkPermission}
+     *             to check {@code AWTPermission("showWindowWithoutWarningBanner")}.
      * @see        #checkPermission(java.security.Permission) checkPermission
      */
     @Deprecated
@@ -1349,17 +1312,7 @@
         if (window == null) {
             throw new NullPointerException("window can't be null");
         }
-        Permission perm = SecurityConstants.AWT.TOPLEVEL_WINDOW_PERMISSION;
-        if (perm == null) {
-            perm = SecurityConstants.ALL_PERMISSION;
-        }
-        try {
-            checkPermission(perm);
-            return true;
-        } catch (SecurityException se) {
-            // just return false
-        }
-        return false;
+        return hasAllPermission();
     }
 
     /**
@@ -1386,75 +1339,39 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
-     * calling thread is not allowed to access the system clipboard.
-     * <p>
-     * This method calls <code>checkPermission</code> with the
-     * <code>AWTPermission("accessClipboard")</code>
-     * permission.
-     * In the case of subset Profiles of Java SE that do not include the
-     * {@code java.awt} package, {@code checkPermission} is instead called
-     * to check the permission {@code java.security.AllPermission}.
-     * <p>
-     * If you override this method, then you should make a call to
-     * <code>super.checkSystemClipboardAccess</code>
-     * at the point the overridden method would normally throw an
-     * exception.
+     * Throws {@code SecurityException} if the calling thread does
+     * not have {@code AllPermission}.
      *
      * @since   JDK1.1
      * @exception  SecurityException  if the calling thread does not have
-     *             permission to access the system clipboard.
-     * @deprecated The dependency on {@code AWTPermission} creates an
-     *             impediment to future modularization of the Java platform.
-     *             Users of this method should instead invoke
-     *             {@link #checkPermission} directly.
-     *             This method will be changed in a future release to check
-     *             the permission {@code java.security.AllPermission}.
+     *             {@code AllPermission}
+     * @deprecated This method was originally used to check if the calling
+     *             thread could access the system clipboard. The method has been
+     *             obsoleted and code should instead use {@link #checkPermission}
+     *             to check {@code AWTPermission("accessClipboard")}.
      * @see        #checkPermission(java.security.Permission) checkPermission
      */
     @Deprecated
     public void checkSystemClipboardAccess() {
-        Permission perm = SecurityConstants.AWT.ACCESS_CLIPBOARD_PERMISSION;
-        if (perm == null) {
-            perm = SecurityConstants.ALL_PERMISSION;
-        }
-        checkPermission(perm);
+        checkPermission(SecurityConstants.ALL_PERMISSION);
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
-     * calling thread is not allowed to access the AWT event queue.
-     * <p>
-     * This method calls <code>checkPermission</code> with the
-     * <code>AWTPermission("accessEventQueue")</code> permission.
-     * In the case of subset Profiles of Java SE that do not include the
-     * {@code java.awt} package, {@code checkPermission} is instead called
-     * to check the permission {@code java.security.AllPermission}.
-     *
-     * <p>
-     * If you override this method, then you should make a call to
-     * <code>super.checkAwtEventQueueAccess</code>
-     * at the point the overridden method would normally throw an
-     * exception.
+     * Throws {@code SecurityException} if the calling thread does
+     * not have {@code AllPermission}.
      *
      * @since   JDK1.1
      * @exception  SecurityException  if the calling thread does not have
-     *             permission to access the AWT event queue.
-     * @deprecated The dependency on {@code AWTPermission} creates an
-     *             impediment to future modularization of the Java platform.
-     *             Users of this method should instead invoke
-     *             {@link #checkPermission} directly.
-     *             This method will be changed in a future release to check
-     *             the permission {@code java.security.AllPermission}.
+     *             {@code AllPermission}
+     * @deprecated This method was originally used to check if the calling
+     *             thread could access the AWT event queue. The method has been
+     *             obsoleted and code should instead use {@link #checkPermission}
+     *             to check {@code AWTPermission("accessEventQueue")}.
      * @see        #checkPermission(java.security.Permission) checkPermission
      */
     @Deprecated
     public void checkAwtEventQueueAccess() {
-        Permission perm = SecurityConstants.AWT.CHECK_AWT_EVENTQUEUE_PERMISSION;
-        if (perm == null) {
-            perm = SecurityConstants.ALL_PERMISSION;
-        }
-        checkPermission(perm);
+        checkPermission(SecurityConstants.ALL_PERMISSION);
     }
 
     /*
--- a/jdk/src/share/classes/java/lang/annotation/Annotation.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/lang/annotation/Annotation.java	Wed Jul 05 19:26:45 2017 +0200
@@ -34,6 +34,10 @@
  * More information about annotation types can be found in section 9.6 of
  * <cite>The Java&trade; Language Specification</cite>.
  *
+ * The {@link java.lang.reflect.AnnotatedElement} interface discusses
+ * compatibility concerns when evolving an annotation type from being
+ * non-repeatable to being repeatable.
+ *
  * @author  Josh Bloch
  * @since   1.5
  */
--- a/jdk/src/share/classes/java/lang/management/ManagementFactory.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/lang/management/ManagementFactory.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -612,7 +612,7 @@
                     " is not an instance of " + mxbeanInterface);
             }
 
-            final Class[] interfaces;
+            final Class<?>[] interfaces;
             // check if the registered MBean is a notification emitter
             boolean emitter = connection.isInstanceOf(objName, NOTIF_EMITTER);
 
--- a/jdk/src/share/classes/java/lang/reflect/AnnotatedElement.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/lang/reflect/AnnotatedElement.java	Wed Jul 05 19:26:45 2017 +0200
@@ -135,7 +135,77 @@
  * annotations on <i>E</i> are directly present on <i>E</i> in place
  * of their container annotation, in the order in which they appear in
  * the value element of the container annotation.
-
+ *
+ * <p>There are several compatibility concerns to keep in mind if an
+ * annotation type <i>T</i> is originally <em>not</em> repeatable and
+ * later modified to be repeatable.
+ *
+ * The containing annotation type for <i>T</i> is <i>TC</i>.
+ *
+ * <ul>
+ *
+ * <li>Modifying <i>T</i> to be repeatable is source and binary
+ * compatible with existing uses of <i>T</i> and with existing uses
+ * of <i>TC</i>.
+ *
+ * That is, for source compatibility, source code with annotations of
+ * type <i>T</i> or of type <i>TC</i> will still compile. For binary
+ * compatibility, class files with annotations of type <i>T</i> or of
+ * type <i>TC</i> (or with other kinds of uses of type <i>T</i> or of
+ * type <i>TC</i>) will link against the modified version of <i>T</i>
+ * if they linked against the earlier version.
+ *
+ * (An annotation type <i>TC</i> may informally serve as an acting
+ * containing annotation type before <i>T</i> is modified to be
+ * formally repeatable. Alternatively, when <i>T</i> is made
+ * repeatable, <i>TC</i> can be introduced as a new type.)
+ *
+ * <li>If an annotation type <i>TC</i> is present on an element, and
+ * <i>T</i> is modified to be repeatable with <i>TC</i> as its
+ * containing annotation type then:
+ *
+ * <ul>
+ *
+ * <li>The change to <i>T</i> is behaviorally compatible with respect
+ * to the {@code get[Declared]Annotation(Class<T>)} (called with an
+ * argument of <i>T</i> or <i>TC</i>) and {@code
+ * get[Declared]Annotations()} methods because the results of the
+ * methods will not change due to <i>TC</i> becoming the containing
+ * annotation type for <i>T</i>.
+ *
+ * <li>The change to <i>T</i> changes the results of the {@code
+ * get[Declared]AnnotationsByType(Class<T>)} methods called with an
+ * argument of <i>T</i>, because those methods will now recognize an
+ * annotation of type <i>TC</i> as a container annotation for <i>T</i>
+ * and will "look through" it to expose annotations of type <i>T</i>.
+ *
+ * </ul>
+ *
+ * <li>If an annotation of type <i>T</i> is present on an
+ * element and <i>T</i> is made repeatable and more annotations of
+ * type <i>T</i> are added to the element:
+ *
+ * <ul>
+ *
+ * <li> The addition of the annotations of type <i>T</i> is both
+ * source compatible and binary compatible.
+ *
+ * <li>The addition of the annotations of type <i>T</i> changes the results
+ * of the {@code get[Declared]Annotation(Class<T>)} methods and {@code
+ * get[Declared]Annotations()} methods, because those methods will now
+ * only see a container annotation on the element and not see an
+ * annotation of type <i>T</i>.
+ *
+ * <li>The addition of the annotations of type <i>T</i> changes the
+ * results of the {@code get[Declared]AnnotationsByType(Class<T>)}
+ * methods, because their results will expose the additional
+ * annotations of type <i>T</i> whereas previously they exposed only a
+ * single annotation of type <i>T</i>.
+ *
+ * </ul>
+ *
+ * </ul>
+ *
  * <p>If an annotation returned by a method in this interface contains
  * (directly or indirectly) a {@link Class}-valued member referring to
  * a class that is not accessible in this VM, attempting to read the class
--- a/jdk/src/share/classes/java/lang/reflect/Constructor.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/lang/reflect/Constructor.java	Wed Jul 05 19:26:45 2017 +0200
@@ -204,6 +204,7 @@
 
     /**
      * {@inheritDoc}
+     * @since 1.8
      */
     public int getParameterCount() { return parameterTypes.length; }
 
--- a/jdk/src/share/classes/java/lang/reflect/Executable.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/lang/reflect/Executable.java	Wed Jul 05 19:26:45 2017 +0200
@@ -240,7 +240,6 @@
      * declared or implicitly declared or neither) for the executable
      * represented by this object.
      *
-     * @since 1.8
      * @return The number of formal parameters for the executable this
      * object represents
      */
@@ -291,7 +290,6 @@
      * have unique names, or names that are legal identifiers in the
      * Java programming language (JLS 3.8).
      *
-     * @since 1.8
      * @throws MalformedParametersException if the class file contains
      * a MethodParameters attribute that is improperly formatted.
      * @return an array of {@code Parameter} objects representing all
@@ -523,7 +521,6 @@
     /**
      * {@inheritDoc}
      * @throws NullPointerException {@inheritDoc}
-     * @since 1.8
      */
     @Override
     public <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) {
@@ -566,8 +563,6 @@
      *
      * @return an object representing the return type of the method
      * or constructor represented by this {@code Executable}
-     *
-     * @since 1.8
      */
     public abstract AnnotatedType getAnnotatedReturnType();
 
@@ -576,8 +571,6 @@
      * Returns an AnnotatedType object that represents the use of a type to
      * specify the return type of the method/constructor represented by this
      * Executable.
-     *
-     * @since 1.8
      */
     AnnotatedType getAnnotatedReturnType0(Type returnType) {
         return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
@@ -607,8 +600,6 @@
      *
      * @return an object representing the receiver type of the method or
      * constructor represented by this {@code Executable}
-     *
-     * @since 1.8
      */
     public AnnotatedType getAnnotatedReceiverType() {
         if (Modifier.isStatic(this.getModifiers()))
@@ -635,8 +626,6 @@
      * @return an array of objects representing the types of the
      * formal parameters of the method or constructor represented by this
      * {@code Executable}
-     *
-     * @since 1.8
      */
     public AnnotatedType[] getAnnotatedParameterTypes() {
         return TypeAnnotationParser.buildAnnotatedTypes(getTypeAnnotationBytes0(),
@@ -661,8 +650,6 @@
      * @return an array of objects representing the declared
      * exceptions of the method or constructor represented by this {@code
      * Executable}
-     *
-     * @since 1.8
      */
     public AnnotatedType[] getAnnotatedExceptionTypes() {
         return TypeAnnotationParser.buildAnnotatedTypes(getTypeAnnotationBytes0(),
--- a/jdk/src/share/classes/java/lang/reflect/Method.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/lang/reflect/Method.java	Wed Jul 05 19:26:45 2017 +0200
@@ -252,6 +252,7 @@
 
     /**
      * {@inheritDoc}
+     * @since 1.8
      */
     public int getParameterCount() { return parameterTypes.length; }
 
--- a/jdk/src/share/classes/java/math/BigInteger.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/math/BigInteger.java	Wed Jul 05 19:26:45 2017 +0200
@@ -268,7 +268,15 @@
      */
     private static final int SCHOENHAGE_BASE_CONVERSION_THRESHOLD = 20;
 
-    //Constructors
+    /**
+     * The threshold value for using squaring code to perform multiplication
+     * of a {@code BigInteger} instance by itself.  If the number of ints in
+     * the number are larger than this value, {@code multiply(this)} will
+     * return {@code square()}.
+     */
+    private static final int MULTIPLY_SQUARE_THRESHOLD = 20;
+
+    // Constructors
 
     /**
      * Translates a byte array containing the two's-complement binary
@@ -1458,6 +1466,9 @@
     /**
      * Returns a BigInteger whose value is {@code (this * val)}.
      *
+     * @implNote An implementation may offer better algorithmic
+     * performance when {@code val == this}.
+     *
      * @param  val value to be multiplied by this BigInteger.
      * @return {@code this * val}
      */
@@ -1466,6 +1477,11 @@
             return ZERO;
 
         int xlen = mag.length;
+
+        if (val == this && xlen > MULTIPLY_SQUARE_THRESHOLD) {
+            return square();
+        }
+
         int ylen = val.mag.length;
 
         if ((xlen < KARATSUBA_THRESHOLD) || (ylen < KARATSUBA_THRESHOLD)) {
--- a/jdk/src/share/classes/java/net/Inet6Address.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/net/Inet6Address.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -604,9 +604,9 @@
 
         ObjectInputStream.GetField gf = s.readFields();
         byte[] ipaddress = (byte[])gf.get("ipaddress", null);
-        int scope_id = (int)gf.get("scope_id", -1);
-        boolean scope_id_set = (boolean)gf.get("scope_id_set", false);
-        boolean scope_ifname_set = (boolean)gf.get("scope_ifname_set", false);
+        int scope_id = gf.get("scope_id", -1);
+        boolean scope_id_set = gf.get("scope_id_set", false);
+        boolean scope_ifname_set = gf.get("scope_ifname_set", false);
         String ifname = (String)gf.get("ifname", null);
 
         if (ifname != null && !"".equals (ifname)) {
--- a/jdk/src/share/classes/java/net/URL.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/net/URL.java	Wed Jul 05 19:26:45 2017 +0200
@@ -978,8 +978,8 @@
      * support proxing will ignore the proxy parameter and make a
      * normal connection.
      *
-     * Invoking this method preempts the system's default ProxySelector
-     * settings.
+     * Invoking this method preempts the system's default
+     * {@link java.net.ProxySelector ProxySelector} settings.
      *
      * @param      proxy the Proxy through which this connection
      *             will be made. If direct connection is desired,
@@ -1055,7 +1055,7 @@
     /**
      * Gets the contents of this URL. This method is a shorthand for:
      * <blockquote><pre>
-     *     openConnection().getContent(Class[])
+     *     openConnection().getContent(classes)
      * </pre></blockquote>
      *
      * @param classes an array of Java types
@@ -1066,7 +1066,7 @@
      * @see        java.net.URLConnection#getContent(Class[])
      * @since 1.3
      */
-    public final Object getContent(Class[] classes)
+    public final Object getContent(Class<?>[] classes)
     throws java.io.IOException {
         return openConnection().getContent(classes);
     }
--- a/jdk/src/share/classes/java/net/URLConnection.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/net/URLConnection.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -760,7 +760,7 @@
      * @see        java.net.URLConnection#setContentHandlerFactory(java.net.ContentHandlerFactory)
      * @since 1.3
      */
-    public Object getContent(Class[] classes) throws IOException {
+    public Object getContent(Class<?>[] classes) throws IOException {
         // Must call getInputStream before GetHeaderField gets called
         // so that FileNotFoundException has a chance to be thrown up
         // from here without being caught.
--- a/jdk/src/share/classes/java/net/URLPermission.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/net/URLPermission.java	Wed Jul 05 19:26:45 2017 +0200
@@ -47,7 +47,7 @@
  * class.
  * <i>authority</i> is specified as:
  * <pre>
- *     authority = hostrange [ : portrange ]
+ *     authority = [ userinfo @ ] hostrange [ : portrange ]
  *     portrange = portnumber | -portnumber | portnumber-[portnumber] | *
  *     hostrange = ([*.] dnsname) | IPv4address | IPv6address
  * </pre>
@@ -65,6 +65,9 @@
  * (default 443). No default is assumed for other schemes. A wildcard may be specified
  * which means all ports.
  * <p>
+ * <i>userinfo</i> is optional. A userinfo component if present, is ignored when
+ * creating a URLPermission, and has no effect on any other methods defined by this class.
+ * <p>
  * The <i>path</i> component comprises a sequence of path segments,
  * separated by '/' characters. <i>path</i> may also be empty. The path is specified
  * in a similar way to the path in {@link java.io.FilePermission}. There are
@@ -473,7 +476,12 @@
         HostPortrange p;
 
         Authority(String scheme, String authority) {
-            p = new HostPortrange(scheme, authority);
+            int at = authority.indexOf('@');
+            if (at == -1) {
+                    p = new HostPortrange(scheme, authority);
+            } else {
+                    p = new HostPortrange(scheme, authority.substring(at+1));
+            }
         }
 
         boolean implies(Authority other) {
--- a/jdk/src/share/classes/java/net/URLStreamHandler.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/net/URLStreamHandler.java	Wed Jul 05 19:26:45 2017 +0200
@@ -76,8 +76,8 @@
      * support proxying will ignore the proxy parameter and make a
      * normal connection.
      *
-     * Calling this method preempts the system's default ProxySelector
-     * settings.
+     * Calling this method preempts the system's default
+     * {@link java.net.ProxySelector ProxySelector} settings.
      *
      * @param      u   the URL that this connects to.
      * @param      p   the proxy through which the connection will be made.
--- a/jdk/src/share/classes/java/nio/channels/spi/SelectorProvider.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/nio/channels/spi/SelectorProvider.java	Wed Jul 05 19:26:45 2017 +0200
@@ -71,6 +71,14 @@
     private static final Object lock = new Object();
     private static SelectorProvider provider = null;
 
+    private static Void checkPermission() {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null)
+            sm.checkPermission(new RuntimePermission("selectorProvider"));
+        return null;
+    }
+    private SelectorProvider(Void ignore) { }
+
     /**
      * Initializes a new instance of this class.
      *
@@ -79,9 +87,7 @@
      *          {@link RuntimePermission}<tt>("selectorProvider")</tt>
      */
     protected SelectorProvider() {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm != null)
-            sm.checkPermission(new RuntimePermission("selectorProvider"));
+        this(checkPermission());
     }
 
     private static boolean loadProviderFromProperty() {
--- a/jdk/src/share/classes/java/nio/charset/spi/CharsetProvider.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/nio/charset/spi/CharsetProvider.java	Wed Jul 05 19:26:45 2017 +0200
@@ -71,6 +71,14 @@
 
 public abstract class CharsetProvider {
 
+    private static Void checkPermission() {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null)
+            sm.checkPermission(new RuntimePermission("charsetProvider"));
+        return null;
+    }
+    private CharsetProvider(Void ignore) { }
+
     /**
      * Initializes a new charset provider.
      *
@@ -79,9 +87,7 @@
      *          {@link RuntimePermission}<tt>("charsetProvider")</tt>
      */
     protected CharsetProvider() {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm != null)
-            sm.checkPermission(new RuntimePermission("charsetProvider"));
+        this(checkPermission());
     }
 
     /**
--- a/jdk/src/share/classes/java/security/Provider.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/security/Provider.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -1405,7 +1405,7 @@
         private String[] supportedFormats;
 
         // names of the supported key (super) classes
-        private Class[] supportedClasses;
+        private Class<?>[] supportedClasses;
 
         // whether this service has been registered with the Provider
         private boolean registered;
@@ -1656,7 +1656,7 @@
                 return o;
             }
             Class<?> argClass = constructorParameter.getClass();
-            Constructor[] cons = clazz.getConstructors();
+            Constructor<?>[] cons = clazz.getConstructors();
             // find first public constructor that can take the
             // argument as parameter
             for (int i = 0; i < cons.length; i++) {
--- a/jdk/src/share/classes/java/security/UnresolvedPermission.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/security/UnresolvedPermission.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -216,9 +216,9 @@
     }
 
 
-    private static final Class[] PARAMS0 = { };
-    private static final Class[] PARAMS1 = { String.class };
-    private static final Class[] PARAMS2 = { String.class, String.class };
+    private static final Class<?>[] PARAMS0 = { };
+    private static final Class<?>[] PARAMS1 = { String.class };
+    private static final Class<?>[] PARAMS2 = { String.class, String.class };
 
     /**
      * try and resolve this permission using the class loader of the permission
--- a/jdk/src/share/classes/java/time/Duration.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/Duration.java	Wed Jul 05 19:26:45 2017 +0200
@@ -74,7 +74,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InvalidObjectException;
-import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.math.BigInteger;
@@ -118,6 +118,13 @@
  * most applications.
  * See {@link Instant} for a discussion as to the meaning of the second and time-scales.
  *
+ * <p>
+ * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code Duration} may have unpredictable results and should be avoided.
+ * The {@code equals} method should be used for comparisons.
+ *
  * @implSpec
  * This class is immutable and thread-safe.
  *
@@ -1105,29 +1112,29 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Gets the number of minutes in this duration.
+     * Gets the number of days in this duration.
      * <p>
-     * This returns the total number of minutes in the duration by dividing the
+     * This returns the total number of days in the duration by dividing the
      * number of seconds by 86400.
      * This is based on the standard definition of a day as 24 hours.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @return the number of minutes in the duration, may be negative
+     * @return the number of days in the duration, may be negative
      */
     public long toDays() {
         return seconds / SECONDS_PER_DAY;
     }
 
     /**
-     * Gets the number of minutes in this duration.
+     * Gets the number of hours in this duration.
      * <p>
-     * This returns the total number of minutes in the duration by dividing the
+     * This returns the total number of hours in the duration by dividing the
      * number of seconds by 3600.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @return the number of minutes in the duration, may be negative
+     * @return the number of hours in the duration, may be negative
      */
     public long toHours() {
         return seconds / SECONDS_PER_HOUR;
@@ -1318,10 +1325,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/Instant.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/Instant.java	Wed Jul 05 19:26:45 2017 +0200
@@ -76,6 +76,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeParseException;
@@ -196,6 +197,13 @@
  * This includes {@code Instant}, {@code LocalDate}, {@code LocalTime}, {@code OffsetDateTime},
  * {@code ZonedDateTime} and {@code Duration}.
  *
+ * <p>
+ * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code Instant} may have unpredictable results and should be avoided.
+ * The {@code equals} method should be used for comparisons.
+ *
  * @implSpec
  * This class is immutable and thread-safe.
  *
@@ -1339,10 +1347,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/LocalDate.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/LocalDate.java	Wed Jul 05 19:26:45 2017 +0200
@@ -78,6 +78,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.chrono.ChronoLocalDate;
 import java.time.chrono.Era;
@@ -121,6 +122,13 @@
  * However, any application that makes use of historical dates, and requires them
  * to be accurate will find the ISO-8601 approach unsuitable.
  *
+ * <p>
+ * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code LocalDate} may have unpredictable results and should be avoided.
+ * The {@code equals} method should be used for comparisons.
+ *
  * @implSpec
  * This class is immutable and thread-safe.
  *
@@ -2044,10 +2052,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/LocalDateTime.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/LocalDateTime.java	Wed Jul 05 19:26:45 2017 +0200
@@ -76,6 +76,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.chrono.ChronoLocalDateTime;
 import java.time.format.DateTimeFormatter;
@@ -119,6 +120,13 @@
  * However, any application that makes use of historical dates, and requires them
  * to be accurate will find the ISO-8601 approach unsuitable.
  *
+ * <p>
+ * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code LocalDateTime} may have unpredictable results and should be avoided.
+ * The {@code equals} method should be used for comparisons.
+ *
  * @implSpec
  * This class is immutable and thread-safe.
  *
@@ -1977,10 +1985,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/LocalTime.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/LocalTime.java	Wed Jul 05 19:26:45 2017 +0200
@@ -74,6 +74,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeParseException;
@@ -109,6 +110,13 @@
  * in most of the world. This API assumes that all calendar systems use the same
  * representation, this class, for time-of-day.
  *
+ * <p>
+ * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code LocalTime} may have unpredictable results and should be avoided.
+ * The {@code equals} method should be used for comparisons.
+ *
  * @implSpec
  * This class is immutable and thread-safe.
  *
@@ -1629,10 +1637,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/MonthDay.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/MonthDay.java	Wed Jul 05 19:26:45 2017 +0200
@@ -68,6 +68,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.chrono.Chronology;
 import java.time.chrono.IsoChronology;
@@ -111,6 +112,13 @@
  * However, any application that makes use of historical dates, and requires them
  * to be accurate will find the ISO-8601 approach unsuitable.
  *
+ * <p>
+ * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code MonthDay} may have unpredictable results and should be avoided.
+ * The {@code equals} method should be used for comparisons.
+ *
  * @implSpec
  * This class is immutable and thread-safe.
  *
@@ -762,10 +770,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/OffsetDateTime.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/OffsetDateTime.java	Wed Jul 05 19:26:45 2017 +0200
@@ -72,6 +72,7 @@
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.chrono.IsoChronology;
 import java.time.format.DateTimeFormatter;
@@ -112,6 +113,13 @@
  * in simpler applications. This class may be used when modeling date-time concepts in
  * more detail, or when communicating to a database or in a network protocol.
  *
+ * <p>
+ * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code OffsetDateTime} may have unpredictable results and should be avoided.
+ * The {@code equals} method should be used for comparisons.
+ *
  * @implSpec
  * This class is immutable and thread-safe.
  *
@@ -1916,10 +1924,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/OffsetTime.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/OffsetTime.java	Wed Jul 05 19:26:45 2017 +0200
@@ -73,6 +73,7 @@
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeParseException;
@@ -102,6 +103,13 @@
  * For example, the value "13:45.30.123456789+02:00" can be stored
  * in an {@code OffsetTime}.
  *
+ * <p>
+ * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code OffsetTime} may have unpredictable results and should be avoided.
+ * The {@code equals} method should be used for comparisons.
+ *
  * @implSpec
  * This class is immutable and thread-safe.
  *
@@ -1387,10 +1395,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/Period.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/Period.java	Wed Jul 05 19:26:45 2017 +0200
@@ -69,6 +69,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.chrono.ChronoLocalDate;
 import java.time.chrono.ChronoPeriod;
@@ -119,6 +120,13 @@
  * The period is modeled as a directed amount of time, meaning that individual parts of the
  * period may be negative.
  *
+ * <p>
+ * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code Period} may have unpredictable results and should be avoided.
+ * The {@code equals} method should be used for comparisons.
+ *
  * @implSpec
  * This class is immutable and thread-safe.
  *
@@ -1049,10 +1057,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws java.io.InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/Year.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/Year.java	Wed Jul 05 19:26:45 2017 +0200
@@ -74,6 +74,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.chrono.Chronology;
 import java.time.chrono.IsoChronology;
@@ -119,6 +120,13 @@
  * However, any application that makes use of historical dates, and requires them
  * to be accurate will find the ISO-8601 approach unsuitable.
  *
+ * <p>
+ * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code Year} may have unpredictable results and should be avoided.
+ * The {@code equals} method should be used for comparisons.
+ *
  * @implSpec
  * This class is immutable and thread-safe.
  *
@@ -1095,10 +1103,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/YearMonth.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/YearMonth.java	Wed Jul 05 19:26:45 2017 +0200
@@ -77,6 +77,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.chrono.Chronology;
 import java.time.chrono.IsoChronology;
@@ -115,6 +116,13 @@
  * However, any application that makes use of historical dates, and requires them
  * to be accurate will find the ISO-8601 approach unsuitable.
  *
+ * <p>
+ * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code YearMonth} may have unpredictable results and should be avoided.
+ * The {@code equals} method should be used for comparisons.
+ *
  * @implSpec
  * This class is immutable and thread-safe.
  *
@@ -1221,10 +1229,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/ZoneId.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/ZoneId.java	Wed Jul 05 19:26:45 2017 +0200
@@ -64,6 +64,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.format.DateTimeFormatterBuilder;
 import java.time.format.TextStyle;
@@ -159,6 +160,13 @@
  * This approach is designed to allow a {@link ZonedDateTime} to be loaded and
  * queried, but not modified, on a Java Runtime with incomplete time-zone information.
  *
+ * <p>
+ * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code ZoneId} may have unpredictable results and should be avoided.
+ * The {@code equals} method should be used for comparisons.
+ *
  * @implSpec
  * This abstract class has two implementations, both of which are immutable and thread-safe.
  * One implementation models region-based IDs, the other is {@code ZoneOffset} modelling
@@ -615,10 +623,10 @@
     //-----------------------------------------------------------------------
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/ZoneOffset.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/ZoneOffset.java	Wed Jul 05 19:26:45 2017 +0200
@@ -70,6 +70,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.temporal.ChronoField;
 import java.time.temporal.Temporal;
@@ -114,6 +115,13 @@
  * Implementations may choose to cache certain common offsets, however
  * applications must not rely on such caching.
  *
+ * <p>
+ * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code ZoneOffset} may have unpredictable results and should be avoided.
+ * The {@code equals} method should be used for comparisons.
+ *
  * @implSpec
  * This class is immutable and thread-safe.
  *
@@ -760,10 +768,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/ZoneRegion.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/ZoneRegion.java	Wed Jul 05 19:26:45 2017 +0200
@@ -60,7 +60,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InvalidObjectException;
-import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.zone.ZoneRules;
 import java.time.zone.ZoneRulesException;
@@ -195,10 +195,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/ZonedDateTime.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/ZonedDateTime.java	Wed Jul 05 19:26:45 2017 +0200
@@ -67,9 +67,9 @@
 
 import java.io.DataOutput;
 import java.io.IOException;
-import java.io.InvalidObjectException;
 import java.io.ObjectInput;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.chrono.ChronoZonedDateTime;
 import java.time.format.DateTimeFormatter;
@@ -142,6 +142,13 @@
  * a vital, but secondary, piece of information, used to ensure that the class
  * represents an instant, especially during a daylight savings overlap.
  *
+ * <p>
+ * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code ZonedDateTime} may have unpredictable results and should be avoided.
+ * The {@code equals} method should be used for comparisons.
+ *
  * @implSpec
  * A {@code ZonedDateTime} holds state equivalent to three separate objects,
  * a {@code LocalDateTime}, a {@code ZoneId} and the resolved {@code ZoneOffset}.
@@ -2217,10 +2224,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/chrono/AbstractChronology.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/chrono/AbstractChronology.java	Wed Jul 05 19:26:45 2017 +0200
@@ -83,6 +83,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.ObjectStreamException;
 import java.io.Serializable;
 import java.time.DateTimeException;
@@ -764,10 +765,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws java.io.InvalidObjectException always
      */
-    private Object readResolve() throws ObjectStreamException {
+    private void readObject(ObjectInputStream s) throws ObjectStreamException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -66,8 +66,8 @@
 import java.io.IOException;
 import java.io.InvalidObjectException;
 import java.io.ObjectInput;
+import java.io.ObjectInputStream;
 import java.io.ObjectOutput;
-import java.io.ObjectStreamException;
 import java.io.Serializable;
 import java.time.LocalTime;
 import java.time.ZoneId;
@@ -415,10 +415,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/chrono/ChronoPeriodImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/chrono/ChronoPeriodImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -65,6 +65,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.ObjectStreamException;
 import java.io.Serializable;
 import java.time.DateTimeException;
@@ -374,10 +375,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws ObjectStreamException {
+    private void readObject(ObjectInputStream s) throws ObjectStreamException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTimeImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTimeImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -66,8 +66,8 @@
 import java.io.IOException;
 import java.io.InvalidObjectException;
 import java.io.ObjectInput;
+import java.io.ObjectInputStream;
 import java.io.ObjectOutput;
-import java.io.ObjectStreamException;
 import java.io.Serializable;
 import java.time.Instant;
 import java.time.LocalDateTime;
@@ -339,10 +339,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/chrono/HijrahChronology.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/chrono/HijrahChronology.java	Wed Jul 05 19:26:45 2017 +0200
@@ -64,7 +64,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InvalidObjectException;
-import java.io.ObjectStreamException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.security.AccessController;
 import java.security.PrivilegedActionException;
@@ -1095,10 +1095,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 }
--- a/jdk/src/share/classes/java/time/chrono/HijrahDate.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/chrono/HijrahDate.java	Wed Jul 05 19:26:45 2017 +0200
@@ -67,6 +67,7 @@
 import java.io.IOException;
 import java.io.InvalidObjectException;
 import java.io.ObjectInput;
+import java.io.ObjectInputStream;
 import java.io.ObjectOutput;
 import java.io.Serializable;
 import java.time.Clock;
@@ -102,6 +103,14 @@
  * to create new HijrahDate instances.
  * Alternatively, the {@link #withVariant} method can be used to convert
  * to a new HijrahChronology.
+ *
+ * <p>
+ * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code HijrahDate} may have unpredictable results and should be avoided.
+ * The {@code equals} method should be used for comparisons.
+ *
  * @implSpec
  * This class is immutable and thread-safe.
  *
@@ -599,13 +608,55 @@
         return getChronology().period(Math.toIntExact(years), months, days);
     }
 
+    //-------------------------------------------------------------------------
+    /**
+     * Compares this date to another date, including the chronology.
+     * <p>
+     * Compares this {@code HijrahDate} with another ensuring that the date is the same.
+     * <p>
+     * Only objects of type {@code HijrahDate} are compared, other types return false.
+     * To compare the dates of two {@code TemporalAccessor} instances, including dates
+     * in two different chronologies, use {@link ChronoField#EPOCH_DAY} as a comparator.
+     *
+     * @param obj  the object to check, null returns false
+     * @return true if this is equal to the other date and the Chronologies are equal
+     */
+    @Override  // override for performance
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof HijrahDate) {
+            HijrahDate otherDate = (HijrahDate) obj;
+            return prolepticYear == otherDate.prolepticYear
+                && this.monthOfYear == otherDate.monthOfYear
+                && this.dayOfMonth == otherDate.dayOfMonth
+                && getChronology().equals(otherDate.getChronology());
+        }
+        return false;
+    }
+
+    /**
+     * A hash code for this date.
+     *
+     * @return a suitable hash code based only on the Chronology and the date
+     */
+    @Override  // override for performance
+    public int hashCode() {
+        int yearValue = prolepticYear;
+        int monthValue = monthOfYear;
+        int dayValue = dayOfMonth;
+        return getChronology().getId().hashCode() ^ (yearValue & 0xFFFFF800)
+                ^ ((yearValue << 11) + (monthValue << 6) + (dayValue));
+    }
+
     //-----------------------------------------------------------------------
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/chrono/IsoChronology.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/chrono/IsoChronology.java	Wed Jul 05 19:26:45 2017 +0200
@@ -62,7 +62,6 @@
 package java.time.chrono;
 
 import java.io.InvalidObjectException;
-import java.io.ObjectStreamException;
 import static java.time.temporal.ChronoField.DAY_OF_MONTH;
 import static java.time.temporal.ChronoField.ERA;
 import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
@@ -70,6 +69,7 @@
 import static java.time.temporal.ChronoField.YEAR;
 import static java.time.temporal.ChronoField.YEAR_OF_ERA;
 
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.Clock;
 import java.time.DateTimeException;
@@ -603,10 +603,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 }
--- a/jdk/src/share/classes/java/time/chrono/JapaneseChronology.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/chrono/JapaneseChronology.java	Wed Jul 05 19:26:45 2017 +0200
@@ -66,6 +66,7 @@
 import static java.time.temporal.ChronoUnit.MONTHS;
 
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.Clock;
 import java.time.DateTimeException;
@@ -523,10 +524,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 }
--- a/jdk/src/share/classes/java/time/chrono/JapaneseDate.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/chrono/JapaneseDate.java	Wed Jul 05 19:26:45 2017 +0200
@@ -68,6 +68,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.Clock;
 import java.time.DateTimeException;
@@ -110,6 +111,13 @@
  * Calling {@code japaneseDate.get(ERA)} will return 2, corresponding to
  * {@code JapaneseChronology.ERA_HEISEI}.<br>
  *
+ * <p>
+ * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code JapaneseDate} may have unpredictable results and should be avoided.
+ * The {@code equals} method should be used for comparisons.
+ *
  * @implSpec
  * This class is immutable and thread-safe.
  *
@@ -670,6 +678,18 @@
     }
 
     //-------------------------------------------------------------------------
+    /**
+     * Compares this date to another date, including the chronology.
+     * <p>
+     * Compares this {@code JapaneseDate} with another ensuring that the date is the same.
+     * <p>
+     * Only objects of type {@code JapaneseDate} are compared, other types return false.
+     * To compare the dates of two {@code TemporalAccessor} instances, including dates
+     * in two different chronologies, use {@link ChronoField#EPOCH_DAY} as a comparator.
+     *
+     * @param obj  the object to check, null returns false
+     * @return true if this is equal to the other date
+     */
     @Override  // override for performance
     public boolean equals(Object obj) {
         if (this == obj) {
@@ -682,6 +702,11 @@
         return false;
     }
 
+    /**
+     * A hash code for this date.
+     *
+     * @return a suitable hash code based only on the Chronology and the date
+     */
     @Override  // override for performance
     public int hashCode() {
         return getChronology().getId().hashCode() ^ isoDate.hashCode();
@@ -690,10 +715,10 @@
     //-----------------------------------------------------------------------
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/chrono/JapaneseEra.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/chrono/JapaneseEra.java	Wed Jul 05 19:26:45 2017 +0200
@@ -68,6 +68,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.ObjectStreamException;
 import java.io.Serializable;
 import java.time.DateTimeException;
@@ -171,24 +172,6 @@
         this.since = since;
     }
 
-    /**
-     * Returns the singleton {@code JapaneseEra} corresponding to this object.
-     * It's possible that this version of {@code JapaneseEra} doesn't support the latest era value.
-     * In that case, this method throws an {@code ObjectStreamException}.
-     *
-     * @return the singleton {@code JapaneseEra} for this object
-     * @throws ObjectStreamException if the deserialized object has any unknown numeric era value.
-     */
-    private Object readResolve() throws ObjectStreamException {
-        try {
-            return of(eraValue);
-        } catch (DateTimeException e) {
-            InvalidObjectException ex = new InvalidObjectException("Invalid era");
-            ex.initCause(e);
-            throw ex;
-        }
-    }
-
     //-----------------------------------------------------------------------
     /**
      * Returns the Sun private Era instance corresponding to this {@code JapaneseEra}.
@@ -212,7 +195,7 @@
      * @throws DateTimeException if the value is invalid
      */
     public static JapaneseEra of(int japaneseEra) {
-        if (japaneseEra < MEIJI.eraValue || japaneseEra > HEISEI.eraValue) {
+        if (japaneseEra < MEIJI.eraValue || japaneseEra + ERA_OFFSET - 1 >= KNOWN_ERAS.length) {
             throw new DateTimeException("Invalid era: " + japaneseEra);
         }
         return KNOWN_ERAS[ordinal(japaneseEra)];
@@ -372,6 +355,16 @@
 
     //-----------------------------------------------------------------------
     /**
+     * Defend against malicious streams.
+     *
+     * @throws InvalidObjectException always
+     */
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
+        throw new InvalidObjectException("Deserialization via serialization delegate");
+    }
+
+    //-----------------------------------------------------------------------
+    /**
      * Writes the object using a
      * <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
      * @serialData
--- a/jdk/src/share/classes/java/time/chrono/MinguoChronology.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/chrono/MinguoChronology.java	Wed Jul 05 19:26:45 2017 +0200
@@ -57,10 +57,10 @@
 package java.time.chrono;
 
 import java.io.InvalidObjectException;
-import java.io.ObjectStreamException;
 import static java.time.temporal.ChronoField.PROLEPTIC_MONTH;
 import static java.time.temporal.ChronoField.YEAR;
 
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.Clock;
 import java.time.DateTimeException;
@@ -354,10 +354,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 }
--- a/jdk/src/share/classes/java/time/chrono/MinguoDate.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/chrono/MinguoDate.java	Wed Jul 05 19:26:45 2017 +0200
@@ -65,6 +65,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.Clock;
 import java.time.DateTimeException;
@@ -90,6 +91,13 @@
  * This calendar system is primarily used in the Republic of China, often known as Taiwan.
  * Dates are aligned such that {@code 0001-01-01 (Minguo)} is {@code 1912-01-01 (ISO)}.
  *
+ * <p>
+ * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code MinguoDate} may have unpredictable results and should be avoided.
+ * The {@code equals} method should be used for comparisons.
+ *
  * @implSpec
  * This class is immutable and thread-safe.
  *
@@ -432,6 +440,18 @@
     }
 
     //-------------------------------------------------------------------------
+    /**
+     * Compares this date to another date, including the chronology.
+     * <p>
+     * Compares this {@code MinguoDate} with another ensuring that the date is the same.
+     * <p>
+     * Only objects of type {@code MinguoDate} are compared, other types return false.
+     * To compare the dates of two {@code TemporalAccessor} instances, including dates
+     * in two different chronologies, use {@link ChronoField#EPOCH_DAY} as a comparator.
+     *
+     * @param obj  the object to check, null returns false
+     * @return true if this is equal to the other date
+     */
     @Override  // override for performance
     public boolean equals(Object obj) {
         if (this == obj) {
@@ -444,6 +464,11 @@
         return false;
     }
 
+    /**
+     * A hash code for this date.
+     *
+     * @return a suitable hash code based only on the Chronology and the date
+     */
     @Override  // override for performance
     public int hashCode() {
         return getChronology().getId().hashCode() ^ isoDate.hashCode();
@@ -452,10 +477,10 @@
     //-----------------------------------------------------------------------
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java	Wed Jul 05 19:26:45 2017 +0200
@@ -57,10 +57,10 @@
 package java.time.chrono;
 
 import java.io.InvalidObjectException;
-import java.io.ObjectStreamException;
 import static java.time.temporal.ChronoField.PROLEPTIC_MONTH;
 import static java.time.temporal.ChronoField.YEAR;
 
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.Clock;
 import java.time.DateTimeException;
@@ -390,10 +390,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 }
--- a/jdk/src/share/classes/java/time/chrono/ThaiBuddhistDate.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/chrono/ThaiBuddhistDate.java	Wed Jul 05 19:26:45 2017 +0200
@@ -65,6 +65,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.Clock;
 import java.time.DateTimeException;
@@ -90,6 +91,13 @@
  * This calendar system is primarily used in Thailand.
  * Dates are aligned such that {@code 2484-01-01 (Buddhist)} is {@code 1941-01-01 (ISO)}.
  *
+ * <p>
+ * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code ThaiBuddhistDate} may have unpredictable results and should be avoided.
+ * The {@code equals} method should be used for comparisons.
+ *
  * @implSpec
  * This class is immutable and thread-safe.
  *
@@ -432,6 +440,18 @@
     }
 
     //-------------------------------------------------------------------------
+    /**
+     * Compares this date to another date, including the chronology.
+     * <p>
+     * Compares this {@code ThaiBuddhistDate} with another ensuring that the date is the same.
+     * <p>
+     * Only objects of type {@code ThaiBuddhistDate} are compared, other types return false.
+     * To compare the dates of two {@code TemporalAccessor} instances, including dates
+     * in two different chronologies, use {@link ChronoField#EPOCH_DAY} as a comparator.
+     *
+     * @param obj  the object to check, null returns false
+     * @return true if this is equal to the other date
+     */
     @Override  // override for performance
     public boolean equals(Object obj) {
         if (this == obj) {
@@ -444,6 +464,11 @@
         return false;
     }
 
+    /**
+     * A hash code for this date.
+     *
+     * @return a suitable hash code based only on the Chronology and the date
+     */
     @Override  // override for performance
     public int hashCode() {
         return getChronology().getId().hashCode() ^ isoDate.hashCode();
@@ -452,10 +477,10 @@
     //-----------------------------------------------------------------------
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/temporal/ValueRange.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/temporal/ValueRange.java	Wed Jul 05 19:26:45 2017 +0200
@@ -61,7 +61,9 @@
  */
 package java.time.temporal;
 
+import java.io.IOException;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.DateTimeException;
 
@@ -338,18 +340,27 @@
         }
     }
 
+    //-----------------------------------------------------------------------
     /**
-     * Return the ValueRange for the serialized values.
-     * The values are validated according to the constraints of the {@link #of}
-     * factory method.
-     * @return the ValueRange for the serialized fields
-     * @throws InvalidObjectException if the serialized object has invalid values
+     * Restore the state of an ValueRange from the stream.
+     * Check that the values are valid.
+     * @throws InvalidObjectException if
+     *     the smallest minimum is greater than the smallest maximum,
+     *  or the smallest maximum is greater than the largest maximum
+     *  or the largest minimum is greater than the largest maximum
      */
-    private Object readResolve() throws InvalidObjectException {
-        try {
-            return of(minSmallest, minLargest, maxSmallest, maxLargest);
-        } catch (IllegalArgumentException iae) {
-            throw new InvalidObjectException("Invalid serialized ValueRange: " + iae.getMessage());
+    private void readObject(ObjectInputStream s)
+         throws IOException, ClassNotFoundException, InvalidObjectException
+    {
+        s.defaultReadObject();
+        if (minSmallest > minLargest) {
+            throw new InvalidObjectException("Smallest minimum value must be less than largest minimum value");
+        }
+        if (maxSmallest > maxLargest) {
+            throw new InvalidObjectException("Smallest maximum value must be less than largest maximum value");
+        }
+        if (minLargest > maxLargest) {
+            throw new InvalidObjectException("Minimum value must be less than maximum value");
         }
     }
 
--- a/jdk/src/share/classes/java/time/temporal/WeekFields.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/temporal/WeekFields.java	Wed Jul 05 19:26:45 2017 +0200
@@ -72,7 +72,9 @@
 import static java.time.temporal.ChronoUnit.WEEKS;
 import static java.time.temporal.ChronoUnit.YEARS;
 
+import java.io.IOException;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.DateTimeException;
 import java.time.DayOfWeek;
@@ -340,6 +342,25 @@
 
     //-----------------------------------------------------------------------
     /**
+     * Restore the state of a WeekFields from the stream.
+     * Check that the values are valid.
+     * @throws InvalidObjectException if the serialized object has an invalid
+     *     value for firstDayOfWeek or minimalDays.
+     */
+    private void readObject(ObjectInputStream s)
+         throws IOException, ClassNotFoundException, InvalidObjectException
+    {
+        s.defaultReadObject();
+        if (firstDayOfWeek == null) {
+            throw new InvalidObjectException("firstDayOfWeek is null");
+        }
+
+        if (minimalDays < 1 || minimalDays > 7) {
+            throw new InvalidObjectException("Minimal number of days is invalid");
+        }
+    }
+
+    /**
      * Return the singleton WeekFields associated with the
      * {@code firstDayOfWeek} and {@code minimalDays}.
      * @return the singleton WeekFields for the firstDayOfWeek and minimalDays.
--- a/jdk/src/share/classes/java/time/zone/ZoneOffsetTransition.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/zone/ZoneOffsetTransition.java	Wed Jul 05 19:26:45 2017 +0200
@@ -65,6 +65,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.Duration;
 import java.time.Instant;
@@ -172,10 +173,9 @@
     //-----------------------------------------------------------------------
     /**
      * Defend against malicious streams.
-     * @return never
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/zone/ZoneOffsetTransitionRule.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/zone/ZoneOffsetTransitionRule.java	Wed Jul 05 19:26:45 2017 +0200
@@ -68,6 +68,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.DayOfWeek;
 import java.time.LocalDate;
@@ -233,10 +234,10 @@
     //-----------------------------------------------------------------------
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/time/zone/ZoneRules.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/time/zone/ZoneRules.java	Wed Jul 05 19:26:45 2017 +0200
@@ -65,6 +65,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.time.Duration;
 import java.time.Instant;
@@ -317,10 +318,10 @@
 
     /**
      * Defend against malicious streams.
-     * @return never
+     *
      * @throws InvalidObjectException always
      */
-    private Object readResolve() throws InvalidObjectException {
+    private void readObject(ObjectInputStream s) throws InvalidObjectException {
         throw new InvalidObjectException("Deserialization via serialization delegate");
     }
 
--- a/jdk/src/share/classes/java/util/AbstractCollection.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/AbstractCollection.java	Wed Jul 05 19:26:45 2017 +0200
@@ -80,7 +80,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation returns <tt>size() == 0</tt>.
+     * @implSpec
+     * This implementation returns <tt>size() == 0</tt>.
      */
     public boolean isEmpty() {
         return size() == 0;
@@ -89,7 +90,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation iterates over the elements in the collection,
+     * @implSpec
+     * This implementation iterates over the elements in the collection,
      * checking each element in turn for equality with the specified element.
      *
      * @throws ClassCastException   {@inheritDoc}
@@ -112,7 +114,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation returns an array containing all the elements
+     * @implSpec
+     * This implementation returns an array containing all the elements
      * returned by this collection's iterator, in the same order, stored in
      * consecutive elements of the array, starting with index {@code 0}.
      * The length of the returned array is equal to the number of elements
@@ -146,7 +149,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation returns an array containing all the elements
+     * @implSpec
+     * This implementation returns an array containing all the elements
      * returned by this collection's iterator in the same order, stored in
      * consecutive elements of the array, starting with index {@code 0}.
      * If the number of elements returned by the iterator is too large to
@@ -249,7 +253,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation always throws an
+     * @implSpec
+     * This implementation always throws an
      * <tt>UnsupportedOperationException</tt>.
      *
      * @throws UnsupportedOperationException {@inheritDoc}
@@ -265,7 +270,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation iterates over the collection looking for the
+     * @implSpec
+     * This implementation iterates over the collection looking for the
      * specified element.  If it finds the element, it removes the element
      * from the collection using the iterator's remove method.
      *
@@ -304,7 +310,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation iterates over the specified collection,
+     * @implSpec
+     * This implementation iterates over the specified collection,
      * checking each element returned by the iterator in turn to see
      * if it's contained in this collection.  If all elements are so
      * contained <tt>true</tt> is returned, otherwise <tt>false</tt>.
@@ -323,7 +330,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation iterates over the specified collection, and adds
+     * @implSpec
+     * This implementation iterates over the specified collection, and adds
      * each object returned by the iterator to this collection, in turn.
      *
      * <p>Note that this implementation will throw an
@@ -349,7 +357,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation iterates over this collection, checking each
+     * @implSpec
+     * This implementation iterates over this collection, checking each
      * element returned by the iterator in turn to see if it's contained
      * in the specified collection.  If it's so contained, it's removed from
      * this collection with the iterator's <tt>remove</tt> method.
@@ -383,7 +392,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation iterates over this collection, checking each
+     * @implSpec
+     * This implementation iterates over this collection, checking each
      * element returned by the iterator in turn to see if it's contained
      * in the specified collection.  If it's not so contained, it's removed
      * from this collection with the iterator's <tt>remove</tt> method.
@@ -417,7 +427,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation iterates over this collection, removing each
+     * @implSpec
+     * This implementation iterates over this collection, removing each
      * element using the <tt>Iterator.remove</tt> operation.  Most
      * implementations will probably choose to override this method for
      * efficiency.
--- a/jdk/src/share/classes/java/util/AbstractList.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/AbstractList.java	Wed Jul 05 19:26:45 2017 +0200
@@ -87,7 +87,8 @@
      * classes should clearly specify in their documentation any restrictions
      * on what elements may be added.
      *
-     * <p>This implementation calls {@code add(size(), e)}.
+     * @implSpec
+     * This implementation calls {@code add(size(), e)}.
      *
      * <p>Note that this implementation throws an
      * {@code UnsupportedOperationException} unless
@@ -119,7 +120,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation always throws an
+     * @implSpec
+     * This implementation always throws an
      * {@code UnsupportedOperationException}.
      *
      * @throws UnsupportedOperationException {@inheritDoc}
@@ -135,7 +137,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation always throws an
+     * @implSpec
+     * This implementation always throws an
      * {@code UnsupportedOperationException}.
      *
      * @throws UnsupportedOperationException {@inheritDoc}
@@ -151,7 +154,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation always throws an
+     * @implSpec
+     * This implementation always throws an
      * {@code UnsupportedOperationException}.
      *
      * @throws UnsupportedOperationException {@inheritDoc}
@@ -167,7 +171,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation first gets a list iterator (with
+     * @implSpec
+     * This implementation first gets a list iterator (with
      * {@code listIterator()}).  Then, it iterates over the list until the
      * specified element is found or the end of the list is reached.
      *
@@ -191,7 +196,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation first gets a list iterator that points to the end
+     * @implSpec
+     * This implementation first gets a list iterator that points to the end
      * of the list (with {@code listIterator(size())}).  Then, it iterates
      * backwards over the list until the specified element is found, or the
      * beginning of the list is reached.
@@ -220,7 +226,8 @@
      * Removes all of the elements from this list (optional operation).
      * The list will be empty after this call returns.
      *
-     * <p>This implementation calls {@code removeRange(0, size())}.
+     * @implSpec
+     * This implementation calls {@code removeRange(0, size())}.
      *
      * <p>Note that this implementation throws an
      * {@code UnsupportedOperationException} unless {@code remove(int
@@ -237,7 +244,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation gets an iterator over the specified collection
+     * @implSpec
+     * This implementation gets an iterator over the specified collection
      * and iterates over it, inserting the elements obtained from the
      * iterator into this list at the appropriate position, one at a time,
      * using {@code add(int, E)}.
@@ -269,7 +277,8 @@
     /**
      * Returns an iterator over the elements in this list in proper sequence.
      *
-     * <p>This implementation returns a straightforward implementation of the
+     * @implSpec
+     * This implementation returns a straightforward implementation of the
      * iterator interface, relying on the backing list's {@code size()},
      * {@code get(int)}, and {@code remove(int)} methods.
      *
@@ -291,7 +300,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation returns {@code listIterator(0)}.
+     * @implSpec
+     * This implementation returns {@code listIterator(0)}.
      *
      * @see #listIterator(int)
      */
@@ -302,7 +312,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation returns a straightforward implementation of the
+     * @implSpec
+     * This implementation returns a straightforward implementation of the
      * {@code ListIterator} interface that extends the implementation of the
      * {@code Iterator} interface returned by the {@code iterator()} method.
      * The {@code ListIterator} implementation relies on the backing list's
@@ -448,7 +459,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation returns a list that subclasses
+     * @implSpec
+     * This implementation returns a list that subclasses
      * {@code AbstractList}.  The subclass stores, in private fields, the
      * offset of the subList within the backing list, the size of the subList
      * (which can change over its lifetime), and the expected
@@ -495,8 +507,9 @@
      * the two lists are <i>equal</i>.  (Two elements {@code e1} and
      * {@code e2} are <i>equal</i> if {@code (e1==null ? e2==null :
      * e1.equals(e2))}.)  In other words, two lists are defined to be
-     * equal if they contain the same elements in the same order.<p>
+     * equal if they contain the same elements in the same order.
      *
+     * @implSpec
      * This implementation first checks if the specified object is this
      * list. If so, it returns {@code true}; if not, it checks if the
      * specified object is a list. If not, it returns {@code false}; if so,
@@ -529,7 +542,8 @@
     /**
      * Returns the hash code value for this list.
      *
-     * <p>This implementation uses exactly the code that is used to define the
+     * @implSpec
+     * This implementation uses exactly the code that is used to define the
      * list hash function in the documentation for the {@link List#hashCode}
      * method.
      *
@@ -555,7 +569,8 @@
      * improve the performance of the {@code clear} operation on this list
      * and its subLists.
      *
-     * <p>This implementation gets a list iterator positioned before
+     * @implSpec
+     * This implementation gets a list iterator positioned before
      * {@code fromIndex}, and repeatedly calls {@code ListIterator.next}
      * followed by {@code ListIterator.remove} until the entire range has
      * been removed.  <b>Note: if {@code ListIterator.remove} requires linear
--- a/jdk/src/share/classes/java/util/AbstractMap.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/AbstractMap.java	Wed Jul 05 19:26:45 2017 +0200
@@ -78,7 +78,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation returns <tt>entrySet().size()</tt>.
+     * @implSpec
+     * This implementation returns <tt>entrySet().size()</tt>.
      */
     public int size() {
         return entrySet().size();
@@ -87,7 +88,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation returns <tt>size() == 0</tt>.
+     * @implSpec
+     * This implementation returns <tt>size() == 0</tt>.
      */
     public boolean isEmpty() {
         return size() == 0;
@@ -96,7 +98,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation iterates over <tt>entrySet()</tt> searching
+     * @implSpec
+     * This implementation iterates over <tt>entrySet()</tt> searching
      * for an entry with the specified value.  If such an entry is found,
      * <tt>true</tt> is returned.  If the iteration terminates without
      * finding such an entry, <tt>false</tt> is returned.  Note that this
@@ -126,7 +129,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation iterates over <tt>entrySet()</tt> searching
+     * @implSpec
+     * This implementation iterates over <tt>entrySet()</tt> searching
      * for an entry with the specified key.  If such an entry is found,
      * <tt>true</tt> is returned.  If the iteration terminates without
      * finding such an entry, <tt>false</tt> is returned.  Note that this
@@ -157,7 +161,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation iterates over <tt>entrySet()</tt> searching
+     * @implSpec
+     * This implementation iterates over <tt>entrySet()</tt> searching
      * for an entry with the specified key.  If such an entry is found,
      * the entry's value is returned.  If the iteration terminates without
      * finding such an entry, <tt>null</tt> is returned.  Note that this
@@ -191,7 +196,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation always throws an
+     * @implSpec
+     * This implementation always throws an
      * <tt>UnsupportedOperationException</tt>.
      *
      * @throws UnsupportedOperationException {@inheritDoc}
@@ -206,7 +212,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation iterates over <tt>entrySet()</tt> searching for an
+     * @implSpec
+     * This implementation iterates over <tt>entrySet()</tt> searching for an
      * entry with the specified key.  If such an entry is found, its value is
      * obtained with its <tt>getValue</tt> operation, the entry is removed
      * from the collection (and the backing map) with the iterator's
@@ -255,7 +262,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation iterates over the specified map's
+     * @implSpec
+     * This implementation iterates over the specified map's
      * <tt>entrySet()</tt> collection, and calls this map's <tt>put</tt>
      * operation once for each entry returned by the iteration.
      *
@@ -276,7 +284,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation calls <tt>entrySet().clear()</tt>.
+     * @implSpec
+     * This implementation calls <tt>entrySet().clear()</tt>.
      *
      * <p>Note that this implementation throws an
      * <tt>UnsupportedOperationException</tt> if the <tt>entrySet</tt>
@@ -302,7 +311,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation returns a set that subclasses {@link AbstractSet}.
+     * @implSpec
+     * This implementation returns a set that subclasses {@link AbstractSet}.
      * The subclass's iterator method returns a "wrapper object" over this
      * map's <tt>entrySet()</tt> iterator.  The <tt>size</tt> method
      * delegates to this map's <tt>size</tt> method and the
@@ -358,7 +368,8 @@
     /**
      * {@inheritDoc}
      *
-     * <p>This implementation returns a collection that subclasses {@link
+     * @implSpec
+     * This implementation returns a collection that subclasses {@link
      * AbstractCollection}.  The subclass's iterator method returns a
      * "wrapper object" over this map's <tt>entrySet()</tt> iterator.
      * The <tt>size</tt> method delegates to this map's <tt>size</tt>
@@ -425,7 +436,8 @@
      * <tt>equals</tt> method works properly across different implementations
      * of the <tt>Map</tt> interface.
      *
-     * <p>This implementation first checks if the specified object is this map;
+     * @implSpec
+     * This implementation first checks if the specified object is this map;
      * if so it returns <tt>true</tt>.  Then, it checks if the specified
      * object is a map whose size is identical to the size of this map; if
      * not, it returns <tt>false</tt>.  If so, it iterates over this map's
@@ -448,13 +460,11 @@
             return false;
 
         try {
-            Iterator<Entry<K,V>> i = entrySet().iterator();
-            while (i.hasNext()) {
-                Entry<K,V> e = i.next();
+            for (Entry<K, V> e : entrySet()) {
                 K key = e.getKey();
                 V value = e.getValue();
                 if (value == null) {
-                    if (!(m.get(key)==null && m.containsKey(key)))
+                    if (!(m.get(key) == null && m.containsKey(key)))
                         return false;
                 } else {
                     if (!value.equals(m.get(key)))
@@ -478,7 +488,8 @@
      * <tt>m1</tt> and <tt>m2</tt>, as required by the general contract of
      * {@link Object#hashCode}.
      *
-     * <p>This implementation iterates over <tt>entrySet()</tt>, calling
+     * @implSpec
+     * This implementation iterates over <tt>entrySet()</tt>, calling
      * {@link Map.Entry#hashCode hashCode()} on each element (entry) in the
      * set, and adding up the results.
      *
@@ -489,9 +500,8 @@
      */
     public int hashCode() {
         int h = 0;
-        Iterator<Entry<K,V>> i = entrySet().iterator();
-        while (i.hasNext())
-            h += i.next().hashCode();
+        for (Entry<K, V> entry : entrySet())
+            h += entry.hashCode();
         return h;
     }
 
--- a/jdk/src/share/classes/java/util/AbstractSequentialList.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/AbstractSequentialList.java	Wed Jul 05 19:26:45 2017 +0200
@@ -213,9 +213,8 @@
         try {
             boolean modified = false;
             ListIterator<E> e1 = listIterator(index);
-            Iterator<? extends E> e2 = c.iterator();
-            while (e2.hasNext()) {
-                e1.add(e2.next());
+            for (E e : c) {
+                e1.add(e);
                 modified = true;
             }
             return modified;
--- a/jdk/src/share/classes/java/util/AbstractSet.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/AbstractSet.java	Wed Jul 05 19:26:45 2017 +0200
@@ -170,8 +170,8 @@
         boolean modified = false;
 
         if (size() > c.size()) {
-            for (Iterator<?> i = c.iterator(); i.hasNext(); )
-                modified |= remove(i.next());
+            for (Object e : c)
+                modified |= remove(e);
         } else {
             for (Iterator<?> i = iterator(); i.hasNext(); ) {
                 if (c.contains(i.next())) {
--- a/jdk/src/share/classes/java/util/ArrayDeque.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/ArrayDeque.java	Wed Jul 05 19:26:45 2017 +0200
@@ -902,7 +902,7 @@
      * @since 1.8
      */
     public Spliterator<E> spliterator() {
-        return new DeqSpliterator<E>(this, -1, -1);
+        return new DeqSpliterator<>(this, -1, -1);
     }
 
     static final class DeqSpliterator<E> implements Spliterator<E> {
--- a/jdk/src/share/classes/java/util/ArrayList.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/ArrayList.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1218,8 +1218,8 @@
 
         public Spliterator<E> spliterator() {
             checkForComodification();
-            return new ArrayListSpliterator<E>(ArrayList.this, offset,
-                                               offset + this.size, this.modCount);
+            return new ArrayListSpliterator<>(ArrayList.this, offset,
+                                              offset + this.size, this.modCount);
         }
     }
 
@@ -1322,8 +1322,8 @@
         public ArrayListSpliterator<E> trySplit() {
             int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
             return (lo >= mid) ? null : // divide range in half unless too small
-                new ArrayListSpliterator<E>(list, lo, index = mid,
-                                            expectedModCount);
+                new ArrayListSpliterator<>(list, lo, index = mid,
+                                           expectedModCount);
         }
 
         public boolean tryAdvance(Consumer<? super E> action) {
--- a/jdk/src/share/classes/java/util/ArrayPrefixHelpers.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/ArrayPrefixHelpers.java	Wed Jul 05 19:26:45 2017 +0200
@@ -142,9 +142,9 @@
                     if (lt == null) {                // first pass
                         int mid = (l + h) >>> 1;
                         f = rt = t.right =
-                                new CumulateTask<T>(t, fn, a, org, fnc, th, mid, h);
+                                new CumulateTask<>(t, fn, a, org, fnc, th, mid, h);
                         t = lt = t.left  =
-                                new CumulateTask<T>(t, fn, a, org, fnc, th, l, mid);
+                                new CumulateTask<>(t, fn, a, org, fnc, th, l, mid);
                     }
                     else {                           // possibly refork
                         T pin = t.in;
--- a/jdk/src/share/classes/java/util/Arrays.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/Arrays.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1002,7 +1002,7 @@
             (p = ForkJoinPool.getCommonPoolParallelism()) == 1)
             TimSort.sort(a, 0, n, NaturalOrder.INSTANCE, null, 0, 0);
         else
-            new ArraysParallelSortHelpers.FJObject.Sorter<T>
+            new ArraysParallelSortHelpers.FJObject.Sorter<>
                 (null, a,
                  (T[])Array.newInstance(a.getClass().getComponentType(), n),
                  0, n, 0, ((g = n / (p << 2)) <= MIN_ARRAY_SORT_GRAN) ?
@@ -1061,7 +1061,7 @@
             (p = ForkJoinPool.getCommonPoolParallelism()) == 1)
             TimSort.sort(a, fromIndex, toIndex, NaturalOrder.INSTANCE, null, 0, 0);
         else
-            new ArraysParallelSortHelpers.FJObject.Sorter<T>
+            new ArraysParallelSortHelpers.FJObject.Sorter<>
                 (null, a,
                  (T[])Array.newInstance(a.getClass().getComponentType(), n),
                  fromIndex, n, 0, ((g = n / (p << 2)) <= MIN_ARRAY_SORT_GRAN) ?
@@ -1110,7 +1110,7 @@
             (p = ForkJoinPool.getCommonPoolParallelism()) == 1)
             TimSort.sort(a, 0, n, cmp, null, 0, 0);
         else
-            new ArraysParallelSortHelpers.FJObject.Sorter<T>
+            new ArraysParallelSortHelpers.FJObject.Sorter<>
                 (null, a,
                  (T[])Array.newInstance(a.getClass().getComponentType(), n),
                  0, n, 0, ((g = n / (p << 2)) <= MIN_ARRAY_SORT_GRAN) ?
@@ -1171,7 +1171,7 @@
             (p = ForkJoinPool.getCommonPoolParallelism()) == 1)
             TimSort.sort(a, fromIndex, toIndex, cmp, null, 0, 0);
         else
-            new ArraysParallelSortHelpers.FJObject.Sorter<T>
+            new ArraysParallelSortHelpers.FJObject.Sorter<>
                 (null, a,
                  (T[])Array.newInstance(a.getClass().getComponentType(), n),
                  fromIndex, n, 0, ((g = n / (p << 2)) <= MIN_ARRAY_SORT_GRAN) ?
@@ -4587,7 +4587,7 @@
         if (a.length != 0 && bufLen <= 0)
             bufLen = Integer.MAX_VALUE;
         StringBuilder buf = new StringBuilder(bufLen);
-        deepToString(a, buf, new HashSet<Object[]>());
+        deepToString(a, buf, new HashSet<>());
         return buf.toString();
     }
 
--- a/jdk/src/share/classes/java/util/ArraysParallelSortHelpers.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/ArraysParallelSortHelpers.java	Wed Jul 05 19:26:45 2017 +0200
@@ -130,15 +130,15 @@
                 int b = this.base, n = this.size, wb = this.wbase, g = this.gran;
                 while (n > g) {
                     int h = n >>> 1, q = h >>> 1, u = h + q; // quartiles
-                    Relay fc = new Relay(new Merger<T>(s, w, a, wb, h,
-                                                       wb+h, n-h, b, g, c));
-                    Relay rc = new Relay(new Merger<T>(fc, a, w, b+h, q,
-                                                       b+u, n-u, wb+h, g, c));
-                    new Sorter<T>(rc, a, w, b+u, n-u, wb+u, g, c).fork();
-                    new Sorter<T>(rc, a, w, b+h, q, wb+h, g, c).fork();;
-                    Relay bc = new Relay(new Merger<T>(fc, a, w, b, q,
-                                                       b+q, h-q, wb, g, c));
-                    new Sorter<T>(bc, a, w, b+q, h-q, wb+q, g, c).fork();
+                    Relay fc = new Relay(new Merger<>(s, w, a, wb, h,
+                                                      wb+h, n-h, b, g, c));
+                    Relay rc = new Relay(new Merger<>(fc, a, w, b+h, q,
+                                                      b+u, n-u, wb+h, g, c));
+                    new Sorter<>(rc, a, w, b+u, n-u, wb+u, g, c).fork();
+                    new Sorter<>(rc, a, w, b+h, q, wb+h, g, c).fork();;
+                    Relay bc = new Relay(new Merger<>(fc, a, w, b, q,
+                                                      b+q, h-q, wb, g, c));
+                    new Sorter<>(bc, a, w, b+q, h-q, wb+q, g, c).fork();
                     s = new EmptyCompleter(bc);
                     n = q;
                 }
@@ -199,9 +199,9 @@
                                 lo = lm + 1;
                         }
                     }
-                    Merger<T> m = new Merger<T>(this, a, w, lb + lh, ln - lh,
-                                                rb + rh, rn - rh,
-                                                k + lh + rh, g, c);
+                    Merger<T> m = new Merger<>(this, a, w, lb + lh, ln - lh,
+                                               rb + rh, rn - rh,
+                                               k + lh + rh, g, c);
                     rn = rh;
                     ln = lh;
                     addToPendingCount(1);
--- a/jdk/src/share/classes/java/util/Calendar.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/Calendar.java	Wed Jul 05 19:26:45 2017 +0200
@@ -3380,8 +3380,7 @@
 
         for (;;) {
             int min = Integer.MAX_VALUE;
-            for (int i = 0; i < stamp.length; i++) {
-                int v = stamp[i];
+            for (int v : stamp) {
                 if (v >= newStamp && min > v) {
                     min = v;
                 }
--- a/jdk/src/share/classes/java/util/Collections.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/Collections.java	Wed Jul 05 19:26:45 2017 +0200
@@ -165,9 +165,9 @@
         Object[] a = list.toArray();
         Arrays.sort(a);
         ListIterator<T> i = list.listIterator();
-        for (int j=0; j<a.length; j++) {
+        for (Object e : a) {
             i.next();
-            i.set((T)a[j]);
+            i.set((T) e);
         }
     }
 
@@ -229,9 +229,9 @@
         Object[] a = list.toArray();
         Arrays.sort(a, (Comparator)c);
         ListIterator<T> i = list.listIterator();
-        for (int j=0; j<a.length; j++) {
+        for (Object e : a) {
             i.next();
-            i.set((T)a[j]);
+            i.set((T) e);
         }
     }
 
@@ -528,9 +528,9 @@
             // the wildcard but it will require a call to a supplementary
             // private method
             ListIterator it = list.listIterator();
-            for (int i=0; i<arr.length; i++) {
+            for (Object e : arr) {
                 it.next();
-                it.set(arr[i]);
+                it.set(e);
             }
         }
     }
@@ -1283,7 +1283,7 @@
             private static final long serialVersionUID = -6291252904449939134L;
 
             public EmptyNavigableSet() {
-                super(new TreeSet<E>());
+                super(new TreeSet<>());
             }
 
             private Object readResolve()        { return EMPTY_NAVIGABLE_SET; }
@@ -1910,7 +1910,7 @@
 
             private static final long serialVersionUID = -2239321462712562324L;
 
-            EmptyNavigableMap()                       { super(new TreeMap<K,V>()); }
+            EmptyNavigableMap()                       { super(new TreeMap<>()); }
 
             @Override
             public NavigableSet<K> navigableKeySet()
--- a/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java	Wed Jul 05 19:26:45 2017 +0200
@@ -64,6 +64,7 @@
     private long count;
     private double sum;
     private double sumCompensation; // Low order bits of sum
+    private double simpleSum; // Used to compute right sum for non-finite inputs
     private double min = Double.POSITIVE_INFINITY;
     private double max = Double.NEGATIVE_INFINITY;
 
@@ -82,6 +83,7 @@
     @Override
     public void accept(double value) {
         ++count;
+        simpleSum += value;
         sumWithCompensation(value);
         min = Math.min(min, value);
         max = Math.max(max, value);
@@ -96,6 +98,7 @@
      */
     public void combine(DoubleSummaryStatistics other) {
         count += other.count;
+        simpleSum += other.simpleSum;
         sumWithCompensation(other.sum);
         sumWithCompensation(other.sumCompensation);
         min = Math.min(min, other.min);
@@ -147,7 +150,15 @@
      */
     public final double getSum() {
         // Better error bounds to add both terms as the final sum
-        return sum + sumCompensation;
+        double tmp =  sum + sumCompensation;
+        if (Double.isNaN(tmp) && Double.isInfinite(simpleSum))
+            // If the compensated sum is spuriously NaN from
+            // accumulating one or more same-signed infinite values,
+            // return the correctly-signed infinity stored in
+            // simpleSum.
+            return simpleSum;
+        else
+            return tmp;
     }
 
     /**
--- a/jdk/src/share/classes/java/util/Formatter.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/Formatter.java	Wed Jul 05 19:26:45 2017 +0200
@@ -2499,8 +2499,7 @@
         int lasto = -1;
 
         FormatString[] fsa = parse(format);
-        for (int i = 0; i < fsa.length; i++) {
-            FormatString fs = fsa[i];
+        for (FormatString fs : fsa) {
             int index = fs.index();
             try {
                 switch (index) {
@@ -2992,9 +2991,9 @@
         }
 
         private void checkBadFlags(Flags ... badFlags) {
-            for (int i = 0; i < badFlags.length; i++)
-                if (f.contains(badFlags[i]))
-                    failMismatch(badFlags[i], c);
+            for (Flags badFlag : badFlags)
+                if (f.contains(badFlag))
+                    failMismatch(badFlag, c);
         }
 
         private void checkFloat() {
@@ -4437,8 +4436,8 @@
         public static Flags parse(String s) {
             char[] ca = s.toCharArray();
             Flags f = new Flags(0);
-            for (int i = 0; i < ca.length; i++) {
-                Flags v = parse(ca[i]);
+            for (char c : ca) {
+                Flags v = parse(c);
                 if (f.contains(v))
                     throw new DuplicateFormatFlagsException(v.toString());
                 f.add(v);
--- a/jdk/src/share/classes/java/util/HashMap.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/HashMap.java	Wed Jul 05 19:26:45 2017 +0200
@@ -344,13 +344,13 @@
      */
     static Class<?> comparableClassFor(Object x) {
         if (x instanceof Comparable) {
-            Class<?> c; Type[] ts, as; Type t; ParameterizedType p;
+            Class<?> c; Type[] ts, as; ParameterizedType p;
             if ((c = x.getClass()) == String.class) // bypass checks
                 return c;
             if ((ts = c.getGenericInterfaces()) != null) {
-                for (int i = 0; i < ts.length; ++i) {
-                    if (((t = ts[i]) instanceof ParameterizedType) &&
-                        ((p = (ParameterizedType)t).getRawType() ==
+                for (Type t : ts) {
+                    if ((t instanceof ParameterizedType) &&
+                        ((p = (ParameterizedType) t).getRawType() ==
                          Comparable.class) &&
                         (as = p.getActualTypeArguments()) != null &&
                         as.length == 1 && as[0] == c) // type arg is c
@@ -875,8 +875,8 @@
     public boolean containsValue(Object value) {
         Node<K,V>[] tab; V v;
         if ((tab = table) != null && size > 0) {
-            for (int i = 0; i < tab.length; ++i) {
-                for (Node<K,V> e = tab[i]; e != null; e = e.next) {
+            for (Node<K, V> e : tab) {
+                for (; e != null; e = e.next) {
                     if ((v = e.value) == value ||
                         (value != null && value.equals(v)))
                         return true;
@@ -923,8 +923,8 @@
                 throw new NullPointerException();
             if (size > 0 && (tab = table) != null) {
                 int mc = modCount;
-                for (int i = 0; i < tab.length; ++i) {
-                    for (Node<K,V> e = tab[i]; e != null; e = e.next)
+                for (Node<K, V> e : tab) {
+                    for (; e != null; e = e.next)
                         action.accept(e.key);
                 }
                 if (modCount != mc)
@@ -967,8 +967,8 @@
                 throw new NullPointerException();
             if (size > 0 && (tab = table) != null) {
                 int mc = modCount;
-                for (int i = 0; i < tab.length; ++i) {
-                    for (Node<K,V> e = tab[i]; e != null; e = e.next)
+                for (Node<K, V> e : tab) {
+                    for (; e != null; e = e.next)
                         action.accept(e.value);
                 }
                 if (modCount != mc)
@@ -1030,8 +1030,8 @@
                 throw new NullPointerException();
             if (size > 0 && (tab = table) != null) {
                 int mc = modCount;
-                for (int i = 0; i < tab.length; ++i) {
-                    for (Node<K,V> e = tab[i]; e != null; e = e.next)
+                for (Node<K, V> e : tab) {
+                    for (; e != null; e = e.next)
                         action.accept(e);
                 }
                 if (modCount != mc)
@@ -1116,13 +1116,13 @@
             }
         }
         V v = mappingFunction.apply(key);
-        if (old != null) {
+        if (v == null) {
+            return null;
+        } else if (old != null) {
             old.value = v;
             afterNodeAccess(old);
             return v;
         }
-        else if (v == null)
-            return null;
         else if (t != null)
             t.putTreeVal(this, tab, hash, key, v);
         else {
@@ -1212,6 +1212,8 @@
     @Override
     public V merge(K key, V value,
                    BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
+        if (value == null)
+            throw new NullPointerException();
         if (remappingFunction == null)
             throw new NullPointerException();
         int hash = hash(key);
@@ -1273,8 +1275,8 @@
             throw new NullPointerException();
         if (size > 0 && (tab = table) != null) {
             int mc = modCount;
-            for (int i = 0; i < tab.length; ++i) {
-                for (Node<K,V> e = tab[i]; e != null; e = e.next)
+            for (Node<K, V> e : tab) {
+                for (; e != null; e = e.next)
                     action.accept(e.key, e.value);
             }
             if (modCount != mc)
@@ -1289,8 +1291,8 @@
             throw new NullPointerException();
         if (size > 0 && (tab = table) != null) {
             int mc = modCount;
-            for (int i = 0; i < tab.length; ++i) {
-                for (Node<K,V> e = tab[i]; e != null; e = e.next) {
+            for (Node<K, V> e : tab) {
+                for (; e != null; e = e.next) {
                     e.value = function.apply(e.key, e.value);
                 }
             }
@@ -1769,8 +1771,8 @@
     void internalWriteEntries(java.io.ObjectOutputStream s) throws IOException {
         Node<K,V>[] tab;
         if (size > 0 && (tab = table) != null) {
-            for (int i = 0; i < tab.length; ++i) {
-                for (Node<K,V> e = tab[i]; e != null; e = e.next) {
+            for (Node<K, V> e : tab) {
+                for (; e != null; e = e.next) {
                     s.writeObject(e.key);
                     s.writeObject(e.value);
                 }
--- a/jdk/src/share/classes/java/util/HashSet.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/HashSet.java	Wed Jul 05 19:26:45 2017 +0200
@@ -324,8 +324,8 @@
 
         // Create backing HashMap
         map = (((HashSet<?>)this) instanceof LinkedHashSet ?
-               new LinkedHashMap<E,Object>(capacity, loadFactor) :
-               new HashMap<E,Object>(capacity, loadFactor));
+               new LinkedHashMap<>(capacity, loadFactor) :
+               new HashMap<>(capacity, loadFactor));
 
         // Read in all elements in the proper order.
         for (int i=0; i<size; i++) {
@@ -348,6 +348,6 @@
      * @since 1.8
      */
     public Spliterator<E> spliterator() {
-        return new HashMap.KeySpliterator<E,Object>(map, 0, -1, 0, 0);
+        return new HashMap.KeySpliterator<>(map, 0, -1, 0, 0);
     }
 }
--- a/jdk/src/share/classes/java/util/Hashtable.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/Hashtable.java	Wed Jul 05 19:26:45 2017 +0200
@@ -801,13 +801,11 @@
             return false;
 
         try {
-            Iterator<Map.Entry<K,V>> i = entrySet().iterator();
-            while (i.hasNext()) {
-                Map.Entry<K,V> e = i.next();
+            for (Map.Entry<K, V> e : entrySet()) {
                 K key = e.getKey();
                 V value = e.getValue();
                 if (value == null) {
-                    if (!(t.get(key)==null && t.containsKey(key)))
+                    if (!(t.get(key) == null && t.containsKey(key)))
                         return false;
                 } else {
                     if (!value.equals(t.get(key)))
@@ -1140,8 +1138,7 @@
             s.writeInt(count);
 
             // Stack copies of the entries in the table
-            for (int index = 0; index < table.length; index++) {
-                Entry<?,?> entry = table[index];
+            for (Entry<?, ?> entry : table) {
 
                 while (entry != null) {
                     entryStack =
--- a/jdk/src/share/classes/java/util/IdentityHashMap.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/IdentityHashMap.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1426,8 +1426,8 @@
         public KeySpliterator<K,V> trySplit() {
             int hi = getFence(), lo = index, mid = ((lo + hi) >>> 1) & ~1;
             return (lo >= mid) ? null :
-                new KeySpliterator<K,V>(map, lo, index = mid, est >>>= 1,
-                                        expectedModCount);
+                new KeySpliterator<>(map, lo, index = mid, est >>>= 1,
+                                     expectedModCount);
         }
 
         @SuppressWarnings("unchecked")
@@ -1483,8 +1483,8 @@
         public ValueSpliterator<K,V> trySplit() {
             int hi = getFence(), lo = index, mid = ((lo + hi) >>> 1) & ~1;
             return (lo >= mid) ? null :
-                new ValueSpliterator<K,V>(map, lo, index = mid, est >>>= 1,
-                                          expectedModCount);
+                new ValueSpliterator<>(map, lo, index = mid, est >>>= 1,
+                                       expectedModCount);
         }
 
         public void forEachRemaining(Consumer<? super V> action) {
@@ -1542,8 +1542,8 @@
         public EntrySpliterator<K,V> trySplit() {
             int hi = getFence(), lo = index, mid = ((lo + hi) >>> 1) & ~1;
             return (lo >= mid) ? null :
-                new EntrySpliterator<K,V>(map, lo, index = mid, est >>>= 1,
-                                          expectedModCount);
+                new EntrySpliterator<>(map, lo, index = mid, est >>>= 1,
+                                       expectedModCount);
         }
 
         public void forEachRemaining(Consumer<? super Map.Entry<K, V>> action) {
@@ -1560,7 +1560,7 @@
                             (K)unmaskNull(key);
                         @SuppressWarnings("unchecked") V v = (V)a[i+1];
                         action.accept
-                            (new AbstractMap.SimpleImmutableEntry<K,V>(k, v));
+                            (new AbstractMap.SimpleImmutableEntry<>(k, v));
 
                     }
                 }
@@ -1583,7 +1583,7 @@
                     @SuppressWarnings("unchecked") K k =
                         (K)unmaskNull(key);
                     action.accept
-                        (new AbstractMap.SimpleImmutableEntry<K,V>(k, v));
+                        (new AbstractMap.SimpleImmutableEntry<>(k, v));
                     if (map.modCount != expectedModCount)
                         throw new ConcurrentModificationException();
                     return true;
--- a/jdk/src/share/classes/java/util/LinkedHashMap.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/LinkedHashMap.java	Wed Jul 05 19:26:45 2017 +0200
@@ -28,7 +28,6 @@
 import java.util.function.Consumer;
 import java.util.function.BiConsumer;
 import java.util.function.BiFunction;
-import java.io.Serializable;
 import java.io.IOException;
 
 /**
@@ -63,14 +62,17 @@
  * provided to create a linked hash map whose order of iteration is the order
  * in which its entries were last accessed, from least-recently accessed to
  * most-recently (<i>access-order</i>).  This kind of map is well-suited to
- * building LRU caches.  Invoking the <tt>put</tt> or <tt>get</tt> method
- * results in an access to the corresponding entry (assuming it exists after
- * the invocation completes).  The <tt>putAll</tt> method generates one entry
- * access for each mapping in the specified map, in the order that key-value
- * mappings are provided by the specified map's entry set iterator.  <i>No
- * other methods generate entry accesses.</i> In particular, operations on
- * collection-views do <i>not</i> affect the order of iteration of the backing
- * map.
+ * building LRU caches.  Invoking the {@code put}, {@code putIfAbsent},
+ * {@code get}, {@code getOrDefault}, {@code compute}, {@code computeIfAbsent},
+ * {@code computeIfPresent}, or {@code merge} methods results
+ * in an access to the corresponding entry (assuming it exists after the
+ * invocation completes). The {@code replace} methods only result in an access
+ * of the entry if the value is replaced.  The {@code putAll} method generates one
+ * entry access for each mapping in the specified map, in the order that
+ * key-value mappings are provided by the specified map's entry set iterator.
+ * <i>No other methods generate entry accesses.</i>  In particular, operations
+ * on collection-views do <i>not</i> affect the order of iteration of the
+ * backing map.
  *
  * <p>The {@link #removeEldestEntry(Map.Entry)} method may be overridden to
  * impose a policy for removing stale mappings automatically when new mappings
@@ -112,8 +114,8 @@
  * iteration order.  In insertion-ordered linked hash maps, merely changing
  * the value associated with a key that is already contained in the map is not
  * a structural modification.  <strong>In access-ordered linked hash maps,
- * merely querying the map with <tt>get</tt> is a structural
- * modification.</strong>)
+ * merely querying the map with <tt>get</tt> is a structural modification.
+ * </strong>)
  *
  * <p>The iterators returned by the <tt>iterator</tt> method of the collections
  * returned by all of this class's collection view methods are
@@ -252,7 +254,7 @@
 
     Node<K,V> newNode(int hash, K key, V value, Node<K,V> e) {
         LinkedHashMap.Entry<K,V> p =
-            new LinkedHashMap.Entry<K,V>(hash, key, value, e);
+            new LinkedHashMap.Entry<>(hash, key, value, e);
         linkNodeLast(p);
         return p;
     }
@@ -260,20 +262,20 @@
     Node<K,V> replacementNode(Node<K,V> p, Node<K,V> next) {
         LinkedHashMap.Entry<K,V> q = (LinkedHashMap.Entry<K,V>)p;
         LinkedHashMap.Entry<K,V> t =
-            new LinkedHashMap.Entry<K,V>(q.hash, q.key, q.value, next);
+            new LinkedHashMap.Entry<>(q.hash, q.key, q.value, next);
         transferLinks(q, t);
         return t;
     }
 
     TreeNode<K,V> newTreeNode(int hash, K key, V value, Node<K,V> next) {
-        TreeNode<K,V> p = new TreeNode<K,V>(hash, key, value, next);
+        TreeNode<K,V> p = new TreeNode<>(hash, key, value, next);
         linkNodeLast(p);
         return p;
     }
 
     TreeNode<K,V> replacementTreeNode(Node<K,V> p, Node<K,V> next) {
         LinkedHashMap.Entry<K,V> q = (LinkedHashMap.Entry<K,V>)p;
-        TreeNode<K,V> t = new TreeNode<K,V>(q.hash, q.key, q.value, next);
+        TreeNode<K,V> t = new TreeNode<>(q.hash, q.key, q.value, next);
         transferLinks(q, t);
         return t;
     }
@@ -443,8 +445,19 @@
     }
 
     /**
-     * Removes all of the mappings from this map.
-     * The map will be empty after this call returns.
+     * {@inheritDoc}
+     */
+    public V getOrDefault(Object key, V defaultValue) {
+       Node<K,V> e;
+       if ((e = getNode(hash(key), key)) == null)
+           return defaultValue;
+       if (accessOrder)
+           afterNodeAccess(e);
+       return e.value;
+   }
+
+    /**
+     * {@inheritDoc}
      */
     public void clear() {
         super.clear();
--- a/jdk/src/share/classes/java/util/LinkedList.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/LinkedList.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1167,7 +1167,7 @@
      */
     @Override
     public Spliterator<E> spliterator() {
-        return new LLSpliterator<E>(this, -1, 0);
+        return new LLSpliterator<>(this, -1, 0);
     }
 
     /** A customized variant of Spliterators.IteratorSpliterator */
--- a/jdk/src/share/classes/java/util/ListResourceBundle.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/ListResourceBundle.java	Wed Jul 05 19:26:45 2017 +0200
@@ -194,10 +194,10 @@
 
         Object[][] contents = getContents();
         HashMap<String,Object> temp = new HashMap<>(contents.length);
-        for (int i = 0; i < contents.length; ++i) {
+        for (Object[] content : contents) {
             // key must be non-null String, value must be non-null
-            String key = (String) contents[i][0];
-            Object value = contents[i][1];
+            String key = (String) content[0];
+            Object value = content[1];
             if (key == null || value == null) {
                 throw new NullPointerException();
             }
--- a/jdk/src/share/classes/java/util/Map.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/Map.java	Wed Jul 05 19:26:45 2017 +0200
@@ -600,7 +600,7 @@
      * @implSpec
      * The default implementation is equivalent to, for this {@code map}:
      * <pre> {@code
-     * for ((Map.Entry<K, V> entry : map.entrySet())
+     * for (Map.Entry<K, V> entry : map.entrySet())
      *     action.accept(entry.getKey(), entry.getValue());
      * }</pre>
      *
@@ -640,7 +640,7 @@
      * @implSpec
      * <p>The default implementation is equivalent to, for this {@code map}:
      * <pre> {@code
-     * for ((Map.Entry<K, V> entry : map.entrySet())
+     * for (Map.Entry<K, V> entry : map.entrySet())
      *     entry.setValue(function.apply(entry.getKey(), entry.getValue()));
      * }</pre>
      *
@@ -1110,8 +1110,8 @@
 
     /**
      * If the specified key is not already associated with a value or is
-     * associated with null, associates it with the given value.
-     * Otherwise, replaces the value with the results of the given
+     * associated with null, associates it with the given non-null value.
+     * Otherwise, replaces the associated value with the results of the given
      * remapping function, or removes if the result is {@code null}. This
      * method may be of use when combining multiple mapped values for a key.
      * For example, to either create or append a {@code String msg} to a
@@ -1121,15 +1121,14 @@
      * map.merge(key, msg, String::concat)
      * }</pre>
      *
-     * <p>If the function returns {@code null}, the mapping is removed (or
-     * remains absent if initially absent).  If the function itself throws an
-     * (unchecked) exception, the exception is rethrown, and the current mapping
-     * is left unchanged.
+     * <p>If the function returns {@code null} the mapping is removed.  If the
+     * function itself throws an (unchecked) exception, the exception is
+     * rethrown, and the current mapping is left unchanged.
      *
      * @implSpec
-     * The default implementation is equivalent to performing the
-     * following steps for this {@code map}, then returning the
-     * current value or {@code null} if absent:
+     * The default implementation is equivalent to performing the following
+     * steps for this {@code map}, then returning the current value or
+     * {@code null} if absent:
      *
      * <pre> {@code
      * V oldValue = map.get(key);
@@ -1137,8 +1136,6 @@
      *              remappingFunction.apply(oldValue, value);
      * if (newValue == null)
      *     map.remove(key);
-     * else if (oldValue == null)
-     *     map.remove(key);
      * else
      *     map.put(key, newValue);
      * }</pre>
@@ -1151,42 +1148,36 @@
      * whether the function is applied once atomically only if the value is not
      * present.
      *
-     * @param key key with which the specified value is to be associated
-     * @param value the value to use if absent
+     * @param key key with which the resulting value is to be associated
+     * @param value the non-null value to be merged with the existing value
+     *        associated with the key or, if no existing value or a null value
+     *        is associated with the key, to be associated with the key
      * @param remappingFunction the function to recompute a value if present
-     * @return the new value associated with the specified key, or null if none
+     * @return the new value associated with the specified key, or null if no
+     *         value is associated with the key
      * @throws UnsupportedOperationException if the {@code put} operation
      *         is not supported by this map
      *         (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws ClassCastException if the class of the specified key or value
      *         prevents it from being stored in this map
      *         (<a href="Collection.html#optional-restrictions">optional</a>)
-     * @throws NullPointerException if the specified key is null and
-     *         this map does not support null keys, or the remappingFunction
-     *         is null
+     * @throws NullPointerException if the specified key is null and this map
+     *         does not support null keys or the value or remappingFunction is
+     *         null
      * @since 1.8
      */
     default V merge(K key, V value,
             BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
         Objects.requireNonNull(remappingFunction);
+        Objects.requireNonNull(value);
         V oldValue = get(key);
-        if (oldValue != null) {
-            V newValue = remappingFunction.apply(oldValue, value);
-            if (newValue != null) {
-                put(key, newValue);
-                return newValue;
-            } else {
-                remove(key);
-                return null;
-            }
+        V newValue = (oldValue == null) ? value :
+                   remappingFunction.apply(oldValue, value);
+        if(newValue == null) {
+            remove(key);
         } else {
-            if (value == null) {
-                remove(key);
-                return null;
-            } else {
-                put(key, value);
-                return value;
-            }
+            put(key, newValue);
         }
+        return newValue;
     }
 }
--- a/jdk/src/share/classes/java/util/PriorityQueue.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/PriorityQueue.java	Wed Jul 05 19:26:45 2017 +0200
@@ -258,8 +258,8 @@
             a = Arrays.copyOf(a, a.length, Object[].class);
         int len = a.length;
         if (len == 1 || this.comparator != null)
-            for (int i = 0; i < len; i++)
-                if (a[i] == null)
+            for (Object e : a)
+                if (e == null)
                     throw new NullPointerException();
         this.queue = a;
         this.size = a.length;
@@ -809,7 +809,7 @@
      * @since 1.8
      */
     public final Spliterator<E> spliterator() {
-        return new PriorityQueueSpliterator<E>(this, 0, -1, 0);
+        return new PriorityQueueSpliterator<>(this, 0, -1, 0);
     }
 
     static final class PriorityQueueSpliterator<E> implements Spliterator<E> {
@@ -843,8 +843,8 @@
         public PriorityQueueSpliterator<E> trySplit() {
             int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
             return (lo >= mid) ? null :
-                new PriorityQueueSpliterator<E>(pq, lo, index = mid,
-                                                expectedModCount);
+                new PriorityQueueSpliterator<>(pq, lo, index = mid,
+                                               expectedModCount);
         }
 
         @SuppressWarnings("unchecked")
--- a/jdk/src/share/classes/java/util/ResourceBundle.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/ResourceBundle.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1494,19 +1494,15 @@
         Locale targetLocale = cacheKey.getLocale();
 
         ResourceBundle bundle = null;
-        int size = formats.size();
-        for (int i = 0; i < size; i++) {
-            String format = formats.get(i);
+        for (String format : formats) {
             try {
                 bundle = control.newBundle(cacheKey.getName(), targetLocale, format,
                                            cacheKey.getLoader(), reload);
-            } catch (LinkageError error) {
+            } catch (LinkageError | Exception error) {
                 // We need to handle the LinkageError case due to
                 // inconsistent case-sensitivity in ClassLoader.
                 // See 6572242 for details.
                 cacheKey.setCause(error);
-            } catch (Exception cause) {
-                cacheKey.setCause(cause);
             }
             if (bundle != null) {
                 // Set the format in the cache key so that it can be
--- a/jdk/src/share/classes/java/util/StringTokenizer.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/StringTokenizer.java	Wed Jul 05 19:26:45 2017 +0200
@@ -297,8 +297,8 @@
     }
 
     private boolean isDelimiter(int codePoint) {
-        for (int i = 0; i < delimiterCodePoints.length; i++) {
-            if (delimiterCodePoints[i] == codePoint) {
+        for (int delimiterCodePoint : delimiterCodePoints) {
+            if (delimiterCodePoint == codePoint) {
                 return true;
             }
         }
--- a/jdk/src/share/classes/java/util/TreeMap.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/TreeMap.java	Wed Jul 05 19:26:45 2017 +0200
@@ -198,8 +198,7 @@
         comparator = m.comparator();
         try {
             buildFromSorted(m.size(), m.entrySet().iterator(), null, null);
-        } catch (java.io.IOException cannotHappen) {
-        } catch (ClassNotFoundException cannotHappen) {
+        } catch (java.io.IOException | ClassNotFoundException cannotHappen) {
         }
     }
 
@@ -318,8 +317,7 @@
                 try {
                     buildFromSorted(mapSize, map.entrySet().iterator(),
                                     null, null);
-                } catch (java.io.IOException cannotHappen) {
-                } catch (ClassNotFoundException cannotHappen) {
+                } catch (java.io.IOException | ClassNotFoundException cannotHappen) {
                 }
                 return;
             }
@@ -644,8 +642,7 @@
         // Initialize clone with our mappings
         try {
             clone.buildFromSorted(size, entrySet().iterator(), null, null);
-        } catch (java.io.IOException cannotHappen) {
-        } catch (ClassNotFoundException cannotHappen) {
+        } catch (java.io.IOException | ClassNotFoundException cannotHappen) {
         }
 
         return clone;
@@ -1050,7 +1047,7 @@
         }
 
         public Spliterator<V> spliterator() {
-            return new ValueSpliterator<K,V>(TreeMap.this, null, null, 0, -1, 0);
+            return new ValueSpliterator<>(TreeMap.this, null, null, 0, -1, 0);
         }
     }
 
@@ -1090,7 +1087,7 @@
         }
 
         public Spliterator<Map.Entry<K,V>> spliterator() {
-            return new EntrySpliterator<K,V>(TreeMap.this, null, null, 0, -1, 0);
+            return new EntrySpliterator<>(TreeMap.this, null, null, 0, -1, 0);
         }
     }
 
@@ -2427,8 +2424,7 @@
         s.writeInt(size);
 
         // Write out keys and values (alternating)
-        for (Iterator<Map.Entry<K,V>> i = entrySet().iterator(); i.hasNext(); ) {
-            Map.Entry<K,V> e = i.next();
+        for (Map.Entry<K, V> e : entrySet()) {
             s.writeObject(e.getKey());
             s.writeObject(e.getValue());
         }
@@ -2459,8 +2455,7 @@
     void addAllForTreeSet(SortedSet<? extends K> set, V defaultVal) {
         try {
             buildFromSorted(set.size(), set.iterator(), null, defaultVal);
-        } catch (java.io.IOException cannotHappen) {
-        } catch (ClassNotFoundException cannotHappen) {
+        } catch (java.io.IOException | ClassNotFoundException cannotHappen) {
         }
     }
 
@@ -2631,11 +2626,11 @@
     }
 
     final Spliterator<K> keySpliterator() {
-        return new KeySpliterator<K,V>(this, null, null, 0, -1, 0);
+        return new KeySpliterator<>(this, null, null, 0, -1, 0);
     }
 
     final Spliterator<K> descendingKeySpliterator() {
-        return new DescendingKeySpliterator<K,V>(this, null, null, 0, -2, 0);
+        return new DescendingKeySpliterator<>(this, null, null, 0, -2, 0);
     }
 
     /**
--- a/jdk/src/share/classes/java/util/TreeSet.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/TreeSet.java	Wed Jul 05 19:26:45 2017 +0200
@@ -121,7 +121,7 @@
      * {@code ClassCastException}.
      */
     public TreeSet() {
-        this(new TreeMap<E,Object>());
+        this(new TreeMap<>());
     }
 
     /**
--- a/jdk/src/share/classes/java/util/Vector.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/Vector.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1374,8 +1374,8 @@
         public Spliterator<E> trySplit() {
             int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
             return (lo >= mid) ? null :
-                new VectorSpliterator<E>(list, array, lo, index = mid,
-                                         expectedModCount);
+                new VectorSpliterator<>(list, array, lo, index = mid,
+                                        expectedModCount);
         }
 
         @SuppressWarnings("unchecked")
--- a/jdk/src/share/classes/java/util/WeakHashMap.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/WeakHashMap.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1097,8 +1097,8 @@
         public KeySpliterator<K,V> trySplit() {
             int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
             return (lo >= mid) ? null :
-                new KeySpliterator<K,V>(map, lo, index = mid, est >>>= 1,
-                                        expectedModCount);
+                new KeySpliterator<>(map, lo, index = mid, est >>>= 1,
+                                     expectedModCount);
         }
 
         public void forEachRemaining(Consumer<? super K> action) {
@@ -1177,8 +1177,8 @@
         public ValueSpliterator<K,V> trySplit() {
             int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
             return (lo >= mid) ? null :
-                new ValueSpliterator<K,V>(map, lo, index = mid, est >>>= 1,
-                                          expectedModCount);
+                new ValueSpliterator<>(map, lo, index = mid, est >>>= 1,
+                                       expectedModCount);
         }
 
         public void forEachRemaining(Consumer<? super V> action) {
@@ -1254,8 +1254,8 @@
         public EntrySpliterator<K,V> trySplit() {
             int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
             return (lo >= mid) ? null :
-                new EntrySpliterator<K,V>(map, lo, index = mid, est >>>= 1,
-                                          expectedModCount);
+                new EntrySpliterator<>(map, lo, index = mid, est >>>= 1,
+                                       expectedModCount);
         }
 
 
@@ -1286,7 +1286,7 @@
                             @SuppressWarnings("unchecked") K k =
                                 (K) WeakHashMap.unmaskNull(x);
                             action.accept
-                                (new AbstractMap.SimpleImmutableEntry<K,V>(k, v));
+                                (new AbstractMap.SimpleImmutableEntry<>(k, v));
                         }
                     }
                 } while (p != null || i < hi);
@@ -1312,7 +1312,7 @@
                             @SuppressWarnings("unchecked") K k =
                                 (K) WeakHashMap.unmaskNull(x);
                             action.accept
-                                (new AbstractMap.SimpleImmutableEntry<K,V>(k, v));
+                                (new AbstractMap.SimpleImmutableEntry<>(k, v));
                             if (map.modCount != expectedModCount)
                                 throw new ConcurrentModificationException();
                             return true;
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentMap.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentMap.java	Wed Jul 05 19:26:45 2017 +0200
@@ -463,9 +463,9 @@
      * {@inheritDoc}
      *
      * @implSpec
-     * The default implementation is equivalent to performing the
-     * following steps for this {@code map}, then returning the
-     * current value or {@code null} if absent:
+     * The default implementation is equivalent to performing the following
+     * steps for this {@code map}, then returning the current value or
+     * {@code null} if absent:
      *
      * <pre> {@code
      * V oldValue = map.get(key);
@@ -473,8 +473,6 @@
      *              remappingFunction.apply(oldValue, value);
      * if (newValue == null)
      *     map.remove(key);
-     * else if (oldValue == null)
-     *     map.remove(key);
      * else
      *     map.put(key, newValue);
      * }</pre>
--- a/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java	Wed Jul 05 19:26:45 2017 +0200
@@ -49,6 +49,9 @@
 import java.util.concurrent.RunnableFuture;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeUnit;
+import java.security.AccessControlContext;
+import java.security.ProtectionDomain;
+import java.security.Permissions;
 
 /**
  * An {@link ExecutorService} for running {@link ForkJoinTask}s.
@@ -140,6 +143,9 @@
  * <li>{@code java.util.concurrent.ForkJoinPool.common.exceptionHandler}
  * - the class name of a {@link UncaughtExceptionHandler}
  * </ul>
+ * If a {@link SecurityManager} is present and no factory is
+ * specified, then the default pool uses a factory supplying
+ * threads that have no {@link Permissions} enabled.
  * The system class loader is used to load these classes.
  * Upon any error in establishing these settings, default parameters
  * are used. It is possible to disable or limit the use of threads in
@@ -501,6 +507,16 @@
      * task status checks) in inapplicable cases amounts to an odd
      * form of limited spin-wait before blocking in ForkJoinTask.join.
      *
+     * As a more appropriate default in managed environments, unless
+     * overridden by system properties, we use workers of subclass
+     * InnocuousForkJoinWorkerThread when there is a SecurityManager
+     * present. These workers have no permissions set, do not belong
+     * to any user-defined ThreadGroup, and erase all ThreadLocals
+     * after executing any top-level task (see WorkQueue.runTask). The
+     * associated mechanics (mainly in ForkJoinWorkerThread) may be
+     * JVM-dependent and must access particular Thread class fields to
+     * achieve this effect.
+     *
      * Style notes
      * ===========
      *
@@ -882,6 +898,7 @@
          */
         final void runTask(ForkJoinTask<?> task) {
             if ((currentSteal = task) != null) {
+                ForkJoinWorkerThread thread;
                 task.doExec();
                 ForkJoinTask<?>[] a = array;
                 int md = mode;
@@ -899,6 +916,8 @@
                         t.doExec();
                     }
                 }
+                if ((thread = owner) != null) // no need to do in finally clause
+                    thread.afterTopLevelExec();
             }
         }
 
@@ -1155,7 +1174,7 @@
      * Increment for seed generators. See class ThreadLocal for
      * explanation.
      */
-    private static final int SEED_INCREMENT = 0x61c88647;
+    private static final int SEED_INCREMENT = 0x9e3779b9;
 
     /*
      * Bits and masks for control variables
@@ -2084,12 +2103,10 @@
                                   ((c & ~AC_MASK) |
                                    ((c & AC_MASK) + AC_UNIT))));
                 }
-                if ((b = q.base) - q.top < 0 && (t = q.pollAt(b)) != null) {
-                    (w.currentSteal = t).doExec();
-                    w.currentSteal = ps;
-                }
+                if ((b = q.base) - q.top < 0 && (t = q.pollAt(b)) != null)
+                    w.runTask(t);
             }
-            else if (active) {       // decrement active count without queuing
+            else if (active) {      // decrement active count without queuing
                 long nc = ((c = ctl) & ~AC_MASK) | ((c & AC_MASK) - AC_UNIT);
                 if ((int)(nc >> AC_SHIFT) + parallelism == 0)
                     break;          // bypass decrement-then-increment
@@ -3282,8 +3299,7 @@
      */
     private static ForkJoinPool makeCommonPool() {
         int parallelism = -1;
-        ForkJoinWorkerThreadFactory factory
-            = defaultForkJoinWorkerThreadFactory;
+        ForkJoinWorkerThreadFactory factory = null;
         UncaughtExceptionHandler handler = null;
         try {  // ignore exceptions in accessing/parsing properties
             String pp = System.getProperty
@@ -3302,7 +3318,12 @@
                            getSystemClassLoader().loadClass(hp).newInstance());
         } catch (Exception ignore) {
         }
-
+        if (factory == null) {
+            if (System.getSecurityManager() == null)
+                factory = defaultForkJoinWorkerThreadFactory;
+            else // use security-managed default
+                factory = new InnocuousForkJoinWorkerThreadFactory();
+        }
         if (parallelism < 0 && // default 1 less than #cores
             (parallelism = Runtime.getRuntime().availableProcessors() - 1) <= 0)
             parallelism = 1;
@@ -3312,4 +3333,38 @@
                                 "ForkJoinPool.commonPool-worker-");
     }
 
+    /**
+     * Factory for innocuous worker threads
+     */
+    static final class InnocuousForkJoinWorkerThreadFactory
+        implements ForkJoinWorkerThreadFactory {
+
+        /**
+         * An ACC to restrict permissions for the factory itself.
+         * The constructed workers have no permissions set.
+         */
+        private static final AccessControlContext innocuousAcc;
+        static {
+            Permissions innocuousPerms = new Permissions();
+            innocuousPerms.add(modifyThreadPermission);
+            innocuousPerms.add(new RuntimePermission(
+                                   "enableContextClassLoaderOverride"));
+            innocuousPerms.add(new RuntimePermission(
+                                   "modifyThreadGroup"));
+            innocuousAcc = new AccessControlContext(new ProtectionDomain[] {
+                    new ProtectionDomain(null, innocuousPerms)
+                });
+        }
+
+        public final ForkJoinWorkerThread newThread(ForkJoinPool pool) {
+            return (ForkJoinWorkerThread.InnocuousForkJoinWorkerThread)
+                java.security.AccessController.doPrivileged(
+                    new java.security.PrivilegedAction<ForkJoinWorkerThread>() {
+                    public ForkJoinWorkerThread run() {
+                        return new ForkJoinWorkerThread.
+                            InnocuousForkJoinWorkerThread(pool);
+                    }}, innocuousAcc);
+        }
+    }
+
 }
--- a/jdk/src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java	Wed Jul 05 19:26:45 2017 +0200
@@ -35,6 +35,9 @@
 
 package java.util.concurrent;
 
+import java.security.AccessControlContext;
+import java.security.ProtectionDomain;
+
 /**
  * A thread managed by a {@link ForkJoinPool}, which executes
  * {@link ForkJoinTask}s.
@@ -61,6 +64,10 @@
      * completes. This leads to a visibility race, that is tolerated
      * by requiring that the workQueue field is only accessed by the
      * owning thread.
+     *
+     * Support for (non-public) subclass InnocuousForkJoinWorkerThread
+     * requires that we break quite a lot of encapulation (via Unsafe)
+     * both here and in the subclass to access and set Thread fields.
      */
 
     final ForkJoinPool pool;                // the pool this thread works in
@@ -80,6 +87,18 @@
     }
 
     /**
+     * Version for InnocuousForkJoinWorkerThread
+     */
+    ForkJoinWorkerThread(ForkJoinPool pool, ThreadGroup threadGroup,
+                         AccessControlContext acc) {
+        super(threadGroup, null, "aForkJoinWorkerThread");
+        U.putOrderedObject(this, INHERITEDACCESSCONTROLCONTEXT, acc);
+        eraseThreadLocals(); // clear before registering
+        this.pool = pool;
+        this.workQueue = pool.registerWorker(this);
+    }
+
+    /**
      * Returns the pool hosting this thread.
      *
      * @return the pool
@@ -131,21 +150,128 @@
      * {@link ForkJoinTask}s.
      */
     public void run() {
-        Throwable exception = null;
-        try {
-            onStart();
-            pool.runWorker(workQueue);
-        } catch (Throwable ex) {
-            exception = ex;
-        } finally {
+        if (workQueue.array == null) { // only run once
+            Throwable exception = null;
             try {
-                onTermination(exception);
+                onStart();
+                pool.runWorker(workQueue);
             } catch (Throwable ex) {
-                if (exception == null)
-                    exception = ex;
+                exception = ex;
             } finally {
-                pool.deregisterWorker(this, exception);
+                try {
+                    onTermination(exception);
+                } catch (Throwable ex) {
+                    if (exception == null)
+                        exception = ex;
+                } finally {
+                    pool.deregisterWorker(this, exception);
+                }
             }
         }
     }
+
+    /**
+     * Erases ThreadLocals by nulling out Thread maps
+     */
+    final void eraseThreadLocals() {
+        U.putObject(this, THREADLOCALS, null);
+        U.putObject(this, INHERITABLETHREADLOCALS, null);
+    }
+
+    /**
+     * Non-public hook method for InnocuousForkJoinWorkerThread
+     */
+    void afterTopLevelExec() {
+    }
+
+    // Set up to allow setting thread fields in constructor
+    private static final sun.misc.Unsafe U;
+    private static final long THREADLOCALS;
+    private static final long INHERITABLETHREADLOCALS;
+    private static final long INHERITEDACCESSCONTROLCONTEXT;
+    static {
+        try {
+            U = sun.misc.Unsafe.getUnsafe();
+            Class<?> tk = Thread.class;
+            THREADLOCALS = U.objectFieldOffset
+                (tk.getDeclaredField("threadLocals"));
+            INHERITABLETHREADLOCALS = U.objectFieldOffset
+                (tk.getDeclaredField("inheritableThreadLocals"));
+            INHERITEDACCESSCONTROLCONTEXT = U.objectFieldOffset
+                (tk.getDeclaredField("inheritedAccessControlContext"));
+
+        } catch (Exception e) {
+            throw new Error(e);
+        }
+    }
+
+    /**
+     * A worker thread that has no permissions, is not a member of any
+     * user-defined ThreadGroup, and erases all ThreadLocals after
+     * running each top-level task.
+     */
+    static final class InnocuousForkJoinWorkerThread extends ForkJoinWorkerThread {
+        /** The ThreadGroup for all InnocuousForkJoinWorkerThreads */
+        private static final ThreadGroup innocuousThreadGroup =
+            createThreadGroup();
+
+        /** An AccessControlContext supporting no privileges */
+        private static final AccessControlContext INNOCUOUS_ACC =
+            new AccessControlContext(
+                new ProtectionDomain[] {
+                    new ProtectionDomain(null, null)
+                });
+
+        InnocuousForkJoinWorkerThread(ForkJoinPool pool) {
+            super(pool, innocuousThreadGroup, INNOCUOUS_ACC);
+        }
+
+        @Override // to erase ThreadLocals
+        void afterTopLevelExec() {
+            eraseThreadLocals();
+        }
+
+        @Override // to always report system loader
+        public ClassLoader getContextClassLoader() {
+            return ClassLoader.getSystemClassLoader();
+        }
+
+        @Override // to silently fail
+        public void setUncaughtExceptionHandler(UncaughtExceptionHandler x) { }
+
+        @Override // paranoically
+        public void setContextClassLoader(ClassLoader cl) {
+            throw new SecurityException("setContextClassLoader");
+        }
+
+        /**
+         * Returns a new group with the system ThreadGroup (the
+         * topmost, parentless group) as parent.  Uses Unsafe to
+         * traverse Thread group and ThreadGroup parent fields.
+         */
+        private static ThreadGroup createThreadGroup() {
+            try {
+                sun.misc.Unsafe u = sun.misc.Unsafe.getUnsafe();
+                Class<?> tk = Thread.class;
+                Class<?> gk = ThreadGroup.class;
+                long tg = u.objectFieldOffset(tk.getDeclaredField("group"));
+                long gp = u.objectFieldOffset(gk.getDeclaredField("parent"));
+                ThreadGroup group = (ThreadGroup)
+                    u.getObject(Thread.currentThread(), tg);
+                while (group != null) {
+                    ThreadGroup parent = (ThreadGroup)u.getObject(group, gp);
+                    if (parent == null)
+                        return new ThreadGroup(group,
+                                               "InnocuousForkJoinWorkerThreadGroup");
+                    group = parent;
+                }
+            } catch (Exception e) {
+                throw new Error(e);
+            }
+            // fall through if null as cannot-happen safeguard
+            throw new Error("Cannot create ThreadGroup");
+        }
+    }
+
 }
+
--- a/jdk/src/share/classes/java/util/jar/Attributes.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/jar/Attributes.java	Wed Jul 05 19:26:45 2017 +0200
@@ -296,24 +296,22 @@
      * XXX Need to handle UTF8 values and break up lines longer than 72 bytes
      */
      void write(DataOutputStream os) throws IOException {
-        Iterator<Map.Entry<Object, Object>> it = entrySet().iterator();
-        while (it.hasNext()) {
-            Map.Entry<Object, Object> e = it.next();
-            StringBuffer buffer = new StringBuffer(
-                                        ((Name)e.getKey()).toString());
-            buffer.append(": ");
+         for (Entry<Object, Object> e : entrySet()) {
+             StringBuffer buffer = new StringBuffer(
+                                         ((Name) e.getKey()).toString());
+             buffer.append(": ");
 
-            String value = (String)e.getValue();
-            if (value != null) {
-                byte[] vb = value.getBytes("UTF8");
-                value = new String(vb, 0, 0, vb.length);
-            }
-            buffer.append(value);
+             String value = (String) e.getValue();
+             if (value != null) {
+                 byte[] vb = value.getBytes("UTF8");
+                 value = new String(vb, 0, 0, vb.length);
+             }
+             buffer.append(value);
 
-            buffer.append("\r\n");
-            Manifest.make72Safe(buffer);
-            os.writeBytes(buffer.toString());
-        }
+             buffer.append("\r\n");
+             Manifest.make72Safe(buffer);
+             os.writeBytes(buffer.toString());
+         }
         os.writeBytes("\r\n");
     }
 
@@ -340,16 +338,14 @@
 
         // write out all attributes except for the version
         // we wrote out earlier
-        Iterator<Map.Entry<Object, Object>> it = entrySet().iterator();
-        while (it.hasNext()) {
-            Map.Entry<Object, Object> e = it.next();
-            String name = ((Name)e.getKey()).toString();
-            if ((version != null) && ! (name.equalsIgnoreCase(vername))) {
+        for (Entry<Object, Object> e : entrySet()) {
+            String name = ((Name) e.getKey()).toString();
+            if ((version != null) && !(name.equalsIgnoreCase(vername))) {
 
                 StringBuffer buffer = new StringBuffer(name);
                 buffer.append(": ");
 
-                String value = (String)e.getValue();
+                String value = (String) e.getValue();
                 if (value != null) {
                     byte[] vb = value.getBytes("UTF8");
                     value = new String(vb, 0, 0, vb.length);
--- a/jdk/src/share/classes/java/util/jar/JarFile.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/jar/JarFile.java	Wed Jul 05 19:26:45 2017 +0200
@@ -324,8 +324,8 @@
         if (verify) {
             String[] names = getMetaInfEntryNames();
             if (names != null) {
-                for (int i = 0; i < names.length; i++) {
-                    String name = names[i].toUpperCase(Locale.ENGLISH);
+                for (String nameLower : names) {
+                    String name = nameLower.toUpperCase(Locale.ENGLISH);
                     if (name.endsWith(".DSA") ||
                         name.endsWith(".RSA") ||
                         name.endsWith(".EC") ||
@@ -356,8 +356,8 @@
         try {
             String[] names = getMetaInfEntryNames();
             if (names != null) {
-                for (int i = 0; i < names.length; i++) {
-                    JarEntry e = getJarEntry(names[i]);
+                for (String name : names) {
+                    JarEntry e = getJarEntry(name);
                     if (e == null) {
                         throw new JarException("corrupted jar file");
                     }
@@ -487,10 +487,9 @@
                 // entries to find a match.
                 String[] names = getMetaInfEntryNames();
                 if (names != null) {
-                    for (int i = 0; i < names.length; i++) {
-                        if (MANIFEST_NAME.equals(
-                                                 names[i].toUpperCase(Locale.ENGLISH))) {
-                            manEntry = getJarEntry(names[i]);
+                    for (String name : names) {
+                        if (MANIFEST_NAME.equals(name.toUpperCase(Locale.ENGLISH))) {
+                            manEntry = getJarEntry(name);
                             break;
                         }
                     }
@@ -580,11 +579,10 @@
         }
 
         String name = getName();
-        String localJavaHome = javaHome;
-        if (name.startsWith(localJavaHome)) {
+        if (name.startsWith(javaHome)) {
             String[] names = jarNames;
-            for (int i = 0; i < names.length; i++) {
-                if (name.endsWith(names[i])) {
+            for (String jarName : names) {
+                if (name.endsWith(jarName)) {
                     return true;
                 }
             }
@@ -619,8 +617,8 @@
          * code source?
          */
         boolean includeUnsigned = false;
-        for (int i = 0; i < cs.length; i++) {
-            if (cs[i].getCodeSigners() == null) {
+        for (CodeSource c : cs) {
+            if (c.getCodeSigners() == null) {
                 includeUnsigned = true;
                 break;
             }
@@ -776,6 +774,6 @@
         if (jv != null) {
             return jv.getManifestDigests();
         }
-        return new ArrayList<Object>();
+        return new ArrayList<>();
     }
 }
--- a/jdk/src/share/classes/java/util/jar/JarVerifier.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/jar/JarVerifier.java	Wed Jul 05 19:26:45 2017 +0200
@@ -258,9 +258,7 @@
                     sigFileData.put(key, bytes);
                     // check pending blocks, we can now process
                     // anyone waiting for this .SF file
-                    Iterator<SignatureFileVerifier> it = pendingBlocks.iterator();
-                    while (it.hasNext()) {
-                        SignatureFileVerifier sfv = it.next();
+                    for (SignatureFileVerifier sfv : pendingBlocks) {
                         if (sfv.needSignatureFile(key)) {
                             if (debug != null) {
                                 debug.println(
@@ -313,18 +311,9 @@
                 }
                 sfv.process(sigFileSigners, manifestDigests);
 
-            } catch (IOException ioe) {
-                // e.g. sun.security.pkcs.ParsingException
-                if (debug != null) debug.println("processEntry caught: "+ioe);
-                // ignore and treat as unsigned
-            } catch (SignatureException se) {
-                if (debug != null) debug.println("processEntry caught: "+se);
-                // ignore and treat as unsigned
-            } catch (NoSuchAlgorithmException nsae) {
-                if (debug != null) debug.println("processEntry caught: "+nsae);
-                // ignore and treat as unsigned
-            } catch (CertificateException ce) {
-                if (debug != null) debug.println("processEntry caught: "+ce);
+            } catch (IOException | CertificateException |
+                    NoSuchAlgorithmException | SignatureException e) {
+                if (debug != null) debug.println("processEntry caught: "+e);
                 // ignore and treat as unsigned
             }
         }
@@ -387,9 +376,9 @@
 
         if (signers != null) {
             ArrayList<java.security.cert.Certificate> certChains = new ArrayList<>();
-            for (int i = 0; i < signers.length; i++) {
+            for (CodeSigner signer : signers) {
                 certChains.addAll(
-                    signers[i].getSignerCertPath().getCertificates());
+                    signer.getSignerCertPath().getCertificates());
             }
 
             // Convert into a Certificate[]
@@ -536,8 +525,8 @@
     private CodeSource[] mapSignersToCodeSources(URL url, List<CodeSigner[]> signers, boolean unsigned) {
         List<CodeSource> sources = new ArrayList<>();
 
-        for (int i = 0; i < signers.size(); i++) {
-            sources.add(mapSignersToCodeSource(url, signers.get(i)));
+        for (CodeSigner[] signer : signers) {
+            sources.add(mapSignersToCodeSource(url, signer));
         }
         if (unsigned) {
             sources.add(mapSignersToCodeSource(url, null));
@@ -563,8 +552,8 @@
          */
         CodeSource[] sources = mapSignersToCodeSources(cs.getLocation(), getJarCodeSigners(), true);
         List<CodeSource> sourceList = new ArrayList<>();
-        for (int i = 0; i < sources.length; i++) {
-            sourceList.add(sources[i]);
+        for (CodeSource source : sources) {
+            sourceList.add(source);
         }
         int j = sourceList.indexOf(cs);
         if (j != -1) {
@@ -677,8 +666,8 @@
          * to see if we can optimize CodeSigner equality test.
          */
         List<CodeSigner[]> req = new ArrayList<>(cs.length);
-        for (int i = 0; i < cs.length; i++) {
-            CodeSigner[] match = findMatchingSigners(cs[i]);
+        for (CodeSource c : cs) {
+            CodeSigner[] match = findMatchingSigners(c);
             if (match != null) {
                 if (match.length > 0) {
                     req.add(match);
--- a/jdk/src/share/classes/java/util/jar/Manifest.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/jar/Manifest.java	Wed Jul 05 19:26:45 2017 +0200
@@ -148,9 +148,7 @@
         // Write out the main attributes for the manifest
         attr.writeMain(dos);
         // Now write out the pre-entry attributes
-        Iterator<Map.Entry<String, Attributes>> it = entries.entrySet().iterator();
-        while (it.hasNext()) {
-            Map.Entry<String, Attributes> e = it.next();
+        for (Map.Entry<String, Attributes> e : entries.entrySet()) {
             StringBuffer buffer = new StringBuffer("Name: ");
             String value = e.getKey();
             if (value != null) {
--- a/jdk/src/share/classes/java/util/jar/Pack200.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/jar/Pack200.java	Wed Jul 05 19:26:45 2017 +0200
@@ -29,9 +29,6 @@
 import java.io.OutputStream;
 import java.io.File;
 import java.io.IOException;
-import java.beans.PropertyChangeListener;
-
-
 
 
 /**
@@ -571,54 +568,6 @@
          * @exception IOException if an error is encountered.
          */
         void pack(JarInputStream in, OutputStream out) throws IOException ;
-
-        /**
-         * Registers a listener for PropertyChange events on the properties map.
-         * This is typically used by applications to update a progress bar.
-         *
-         * <p> The default implementation of this method does nothing and has
-         * no side-effects.</p>
-         *
-         * <p><b>WARNING:</b> This method is omitted from the interface
-         * declaration in all subset Profiles of Java SE that do not include
-         * the {@code java.beans} package. </p>
-
-         * @see #properties
-         * @see #PROGRESS
-         * @param listener  An object to be invoked when a property is changed.
-         * @deprecated The dependency on {@code PropertyChangeListener} creates
-         *             a significant impediment to future modularization of the
-         *             Java platform. This method will be removed in a future
-         *             release.
-         *             Applications that need to monitor progress of the packer
-         *             can poll the value of the {@link #PROGRESS PROGRESS}
-         *             property instead.
-         */
-        @Deprecated
-        default void addPropertyChangeListener(PropertyChangeListener listener) {
-        }
-
-        /**
-         * Remove a listener for PropertyChange events, added by
-         * the {@link #addPropertyChangeListener}.
-         *
-         * <p> The default implementation of this method does nothing and has
-         * no side-effects.</p>
-         *
-         * <p><b>WARNING:</b> This method is omitted from the interface
-         * declaration in all subset Profiles of Java SE that do not include
-         * the {@code java.beans} package. </p>
-         *
-         * @see #addPropertyChangeListener
-         * @param listener  The PropertyChange listener to be removed.
-         * @deprecated The dependency on {@code PropertyChangeListener} creates
-         *             a significant impediment to future modularization of the
-         *             Java platform. This method will be removed in a future
-         *             release.
-         */
-        @Deprecated
-        default void removePropertyChangeListener(PropertyChangeListener listener) {
-        }
     }
 
     /**
@@ -730,54 +679,6 @@
          * @exception IOException if an error is encountered.
          */
         void unpack(File in, JarOutputStream out) throws IOException;
-
-        /**
-         * Registers a listener for PropertyChange events on the properties map.
-         * This is typically used by applications to update a progress bar.
-         *
-         * <p> The default implementation of this method does nothing and has
-         * no side-effects.</p>
-         *
-         * <p><b>WARNING:</b> This method is omitted from the interface
-         * declaration in all subset Profiles of Java SE that do not include
-         * the {@code java.beans} package. </p>
-         *
-         * @see #properties
-         * @see #PROGRESS
-         * @param listener  An object to be invoked when a property is changed.
-         * @deprecated The dependency on {@code PropertyChangeListener} creates
-         *             a significant impediment to future modularization of the
-         *             Java platform. This method will be removed in a future
-         *             release.
-         *             Applications that need to monitor progress of the
-         *             unpacker can poll the value of the {@link #PROGRESS
-         *             PROGRESS} property instead.
-         */
-        @Deprecated
-        default void addPropertyChangeListener(PropertyChangeListener listener) {
-        }
-
-        /**
-         * Remove a listener for PropertyChange events, added by
-         * the {@link #addPropertyChangeListener}.
-         *
-         * <p> The default implementation of this method does nothing and has
-         * no side-effects.</p>
-         *
-         * <p><b>WARNING:</b> This method is omitted from the interface
-         * declaration in all subset Profiles of Java SE that do not include
-         * the {@code java.beans} package. </p>
-         *
-         * @see #addPropertyChangeListener
-         * @param listener  The PropertyChange listener to be removed.
-         * @deprecated The dependency on {@code PropertyChangeListener} creates
-         *             a significant impediment to future modularization of the
-         *             Java platform. This method will be removed in a future
-         *             release.
-         */
-        @Deprecated
-        default void removePropertyChangeListener(PropertyChangeListener listener) {
-        }
     }
 
     // Private stuff....
--- a/jdk/src/share/classes/java/util/logging/ConsoleHandler.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/logging/ConsoleHandler.java	Wed Jul 05 19:26:45 2017 +0200
@@ -66,27 +66,6 @@
  * @since 1.4
  */
 public class ConsoleHandler extends StreamHandler {
-    // Private method to configure a ConsoleHandler from LogManager
-    // properties and/or default values as specified in the class
-    // javadoc.
-    private void configure() {
-        LogManager manager = LogManager.getLogManager();
-        String cname = getClass().getName();
-
-        setLevel(manager.getLevelProperty(cname +".level", Level.INFO));
-        setFilter(manager.getFilterProperty(cname +".filter", null));
-        setFormatter(manager.getFormatterProperty(cname +".formatter", new SimpleFormatter()));
-        try {
-            setEncoding(manager.getStringProperty(cname +".encoding", null));
-        } catch (Exception ex) {
-            try {
-                setEncoding(null);
-            } catch (Exception ex2) {
-                // doing a setEncoding with null should always work.
-                // assert false;
-            }
-        }
-    }
 
     /**
      * Create a <tt>ConsoleHandler</tt> for <tt>System.err</tt>.
@@ -96,10 +75,10 @@
      *
      */
     public ConsoleHandler() {
-        sealed = false;
-        configure();
-        setOutputStream(System.err);
-        sealed = true;
+        // configure with specific defaults for ConsoleHandler
+        super(Level.INFO, new SimpleFormatter(), null);
+
+        setOutputStreamPrivileged(System.err);
     }
 
     /**
--- a/jdk/src/share/classes/java/util/logging/Handler.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/logging/Handler.java	Wed Jul 05 19:26:45 2017 +0200
@@ -27,6 +27,9 @@
 package java.util.logging;
 
 import java.io.UnsupportedEncodingException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
 /**
  * A <tt>Handler</tt> object takes log messages from a <tt>Logger</tt> and
  * exports them.  It might for example, write them to a console
@@ -62,10 +65,6 @@
     private volatile ErrorManager errorManager = new ErrorManager();
     private volatile String encoding;
 
-    // Package private support for security checking.  When sealed
-    // is true, we access check updates to the class.
-    boolean sealed = true;
-
     /**
      * Default constructor.  The resulting <tt>Handler</tt> has a log
      * level of <tt>Level.ALL</tt>, no <tt>Formatter</tt>, and no
@@ -76,6 +75,52 @@
     }
 
     /**
+     * Package-private constructor for chaining from subclass constructors
+     * that wish to configure the handler with specific default and/or
+     * specified values.
+     *
+     * @param defaultLevel       a default {@link Level} to configure if one is
+     *                           not found in LogManager configuration properties
+     * @param defaultFormatter   a default {@link Formatter} to configure if one is
+     *                           not specified by {@code specifiedFormatter} parameter
+     *                           nor found in LogManager configuration properties
+     * @param specifiedFormatter if not null, this is the formatter to configure
+     */
+    Handler(Level defaultLevel, Formatter defaultFormatter,
+            Formatter specifiedFormatter) {
+
+        LogManager manager = LogManager.getLogManager();
+        String cname = getClass().getName();
+
+        final Level level = manager.getLevelProperty(cname + ".level", defaultLevel);
+        final Filter filter = manager.getFilterProperty(cname + ".filter", null);
+        final Formatter formatter = specifiedFormatter == null
+                                    ? manager.getFormatterProperty(cname + ".formatter", defaultFormatter)
+                                    : specifiedFormatter;
+        final String encoding = manager.getStringProperty(cname + ".encoding", null);
+
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            @Override
+            public Void run() {
+                setLevel(level);
+                setFilter(filter);
+                setFormatter(formatter);
+                try {
+                    setEncoding(encoding);
+                } catch (Exception ex) {
+                    try {
+                        setEncoding(null);
+                    } catch (Exception ex2) {
+                        // doing a setEncoding with null should always work.
+                        // assert false;
+                    }
+                }
+                return null;
+            }
+        }, null, LogManager.controlPermission);
+    }
+
+    /**
      * Publish a <tt>LogRecord</tt>.
      * <p>
      * The logging request was made initially to a <tt>Logger</tt> object,
@@ -302,12 +347,9 @@
     }
 
     // Package-private support method for security checks.
-    // If "sealed" is true, we check that the caller has
-    // appropriate security privileges to update Handler
-    // state and if not throw a SecurityException.
+    // We check that the caller has appropriate security privileges
+    // to update Handler state and if not throw a SecurityException.
     void checkPermission() throws SecurityException {
-        if (sealed) {
-            manager.checkPermission();
-        }
+        manager.checkPermission();
     }
 }
--- a/jdk/src/share/classes/java/util/logging/LogManager.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/logging/LogManager.java	Wed Jul 05 19:26:45 2017 +0200
@@ -31,10 +31,6 @@
 import java.security.*;
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.WeakReference;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.beans.PropertyChangeListener;
 import sun.misc.JavaAWTAccess;
 import sun.misc.SharedSecrets;
 
@@ -156,10 +152,6 @@
     private volatile Properties props = new Properties();
     private final static Level defaultLevel = Level.INFO;
 
-    // The map of the registered listeners. The map value is the registration
-    // count to allow for cases where the same listener is registered many times.
-    private final Map<Object,Integer> listenerMap = new HashMap<>();
-
     // LoggerContext for system loggers and user loggers
     private final LoggerContext systemContext = new SystemLoggerContext();
     private final LoggerContext userContext = new LoggerContext();
@@ -329,6 +321,9 @@
                         // Create and retain Logger for the root of the namespace.
                         owner.rootLogger = owner.new RootLogger();
                         owner.addLogger(owner.rootLogger);
+                        if (!owner.rootLogger.isLevelInitialized()) {
+                            owner.rootLogger.setLevel(defaultLevel);
+                        }
 
                         // Adding the global Logger.
                         // Do not call Logger.getGlobal() here as this might trigger
@@ -390,85 +385,6 @@
         }
     }
 
-    /**
-     * Adds an event listener to be invoked when the logging
-     * properties are re-read. Adding multiple instances of
-     * the same event Listener results in multiple entries
-     * in the property event listener table.
-     *
-     * <p><b>WARNING:</b> This method is omitted from this class in all subset
-     * Profiles of Java SE that do not include the {@code java.beans} package.
-     * </p>
-     *
-     * @param l  event listener
-     * @exception  SecurityException  if a security manager exists and if
-     *             the caller does not have LoggingPermission("control").
-     * @exception NullPointerException if the PropertyChangeListener is null.
-     * @deprecated The dependency on {@code PropertyChangeListener} creates a
-     *             significant impediment to future modularization of the Java
-     *             platform. This method will be removed in a future release.
-     *             The global {@code LogManager} can detect changes to the
-     *             logging configuration by overridding the {@link
-     *             #readConfiguration readConfiguration} method.
-     */
-    @Deprecated
-    public void addPropertyChangeListener(PropertyChangeListener l) throws SecurityException {
-        PropertyChangeListener listener = Objects.requireNonNull(l);
-        checkPermission();
-        synchronized (listenerMap) {
-            // increment the registration count if already registered
-            Integer value = listenerMap.get(listener);
-            value = (value == null) ? 1 : (value + 1);
-            listenerMap.put(listener, value);
-        }
-    }
-
-    /**
-     * Removes an event listener for property change events.
-     * If the same listener instance has been added to the listener table
-     * through multiple invocations of <CODE>addPropertyChangeListener</CODE>,
-     * then an equivalent number of
-     * <CODE>removePropertyChangeListener</CODE> invocations are required to remove
-     * all instances of that listener from the listener table.
-     * <P>
-     * Returns silently if the given listener is not found.
-     *
-     * <p><b>WARNING:</b> This method is omitted from this class in all subset
-     * Profiles of Java SE that do not include the {@code java.beans} package.
-     * </p>
-     *
-     * @param l  event listener (can be null)
-     * @exception  SecurityException  if a security manager exists and if
-     *             the caller does not have LoggingPermission("control").
-     * @deprecated The dependency on {@code PropertyChangeListener} creates a
-     *             significant impediment to future modularization of the Java
-     *             platform. This method will be removed in a future release.
-     *             The global {@code LogManager} can detect changes to the
-     *             logging configuration by overridding the {@link
-     *             #readConfiguration readConfiguration} method.
-     */
-    @Deprecated
-    public void removePropertyChangeListener(PropertyChangeListener l) throws SecurityException {
-        checkPermission();
-        if (l != null) {
-            PropertyChangeListener listener = l;
-            synchronized (listenerMap) {
-                Integer value = listenerMap.get(listener);
-                if (value != null) {
-                    // remove from map if registration count is 1, otherwise
-                    // just decrement its count
-                    int i = value.intValue();
-                    if (i == 1) {
-                        listenerMap.remove(listener);
-                    } else {
-                        assert i > 1;
-                        listenerMap.put(listener, i - 1);
-                    }
-                }
-            }
-        }
-    }
-
     // LoggerContext maps from AppContext
     private WeakHashMap<Object, LoggerContext> contextsMap = null;
 
@@ -938,8 +854,7 @@
             @Override
             public Object run() {
                 String names[] = parseClassNames(handlersPropertyName);
-                for (int i = 0; i < names.length; i++) {
-                    String word = names[i];
+                for (String word : names) {
                     try {
                         Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(word);
                         Handler hdl = (Handler) clz.newInstance();
@@ -1318,8 +1233,7 @@
     private void resetLogger(Logger logger) {
         // Close all the Logger's handlers.
         Handler[] targets = logger.getHandlers();
-        for (int i = 0; i < targets.length; i++) {
-            Handler h = targets[i];
+        for (Handler h : targets) {
             logger.removeHandler(h);
             try {
                 h.close();
@@ -1389,8 +1303,7 @@
         // Instantiate new configuration objects.
         String names[] = parseClassNames("config");
 
-        for (int i = 0; i < names.length; i++) {
-            String word = names[i];
+        for (String word : names) {
             try {
                 Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(word);
                 clz.newInstance();
@@ -1404,27 +1317,6 @@
         // Set levels on any pre-existing loggers, based on the new properties.
         setLevelsOnExistingLoggers();
 
-        // Notify any interested parties that our properties have changed.
-        // We first take a copy of the listener map so that we aren't holding any
-        // locks when calling the listeners.
-        Map<Object,Integer> listeners = null;
-        synchronized (listenerMap) {
-            if (!listenerMap.isEmpty())
-                listeners = new HashMap<>(listenerMap);
-        }
-        if (listeners != null) {
-            assert Beans.isBeansPresent();
-            Object ev = Beans.newPropertyChangeEvent(LogManager.class, null, null, null);
-            for (Map.Entry<Object,Integer> entry : listeners.entrySet()) {
-                Object listener = entry.getKey();
-                int count = entry.getValue().intValue();
-                for (int i = 0; i < count; i++) {
-                    Beans.invokePropertyChange(listener, ev);
-                }
-            }
-        }
-
-
         // Note that we need to reinitialize global handles when
         // they are first referenced.
         synchronized (this) {
@@ -1557,7 +1449,7 @@
         loadLoggerHandlers(rootLogger, null, "handlers");
     }
 
-    private final Permission controlPermission = new LoggingPermission("control", null);
+    static final Permission controlPermission = new LoggingPermission("control", null);
 
     void checkPermission() {
         SecurityManager sm = System.getSecurityManager();
@@ -1597,9 +1489,7 @@
             if (children == null) {
                 return;
             }
-            Iterator<LogNode> values = children.values().iterator();
-            while (values.hasNext()) {
-                LogNode node = values.next();
+            for (LogNode node : children.values()) {
                 LoggerWeakRef ref = node.loggerRef;
                 Logger logger = (ref == null) ? null : ref.get();
                 if (logger == null) {
@@ -1620,7 +1510,6 @@
             // to avoid calling LogManager.getLogManager() from within the
             // RootLogger constructor.
             super("", null, null, LogManager.this);
-            setLevel(defaultLevel);
         }
 
         @Override
@@ -1713,101 +1602,4 @@
         }
         return loggingMXBean;
     }
-
-    /**
-     * A class that provides access to the java.beans.PropertyChangeListener
-     * and java.beans.PropertyChangeEvent without creating a static dependency
-     * on java.beans. This class can be removed once the addPropertyChangeListener
-     * and removePropertyChangeListener methods are removed.
-     */
-    private static class Beans {
-        private static final Class<?> propertyChangeListenerClass =
-            getClass("java.beans.PropertyChangeListener");
-
-        private static final Class<?> propertyChangeEventClass =
-            getClass("java.beans.PropertyChangeEvent");
-
-        private static final Method propertyChangeMethod =
-            getMethod(propertyChangeListenerClass,
-                      "propertyChange",
-                      propertyChangeEventClass);
-
-        private static final Constructor<?> propertyEventCtor =
-            getConstructor(propertyChangeEventClass,
-                           Object.class,
-                           String.class,
-                           Object.class,
-                           Object.class);
-
-        private static Class<?> getClass(String name) {
-            try {
-                return Class.forName(name, true, Beans.class.getClassLoader());
-            } catch (ClassNotFoundException e) {
-                return null;
-            }
-        }
-        private static Constructor<?> getConstructor(Class<?> c, Class<?>... types) {
-            try {
-                return (c == null) ? null : c.getDeclaredConstructor(types);
-            } catch (NoSuchMethodException x) {
-                throw new AssertionError(x);
-            }
-        }
-
-        private static Method getMethod(Class<?> c, String name, Class<?>... types) {
-            try {
-                return (c == null) ? null : c.getMethod(name, types);
-            } catch (NoSuchMethodException e) {
-                throw new AssertionError(e);
-            }
-        }
-
-        /**
-         * Returns {@code true} if java.beans is present.
-         */
-        static boolean isBeansPresent() {
-            return propertyChangeListenerClass != null &&
-                   propertyChangeEventClass != null;
-        }
-
-        /**
-         * Returns a new PropertyChangeEvent with the given source, property
-         * name, old and new values.
-         */
-        static Object newPropertyChangeEvent(Object source, String prop,
-                                             Object oldValue, Object newValue)
-        {
-            try {
-                return propertyEventCtor.newInstance(source, prop, oldValue, newValue);
-            } catch (InstantiationException | IllegalAccessException x) {
-                throw new AssertionError(x);
-            } catch (InvocationTargetException x) {
-                Throwable cause = x.getCause();
-                if (cause instanceof Error)
-                    throw (Error)cause;
-                if (cause instanceof RuntimeException)
-                    throw (RuntimeException)cause;
-                throw new AssertionError(x);
-            }
-        }
-
-        /**
-         * Invokes the given PropertyChangeListener's propertyChange method
-         * with the given event.
-         */
-        static void invokePropertyChange(Object listener, Object ev) {
-            try {
-                propertyChangeMethod.invoke(listener, ev);
-            } catch (IllegalAccessException x) {
-                throw new AssertionError(x);
-            } catch (InvocationTargetException x) {
-                Throwable cause = x.getCause();
-                if (cause instanceof Error)
-                    throw (Error)cause;
-                if (cause instanceof RuntimeException)
-                    throw (RuntimeException)cause;
-                throw new AssertionError(x);
-            }
-        }
-    }
 }
--- a/jdk/src/share/classes/java/util/logging/LogRecord.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/logging/LogRecord.java	Wed Jul 05 19:26:45 2017 +0200
@@ -481,12 +481,8 @@
         }
         out.writeInt(parameters.length);
         // Write string values for the parameters.
-        for (int i = 0; i < parameters.length; i++) {
-            if (parameters[i] == null) {
-                out.writeObject(null);
-            } else {
-                out.writeObject(parameters[i].toString());
-            }
+        for (Object parameter : parameters) {
+            out.writeObject(Objects.toString(parameter, null));
         }
     }
 
--- a/jdk/src/share/classes/java/util/logging/Logger.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/logging/Logger.java	Wed Jul 05 19:26:45 2017 +0200
@@ -2108,9 +2108,8 @@
 
         // Recursively update the level on each of our kids.
         if (kids != null) {
-            for (int i = 0; i < kids.size(); i++) {
-                LogManager.LoggerWeakRef ref = kids.get(i);
-                Logger kid =  ref.get();
+            for (LogManager.LoggerWeakRef ref : kids) {
+                Logger kid = ref.get();
                 if (kid != null) {
                     kid.updateEffectiveLevel();
                 }
--- a/jdk/src/share/classes/java/util/logging/MemoryHandler.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/logging/MemoryHandler.java	Wed Jul 05 19:26:45 2017 +0200
@@ -94,37 +94,24 @@
     private LogRecord buffer[];
     int start, count;
 
-    // Private method to configure a MemoryHandler from LogManager
-    // properties and/or default values as specified in the class
-    // javadoc.
-    private void configure() {
+    /**
+     * Create a <tt>MemoryHandler</tt> and configure it based on
+     * <tt>LogManager</tt> configuration properties.
+     */
+    public MemoryHandler() {
+        // configure with specific defaults for MemoryHandler
+        super(Level.ALL, new SimpleFormatter(), null);
+
         LogManager manager = LogManager.getLogManager();
         String cname = getClass().getName();
-
         pushLevel = manager.getLevelProperty(cname +".push", Level.SEVERE);
         size = manager.getIntProperty(cname + ".size", DEFAULT_SIZE);
         if (size <= 0) {
             size = DEFAULT_SIZE;
         }
-        setLevel(manager.getLevelProperty(cname +".level", Level.ALL));
-        setFilter(manager.getFilterProperty(cname +".filter", null));
-        setFormatter(manager.getFormatterProperty(cname +".formatter", new SimpleFormatter()));
-    }
-
-    /**
-     * Create a <tt>MemoryHandler</tt> and configure it based on
-     * <tt>LogManager</tt> configuration properties.
-     */
-    public MemoryHandler() {
-        sealed = false;
-        configure();
-        sealed = true;
-
-        LogManager manager = LogManager.getLogManager();
-        String handlerName = getClass().getName();
-        String targetName = manager.getProperty(handlerName+".target");
+        String targetName = manager.getProperty(cname+".target");
         if (targetName == null) {
-            throw new RuntimeException("The handler " + handlerName
+            throw new RuntimeException("The handler " + cname
                     + " does not specify a target");
         }
         Class<?> clz;
@@ -158,15 +145,15 @@
      * @throws IllegalArgumentException if {@code size is <= 0}
      */
     public MemoryHandler(Handler target, int size, Level pushLevel) {
+        // configure with specific defaults for MemoryHandler
+        super(Level.ALL, new SimpleFormatter(), null);
+
         if (target == null || pushLevel == null) {
             throw new NullPointerException();
         }
         if (size <= 0) {
             throw new IllegalArgumentException();
         }
-        sealed = false;
-        configure();
-        sealed = true;
         this.target = target;
         this.pushLevel = pushLevel;
         this.size = size;
--- a/jdk/src/share/classes/java/util/logging/SocketHandler.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/logging/SocketHandler.java	Wed Jul 05 19:26:45 2017 +0200
@@ -83,31 +83,6 @@
     private String host;
     private int port;
 
-    // Private method to configure a SocketHandler from LogManager
-    // properties and/or default values as specified in the class
-    // javadoc.
-    private void configure() {
-        LogManager manager = LogManager.getLogManager();
-        String cname = getClass().getName();
-
-        setLevel(manager.getLevelProperty(cname +".level", Level.ALL));
-        setFilter(manager.getFilterProperty(cname +".filter", null));
-        setFormatter(manager.getFormatterProperty(cname +".formatter", new XMLFormatter()));
-        try {
-            setEncoding(manager.getStringProperty(cname +".encoding", null));
-        } catch (Exception ex) {
-            try {
-                setEncoding(null);
-            } catch (Exception ex2) {
-                // doing a setEncoding with null should always work.
-                // assert false;
-            }
-        }
-        port = manager.getIntProperty(cname + ".port", 0);
-        host = manager.getStringProperty(cname + ".host", null);
-    }
-
-
     /**
      * Create a <tt>SocketHandler</tt>, using only <tt>LogManager</tt> properties
      * (or their defaults).
@@ -117,9 +92,13 @@
      *         host and port.
      */
     public SocketHandler() throws IOException {
-        // We are going to use the logging defaults.
-        sealed = false;
-        configure();
+        // configure with specific defaults for SocketHandler
+        super(Level.ALL, new XMLFormatter(), null);
+
+        LogManager manager = LogManager.getLogManager();
+        String cname = getClass().getName();
+        port = manager.getIntProperty(cname + ".port", 0);
+        host = manager.getStringProperty(cname + ".host", null);
 
         try {
             connect();
@@ -127,7 +106,6 @@
             System.err.println("SocketHandler: connect failed to " + host + ":" + port);
             throw ix;
         }
-        sealed = true;
     }
 
     /**
@@ -146,11 +124,12 @@
      *         host and port.
      */
     public SocketHandler(String host, int port) throws IOException {
-        sealed = false;
-        configure();
-        sealed = true;
+        // configure with specific defaults for SocketHandler
+        super(Level.ALL, new XMLFormatter(), null);
+
         this.port = port;
         this.host = host;
+
         connect();
     }
 
@@ -167,7 +146,7 @@
         sock = new Socket(host, port);
         OutputStream out = sock.getOutputStream();
         BufferedOutputStream bout = new BufferedOutputStream(out);
-        setOutputStream(bout);
+        setOutputStreamPrivileged(bout);
     }
 
     /**
--- a/jdk/src/share/classes/java/util/logging/StreamHandler.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/logging/StreamHandler.java	Wed Jul 05 19:26:45 2017 +0200
@@ -27,6 +27,9 @@
 package java.util.logging;
 
 import java.io.*;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Objects;
 
 /**
  * Stream based logging <tt>Handler</tt>.
@@ -77,35 +80,12 @@
     private boolean doneHeader;
     private volatile Writer writer;
 
-    // Private method to configure a StreamHandler from LogManager
-    // properties and/or default values as specified in the class
-    // javadoc.
-    private void configure() {
-        LogManager manager = LogManager.getLogManager();
-        String cname = getClass().getName();
-
-        setLevel(manager.getLevelProperty(cname +".level", Level.INFO));
-        setFilter(manager.getFilterProperty(cname +".filter", null));
-        setFormatter(manager.getFormatterProperty(cname +".formatter", new SimpleFormatter()));
-        try {
-            setEncoding(manager.getStringProperty(cname +".encoding", null));
-        } catch (Exception ex) {
-            try {
-                setEncoding(null);
-            } catch (Exception ex2) {
-                // doing a setEncoding with null should always work.
-                // assert false;
-            }
-        }
-    }
-
     /**
      * Create a <tt>StreamHandler</tt>, with no current output stream.
      */
     public StreamHandler() {
-        sealed = false;
-        configure();
-        sealed = true;
+        // configure with specific defaults for StreamHandler
+        super(Level.INFO, new SimpleFormatter(), null);
     }
 
     /**
@@ -116,11 +96,19 @@
      * @param formatter   Formatter to be used to format output
      */
     public StreamHandler(OutputStream out, Formatter formatter) {
-        sealed = false;
-        configure();
-        setFormatter(formatter);
-        setOutputStream(out);
-        sealed = true;
+        // configure with default level but use specified formatter
+        super(Level.INFO, null, Objects.requireNonNull(formatter));
+
+        setOutputStreamPrivileged(out);
+    }
+
+    /**
+     * @see Handler#Handler(Level, Formatter, Formatter)
+     */
+    StreamHandler(Level defaultLevel,
+                  Formatter defaultFormatter,
+                  Formatter specifiedFormatter) {
+        super(defaultLevel, defaultFormatter, specifiedFormatter);
     }
 
     /**
@@ -301,4 +289,16 @@
     public synchronized void close() throws SecurityException {
         flushAndClose();
     }
+
+    // Package-private support for setting OutputStream
+    // with elevated privilege.
+    final void setOutputStreamPrivileged(final OutputStream out) {
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            @Override
+            public Void run() {
+                setOutputStream(out);
+                return null;
+            }
+        }, null, LogManager.controlPermission);
+    }
 }
--- a/jdk/src/share/classes/java/util/logging/XMLFormatter.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/logging/XMLFormatter.java	Wed Jul 05 19:26:45 2017 +0200
@@ -173,12 +173,12 @@
         Object parameters[] = record.getParameters();
         //  Check to see if the parameter was not a messagetext format
         //  or was not null or empty
-        if ( parameters != null && parameters.length != 0
+        if (parameters != null && parameters.length != 0
                 && record.getMessage().indexOf("{") == -1 ) {
-            for (int i = 0; i < parameters.length; i++) {
+            for (Object parameter : parameters) {
                 sb.append("  <param>");
                 try {
-                    escape(sb, parameters[i].toString());
+                    escape(sb, parameter.toString());
                 } catch (Exception ex) {
                     sb.append("???");
                 }
@@ -194,8 +194,7 @@
             escape(sb, th.toString());
             sb.append("</message>\n");
             StackTraceElement trace[] = th.getStackTrace();
-            for (int i = 0; i < trace.length; i++) {
-                StackTraceElement frame = trace[i];
+            for (StackTraceElement frame : trace) {
                 sb.append("    <frame>\n");
                 sb.append("      <class>");
                 escape(sb, frame.getClassName());
--- a/jdk/src/share/classes/java/util/prefs/AbstractPreferences.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/prefs/AbstractPreferences.java	Wed Jul 05 19:26:45 2017 +0200
@@ -334,9 +334,8 @@
      */
     public void clear() throws BackingStoreException {
         synchronized(lock) {
-            String[] keys = keys();
-            for (int i=0; i<keys.length; i++)
-                remove(keys[i]);
+            for (String key : keys())
+                remove(key);
         }
     }
 
@@ -959,9 +958,9 @@
 
             // Ensure that all children are cached
             String[] kidNames = childrenNamesSpi();
-            for (int i=0; i<kidNames.length; i++)
-                if (!kidCache.containsKey(kidNames[i]))
-                    kidCache.put(kidNames[i], childSpi(kidNames[i]));
+            for (String kidName : kidNames)
+                if (!kidCache.containsKey(kidName))
+                    kidCache.put(kidName, childSpi(kidName));
 
             // Recursively remove all cached children
             for (Iterator<AbstractPreferences> i = kidCache.values().iterator();
@@ -1257,9 +1256,9 @@
         synchronized(lock) {
             // assert kidCache.get(nodeName)==null;
             String[] kidNames = childrenNames();
-            for (int i=0; i<kidNames.length; i++)
-                if (kidNames[i].equals(nodeName))
-                    return childSpi(kidNames[i]);
+            for (String kidName : kidNames)
+                if (kidName.equals(nodeName))
+                    return childSpi(kidName);
         }
         return null;
     }
@@ -1339,8 +1338,8 @@
             cachedKids = cachedChildren();
         }
 
-        for (int i=0; i<cachedKids.length; i++)
-            cachedKids[i].sync2();
+        for (AbstractPreferences cachedKid : cachedKids)
+            cachedKid.sync2();
     }
 
     /**
@@ -1399,8 +1398,8 @@
             cachedKids = cachedChildren();
         }
 
-        for (int i = 0; i < cachedKids.length; i++)
-            cachedKids[i].flush2();
+        for (AbstractPreferences cachedKid : cachedKids)
+            cachedKid.flush2();
     }
 
     /**
@@ -1492,18 +1491,18 @@
                 if (event instanceof PreferenceChangeEvent) {
                     PreferenceChangeEvent pce = (PreferenceChangeEvent)event;
                     PreferenceChangeListener[] listeners = src.prefListeners();
-                    for (int i=0; i<listeners.length; i++)
-                        listeners[i].preferenceChange(pce);
+                    for (PreferenceChangeListener listener : listeners)
+                        listener.preferenceChange(pce);
                 } else {
                     NodeChangeEvent nce = (NodeChangeEvent)event;
                     NodeChangeListener[] listeners = src.nodeListeners();
                     if (nce instanceof NodeAddedEvent) {
-                        for (int i=0; i<listeners.length; i++)
-                            listeners[i].childAdded(nce);
+                        for (NodeChangeListener listener : listeners)
+                            listener.childAdded(nce);
                     } else {
                         // assert nce instanceof NodeRemovedEvent;
-                        for (int i=0; i<listeners.length; i++)
-                            listeners[i].childRemoved(nce);
+                        for (NodeChangeListener listener : listeners)
+                            listener.childRemoved(nce);
                     }
                 }
             }
--- a/jdk/src/share/classes/java/util/prefs/XmlSupport.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/prefs/XmlSupport.java	Wed Jul 05 19:26:45 2017 +0200
@@ -154,12 +154,12 @@
             // Put map in xml element
             String[] keys = prefs.keys();
             Element map = (Element) elt.appendChild(doc.createElement("map"));
-            for (int i=0; i<keys.length; i++) {
+            for (String key : keys) {
                 Element entry = (Element)
                     map.appendChild(doc.createElement("entry"));
-                entry.setAttribute("key", keys[i]);
+                entry.setAttribute("key", key);
                 // NEXT STATEMENT THROWS NULL PTR EXC INSTEAD OF ASSERT FAIL
-                entry.setAttribute("value", prefs.get(keys[i], null));
+                entry.setAttribute("value", prefs.get(key, null));
             }
             // Recurse if appropriate
             if (subTree) {
@@ -344,8 +344,7 @@
         Element xmlMap = doc.getDocumentElement( ) ;
         xmlMap.setAttribute("MAP_XML_VERSION", MAP_XML_VERSION);
 
-        for (Iterator<Map.Entry<String, String>> i = map.entrySet().iterator(); i.hasNext(); ) {
-            Map.Entry<String, String> e = i.next();
+        for (Map.Entry<String, String> e : map.entrySet()) {
             Element xe = (Element)
                 xmlMap.appendChild(doc.createElement("entry"));
             xe.setAttribute("key",   e.getKey());
--- a/jdk/src/share/classes/java/util/regex/Pattern.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/regex/Pattern.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1545,8 +1545,8 @@
             String[] subResult = producePermutations(otherChars);
 
             String prefix = input.substring(offset, offset+len);
-            for(int y=0; y<subResult.length; y++)
-                temp[index++] =  prefix + subResult[y];
+            for (String sre : subResult)
+                temp[index++] = prefix + sre;
         }
         String[] result = new String[index];
         for (int x=0; x<index; x++)
@@ -2702,15 +2702,22 @@
             // property construct \p{name=value}
             String value = name.substring(i + 1);
             name = name.substring(0, i).toLowerCase(Locale.ENGLISH);
-            if ("sc".equals(name) || "script".equals(name)) {
-                node = unicodeScriptPropertyFor(value);
-            } else if ("blk".equals(name) || "block".equals(name)) {
-                node = unicodeBlockPropertyFor(value);
-            } else if ("gc".equals(name) || "general_category".equals(name)) {
-                node = charPropertyNodeFor(value);
-            } else {
-                throw error("Unknown Unicode property {name=<" + name + ">, "
-                             + "value=<" + value + ">}");
+            switch (name) {
+                case "sc":
+                case "script":
+                    node = unicodeScriptPropertyFor(value);
+                    break;
+                case "blk":
+                case "block":
+                    node = unicodeBlockPropertyFor(value);
+                    break;
+                case "gc":
+                case "general_category":
+                    node = charPropertyNodeFor(value);
+                    break;
+                default:
+                    throw error("Unknown Unicode property {name=<" + name + ">, "
+                                + "value=<" + value + ">}");
             }
         } else {
             if (name.startsWith("In")) {
@@ -5497,8 +5504,8 @@
 
         BnMS(int[] src, int[] lastOcc, int[] optoSft, Node next) {
             super(src, lastOcc, optoSft, next);
-            for (int x = 0; x < buffer.length; x++) {
-                lengthInChars += Character.charCount(buffer[x]);
+            for (int cp : buffer) {
+                lengthInChars += Character.charCount(cp);
             }
         }
         boolean match(Matcher matcher, int i, CharSequence seq) {
--- a/jdk/src/share/classes/java/util/stream/Collectors.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/stream/Collectors.java	Wed Jul 05 19:26:45 2017 +0200
@@ -507,16 +507,20 @@
     summingDouble(ToDoubleFunction<? super T> mapper) {
         /*
          * In the arrays allocated for the collect operation, index 0
-         * holds the high-order bits of the running sum and index 1
-         * holds the low-order bits of the sum computed via
-         * compensated summation.
+         * holds the high-order bits of the running sum, index 1 holds
+         * the low-order bits of the sum computed via compensated
+         * summation, and index 2 holds the simple sum used to compute
+         * the proper result if the stream contains infinite values of
+         * the same sign.
          */
         return new CollectorImpl<>(
-                () -> new double[2],
-                (a, t) -> { sumWithCompensation(a, mapper.applyAsDouble(t)); },
-                (a, b) -> { sumWithCompensation(a, b[0]); return sumWithCompensation(a, b[1]); },
-                // Better error bounds to add both terms as the final sum
-                a -> a[0] + a[1],
+                () -> new double[3],
+                (a, t) -> { sumWithCompensation(a, mapper.applyAsDouble(t));
+                            a[2] += mapper.applyAsDouble(t);},
+                (a, b) -> { sumWithCompensation(a, b[0]);
+                            a[2] += b[2];
+                            return sumWithCompensation(a, b[1]); },
+                a -> computeFinalSum(a),
                 CH_NOID);
     }
 
@@ -540,6 +544,20 @@
         return intermediateSum;
     }
 
+    /**
+     * If the compensated sum is spuriously NaN from accumulating one
+     * or more same-signed infinite values, return the
+     * correctly-signed infinity stored in the simple sum.
+     */
+    static double computeFinalSum(double[] summands) {
+        // Better error bounds to add both terms as the final sum
+        double tmp = summands[0] + summands[1];
+        double simpleSum = summands[summands.length - 1];
+        if (Double.isNaN(tmp) && Double.isInfinite(simpleSum))
+            return simpleSum;
+        else
+            return tmp;
+    }
 
     /**
      * Returns a {@code Collector} that produces the arithmetic mean of an integer-valued
@@ -608,11 +626,10 @@
          * summation, and index 2 holds the number of values seen.
          */
         return new CollectorImpl<>(
-                () -> new double[3],
-                (a, t) -> { sumWithCompensation(a, mapper.applyAsDouble(t)); a[2]++; },
-                (a, b) -> { sumWithCompensation(a, b[0]); sumWithCompensation(a, b[1]); a[2] += b[2]; return a; },
-                // Better error bounds to add both terms as the final sum to compute average
-                a -> (a[2] == 0) ? 0.0d : ((a[0] + a[1]) / a[2]),
+                () -> new double[4],
+                (a, t) -> { sumWithCompensation(a, mapper.applyAsDouble(t)); a[2]++; a[3]+= mapper.applyAsDouble(t);},
+                (a, b) -> { sumWithCompensation(a, b[0]); sumWithCompensation(a, b[1]); a[2] += b[2]; a[3] += b[3]; return a; },
+                a -> (a[2] == 0) ? 0.0d : (computeFinalSum(a) / a[2]),
                 CH_NOID);
     }
 
--- a/jdk/src/share/classes/java/util/stream/DoublePipeline.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/stream/DoublePipeline.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -379,21 +379,24 @@
     public final double sum() {
         /*
          * In the arrays allocated for the collect operation, index 0
-         * holds the high-order bits of the running sum and index 1
-         * holds the low-order bits of the sum computed via
-         * compensated summation.
+         * holds the high-order bits of the running sum, index 1 holds
+         * the low-order bits of the sum computed via compensated
+         * summation, and index 2 holds the simple sum used to compute
+         * the proper result if the stream contains infinite values of
+         * the same sign.
          */
-        double[] summation = collect(() -> new double[2],
+        double[] summation = collect(() -> new double[3],
                                (ll, d) -> {
                                    Collectors.sumWithCompensation(ll, d);
+                                   ll[2] += d;
                                },
                                (ll, rr) -> {
                                    Collectors.sumWithCompensation(ll, rr[0]);
                                    Collectors.sumWithCompensation(ll, rr[1]);
+                                   ll[2] += rr[2];
                                });
 
-        // Better error bounds to add both terms as the final sum
-        return summation[0] + summation[1];
+        return Collectors.computeFinalSum(summation);
     }
 
     @Override
@@ -421,27 +424,29 @@
          * In the arrays allocated for the collect operation, index 0
          * holds the high-order bits of the running sum, index 1 holds
          * the low-order bits of the sum computed via compensated
-         * summation, and index 2 holds the number of values seen.
+         * summation, index 2 holds the number of values seen, index 3
+         * holds the simple sum.
          */
-        double[] avg = collect(() -> new double[3],
+        double[] avg = collect(() -> new double[4],
                                (ll, d) -> {
                                    ll[2]++;
                                    Collectors.sumWithCompensation(ll, d);
+                                   ll[3] += d;
                                },
                                (ll, rr) -> {
                                    Collectors.sumWithCompensation(ll, rr[0]);
                                    Collectors.sumWithCompensation(ll, rr[1]);
                                    ll[2] += rr[2];
+                                   ll[3] += rr[3];
                                });
         return avg[2] > 0
-            // Better error bounds to add both terms as the final sum to compute average
-            ? OptionalDouble.of((avg[0] + avg[1]) / avg[2])
+            ? OptionalDouble.of(Collectors.computeFinalSum(avg) / avg[2])
             : OptionalDouble.empty();
     }
 
     @Override
     public final long count() {
-        return mapToObj(e -> null).mapToInt(e -> 1).sum();
+        return mapToLong(e -> 1L).sum();
     }
 
     @Override
--- a/jdk/src/share/classes/java/util/stream/IntPipeline.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/stream/IntPipeline.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -426,7 +426,7 @@
 
     @Override
     public final long count() {
-        return asLongStream().map(e -> 1L).sum();
+        return mapToLong(e -> 1L).sum();
     }
 
     @Override
--- a/jdk/src/share/classes/java/util/stream/SortedOps.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/java/util/stream/SortedOps.java	Wed Jul 05 19:26:45 2017 +0200
@@ -329,7 +329,7 @@
         public void begin(long size) {
             if (size >= Nodes.MAX_ARRAY_SIZE)
                 throw new IllegalArgumentException(Nodes.BAD_SIZE);
-            list = (size >= 0) ? new ArrayList<T>((int) size) : new ArrayList<T>();
+            list = (size >= 0) ? new ArrayList<>((int) size) : new ArrayList<>();
         }
 
         @Override
--- a/jdk/src/share/classes/javax/xml/crypto/dsig/CanonicalizationMethod.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/javax/xml/crypto/dsig/CanonicalizationMethod.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -36,7 +36,6 @@
  * <a href="http://www.w3.org/TR/xmldsig-core/">
  * W3C Recommendation for XML-Signature Syntax and Processing</a>. The XML
  * Schema Definition is defined as:
- * <p>
  * <pre>
  *   &lt;element name="CanonicalizationMethod" type="ds:CanonicalizationMethodType"/&gt;
  *     &lt;complexType name="CanonicalizationMethodType" mixed="true"&gt;
--- a/jdk/src/share/classes/javax/xml/crypto/dsig/DigestMethod.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/javax/xml/crypto/dsig/DigestMethod.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -37,7 +37,6 @@
  * defined in the <a href="http://www.w3.org/TR/xmldsig-core/">
  * W3C Recommendation for XML-Signature Syntax and Processing</a>.
  * The XML Schema Definition is defined as:
- * <p>
  * <pre>
  *   &lt;element name="DigestMethod" type="ds:DigestMethodType"/&gt;
  *     &lt;complexType name="DigestMethodType" mixed="true"&gt;
--- a/jdk/src/share/classes/javax/xml/crypto/dsig/Reference.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/javax/xml/crypto/dsig/Reference.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -38,7 +38,7 @@
  * <a href="http://www.w3.org/TR/xmldsig-core/">
  * W3C Recommendation for XML-Signature Syntax and Processing</a>.
  * The XML schema is defined as:
- * <code><pre>
+ * <pre>
  * &lt;element name="Reference" type="ds:ReferenceType"/&gt;
  * &lt;complexType name="ReferenceType"&gt;
  *   &lt;sequence&gt;
@@ -55,7 +55,7 @@
  * &lt;simpleType name="DigestValueType"&gt;
  *   &lt;restriction base="base64Binary"/&gt;
  * &lt;/simpleType&gt;
- * </pre></code>
+ * </pre>
  *
  * <p>A <code>Reference</code> instance may be created by invoking one of the
  * {@link XMLSignatureFactory#newReference newReference} methods of the
@@ -145,7 +145,7 @@
 
     /**
      * Returns the dereferenced data, if
-     * <a href="XMLSignContext.html#Supported Properties">reference caching</a>
+     * <a href="XMLSignContext.html#Supported%20Properties">reference caching</a>
      * is enabled. This is the result of dereferencing the URI of this
      * reference during a validation or generation operation.
      *
@@ -157,7 +157,7 @@
 
     /**
      * Returns the pre-digested input stream, if
-     * <a href="XMLSignContext.html#Supported Properties">reference caching</a>
+     * <a href="XMLSignContext.html#Supported%20Properties">reference caching</a>
      * is enabled. This is the input to the digest operation during a
      * validation or signing operation.
      *
--- a/jdk/src/share/classes/javax/xml/crypto/dsig/SignatureMethod.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/javax/xml/crypto/dsig/SignatureMethod.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -37,7 +37,6 @@
  * as defined in the <a href="http://www.w3.org/TR/xmldsig-core/">
  * W3C Recommendation for XML-Signature Syntax and Processing</a>.
  * The XML Schema Definition is defined as:
- * <p>
  * <pre>
  *   &lt;element name="SignatureMethod" type="ds:SignatureMethodType"/&gt;
  *     &lt;complexType name="SignatureMethodType" mixed="true"&gt;
--- a/jdk/src/share/classes/javax/xml/crypto/dsig/TransformService.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/javax/xml/crypto/dsig/TransformService.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -71,9 +71,9 @@
  * <code>TransformService</code> implementations that support the DOM
  * mechanism type must abide by the DOM interoperability requirements defined
  * in the
- * <a href="../../../../../technotes/guides/security/xmldsig/overview.html#DOM Mechanism Requirements">
+ * <a href="../../../../../technotes/guides/security/xmldsig/overview.html#DOM%20Mechanism%20Requirements">
  * DOM Mechanism Requirements</a> section of the API overview. See the
- * <a href="../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider">
+ * <a href="../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider">
  * Service Providers</a> section of the API overview for a list of standard
  * mechanism types.
  * <p>
--- a/jdk/src/share/classes/javax/xml/crypto/dsig/XMLSignContext.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/javax/xml/crypto/dsig/XMLSignContext.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -41,7 +41,7 @@
  * (for example, you should not use the same <code>XMLSignContext</code>
  * instance to sign two different {@link XMLSignature} objects).
  * <p>
- * <b><a name="Supported Properties"></a>Supported Properties</b>
+ * <b><a name="SupportedProperties"></a>Supported Properties</b>
  * <p>The following properties can be set using the
  * {@link #setProperty setProperty} method.
  * <ul>
--- a/jdk/src/share/classes/javax/xml/crypto/dsig/XMLSignature.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/javax/xml/crypto/dsig/XMLSignature.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -187,7 +187,6 @@
      * defined in the <a href="http://www.w3.org/TR/xmldsig-core/">
      * W3C Recommendation for XML-Signature Syntax and Processing</a>.
      * The XML Schema Definition is defined as:
-     * <p>
      * <pre>
      *   &lt;element name="SignatureValue" type="ds:SignatureValueType"/&gt;
      *     &lt;complexType name="SignatureValueType"&gt;
--- a/jdk/src/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -67,9 +67,9 @@
  *
  * <p>The objects that this factory produces will be based
  * on DOM and abide by the DOM interoperability requirements as defined in the
- * <a href="../../../../../technotes/guides/security/xmldsig/overview.html#DOM Mechanism Requirements">
+ * <a href="../../../../../technotes/guides/security/xmldsig/overview.html#DOM%20Mechanism%20Requirements">
  * DOM Mechanism Requirements</a> section of the API overview. See the
- * <a href="../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider">
+ * <a href="../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider">
  * Service Providers</a> section of the API overview for a list of standard
  * mechanism types.
  *
@@ -175,7 +175,7 @@
      *
      * @param mechanismType the type of the XML processing mechanism and
      *    representation. See the <a
-     *    href="../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider">
+     *    href="../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider">
      *    Service Providers</a> section of the API overview for a list of
      *    standard mechanism types.
      * @return a new <code>XMLSignatureFactory</code>
@@ -212,7 +212,7 @@
      *
      * @param mechanismType the type of the XML processing mechanism and
      *    representation. See the <a
-     *    href="../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider">
+     *    href="../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider">
      *    Service Providers</a> section of the API overview for a list of
      *    standard mechanism types.
      * @param provider the <code>Provider</code> object
@@ -256,7 +256,7 @@
      *
      * @param mechanismType the type of the XML processing mechanism and
      *    representation. See the <a
-     *    href="../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider">
+     *    href="../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider">
      *    Service Providers</a> section of the API overview for a list of
      *    standard mechanism types.
      * @param provider the string name of the provider
--- a/jdk/src/share/classes/javax/xml/crypto/dsig/XMLValidateContext.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/javax/xml/crypto/dsig/XMLValidateContext.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -40,7 +40,7 @@
  * (for example, you should not use the same <code>XMLValidateContext</code>
  * instance to validate two different {@link XMLSignature} objects).
  * <p>
- * <b><a name="Supported Properties"></a>Supported Properties</b>
+ * <b><a name="SupportedProperties"></a>Supported Properties</b>
  * <p>The following properties can be set by an application using the
  * {@link #setProperty setProperty} method.
  * <ul>
--- a/jdk/src/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -62,9 +62,9 @@
  *
  * <p>The objects that this factory produces will be based
  * on DOM and abide by the DOM interoperability requirements as defined in the
- * <a href="../../../../../../technotes/guides/security/xmldsig/overview.html#DOM Mechanism Requirements">
+ * <a href="../../../../../../technotes/guides/security/xmldsig/overview.html#DOM%20Mechanism%20Requirements">
  * DOM Mechanism Requirements</a> section of the API overview. See the
- * <a href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider">
+ * <a href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider">
  * Service Providers</a> section of the API overview for a list of standard
  * mechanism types.
  *
@@ -131,7 +131,7 @@
      *
      * @param mechanismType the type of the XML processing mechanism and
      *    representation. See the <a
-     *    href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider">
+     *    href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider">
      *    Service Providers</a> section of the API overview for a list of
      *    standard mechanism types.
      * @return a new <code>KeyInfoFactory</code>
@@ -167,7 +167,7 @@
      *
      * @param mechanismType the type of the XML processing mechanism and
      *    representation. See the <a
-     *    href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider">
+     *    href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider">
      *    Service Providers</a> section of the API overview for a list of
      *    standard mechanism types.
      * @param provider the <code>Provider</code> object
@@ -211,7 +211,7 @@
      *
      * @param mechanismType the type of the XML processing mechanism and
      *    representation. See the <a
-     *    href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider">
+     *    href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider">
      *    Service Providers</a> section of the API overview for a list of
      *    standard mechanism types.
      * @param provider the string name of the provider
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/XMLDSigRI.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/XMLDSigRI.java	Wed Jul 05 19:26:45 2017 +0200
@@ -28,7 +28,7 @@
  * ===========================================================================
  */
 /*
- * Copyright (c) 2005, 2013 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014 Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * $Id: XMLDSigRI.java 1400021 2012-10-19 10:16:04Z coheigea $
@@ -61,7 +61,7 @@
 
     public XMLDSigRI() {
         /* We are the XMLDSig provider */
-        super("XMLDSig", 1.8d, INFO);
+        super("XMLDSig", 1.9d, INFO);
 
         final Map<Object, Object> map = new HashMap<Object, Object>();
         map.put("XMLSignatureFactory.DOM",
--- a/jdk/src/share/classes/sun/applet/AppletSecurity.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/applet/AppletSecurity.java	Wed Jul 05 19:26:45 2017 +0200
@@ -42,6 +42,7 @@
 import java.lang.reflect.*;
 import sun.awt.AWTSecurityManager;
 import sun.awt.AppContext;
+import sun.awt.AWTPermissions;
 import sun.security.provider.*;
 import sun.security.util.SecurityConstants;
 
@@ -314,7 +315,7 @@
             // If we're about to allow access to the main EventQueue,
             // and anything untrusted is on the class context stack,
             // disallow access.
-            super.checkPermission(SecurityConstants.AWT.CHECK_AWT_EVENTQUEUE_PERMISSION);
+            super.checkPermission(AWTPermissions.CHECK_AWT_EVENTQUEUE_PERMISSION);
         }
     } // checkAwtEventQueueAccess()
 
--- a/jdk/src/share/classes/sun/awt/AWTPermissionFactory.java	Fri Dec 13 09:35:35 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2009, 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.awt;
-
-import java.awt.AWTPermission;
-import sun.security.util.PermissionFactory;
-
-/**
- * A factory object for AWTPermission objects.
- */
-
-public class AWTPermissionFactory
-    implements PermissionFactory<AWTPermission>
-{
-    @Override
-    public AWTPermission newPermission(String name) {
-        return new AWTPermission(name);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/awt/AWTPermissions.java	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 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 sun.awt;
+
+import java.awt.AWTPermission;
+
+/**
+ * Defines the {@code AWTPermission} objects used for permission checks.
+ */
+
+public final class AWTPermissions {
+    private AWTPermissions() { }
+
+    public static final AWTPermission TOPLEVEL_WINDOW_PERMISSION =
+        new AWTPermission("showWindowWithoutWarningBanner");
+
+    public static final AWTPermission ACCESS_CLIPBOARD_PERMISSION =
+        new AWTPermission("accessClipboard");
+
+    public static final AWTPermission CHECK_AWT_EVENTQUEUE_PERMISSION =
+        new AWTPermission("accessEventQueue");
+
+    public static final AWTPermission TOOLKIT_MODALITY_PERMISSION =
+        new AWTPermission("toolkitModality");
+
+    public static final AWTPermission READ_DISPLAY_PIXELS_PERMISSION =
+        new AWTPermission("readDisplayPixels");
+
+    public static final AWTPermission CREATE_ROBOT_PERMISSION =
+        new AWTPermission("createRobot");
+
+    public static final AWTPermission WATCH_MOUSE_PERMISSION =
+        new AWTPermission("watchMousePointer");
+
+    public static final AWTPermission SET_WINDOW_ALWAYS_ON_TOP_PERMISSION =
+        new AWTPermission("setWindowAlwaysOnTop");
+
+    public static final AWTPermission ALL_AWT_EVENTS_PERMISSION =
+        new AWTPermission("listenToAllAWTEvents");
+
+    public static final AWTPermission ACCESS_SYSTEM_TRAY_PERMISSION =
+        new AWTPermission("accessSystemTray");
+}
--- a/jdk/src/share/classes/sun/awt/SunToolkit.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/awt/SunToolkit.java	Wed Jul 05 19:26:45 2017 +0200
@@ -43,7 +43,6 @@
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 
-import sun.security.util.SecurityConstants;
 import sun.util.logging.PlatformLogger;
 import sun.misc.SoftCache;
 import sun.font.FontDesignMetrics;
@@ -1049,8 +1048,7 @@
         try {
             SecurityManager sm = System.getSecurityManager();
             if (sm != null) {
-                sm.checkPermission(
-                        SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION);
+                sm.checkPermission(AWTPermissions.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION);
             }
         } catch (SecurityException se) {
             // There is no permission to show popups over the task bar
--- a/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java	Wed Jul 05 19:26:45 2017 +0200
@@ -54,10 +54,10 @@
 import java.io.InputStream;
 
 import sun.awt.AppContext;
+import sun.awt.AWTPermissions;
 import sun.awt.SunToolkit;
 import sun.awt.datatransfer.DataTransferer;
 import sun.awt.datatransfer.ToolkitThreadBlockedHandler;
-import sun.security.util.SecurityConstants;
 
 /**
  * <p>
@@ -226,7 +226,7 @@
         SecurityManager sm = System.getSecurityManager();
         try {
             if (!dropInProcess && sm != null) {
-                sm.checkPermission(SecurityConstants.AWT.ACCESS_CLIPBOARD_PERMISSION);
+                sm.checkPermission(AWTPermissions.ACCESS_CLIPBOARD_PERMISSION);
             }
         } catch (Exception e) {
             Thread currentThread = Thread.currentThread();
--- a/jdk/src/share/classes/sun/misc/Cache.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/misc/Cache.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 1996, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -73,9 +73,11 @@
  * @see java.lang.Object#hashCode
  * @see java.lang.Object#equals
  * @see sun.misc.Ref
+ * @deprecated Consider {@link java.util.LinkedHashMap} for LRU caches.
  */
+@Deprecated
 public
-class Cache extends Dictionary {
+    class Cache extends Dictionary<Object, Object> {
     /**
      * The hash table data.
      */
@@ -163,7 +165,7 @@
      * @see Cache#elements
      * @see Enumeration
      */
-    public synchronized Enumeration keys() {
+    public synchronized Enumeration<Object> keys() {
         return new CacheEnumerator(table, true);
     }
 
@@ -173,7 +175,7 @@
      * @see Cache#keys
      * @see Enumeration
      */
-    public synchronized Enumeration elements() {
+    public synchronized Enumeration<Object> elements() {
         return new CacheEnumerator(table, false);
     }
 
@@ -305,7 +307,7 @@
  * A Cache enumerator class.  This class should remain opaque
  * to the client. It will use the Enumeration interface.
  */
-class CacheEnumerator implements Enumeration {
+class CacheEnumerator implements Enumeration<Object> {
     boolean keys;
     int index;
     CacheEntry table[];
--- a/jdk/src/share/classes/sun/misc/SoftCache.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/misc/SoftCache.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -99,10 +99,12 @@
  * @since       1.2
  * @see         java.util.HashMap
  * @see         java.lang.ref.SoftReference
+ * @deprecated No direct replacement; {@link java.util.WeakHashMap}
+ * addresses a related by different use-case.
  */
 
-
-public class SoftCache extends AbstractMap implements Map {
+@Deprecated
+public class SoftCache extends AbstractMap<Object, Object> implements Map<Object, Object> {
 
     /* The basic idea of this implementation is to maintain an internal HashMap
        that maps keys to soft references whose referents are the keys' values;
@@ -115,18 +117,18 @@
      */
 
 
-    static private class ValueCell extends SoftReference {
+    static private class ValueCell extends SoftReference<Object> {
         static private Object INVALID_KEY = new Object();
         static private int dropped = 0;
         private Object key;
 
-        private ValueCell(Object key, Object value, ReferenceQueue queue) {
+        private ValueCell(Object key, Object value, ReferenceQueue<Object> queue) {
             super(value, queue);
             this.key = key;
         }
 
         private static ValueCell create(Object key, Object value,
-                                        ReferenceQueue queue)
+                                        ReferenceQueue<Object> queue)
         {
             if (value == null) return null;
             return new ValueCell(key, value, queue);
@@ -154,10 +156,10 @@
 
 
     /* Hash table mapping keys to ValueCells */
-    private Map hash;
+    private Map<Object, Object> hash;
 
     /* Reference queue for cleared ValueCells */
-    private ReferenceQueue queue = new ReferenceQueue();
+    private ReferenceQueue<Object> queue = new ReferenceQueue<>();
 
 
     /* Process any ValueCells that have been cleared and enqueued by the
@@ -189,7 +191,7 @@
      *                                   factor is less than zero
      */
     public SoftCache(int initialCapacity, float loadFactor) {
-        hash = new HashMap(initialCapacity, loadFactor);
+        hash = new HashMap<>(initialCapacity, loadFactor);
     }
 
     /**
@@ -202,7 +204,7 @@
      *                                   or equal to zero
      */
     public SoftCache(int initialCapacity) {
-        hash = new HashMap(initialCapacity);
+        hash = new HashMap<>(initialCapacity);
     }
 
     /**
@@ -210,7 +212,7 @@
      * capacity and the default load factor.
      */
     public SoftCache() {
-        hash = new HashMap();
+        hash = new HashMap<>();
     }
 
 
@@ -348,13 +350,13 @@
     /* Internal class for entries.
        Because it uses SoftCache.this.queue, this class cannot be static.
      */
-    private class Entry implements Map.Entry {
-        private Map.Entry ent;
+    private class Entry implements Map.Entry<Object, Object> {
+        private Map.Entry<Object, Object> ent;
         private Object value;   /* Strong reference to value, to prevent the GC
                                    from flushing the value while this Entry
                                    exists */
 
-        Entry(Map.Entry ent, Object value) {
+        Entry(Map.Entry<Object, Object> ent, Object value) {
             this.ent = ent;
             this.value = value;
         }
@@ -371,9 +373,10 @@
             return ent.setValue(ValueCell.create(ent.getKey(), value, queue));
         }
 
+        @SuppressWarnings("unchecked")
         public boolean equals(Object o) {
             if (! (o instanceof Map.Entry)) return false;
-            Map.Entry e = (Map.Entry)o;
+            Map.Entry<Object, Object> e = (Map.Entry<Object, Object>)o;
             return (valEquals(ent.getKey(), e.getKey())
                     && valEquals(value, e.getValue()));
         }
@@ -388,18 +391,18 @@
 
 
     /* Internal class for entry sets */
-    private class EntrySet extends AbstractSet {
-        Set hashEntries = hash.entrySet();
+    private class EntrySet extends AbstractSet<Map.Entry<Object, Object>> {
+        Set<Map.Entry<Object, Object>> hashEntries = hash.entrySet();
 
-        public Iterator iterator() {
+        public Iterator<Map.Entry<Object, Object>> iterator() {
 
-            return new Iterator() {
-                Iterator hashIterator = hashEntries.iterator();
+            return new Iterator<Map.Entry<Object, Object>>() {
+                Iterator<Map.Entry<Object, Object>> hashIterator = hashEntries.iterator();
                 Entry next = null;
 
                 public boolean hasNext() {
                     while (hashIterator.hasNext()) {
-                        Map.Entry ent = (Map.Entry)hashIterator.next();
+                        Map.Entry<Object, Object> ent = hashIterator.next();
                         ValueCell vc = (ValueCell)ent.getValue();
                         Object v = null;
                         if ((vc != null) && ((v = vc.get()) == null)) {
@@ -412,7 +415,7 @@
                     return false;
                 }
 
-                public Object next() {
+                public Map.Entry<Object, Object> next() {
                     if ((next == null) && !hasNext())
                         throw new NoSuchElementException();
                     Entry e = next;
@@ -433,7 +436,7 @@
 
         public int size() {
             int j = 0;
-            for (Iterator i = iterator(); i.hasNext(); i.next()) j++;
+            for (Iterator<Map.Entry<Object, Object>> i = iterator(); i.hasNext(); i.next()) j++;
             return j;
         }
 
@@ -446,12 +449,12 @@
     }
 
 
-    private Set entrySet = null;
+    private Set<Map.Entry<Object, Object>> entrySet = null;
 
     /**
      * Return a <code>Set</code> view of the mappings in this cache.
      */
-    public Set entrySet() {
+    public Set<Map.Entry<Object, Object>> entrySet() {
         if (entrySet == null) entrySet = new EntrySet();
         return entrySet;
     }
--- a/jdk/src/share/classes/sun/rmi/rmic/Main.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/rmi/rmic/Main.java	Wed Jul 05 19:26:45 2017 +0200
@@ -162,6 +162,15 @@
             return false;
         }
 
+        if ((flags & F_WARNINGS) != 0) {
+            for (Generator g : generators) {
+                if (g instanceof RMIGenerator) {
+                    output(getText("rmic.jrmp.stubs.deprecated", program));
+                    break;
+                }
+            }
+        }
+
         return doCompile();
     }
 
--- a/jdk/src/share/classes/sun/rmi/rmic/resources/rmic.properties	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/rmi/rmic/resources/rmic.properties	Wed Jul 05 19:26:45 2017 +0200
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+# 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
@@ -76,10 +76,10 @@
 \nwhere <options> includes:\
 \n  -keep          Do not delete intermediate generated source files\
 \n  -keepgenerated (same as "-keep")\
-\n  -v1.1          Create stubs/skeletons for 1.1 stub protocol version\
+\n  -v1.1          Create stubs/skeletons for 1.1 stub protocol version (deprecated)\
 \n  -vcompat       Create stubs/skeletons compatible with both\
-\n                           1.1 and 1.2 stub protocol versions\
-\n  -v1.2          (default) Create stubs for 1.2 stub protocol version only\
+\n                           1.1 and 1.2 stub protocol versions (deprecated)\
+\n  -v1.2          (default) Create stubs for 1.2 stub protocol version only (deprecated)\
 \n  -iiop          Create stubs for IIOP. When present, <options> also includes:\
 \n\
 \n                   -always           Create stubs even when they appear current\
@@ -154,6 +154,12 @@
 	An IIOP "tie" exists for class {0}:\
 	\n  {1}\
 	\nIf you use PortableRemoteObject.exportObject, you should remove this file; otherwise, your server object will be exported to IIOP rather than to JRMP.
+rmic.jrmp.stubs.deprecated=\
+	Warning: generation and use of skeletons and static stubs for JRMP\
+	\nis deprecated. Skeletons are unnecessary, and static stubs have\
+	\nbeen superseded by dynamically generated stubs. Users are\
+	\nencouraged to migrate away from using {0} to generate skeletons and static\
+	\nstubs. See the documentation for java.rmi.server.UnicastRemoteObject.
 
 #
 # RMI-IIOP Messages
--- a/jdk/src/share/classes/sun/security/ec/SunEC.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/ec/SunEC.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -67,7 +67,7 @@
     }
 
     public SunEC() {
-        super("SunEC", 1.8d, "Sun Elliptic Curve provider (EC, ECDSA, ECDH)");
+        super("SunEC", 1.9d, "Sun Elliptic Curve provider (EC, ECDSA, ECDH)");
 
         // if there is no security manager installed, put directly into
         // the provider. Otherwise, create a temporary map and use a
--- a/jdk/src/share/classes/sun/security/jca/ProviderConfig.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/jca/ProviderConfig.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -58,7 +58,7 @@
 
     // parameters for the Provider(String) constructor,
     // use by doLoadProvider()
-    private final static Class[] CL_STRING = { String.class };
+    private final static Class<?>[] CL_STRING = { String.class };
 
     // name of the provider class
     private final String className;
--- a/jdk/src/share/classes/sun/security/jgss/GSSNameImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/jgss/GSSNameImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -257,6 +257,10 @@
                               ((0xFF & bytes[pos++]) << 16) |
                               ((0xFF & bytes[pos++]) << 8) |
                               (0xFF & bytes[pos++]));
+        if (pos > bytes.length - mechPortionLen) {
+            throw new GSSExceptionImpl(GSSException.BAD_NAME,
+                    "Exported name mech name is corrupted!");
+        }
         byte[] mechPortion = new byte[mechPortionLen];
         System.arraycopy(bytes, pos, mechPortion, 0, mechPortionLen);
 
--- a/jdk/src/share/classes/sun/security/jgss/SunProvider.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/jgss/SunProvider.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -62,7 +62,7 @@
 
     public SunProvider() {
         /* We are the Sun JGSS provider */
-        super("SunJGSS", 1.8d, INFO);
+        super("SunJGSS", 1.9d, INFO);
 
         AccessController.doPrivileged(
                         new java.security.PrivilegedAction<Void>() {
--- a/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -120,7 +120,7 @@
 
     public SunNativeProvider() {
         /* We are the Sun NativeGSS provider */
-        super(NAME, 1.8d, INFO);
+        super(NAME, 1.9d, INFO);
 
         if (MECH_MAP != null) {
             AccessController.doPrivileged(new PutAllAction(this, MECH_MAP));
--- a/jdk/src/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java	Wed Jul 05 19:26:45 2017 +0200
@@ -32,9 +32,11 @@
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.Hashtable;
-import java.util.Vector;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.StringTokenizer;
+
+import sun.misc.IOUtils;
 import sun.security.krb5.*;
 import sun.security.krb5.internal.*;
 import sun.security.krb5.internal.util.KrbDataInputStream;
@@ -74,7 +76,6 @@
     // this needs to be public for Kinit.
     public Tag readTag() throws IOException {
         char[] buf = new char[1024];
-        byte[] bytes;
         int len;
         int tag = -1;
         int taglen;
@@ -85,7 +86,6 @@
         if (len < 0) {
             throw new IOException("stop.");
         }
-        bytes = new byte[len + 2];
         if (len > buf.length) {
             throw new IOException("Invalid tag length.");
         }
@@ -101,11 +101,7 @@
             }
             len = len - (4 + taglen);
         }
-        Tag result;
-        if (tag == -1) {
-        }
-        result = new Tag(len, tag, time_offset, usec_offset);
-        return result;
+        return new Tag(len, tag, time_offset, usec_offset);
     }
     /*
      * In file-based credential cache, the realm name is stored as part of
@@ -123,7 +119,7 @@
             type = read(4);
         }
         length = read(4);
-        String[] result = new String[length + 1];
+        List<String> result = new ArrayList<String>();
         /*
          * DCE includes the principal's realm in the count; the new format
          * does not.
@@ -132,21 +128,26 @@
             length--;
         for (int i = 0; i <= length; i++) {
             namelength = read(4);
-            if (namelength > MAXNAMELENGTH) {
-                throw new IOException("Invalid name length in principal name.");
+            byte[] bytes = IOUtils.readFully(this, namelength, true);
+            result.add(new String(bytes));
+        }
+        if (result.isEmpty()) {
+            throw new IOException("No realm or principal");
+        }
+        if (isRealm(result.get(0))) {
+            realm = result.remove(0);
+            if (result.isEmpty()) {
+                throw new IOException("No principal name components");
             }
-            byte[] bytes = new byte[namelength];
-            read(bytes, 0, namelength);
-            result[i] = new String(bytes);
-        }
-        if (isRealm(result[0])) {
-            realm = result[0];
-            pname = new String[length];
-            System.arraycopy(result, 1, pname, 0, length);
-            return new PrincipalName(type, pname, new Realm(realm));
+            return new PrincipalName(
+                    type,
+                    result.toArray(new String[result.size()]),
+                    new Realm(realm));
         }
         try {
-            return new PrincipalName(result, type);
+            return new PrincipalName(
+                    result.toArray(new String[result.size()]),
+                    type);
         } catch (RealmException re) {
             return null;
         }
@@ -184,10 +185,7 @@
         if (version == KRB5_FCC_FVNO_3)
             read(2); /* keytype recorded twice in fvno 3 */
         keyLen = read(4);
-        byte[] bytes = new byte[keyLen];
-        for (int i = 0; i < keyLen; i++) {
-            bytes[i] = (byte)read();
-        }
+        byte[] bytes = IOUtils.readFully(this, keyLen, true);
         return new EncryptionKey(bytes, keyType, new Integer(version));
     }
 
@@ -211,7 +209,7 @@
         int numAddrs, addrType, addrLength;
         numAddrs = read(4);
         if (numAddrs > 0) {
-            HostAddress[] addrs = new HostAddress[numAddrs];
+            List<HostAddress> addrs = new ArrayList<>();
             for (int i = 0; i < numAddrs; i++) {
                 addrType = read(2);
                 addrLength = read(4);
@@ -224,9 +222,9 @@
                 byte[] result = new byte[addrLength];
                 for (int j = 0; j < addrLength; j++)
                     result[j] = (byte)read(1);
-                addrs[i] = new HostAddress(addrType, result);
+                addrs.add(new HostAddress(addrType, result));
             }
-            return addrs;
+            return addrs.toArray(new HostAddress[addrs.size()]);
         }
         return null;
     }
@@ -235,18 +233,15 @@
         int num, adtype, adlength;
         num = read(4);
         if (num > 0) {
-            AuthorizationDataEntry[] auData = new AuthorizationDataEntry[num];
+            List<AuthorizationDataEntry> auData = new ArrayList<>();
             byte[] data = null;
             for (int i = 0; i < num; i++) {
                 adtype = read(2);
                 adlength = read(4);
-                data = new byte[adlength];
-                for (int j = 0; j < adlength; j++) {
-                    data[j] = (byte)read();
-                }
-                auData[i] = new AuthorizationDataEntry(adtype, data);
+                data = IOUtils.readFully(this, adlength, true);
+                auData.add(new AuthorizationDataEntry(adtype, data));
             }
-            return auData;
+            return auData.toArray(new AuthorizationDataEntry[auData.size()]);
         }
         else return null;
     }
@@ -257,9 +252,7 @@
         if (length == 0) {
             return null;
         } else {
-            byte[] bytes = new byte[length];
-            read(bytes, 0, length);
-            return bytes;
+            return IOUtils.readFully(this, length, true);
         }
     }
 
--- a/jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCCacheConstants.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCCacheConstants.java	Wed Jul 05 19:26:45 2017 +0200
@@ -49,7 +49,6 @@
     public final int KRB5_FCC_FVNO_4 = 0x504;
     public final int FCC_TAG_DELTATIME = 1;
     public final int KRB5_NT_UNKNOWN = 0;
-    public final int MAXNAMELENGTH = 1024;
     public final int TKT_FLG_FORWARDABLE = 0x40000000;
     public final int TKT_FLG_FORWARDED  =  0x20000000;
     public final int TKT_FLG_PROXIABLE   = 0x10000000;
--- a/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -94,7 +94,7 @@
     }
 
     public SunPKCS11() {
-        super("SunPKCS11-Dummy", 1.8d, "SunPKCS11-Dummy");
+        super("SunPKCS11-Dummy", 1.9d, "SunPKCS11-Dummy");
         throw new ProviderException
             ("SunPKCS11 requires configuration file argument");
     }
@@ -127,7 +127,7 @@
     public SunPKCS11(String configName, InputStream configStream) {
         super("SunPKCS11-" +
             Config.getConfig(configName, configStream).getName(),
-            1.8d, Config.getConfig(configName, configStream).getDescription());
+            1.9d, Config.getConfig(configName, configStream).getDescription());
         this.configName = configName;
         this.config = Config.removeConfig(configName);
 
--- a/jdk/src/share/classes/sun/security/provider/MD4.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/provider/MD4.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -65,7 +65,7 @@
     private final static Provider md4Provider;
 
     static {
-        md4Provider = new Provider("MD4Provider", 1.8d, "MD4 MessageDigest") {
+        md4Provider = new Provider("MD4Provider", 1.9d, "MD4 MessageDigest") {
             private static final long serialVersionUID = -8850464997518327965L;
         };
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
--- a/jdk/src/share/classes/sun/security/provider/PolicyFile.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/provider/PolicyFile.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -285,9 +285,9 @@
 
     // for use with the reflection API
 
-    private static final Class[] PARAMS0 = { };
-    private static final Class[] PARAMS1 = { String.class };
-    private static final Class[] PARAMS2 = { String.class, String.class };
+    private static final Class<?>[] PARAMS0 = { };
+    private static final Class<?>[] PARAMS1 = { String.class };
+    private static final Class<?>[] PARAMS2 = { String.class, String.class };
 
     /**
      * Initializes the Policy object and reads the default policy
--- a/jdk/src/share/classes/sun/security/provider/Sun.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/provider/Sun.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -47,7 +47,7 @@
 
     public Sun() {
         /* We are the SUN provider */
-        super("SUN", 1.8d, INFO);
+        super("SUN", 1.9d, INFO);
 
         // if there is no security manager installed, put directly into
         // the provider. Otherwise, create a temporary map and use a
--- a/jdk/src/share/classes/sun/security/provider/VerificationProvider.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/provider/VerificationProvider.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -61,7 +61,7 @@
     }
 
     public VerificationProvider() {
-        super("SunJarVerification", 1.8d, "Jar Verification Provider");
+        super("SunJarVerification", 1.9d, "Jar Verification Provider");
         // register all algorithms normally registered by the Sun and SunRsaSign
         // providers, but only if they are missing
         if (ACTIVE == false) {
--- a/jdk/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java	Wed Jul 05 19:26:45 2017 +0200
@@ -76,6 +76,25 @@
                                               Date validity)
         throws CertStoreException
     {
+        return getCRLs(selector, signFlag, prevKey, null, provider, certStores,
+                       reasonsMask, trustAnchors, validity);
+    }
+
+    /**
+     * Return the X509CRLs matching this selector. The selector must be
+     * an X509CRLSelector with certificateChecking set.
+     */
+    public static Collection<X509CRL> getCRLs(X509CRLSelector selector,
+                                              boolean signFlag,
+                                              PublicKey prevKey,
+                                              X509Certificate prevCert,
+                                              String provider,
+                                              List<CertStore> certStores,
+                                              boolean[] reasonsMask,
+                                              Set<TrustAnchor> trustAnchors,
+                                              Date validity)
+        throws CertStoreException
+    {
         X509Certificate cert = selector.getCertificateChecking();
         if (cert == null) {
             return Collections.emptySet();
@@ -101,7 +120,7 @@
                  t.hasNext() && !Arrays.equals(reasonsMask, ALL_REASONS); ) {
                 DistributionPoint point = t.next();
                 Collection<X509CRL> crls = getCRLs(selector, certImpl,
-                    point, reasonsMask, signFlag, prevKey, provider,
+                    point, reasonsMask, signFlag, prevKey, prevCert, provider,
                     certStores, trustAnchors, validity);
                 results.addAll(crls);
             }
@@ -125,9 +144,10 @@
      */
     private static Collection<X509CRL> getCRLs(X509CRLSelector selector,
         X509CertImpl certImpl, DistributionPoint point, boolean[] reasonsMask,
-        boolean signFlag, PublicKey prevKey, String provider,
-        List<CertStore> certStores, Set<TrustAnchor> trustAnchors,
-        Date validity) throws CertStoreException {
+        boolean signFlag, PublicKey prevKey, X509Certificate prevCert,
+        String provider, List<CertStore> certStores,
+        Set<TrustAnchor> trustAnchors, Date validity)
+            throws CertStoreException {
 
         // check for full name
         GeneralNames fullName = point.getFullName();
@@ -188,8 +208,8 @@
                 // we check the issuer in verifyCRLs method
                 selector.setIssuerNames(null);
                 if (selector.match(crl) && verifyCRL(certImpl, point, crl,
-                        reasonsMask, signFlag, prevKey, provider, trustAnchors,
-                        certStores, validity)) {
+                        reasonsMask, signFlag, prevKey, prevCert, provider,
+                        trustAnchors, certStores, validity)) {
                     crls.add(crl);
                 }
             } catch (IOException | CRLException e) {
@@ -284,6 +304,8 @@
      * @param reasonsMask the interim reasons mask
      * @param signFlag true if prevKey can be used to verify the CRL
      * @param prevKey the public key that verifies the certificate's signature
+     * @param prevCert the certificate whose public key verifies
+     *        {@code certImpl}'s signature
      * @param provider the Signature provider to use
      * @param trustAnchors a {@code Set} of {@code TrustAnchor}s
      * @param certStores a {@code List} of {@code CertStore}s to be used in
@@ -294,7 +316,7 @@
      */
     static boolean verifyCRL(X509CertImpl certImpl, DistributionPoint point,
         X509CRL crl, boolean[] reasonsMask, boolean signFlag,
-        PublicKey prevKey, String provider,
+        PublicKey prevKey, X509Certificate prevCert, String provider,
         Set<TrustAnchor> trustAnchors, List<CertStore> certStores,
         Date validity) throws CRLException, IOException {
 
@@ -591,18 +613,26 @@
                 // the subject criterion will be set by builder automatically.
             }
 
-            // by far, we have validated the previous certificate, we can
-            // trust it during validating the CRL issuer.
-            // Except the performance improvement, another benefit is to break
-            // the dead loop while looking for the issuer back and forth
+            // By now, we have validated the previous certificate, so we can
+            // trust it during the validation of the CRL issuer.
+            // In addition to the performance improvement, another benefit is to
+            // break the dead loop while looking for the issuer back and forth
             // between the delegated self-issued certificate and its issuer.
             Set<TrustAnchor> newTrustAnchors = new HashSet<>(trustAnchors);
 
             if (prevKey != null) {
                 // Add the previous certificate as a trust anchor.
-                X500Principal principal = certImpl.getIssuerX500Principal();
-                TrustAnchor temporary =
-                        new TrustAnchor(principal, prevKey, null);
+                // If prevCert is not null, we want to construct a TrustAnchor
+                // using the cert object because when the certpath for the CRL
+                // is built later, the CertSelector will make comparisons with
+                // the TrustAnchor's trustedCert member rather than its pubKey.
+                TrustAnchor temporary;
+                if (prevCert != null) {
+                    temporary = new TrustAnchor(prevCert, null);
+                } else {
+                    X500Principal principal = certImpl.getIssuerX500Principal();
+                    temporary = new TrustAnchor(principal, prevKey, null);
+                }
                 newTrustAnchors.add(temporary);
             }
 
--- a/jdk/src/share/classes/sun/security/provider/certpath/ForwardBuilder.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/provider/certpath/ForwardBuilder.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -47,9 +47,7 @@
 import sun.security.x509.AccessDescription;
 import sun.security.x509.AuthorityInfoAccessExtension;
 import static sun.security.x509.PKIXExtensions.*;
-import sun.security.x509.PolicyMappingsExtension;
 import sun.security.x509.X500Name;
-import sun.security.x509.X509CertImpl;
 import sun.security.x509.AuthorityKeyIdentifierExtension;
 
 /**
@@ -672,32 +670,16 @@
         currState.untrustedChecker.check(cert, Collections.<String>emptySet());
 
         /*
-         * check for looping - abort a loop if
-         * ((we encounter the same certificate twice) AND
-         * ((policyMappingInhibited = true) OR (no policy mapping
-         * extensions can be found between the occurrences of the same
-         * certificate)))
+         * check for looping - abort a loop if we encounter the same
+         * certificate twice
          */
         if (certPathList != null) {
-            boolean policyMappingFound = false;
             for (X509Certificate cpListCert : certPathList) {
-                X509CertImpl cpListCertImpl = X509CertImpl.toImpl(cpListCert);
-                PolicyMappingsExtension policyMappingsExt
-                    = cpListCertImpl.getPolicyMappingsExtension();
-                if (policyMappingsExt != null) {
-                    policyMappingFound = true;
-                }
-                if (debug != null) {
-                    debug.println("policyMappingFound = " + policyMappingFound);
-                }
                 if (cert.equals(cpListCert)) {
-                    if ((buildParams.policyMappingInhibited()) ||
-                        (!policyMappingFound)) {
-                        if (debug != null) {
-                            debug.println("loop detected!!");
-                        }
-                        throw new CertPathValidatorException("loop detected");
+                    if (debug != null) {
+                        debug.println("loop detected!!");
                     }
+                    throw new CertPathValidatorException("loop detected");
                 }
             }
         }
--- a/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java	Wed Jul 05 19:26:45 2017 +0200
@@ -427,9 +427,14 @@
         if (signerCert == null) {
             // Add the Issuing CA cert and/or Trusted Responder cert to the list
             // of certs from the OCSP response
-            certs.add((X509CertImpl) issuerCert);
-            if (responderCert != null) {
-                certs.add((X509CertImpl) responderCert);
+            try {
+                certs.add(X509CertImpl.toImpl(issuerCert));
+                if (responderCert != null) {
+                    certs.add(X509CertImpl.toImpl(responderCert));
+                }
+            } catch (CertificateException ce) {
+                throw new CertPathValidatorException(
+                    "Invalid issuer or trusted responder certificate", ce);
             }
 
             if (responderName != null) {
--- a/jdk/src/share/classes/sun/security/provider/certpath/RevocationChecker.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/provider/certpath/RevocationChecker.java	Wed Jul 05 19:26:45 2017 +0200
@@ -456,12 +456,13 @@
                            PublicKey pubKey, boolean signFlag)
         throws CertPathValidatorException
     {
-        checkCRLs(cert, pubKey, signFlag, true,
+        checkCRLs(cert, pubKey, null, signFlag, true,
                   stackedCerts, params.trustAnchors());
     }
 
     private void checkCRLs(X509Certificate cert, PublicKey prevKey,
-                           boolean signFlag, boolean allowSeparateKey,
+                           X509Certificate prevCert, boolean signFlag,
+                           boolean allowSeparateKey,
                            Set<X509Certificate> stackedCerts,
                            Set<TrustAnchor> anchors)
         throws CertPathValidatorException
@@ -543,7 +544,7 @@
             try {
                 if (crlDP) {
                     approvedCRLs.addAll(DistributionPointFetcher.getCRLs(
-                                        sel, signFlag, prevKey,
+                                        sel, signFlag, prevKey, prevCert,
                                         params.sigProvider(), certStores,
                                         reasonsMask, anchors, null));
                 }
@@ -825,7 +826,7 @@
                 for (X509CRL crl : crls) {
                     if (DistributionPointFetcher.verifyCRL(
                             certImpl, point, crl, reasonsMask, signFlag,
-                            prevKey, params.sigProvider(), anchors,
+                            prevKey, null, params.sigProvider(), anchors,
                             certStores, params.date()))
                     {
                         results.add(crl);
@@ -1043,7 +1044,7 @@
                                           + " index " + i + " checking "
                                           + cert);
                         }
-                        checkCRLs(cert, prevKey2, signFlag, true,
+                        checkCRLs(cert, prevKey2, null, signFlag, true,
                                   stackedCerts, newAnchors);
                         signFlag = certCanSignCrl(cert);
                         prevKey2 = cert.getPublicKey();
@@ -1058,13 +1059,14 @@
                     debug.println("RevocationChecker.buildToNewKey()" +
                                   " got key " + cpbr.getPublicKey());
                 }
-                // Now check revocation on the current cert using that key.
+                // Now check revocation on the current cert using that key and
+                // the corresponding certificate.
                 // If it doesn't check out, try to find a different key.
                 // And if we can't find a key, then return false.
                 PublicKey newKey = cpbr.getPublicKey();
                 try {
-                    checkCRLs(currCert, newKey, true, false, null,
-                              params.trustAnchors());
+                    checkCRLs(currCert, newKey, (X509Certificate) cpList.get(0),
+                              true, false, null, params.trustAnchors());
                     // If that passed, the cert is OK!
                     return;
                 } catch (CertPathValidatorException cpve) {
--- a/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java	Wed Jul 05 19:26:45 2017 +0200
@@ -30,6 +30,7 @@
 import java.security.InvalidAlgorithmParameterException;
 import java.security.PublicKey;
 import java.security.cert.*;
+import java.security.cert.CertPathValidatorException.BasicReason;
 import java.security.cert.PKIXReason;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -49,7 +50,7 @@
  * This class is able to build certification paths in either the forward
  * or reverse directions.
  *
- * <p> If successful, it returns a certification path which has succesfully
+ * <p> If successful, it returns a certification path which has successfully
  * satisfied all the constraints and requirements specified in the
  * PKIXBuilderParameters object and has been validated according to the PKIX
  * path validation algorithm defined in RFC 3280.
@@ -510,6 +511,12 @@
                                     debug.println
                                     ("SunCertPathBuilder.depthFirstSearchForward(): " +
                                     "final verification failed: " + cpve);
+                                // If the target cert itself is revoked, we
+                                // cannot trust it. We can bail out here.
+                                if (buildParams.targetCertConstraints().match(currCert)
+                                        && cpve.getReason() == BasicReason.REVOKED) {
+                                    throw cpve;
+                                }
                                 vertex.setThrowable(cpve);
                                 continue vertices;
                             }
--- a/jdk/src/share/classes/sun/security/provider/certpath/ldap/LDAPCertStore.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/provider/certpath/ldap/LDAPCertStore.java	Wed Jul 05 19:26:45 2017 +0200
@@ -50,6 +50,7 @@
 import sun.security.util.Cache;
 import sun.security.util.Debug;
 import sun.security.x509.X500Name;
+import sun.security.action.GetBooleanAction;
 import sun.security.action.GetPropertyAction;
 
 /**
@@ -135,6 +136,14 @@
     private final static String PROP_LIFETIME =
                             "sun.security.certpath.ldap.cache.lifetime";
 
+    /*
+     * Internal system property, that when set to "true", disables the
+     * JNDI application resource files lookup to prevent recursion issues
+     * when validating signed JARs with LDAP URLs in certificates.
+     */
+    private final static String PROP_DISABLE_APP_RESOURCE_FILES =
+        "sun.security.certpath.ldap.disable.app.resource.files";
+
     static {
         String s = AccessController.doPrivileged(
                                 new GetPropertyAction(PROP_LIFETIME));
@@ -237,6 +246,17 @@
         env.put(Context.INITIAL_CONTEXT_FACTORY,
                 "com.sun.jndi.ldap.LdapCtxFactory");
         env.put(Context.PROVIDER_URL, url);
+
+        // If property is set to true, disable application resource file lookup.
+        boolean disableAppResourceFiles = AccessController.doPrivileged(
+            new GetBooleanAction(PROP_DISABLE_APP_RESOURCE_FILES));
+        if (disableAppResourceFiles) {
+            if (debug != null) {
+                debug.println("LDAPCertStore disabling app resource files");
+            }
+            env.put("com.sun.naming.disable.app.resource.files", "true");
+        }
+
         try {
             ctx = new InitialDirContext(env);
             /*
--- a/jdk/src/share/classes/sun/security/rsa/SunRsaSign.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/rsa/SunRsaSign.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -43,7 +43,7 @@
     private static final long serialVersionUID = 866040293550393045L;
 
     public SunRsaSign() {
-        super("SunRsaSign", 1.8d, "Sun RSA signature provider");
+        super("SunRsaSign", 1.9d, "Sun RSA signature provider");
 
         // if there is no security manager installed, put directly into
         // the provider. Otherwise, create a temporary map and use a
--- a/jdk/src/share/classes/sun/security/smartcardio/SunPCSC.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/smartcardio/SunPCSC.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -40,7 +40,7 @@
     private static final long serialVersionUID = 6168388284028876579L;
 
     public SunPCSC() {
-        super("SunPCSC", 1.8d, "Sun PC/SC provider");
+        super("SunPCSC", 1.9d, "Sun PC/SC provider");
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
             public Void run() {
                 put("TerminalFactory.PC/SC", "sun.security.smartcardio.SunPCSC$Factory");
--- a/jdk/src/share/classes/sun/security/ssl/JsseJce.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/ssl/JsseJce.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -110,7 +110,7 @@
         private static final long serialVersionUID = -3284138292032213752L;
 
         SunCertificates(final Provider p) {
-            super("SunCertificates", 1.8d, "SunJSSE internal");
+            super("SunCertificates", 1.9d, "SunJSSE internal");
             AccessController.doPrivileged(new PrivilegedAction<Object>() {
                 @Override
                 public Object run() {
--- a/jdk/src/share/classes/sun/security/ssl/ProtocolVersion.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/ssl/ProtocolVersion.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -80,8 +80,8 @@
     // maximum version we implement (TLS 1.2)
     final static ProtocolVersion MAX = TLS12;
 
-    // ProtocolVersion to use by default (TLS 1.0)
-    final static ProtocolVersion DEFAULT = TLS10;
+    // ProtocolVersion to use by default (TLS 1.2)
+    final static ProtocolVersion DEFAULT = TLS12;
 
     // Default version for hello messages (SSLv2Hello)
     final static ProtocolVersion DEFAULT_HELLO = FIPS ? TLS10 : SSL30;
--- a/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -36,6 +36,7 @@
 import javax.net.ssl.*;
 
 import sun.security.provider.certpath.AlgorithmChecker;
+import sun.security.action.GetPropertyAction;
 
 public abstract class SSLContextImpl extends SSLContextSpi {
 
@@ -421,22 +422,21 @@
      */
 
     /*
-     * The conservative SSLContext implementation for TLS, SSL, SSLv3 and
-     * TLS10 algorithm.
+     * The base abstract SSLContext implementation.
      *
-     * This is a super class of DefaultSSLContext and TLS10Context.
+     * This abstract class encapsulates supported and the default server
+     * SSL parameters.
      *
      * @see SSLContext
      */
-    private static class ConservativeSSLContext extends SSLContextImpl {
+    private abstract static class AbstractSSLContext extends SSLContextImpl {
         // parameters
-        private static SSLParameters defaultServerSSLParams;
-        private static SSLParameters defaultClientSSLParams;
-        private static SSLParameters supportedSSLParams;
+        private final static SSLParameters defaultServerSSLParams;
+        private final static SSLParameters supportedSSLParams;
 
         static {
+            supportedSSLParams = new SSLParameters();
             if (SunJSSE.isFIPS()) {
-                supportedSSLParams = new SSLParameters();
                 supportedSSLParams.setProtocols(new String[] {
                     ProtocolVersion.TLS10.name,
                     ProtocolVersion.TLS11.name,
@@ -444,14 +444,7 @@
                 });
 
                 defaultServerSSLParams = supportedSSLParams;
-
-                defaultClientSSLParams = new SSLParameters();
-                defaultClientSSLParams.setProtocols(new String[] {
-                    ProtocolVersion.TLS10.name
-                });
-
             } else {
-                supportedSSLParams = new SSLParameters();
                 supportedSSLParams.setProtocols(new String[] {
                     ProtocolVersion.SSL20Hello.name,
                     ProtocolVersion.SSL30.name,
@@ -461,12 +454,6 @@
                 });
 
                 defaultServerSSLParams = supportedSSLParams;
-
-                defaultClientSSLParams = new SSLParameters();
-                defaultClientSSLParams.setProtocols(new String[] {
-                    ProtocolVersion.SSL30.name,
-                    ProtocolVersion.TLS10.name
-                });
             }
         }
 
@@ -476,22 +463,205 @@
         }
 
         @Override
-        SSLParameters getDefaultClientSSLParams() {
-            return defaultClientSSLParams;
-        }
-
-        @Override
         SSLParameters getSupportedSSLParams() {
             return supportedSSLParams;
         }
     }
 
     /*
-     * The SSLContext implementation for default algorithm
+     * The SSLContext implementation for SSLv3 and TLS10 algorithm
+     *
+     * @see SSLContext
+     */
+    public static final class TLS10Context extends AbstractSSLContext {
+        private final static SSLParameters defaultClientSSLParams;
+
+        static {
+            defaultClientSSLParams = new SSLParameters();
+            if (SunJSSE.isFIPS()) {
+                defaultClientSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.TLS10.name
+                });
+
+            } else {
+                defaultClientSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.SSL30.name,
+                    ProtocolVersion.TLS10.name
+                });
+            }
+        }
+
+        @Override
+        SSLParameters getDefaultClientSSLParams() {
+            return defaultClientSSLParams;
+        }
+    }
+
+    /*
+     * The SSLContext implementation for TLS11 algorithm
+     *
+     * @see SSLContext
+     */
+    public static final class TLS11Context extends AbstractSSLContext {
+        private final static SSLParameters defaultClientSSLParams;
+
+        static {
+            defaultClientSSLParams = new SSLParameters();
+            if (SunJSSE.isFIPS()) {
+                defaultClientSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name
+                });
+
+            } else {
+                defaultClientSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.SSL30.name,
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name
+                });
+            }
+        }
+
+        @Override
+        SSLParameters getDefaultClientSSLParams() {
+            return defaultClientSSLParams;
+        }
+    }
+
+    /*
+     * The SSLContext implementation for TLS12 algorithm
+     *
+     * @see SSLContext
+     */
+    public static final class TLS12Context extends AbstractSSLContext {
+        private final static SSLParameters defaultClientSSLParams;
+
+        static {
+            defaultClientSSLParams = new SSLParameters();
+            if (SunJSSE.isFIPS()) {
+                defaultClientSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name,
+                    ProtocolVersion.TLS12.name
+                });
+
+            } else {
+                defaultClientSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.SSL30.name,
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name,
+                    ProtocolVersion.TLS12.name
+                });
+            }
+        }
+
+        @Override
+        SSLParameters getDefaultClientSSLParams() {
+            return defaultClientSSLParams;
+        }
+    }
+
+    /*
+     * The SSLContext implementation for customized TLS protocols
      *
      * @see SSLContext
      */
-    public static final class DefaultSSLContext extends ConservativeSSLContext {
+    private static class CustomizedSSLContext extends AbstractSSLContext {
+        private final static String PROPERTY_NAME = "jdk.tls.client.protocols";
+        private final static SSLParameters defaultClientSSLParams;
+        private static IllegalArgumentException reservedException = null;
+
+        // Don't want a java.lang.LinkageError for illegal system property.
+        //
+        // Please don't throw exception in this static block.  Otherwise,
+        // java.lang.LinkageError may be thrown during the instantiation of
+        // the provider service. Instead, let's handle the initialization
+        // exception in constructor.
+        static {
+            String property = AccessController.doPrivileged(
+                    new GetPropertyAction(PROPERTY_NAME));
+            defaultClientSSLParams = new SSLParameters();
+            if (property == null || property.length() == 0) {
+                // the default enabled client TLS protocols
+                if (SunJSSE.isFIPS()) {
+                    defaultClientSSLParams.setProtocols(new String[] {
+                        ProtocolVersion.TLS10.name,
+                        ProtocolVersion.TLS11.name,
+                        ProtocolVersion.TLS12.name
+                    });
+
+                } else {
+                    defaultClientSSLParams.setProtocols(new String[] {
+                        ProtocolVersion.SSL30.name,
+                        ProtocolVersion.TLS10.name,
+                        ProtocolVersion.TLS11.name,
+                        ProtocolVersion.TLS12.name
+                    });
+                }
+            } else {
+                // remove double quote marks from beginning/end of the property
+                if (property.charAt(0) == '"' &&
+                        property.charAt(property.length() - 1) == '"') {
+                    property = property.substring(1, property.length() - 1);
+                }
+
+                String[] protocols = property.split(",");
+                for (int i = 0; i < protocols.length; i++) {
+                    protocols[i] = protocols[i].trim();
+                    // Is it a supported protocol name?
+                    try {
+                        ProtocolVersion.valueOf(protocols[i]);
+                    } catch (IllegalArgumentException iae) {
+                        reservedException = new IllegalArgumentException(
+                                PROPERTY_NAME + ": " + protocols[i] +
+                                " is not a standard SSL protocol name", iae);
+                    }
+                }
+
+                if ((reservedException == null) && SunJSSE.isFIPS()) {
+                    for (String protocol : protocols) {
+                        if (ProtocolVersion.SSL20Hello.name.equals(protocol) ||
+                                ProtocolVersion.SSL30.name.equals(protocol)) {
+                            reservedException = new IllegalArgumentException(
+                                    PROPERTY_NAME + ": " + protocol +
+                                    " is not FIPS compliant");
+                        }
+                    }
+                }
+
+                if (reservedException == null) {
+                    defaultClientSSLParams.setProtocols(protocols);
+               }
+            }
+        }
+
+        protected CustomizedSSLContext() {
+            if (reservedException != null) {
+                throw reservedException;
+            }
+        }
+
+        @Override
+        SSLParameters getDefaultClientSSLParams() {
+            return defaultClientSSLParams;
+        }
+    }
+
+    /*
+     * The SSLContext implementation for default "TLS" algorithm
+     *
+     * @see SSLContext
+     */
+    public static final class TLSContext extends CustomizedSSLContext {
+        // use the default constructor and methods
+    }
+
+    /*
+     * The SSLContext implementation for default "Default" algorithm
+     *
+     * @see SSLContext
+     */
+    public static final class DefaultSSLContext extends CustomizedSSLContext {
         private static final String NONE = "NONE";
         private static final String P11KEYSTORE = "PKCS11";
 
@@ -652,147 +822,6 @@
         }
     }
 
-    /*
-     * The SSLContext implementation for TLS, SSL, SSLv3 and TLS10 algorithm
-     *
-     * @see SSLContext
-     */
-    public static final class TLS10Context extends ConservativeSSLContext {
-        // use the default constructor and methods
-    }
-
-    /*
-     * The SSLContext implementation for TLS11 algorithm
-     *
-     * @see SSLContext
-     */
-    public static final class TLS11Context extends SSLContextImpl {
-        // parameters
-        private static SSLParameters defaultServerSSLParams;
-        private static SSLParameters defaultClientSSLParams;
-        private static SSLParameters supportedSSLParams;
-
-        static {
-            if (SunJSSE.isFIPS()) {
-                supportedSSLParams = new SSLParameters();
-                supportedSSLParams.setProtocols(new String[] {
-                    ProtocolVersion.TLS10.name,
-                    ProtocolVersion.TLS11.name,
-                    ProtocolVersion.TLS12.name
-                });
-
-                defaultServerSSLParams = supportedSSLParams;
-
-                defaultClientSSLParams = new SSLParameters();
-                defaultClientSSLParams.setProtocols(new String[] {
-                    ProtocolVersion.TLS10.name,
-                    ProtocolVersion.TLS11.name
-                });
-
-            } else {
-                supportedSSLParams = new SSLParameters();
-                supportedSSLParams.setProtocols(new String[] {
-                    ProtocolVersion.SSL20Hello.name,
-                    ProtocolVersion.SSL30.name,
-                    ProtocolVersion.TLS10.name,
-                    ProtocolVersion.TLS11.name,
-                    ProtocolVersion.TLS12.name
-                });
-
-                defaultServerSSLParams = supportedSSLParams;
-
-                defaultClientSSLParams = new SSLParameters();
-                defaultClientSSLParams.setProtocols(new String[] {
-                    ProtocolVersion.SSL30.name,
-                    ProtocolVersion.TLS10.name,
-                    ProtocolVersion.TLS11.name
-                });
-            }
-        }
-
-        @Override
-        SSLParameters getDefaultServerSSLParams() {
-            return defaultServerSSLParams;
-        }
-
-        @Override
-        SSLParameters getDefaultClientSSLParams() {
-            return defaultClientSSLParams;
-        }
-
-        @Override
-        SSLParameters getSupportedSSLParams() {
-            return supportedSSLParams;
-        }
-    }
-
-    /*
-     * The SSLContext implementation for TLS12 algorithm
-     *
-     * @see SSLContext
-     */
-    public static final class TLS12Context extends SSLContextImpl {
-        // parameters
-        private static SSLParameters defaultServerSSLParams;
-        private static SSLParameters defaultClientSSLParams;
-        private static SSLParameters supportedSSLParams;
-
-        static {
-            if (SunJSSE.isFIPS()) {
-                supportedSSLParams = new SSLParameters();
-                supportedSSLParams.setProtocols(new String[] {
-                    ProtocolVersion.TLS10.name,
-                    ProtocolVersion.TLS11.name,
-                    ProtocolVersion.TLS12.name
-                });
-
-                defaultServerSSLParams = supportedSSLParams;
-
-                defaultClientSSLParams = new SSLParameters();
-                defaultClientSSLParams.setProtocols(new String[] {
-                    ProtocolVersion.TLS10.name,
-                    ProtocolVersion.TLS11.name,
-                    ProtocolVersion.TLS12.name
-                });
-
-            } else {
-                supportedSSLParams = new SSLParameters();
-                supportedSSLParams.setProtocols(new String[] {
-                    ProtocolVersion.SSL20Hello.name,
-                    ProtocolVersion.SSL30.name,
-                    ProtocolVersion.TLS10.name,
-                    ProtocolVersion.TLS11.name,
-                    ProtocolVersion.TLS12.name
-                });
-
-                defaultServerSSLParams = supportedSSLParams;
-
-                defaultClientSSLParams = new SSLParameters();
-                defaultClientSSLParams.setProtocols(new String[] {
-                    ProtocolVersion.SSL30.name,
-                    ProtocolVersion.TLS10.name,
-                    ProtocolVersion.TLS11.name,
-                    ProtocolVersion.TLS12.name
-                });
-            }
-        }
-
-        @Override
-        SSLParameters getDefaultServerSSLParams() {
-            return defaultServerSSLParams;
-        }
-
-        @Override
-        SSLParameters getDefaultClientSSLParams() {
-            return defaultClientSSLParams;
-        }
-
-        @Override
-        SSLParameters getSupportedSSLParams() {
-            return supportedSSLParams;
-        }
-    }
-
 }
 
 
--- a/jdk/src/share/classes/sun/security/ssl/SunJSSE.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/ssl/SunJSSE.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -60,7 +60,8 @@
     private static final long serialVersionUID = 3231825739635378733L;
 
     private static String info = "Sun JSSE provider" +
-        "(PKCS12, SunX509 key/trust factories, SSLv3, TLSv1)";
+        "(PKCS12, SunX509/PKIX key/trust factories, " +
+        "SSLv3/TLSv1/TLSv1.1/TLSv1.2)";
 
     private static String fipsInfo =
         "Sun JSSE provider (FIPS mode, crypto provider ";
@@ -103,7 +104,7 @@
 
     // standard constructor
     protected SunJSSE() {
-        super("SunJSSE", 1.8d, info);
+        super("SunJSSE", 1.9d, info);
         subclassCheck();
         if (Boolean.TRUE.equals(fips)) {
             throw new ProviderException
@@ -131,7 +132,7 @@
 
     private SunJSSE(java.security.Provider cryptoProvider,
             String providerName) {
-        super("SunJSSE", 1.8d, fipsInfo + providerName + ")");
+        super("SunJSSE", 1.9d, fipsInfo + providerName + ")");
         subclassCheck();
         if (cryptoProvider == null) {
             // Calling Security.getProvider() will cause other providers to be
@@ -208,16 +209,17 @@
 
         put("SSLContext.TLSv1",
             "sun.security.ssl.SSLContextImpl$TLS10Context");
-        put("Alg.Alias.SSLContext.TLS", "TLSv1");
-        if (isfips == false) {
-            put("Alg.Alias.SSLContext.SSL", "TLSv1");
-            put("Alg.Alias.SSLContext.SSLv3", "TLSv1");
-        }
-
         put("SSLContext.TLSv1.1",
             "sun.security.ssl.SSLContextImpl$TLS11Context");
         put("SSLContext.TLSv1.2",
             "sun.security.ssl.SSLContextImpl$TLS12Context");
+        put("SSLContext.TLS",
+            "sun.security.ssl.SSLContextImpl$TLSContext");
+        if (isfips == false) {
+            put("Alg.Alias.SSLContext.SSL", "TLS");
+            put("Alg.Alias.SSLContext.SSLv3", "TLSv1");
+        }
+
         put("SSLContext.Default",
             "sun.security.ssl.SSLContextImpl$DefaultSSLContext");
 
--- a/jdk/src/share/classes/sun/security/tools/policytool/PolicyTool.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/tools/policytool/PolicyTool.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -1056,7 +1056,7 @@
     public static final int MW_POLICY_LIST              = 3; // follows MW_PANEL
 
     /* The preferred height of JTextField should match JComboBox. */
-    static final int TEXTFIELD_HEIGHT = new JComboBox().getPreferredSize().height;
+    static final int TEXTFIELD_HEIGHT = new JComboBox<>().getPreferredSize().height;
 
     private PolicyTool tool;
 
@@ -1169,8 +1169,8 @@
             tool.openPolicy(policyFile);
 
             // display the policy entries via the policy list textarea
-            DefaultListModel listModel = new DefaultListModel();
-            JList list = new JList(listModel);
+            DefaultListModel<String> listModel = new DefaultListModel<>();
+            JList<String> list = new JList<>(listModel);
             list.setVisibleRowCount(15);
             list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
             list.addMouseListener(new PolicyListListener(tool, this));
@@ -1187,7 +1187,7 @@
 
         } catch (FileNotFoundException fnfe) {
             // add blank policy listing
-            JList list = new JList(new DefaultListModel());
+            JList<String> list = new JList<>(new DefaultListModel<>());
             list.setVisibleRowCount(15);
             list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
             list.addMouseListener(new PolicyListListener(tool, this));
@@ -1200,7 +1200,7 @@
 
         } catch (Exception e) {
             // add blank policy listing
-            JList list = new JList(new DefaultListModel());
+            JList<String> list = new JList<>(new DefaultListModel<>());
             list.setVisibleRowCount(15);
             list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
             list.addMouseListener(new PolicyListListener(tool, this));
@@ -1316,7 +1316,7 @@
      * Init the policy_entry_list TEXTAREA component in the
      * PolicyTool window
      */
-    void initPolicyList(JList policyList) {
+    void initPolicyList(JList<String> policyList) {
 
         // add the policy list to the window
         //policyList.setPreferredSize(new Dimension(500, 350));
@@ -1329,11 +1329,12 @@
      * Replace the policy_entry_list TEXTAREA component in the
      * PolicyTool window with an updated one.
      */
-    void replacePolicyList(JList policyList) {
+    void replacePolicyList(JList<String> policyList) {
 
         // remove the original list of Policy Entries
         // and add the new list of entries
-        JList list = (JList)getComponent(MW_POLICY_LIST);
+        @SuppressWarnings("unchecked")
+        JList<String> list = (JList<String>)getComponent(MW_POLICY_LIST);
         list.setModel(policyList.getModel());
     }
 
@@ -1668,7 +1669,7 @@
     private static final int PRINCIPAL_NAME             = 5;
 
     /* The preferred height of JTextField should match JComboBox. */
-    static final int TEXTFIELD_HEIGHT = new JComboBox().getPreferredSize().height;
+    static final int TEXTFIELD_HEIGHT = new JComboBox<>().getPreferredSize().height;
 
     public static java.util.ArrayList<Perm> PERM_ARRAY;
     public static java.util.ArrayList<Prin> PRIN_ARRAY;
@@ -1811,7 +1812,8 @@
         if (edit) {
             // get the selected item
             entries = tool.getEntry();
-            JList policyList = (JList)tw.getComponent(ToolWindow.MW_POLICY_LIST);
+            @SuppressWarnings("unchecked")
+            JList<String> policyList = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
             listIndex = policyList.getSelectedIndex();
 
             // get principal list
@@ -2155,7 +2157,7 @@
                            ToolWindow.TOP_BOTTOM_PADDING);
 
         // principal choice
-        JComboBox choice = new JComboBox();
+        JComboBox<String> choice = new JComboBox<>();
         choice.addItem(PRIN_TYPE);
         choice.getAccessibleContext().setAccessibleName(PRIN_TYPE);
         for (int i = 0; i < PRIN_ARRAY.size(); i++) {
@@ -2271,7 +2273,7 @@
                            ToolWindow.TOP_BOTTOM_PADDING);
 
         // permission choice (added in alphabetical order)
-        JComboBox choice = new JComboBox();
+        JComboBox<String> choice = new JComboBox<>();
         choice.addItem(PERM);
         choice.getAccessibleContext().setAccessibleName(PERM);
         for (int i = 0; i < PERM_ARRAY.size(); i++) {
@@ -2299,7 +2301,7 @@
         choice.addItemListener(new PermissionMenuListener(newTD));
 
         // name label and textfield
-        choice = new JComboBox();
+        choice = new JComboBox<>();
         choice.addItem(PERM_NAME);
         choice.getAccessibleContext().setAccessibleName(PERM_NAME);
         tf = (edit ? new JTextField(editMe.name, 40) : new JTextField(40));
@@ -2317,7 +2319,7 @@
         choice.addItemListener(new PermissionNameMenuListener(newTD));
 
         // actions label and textfield
-        choice = new JComboBox();
+        choice = new JComboBox<>();
         choice.addItem(PERM_ACTIONS);
         choice.getAccessibleContext().setAccessibleName(PERM_ACTIONS);
         tf = (edit ? new JTextField(editMe.action, 40) : new JTextField(40));
@@ -2514,7 +2516,8 @@
     void displayConfirmRemovePolicyEntry() {
 
         // find the entry to be removed
-        JList list = (JList)tw.getComponent(ToolWindow.MW_POLICY_LIST);
+        @SuppressWarnings("unchecked")
+        JList<String> list = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
         int index = list.getSelectedIndex();
         PolicyEntry entries[] = tool.getEntry();
 
@@ -2734,7 +2737,7 @@
             }
 
             // display the policy entries via the policy list textarea
-            JList list = new JList(new DefaultListModel());
+            JList<String> list = new JList<>(new DefaultListModel<>());
             list.setVisibleRowCount(15);
             list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
             list.addMouseListener(new PolicyListListener(tool, tw));
@@ -2772,8 +2775,8 @@
                 tool.openPolicy(policyFile);
 
                 // display the policy entries via the policy list textarea
-                DefaultListModel listModel = new DefaultListModel();
-                list = new JList(listModel);
+                DefaultListModel<String> listModel = new DefaultListModel<>();
+                list = new JList<>(listModel);
                 list.setVisibleRowCount(15);
                 list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                 list.addMouseListener(new PolicyListListener(tool, tw));
@@ -2800,7 +2803,7 @@
 
             } catch (Exception e) {
                 // add blank policy listing
-                list = new JList(new DefaultListModel());
+                list = new JList<>(new DefaultListModel<>());
                 list.setVisibleRowCount(15);
                 list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                 list.addMouseListener(new PolicyListListener(tool, tw));
@@ -2835,7 +2838,7 @@
      * (user must enter them by hand) then the TARGETS array may be empty
      * (and of course non-null).
      */
-    void setPermissionNames(Perm inputPerm, JComboBox names, JTextField field) {
+    void setPermissionNames(Perm inputPerm, JComboBox<String> names, JTextField field) {
         names.removeAllItems();
         names.addItem(PERM_NAME);
 
@@ -2865,7 +2868,7 @@
      * (user must enter them by hand) then the ACTIONS array may be empty
      * (and of course non-null).
      */
-    void setPermissionActions(Perm inputPerm, JComboBox actions, JTextField field) {
+    void setPermissionActions(Perm inputPerm, JComboBox<String> actions, JTextField field) {
         actions.removeAllItems();
         actions.addItem(PERM_ACTIONS);
 
@@ -3104,7 +3107,8 @@
                                ToolWindow.REMOVE_POLICY_ENTRY) == 0) {
 
             // get the selected entry
-            JList list = (JList)tw.getComponent(ToolWindow.MW_POLICY_LIST);
+            @SuppressWarnings("unchecked")
+            JList<String> list = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
             int index = list.getSelectedIndex();
             if (index < 0) {
                 tw.displayErrorDialog(null, new Exception
@@ -3121,7 +3125,8 @@
                                  ToolWindow.EDIT_POLICY_ENTRY) == 0) {
 
             // get the selected entry
-            JList list = (JList)tw.getComponent(ToolWindow.MW_POLICY_LIST);
+            @SuppressWarnings("unchecked")
+            JList<String> list = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
             int index = list.getSelectedIndex();
             if (index < 0) {
                 tw.displayErrorDialog(null, new Exception
@@ -3192,7 +3197,8 @@
             }
 
             // add the entry
-            JList policyList = (JList)tw.getComponent(ToolWindow.MW_POLICY_LIST);
+            @SuppressWarnings("unchecked")
+            JList<String> policyList = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
             if (edit) {
                 int listIndex = policyList.getSelectedIndex();
                 tool.addEntry(newEntry, listIndex);
@@ -3200,10 +3206,10 @@
                 if (PolicyTool.collator.compare
                         (newCodeBaseStr, policyList.getModel().getElementAt(listIndex)) != 0)
                     tool.modified = true;
-                ((DefaultListModel)policyList.getModel()).set(listIndex, newCodeBaseStr);
+                ((DefaultListModel<String>)policyList.getModel()).set(listIndex, newCodeBaseStr);
             } else {
                 tool.addEntry(newEntry, -1);
-                ((DefaultListModel)policyList.getModel()).addElement(newEntry.headerToString());
+                ((DefaultListModel<String>)policyList.getModel()).addElement(newEntry.headerToString());
                 tool.modified = true;
             }
             td.setVisible(false);
@@ -3581,7 +3587,8 @@
     public void actionPerformed(ActionEvent e) {
 
         // get the Permission selected from the Permission List
-        JList list = (JList)td.getComponent(ToolDialog.PE_PERM_LIST);
+        @SuppressWarnings("unchecked")
+        JList<String> list = (JList<String>)td.getComponent(ToolDialog.PE_PERM_LIST);
         int permIndex = list.getSelectedIndex();
 
         if (permIndex < 0) {
@@ -3616,7 +3623,8 @@
             return;
         }
 
-        JComboBox prin = (JComboBox)td.getComponent(ToolDialog.PRD_PRIN_CHOICE);
+        @SuppressWarnings("unchecked")
+        JComboBox<String> prin = (JComboBox<String>)td.getComponent(ToolDialog.PRD_PRIN_CHOICE);
         JTextField prinField = (JTextField)td.getComponent(
                 ToolDialog.PRD_PRIN_TEXTFIELD);
         JTextField nameField = (JTextField)td.getComponent(
@@ -3666,11 +3674,14 @@
             return;
         }
 
-        JComboBox perms = (JComboBox)td.getComponent(
+        @SuppressWarnings("unchecked")
+        JComboBox<String> perms = (JComboBox<String>)td.getComponent(
                 ToolDialog.PD_PERM_CHOICE);
-        JComboBox names = (JComboBox)td.getComponent(
+        @SuppressWarnings("unchecked")
+        JComboBox<String> names = (JComboBox<String>)td.getComponent(
                 ToolDialog.PD_NAME_CHOICE);
-        JComboBox actions = (JComboBox)td.getComponent(
+        @SuppressWarnings("unchecked")
+        JComboBox<String> actions = (JComboBox<String>)td.getComponent(
                 ToolDialog.PD_ACTIONS_CHOICE);
         JTextField nameField = (JTextField)td.getComponent(
                 ToolDialog.PD_NAME_TEXTFIELD);
@@ -3737,7 +3748,8 @@
             return;
         }
 
-        JComboBox names = (JComboBox)td.getComponent(ToolDialog.PD_NAME_CHOICE);
+        @SuppressWarnings("unchecked")
+        JComboBox<String> names = (JComboBox<String>)td.getComponent(ToolDialog.PD_NAME_CHOICE);
         names.getAccessibleContext().setAccessibleName(
             PolicyTool.splitToWords((String)e.getItem()));
 
@@ -3766,7 +3778,8 @@
             return;
         }
 
-        JComboBox actions = (JComboBox)td.getComponent(
+        @SuppressWarnings("unchecked")
+        JComboBox<String> actions = (JComboBox<String>)td.getComponent(
                 ToolDialog.PD_ACTIONS_CHOICE);
         actions.getAccessibleContext().setAccessibleName((String)e.getItem());
 
@@ -3991,14 +4004,15 @@
 
     public void actionPerformed(ActionEvent e) {
         // remove the entry
-        JList list = (JList)tw.getComponent(ToolWindow.MW_POLICY_LIST);
+        @SuppressWarnings("unchecked")
+        JList<String> list = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
         int index = list.getSelectedIndex();
         PolicyEntry entries[] = tool.getEntry();
         tool.removeEntry(entries[index]);
 
         // redraw the window listing
-        DefaultListModel listModel = new DefaultListModel();
-        list = new JList(listModel);
+        DefaultListModel<String> listModel = new DefaultListModel<>();
+        list = new JList<>(listModel);
         list.setVisibleRowCount(15);
         list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
         list.addMouseListener(new PolicyListListener(tool, tw));
@@ -4025,12 +4039,12 @@
 /**
  * This is a java.awt.List that bind an Object to each String it holds.
  */
-class TaggedList extends JList {
+class TaggedList extends JList<String> {
     private static final long serialVersionUID = -5676238110427785853L;
 
     private java.util.List<Object> data = new LinkedList<>();
     public TaggedList(int i, boolean b) {
-        super(new DefaultListModel());
+        super(new DefaultListModel<>());
         setVisibleRowCount(i);
         setSelectionMode(b ? ListSelectionModel.MULTIPLE_INTERVAL_SELECTION : ListSelectionModel.SINGLE_SELECTION);
     }
@@ -4040,17 +4054,17 @@
     }
 
     public void addTaggedItem(String string, Object object) {
-        ((DefaultListModel)getModel()).addElement(string);
+        ((DefaultListModel<String>)getModel()).addElement(string);
         data.add(object);
     }
 
     public void replaceTaggedItem(String string, Object object, int index) {
-        ((DefaultListModel)getModel()).set(index, string);
+        ((DefaultListModel<String>)getModel()).set(index, string);
         data.set(index, object);
     }
 
     public void removeTaggedItem(int index) {
-        ((DefaultListModel)getModel()).remove(index);
+        ((DefaultListModel<String>)getModel()).remove(index);
         data.remove(index);
     }
 }
--- a/jdk/src/share/classes/sun/security/util/SecurityConstants.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/util/SecurityConstants.java	Wed Jul 05 19:26:45 2017 +0200
@@ -70,84 +70,6 @@
     // sun.security.provider.PolicyFile
     public static final AllPermission ALL_PERMISSION = new AllPermission();
 
-    /**
-     * AWT Permissions used in the JDK.
-     */
-    public static class AWT {
-        private AWT() { }
-
-        /**
-         * The class name of the factory to create java.awt.AWTPermission objects.
-         */
-        private static final String AWTFactory = "sun.awt.AWTPermissionFactory";
-
-        /**
-         * The PermissionFactory to create AWT permissions (or null if AWT is
-         * not present)
-         */
-        private static final PermissionFactory<?> factory = permissionFactory();
-
-        private static PermissionFactory<?> permissionFactory() {
-            Class<?> c;
-            try {
-                c = Class.forName(AWTFactory, false, AWT.class.getClassLoader());
-            } catch (ClassNotFoundException e) {
-                // not available
-                return null;
-            }
-            // AWT present
-            try {
-                return (PermissionFactory<?>)c.newInstance();
-            } catch (ReflectiveOperationException x) {
-                throw new InternalError(x);
-            }
-        }
-
-        private static Permission newAWTPermission(String name) {
-            return (factory == null) ? null : factory.newPermission(name);
-        }
-
-        // java.lang.SecurityManager
-        public static final Permission TOPLEVEL_WINDOW_PERMISSION =
-            newAWTPermission("showWindowWithoutWarningBanner");
-
-        // java.lang.SecurityManager
-        public static final Permission ACCESS_CLIPBOARD_PERMISSION =
-            newAWTPermission("accessClipboard");
-
-        // java.lang.SecurityManager
-        public static final Permission CHECK_AWT_EVENTQUEUE_PERMISSION =
-            newAWTPermission("accessEventQueue");
-
-        // java.awt.Dialog
-        public static final Permission TOOLKIT_MODALITY_PERMISSION =
-            newAWTPermission("toolkitModality");
-
-        // java.awt.Robot
-        public static final Permission READ_DISPLAY_PIXELS_PERMISSION =
-            newAWTPermission("readDisplayPixels");
-
-        // java.awt.Robot
-        public static final Permission CREATE_ROBOT_PERMISSION =
-            newAWTPermission("createRobot");
-
-        // java.awt.MouseInfo
-        public static final Permission WATCH_MOUSE_PERMISSION =
-            newAWTPermission("watchMousePointer");
-
-        // java.awt.Window
-        public static final Permission SET_WINDOW_ALWAYS_ON_TOP_PERMISSION =
-            newAWTPermission("setWindowAlwaysOnTop");
-
-        // java.awt.Toolkit
-        public static final Permission ALL_AWT_EVENTS_PERMISSION =
-            newAWTPermission("listenToAllAWTEvents");
-
-        // java.awt.SystemTray
-        public static final Permission ACCESS_SYSTEM_TRAY_PERMISSION =
-            newAWTPermission("accessSystemTray");
-    }
-
     // java.net.URL
     public static final NetPermission SPECIFY_HANDLER_PERMISSION =
        new NetPermission("specifyStreamHandler");
--- a/jdk/src/share/classes/sun/security/x509/CRLExtensions.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/x509/CRLExtensions.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -106,7 +106,7 @@
         }
     }
 
-    private static final Class[] PARAMS = {Boolean.class, Object.class};
+    private static final Class<?>[] PARAMS = {Boolean.class, Object.class};
 
     // Parse the encoded extension
     private void parseExtension(Extension ext) throws CRLException {
--- a/jdk/src/share/classes/sun/security/x509/CertificateExtensions.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/x509/CertificateExtensions.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -89,7 +89,7 @@
         }
     }
 
-    private static Class[] PARAMS = {Boolean.class, Object.class};
+    private static Class<?>[] PARAMS = {Boolean.class, Object.class};
 
     // Parse the encoded extension
     private void parseExtension(Extension ext) throws IOException {
--- a/jdk/src/share/classes/sun/security/x509/X509CertImpl.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/security/x509/X509CertImpl.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1115,8 +1115,7 @@
         SubjectKeyIdentifierExtension ski = getSubjectKeyIdentifierExtension();
         if (ski != null) {
             try {
-                return (KeyIdentifier)ski.get(
-                    SubjectKeyIdentifierExtension.KEY_ID);
+                return ski.get(SubjectKeyIdentifierExtension.KEY_ID);
             } catch (IOException ioe) {} // not possible
         }
         return null;
--- a/jdk/src/share/classes/sun/swing/SwingUtilities2.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/swing/SwingUtilities2.java	Wed Jul 05 19:26:45 2017 +0200
@@ -53,7 +53,6 @@
 import sun.print.ProxyPrintGraphics;
 import sun.awt.*;
 import sun.security.action.GetPropertyAction;
-import sun.security.util.SecurityConstants;
 import java.io.*;
 import java.util.*;
 import sun.font.FontDesignMetrics;
@@ -1232,7 +1231,7 @@
                canAccess = true;
            } else {
                try {
-                   sm.checkPermission(SecurityConstants.AWT.ACCESS_CLIPBOARD_PERMISSION);
+                   sm.checkPermission(AWTPermissions.ACCESS_CLIPBOARD_PERMISSION);
                    canAccess = true;
                } catch (SecurityException e) {
                }
--- a/jdk/src/share/classes/sun/tools/jconsole/Messages.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/tools/jconsole/Messages.java	Wed Jul 05 19:26:45 2017 +0200
@@ -36,7 +36,7 @@
         Resources.initializeMessages(Messages.class, BUNDLE_NAME);
     }
     // TODO:
-    // The names of some of the constants below looks strange.
+    // The names of some of the constants below look strange.
     // That's because they  were generated programmatically
     // from the messages. They should be cleaned up,
     // ___ should be removed etc.
@@ -269,6 +269,7 @@
     public static String SUMMARY_TAB_TAB_NAME;
     public static String SUMMARY_TAB_VM_VERSION;
     public static String THREADS;
+    public static String THREAD_TAB_INFO_LABEL_FORMAT;
     public static String THREAD_TAB_THREAD_INFO_ACCESSIBLE_NAME;
     public static String THREAD_TAB_THREAD_PLOTTER_ACCESSIBLE_NAME;
     public static String THREAD_TAB_INITIAL_STACK_TRACE_MESSAGE;
--- a/jdk/src/share/classes/sun/tools/jconsole/SummaryTab.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/tools/jconsole/SummaryTab.java	Wed Jul 05 19:26:45 2017 +0200
@@ -213,8 +213,8 @@
                 String[] strings2 = formatKByteStrings(u.getCommitted());
                 append(Messages.COMMITTED_MEMORY,  strings2[0]);
                 append(Messages.SUMMARY_TAB_PENDING_FINALIZATION_LABEL,
-                       Messages.SUMMARY_TAB_PENDING_FINALIZATION_VALUE,
-                       memoryBean.getObjectPendingFinalizationCount());
+                       Resources.format(Messages.SUMMARY_TAB_PENDING_FINALIZATION_VALUE,
+                                        memoryBean.getObjectPendingFinalizationCount()));
                 append(endTable);
 
                 append(newTable);
--- a/jdk/src/share/classes/sun/tools/jconsole/ThreadTab.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/tools/jconsole/ThreadTab.java	Wed Jul 05 19:26:45 2017 +0200
@@ -66,9 +66,6 @@
 
     private static final Border thinEmptyBorder  = new EmptyBorder(2, 2, 2, 2);
 
-    private static final String infoLabelFormat = "ThreadTab.infoLabelFormat";
-
-
     /*
       Hierarchy of panels and layouts for this tab:
 
@@ -692,7 +689,7 @@
 
         private void updateThreadsInfo(long tlCount, long tpCount, long ttCount, long timeStamp) {
             getPlotter().addValues(timeStamp, tlCount);
-            getInfoLabel().setText(Resources.format(infoLabelFormat, tlCount, tpCount, ttCount));
+            getInfoLabel().setText(Resources.format(Messages.THREAD_TAB_INFO_LABEL_FORMAT, tlCount, tpCount, ttCount));
         }
     }
 }
--- a/jdk/src/share/classes/sun/tools/jconsole/resources/messages.properties	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/tools/jconsole/resources/messages.properties	Wed Jul 05 19:26:45 2017 +0200
@@ -227,6 +227,7 @@
 SUMMARY_TAB_TAB_NAME=VM Summary
 SUMMARY_TAB_VM_VERSION={0} version {1}
 THREADS=Threads
+THREAD_TAB_INFO_LABEL_FORMAT=<html>Live: {0}    Peak: {1}    Total: {2}</html>
 THREAD_TAB_THREAD_INFO_ACCESSIBLE_NAME=Thread Information
 THREAD_TAB_THREAD_PLOTTER_ACCESSIBLE_NAME=Chart for number of threads.
 THREAD_TAB_INITIAL_STACK_TRACE_MESSAGE=[No thread selected]
@@ -249,7 +250,7 @@
 UNREGISTER=Unregister
 UPTIME=Uptime
 USAGE_THRESHOLD=Usage Threshold
-REMOTE_TF_USAGE=<b>Usage</b>: &lt;hostname&gt;:&lt;port&gt; OR service:jmx:&lt;protocol&gt;:&lt;sap&gt;
+REMOTE_TF_USAGE=<b>Usage</b>: &&lt;hostname&&gt;:&&lt;port&&gt; OR service:jmx:&&lt;protocol&&gt;:&&lt;sap&&gt;
 USED=Used
 USERNAME_COLON_=&Username:
 USERNAME_ACCESSIBLE_NAME=User Name
--- a/jdk/src/share/classes/sun/tools/jconsole/resources/messages_ja.properties	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/tools/jconsole/resources/messages_ja.properties	Wed Jul 05 19:26:45 2017 +0200
@@ -227,6 +227,7 @@
 SUMMARY_TAB_TAB_NAME=VM\u30B5\u30DE\u30EA\u30FC
 SUMMARY_TAB_VM_VERSION={0}\u30D0\u30FC\u30B8\u30E7\u30F3{1}
 THREADS=\u30B9\u30EC\u30C3\u30C9
+THREAD_TAB_INFO_LABEL_FORMAT=<html>\u5B9F\u884C\u4E2D: {0}    \u30D4\u30FC\u30AF: {1}    \u5408\u8A08: {2}</html>
 THREAD_TAB_THREAD_INFO_ACCESSIBLE_NAME=\u30B9\u30EC\u30C3\u30C9\u60C5\u5831
 THREAD_TAB_THREAD_PLOTTER_ACCESSIBLE_NAME=\u30B9\u30EC\u30C3\u30C9\u6570\u306E\u30C1\u30E3\u30FC\u30C8\u3002
 THREAD_TAB_INITIAL_STACK_TRACE_MESSAGE=[\u30B9\u30EC\u30C3\u30C9\u304C\u9078\u629E\u3055\u308C\u3066\u3044\u307E\u305B\u3093]
@@ -249,7 +250,7 @@
 UNREGISTER=\u767B\u9332\u89E3\u9664
 UPTIME=\u7A3C\u50CD\u6642\u9593
 USAGE_THRESHOLD=\u4F7F\u7528\u3057\u304D\u3044\u5024
-REMOTE_TF_USAGE=<b>\u4F7F\u7528\u65B9\u6CD5</b>: &lt;hostname&gt;:&lt;port&gt;\u307E\u305F\u306Fservice:jmx:&lt;protocol&gt;:&lt;sap&gt;
+REMOTE_TF_USAGE=<b>\u4F7F\u7528\u65B9\u6CD5</b>: &&lt;hostname&&gt;:&&lt;port&&gt;\u307E\u305F\u306Fservice:jmx:&&lt;protocol&&gt;:&&lt;sap&&gt;
 USED=\u4F7F\u7528\u6E08
 USERNAME_COLON_=\u30E6\u30FC\u30B6\u30FC\u540D(&U):
 USERNAME_ACCESSIBLE_NAME=\u30E6\u30FC\u30B6\u30FC\u540D
--- a/jdk/src/share/classes/sun/tools/jconsole/resources/messages_zh_CN.properties	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/tools/jconsole/resources/messages_zh_CN.properties	Wed Jul 05 19:26:45 2017 +0200
@@ -227,6 +227,7 @@
 SUMMARY_TAB_TAB_NAME=VM \u6982\u8981
 SUMMARY_TAB_VM_VERSION={0}\u7248\u672C {1}
 THREADS=\u7EBF\u7A0B
+THREAD_TAB_INFO_LABEL_FORMAT=<html>\u6D3B\u52A8: {0}    \u5CF0\u503C: {1}    \u603B\u8BA1: {2}</html>
 THREAD_TAB_THREAD_INFO_ACCESSIBLE_NAME=\u7EBF\u7A0B\u4FE1\u606F
 THREAD_TAB_THREAD_PLOTTER_ACCESSIBLE_NAME=\u8868\u793A\u7EBF\u7A0B\u6570\u7684\u56FE\u8868\u3002
 THREAD_TAB_INITIAL_STACK_TRACE_MESSAGE=[\u672A\u9009\u62E9\u7EBF\u7A0B]
@@ -249,7 +250,7 @@
 UNREGISTER=\u6CE8\u9500
 UPTIME=\u8FD0\u884C\u65F6\u95F4
 USAGE_THRESHOLD=\u7528\u6CD5\u9608\u503C
-REMOTE_TF_USAGE=<b>\u7528\u6CD5</b>: &lt;hostname&gt;:&lt;port&gt; \u6216 service:jmx:&lt;protocol&gt;:&lt;sap&gt;
+REMOTE_TF_USAGE=<b>\u7528\u6CD5</b>: &&lt;hostname&&gt;:&&lt;port&&gt; \u6216 service:jmx:&&lt;protocol&&gt;:&&lt;sap&&gt;
 USED=\u5DF2\u7528
 USERNAME_COLON_=\u7528\u6237\u540D(&U):
 USERNAME_ACCESSIBLE_NAME=\u7528\u6237\u540D
--- a/jdk/src/share/classes/sun/tools/jinfo/JInfo.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/classes/sun/tools/jinfo/JInfo.java	Wed Jul 05 19:26:45 2017 +0200
@@ -196,15 +196,17 @@
         if (usageSA) {
             System.err.println("    jinfo [option] <pid>");
             System.err.println("        (to connect to running process)");
-            System.err.println("    jinfo [option] <executable <core>");
+            System.err.println("    jinfo [option] <executable> <core>");
             System.err.println("        (to connect to a core file)");
             System.err.println("    jinfo [option] [server_id@]<remote server IP or hostname>");
             System.err.println("        (to connect to remote debug server)");
             System.err.println("");
             System.err.println("where <option> is one of:");
+            System.err.println("  for running processes:");
             System.err.println("    -flag <name>         to print the value of the named VM flag");
             System.err.println("    -flag [+|-]<name>    to enable or disable the named VM flag");
             System.err.println("    -flag <name>=<value> to set the named VM flag to the given value");
+            System.err.println("  for running processes and core files:");
             System.err.println("    -flags               to print VM flags");
             System.err.println("    -sysprops            to print Java system properties");
             System.err.println("    <no option>          to print both of the above");
--- a/jdk/src/share/native/java/nio/Bits.c	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/share/native/java/nio/Bits.c	Wed Jul 05 19:26:45 2017 +0200
@@ -51,10 +51,13 @@
 
 #define MBYTE 1048576
 
-#define GETCRITICAL(bytes, env, obj) { \
+#define GETCRITICAL_OR_RETURN(bytes, env, obj) { \
     bytes = (*env)->GetPrimitiveArrayCritical(env, obj, NULL); \
-    if (bytes == NULL) \
-        JNU_ThrowInternalError(env, "Unable to get array"); \
+    if (bytes == NULL)  { \
+        if ((*env)->ExceptionOccurred(env) == NULL) \
+            JNU_ThrowInternalError(env, "Unable to get array"); \
+        return; \
+    } \
 }
 
 #define RELEASECRITICAL(bytes, env, obj, mode) { \
@@ -85,7 +88,7 @@
         else
             size = (size_t)length;
 
-        GETCRITICAL(bytes, env, src);
+        GETCRITICAL_OR_RETURN(bytes, env, src);
 
         srcShort = (jshort *)(bytes + srcPos);
         endShort = srcShort + (size / sizeof(jshort));
@@ -120,7 +123,7 @@
         else
             size = (size_t)length;
 
-        GETCRITICAL(bytes, env, dst);
+        GETCRITICAL_OR_RETURN(bytes, env, dst);
 
         dstShort = (jshort *)(bytes + dstPos);
         endShort = srcShort + (size / sizeof(jshort));
@@ -155,7 +158,7 @@
         else
             size = (size_t)length;
 
-        GETCRITICAL(bytes, env, src);
+        GETCRITICAL_OR_RETURN(bytes, env, src);
 
         srcInt = (jint *)(bytes + srcPos);
         endInt = srcInt + (size / sizeof(jint));
@@ -190,7 +193,7 @@
         else
             size = (size_t)length;
 
-        GETCRITICAL(bytes, env, dst);
+        GETCRITICAL_OR_RETURN(bytes, env, dst);
 
         dstInt = (jint *)(bytes + dstPos);
         endInt = srcInt + (size / sizeof(jint));
@@ -225,7 +228,7 @@
         else
             size = (size_t)length;
 
-        GETCRITICAL(bytes, env, src);
+        GETCRITICAL_OR_RETURN(bytes, env, src);
 
         srcLong = (jlong *)(bytes + srcPos);
         endLong = srcLong + (size / sizeof(jlong));
@@ -260,7 +263,7 @@
         else
             size = (size_t)length;
 
-        GETCRITICAL(bytes, env, dst);
+        GETCRITICAL_OR_RETURN(bytes, env, dst);
 
         dstLong = (jlong *)(bytes + dstPos);
         endLong = srcLong + (size / sizeof(jlong));
--- a/jdk/src/solaris/bin/java_md_solinux.c	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/solaris/bin/java_md_solinux.c	Wed Jul 05 19:26:45 2017 +0200
@@ -47,23 +47,10 @@
 #ifndef SETENV_REQUIRED
 #define SETENV_REQUIRED
 #endif
-/*
- * If a processor / os combination has the ability to run binaries of
- * two data models and cohabitation of jre/jdk bits with both data
- * models is supported, then DUAL_MODE is defined.  When DUAL_MODE is
- * defined, the architecture names for the narrow and wide version of
- * the architecture are defined in LIBARCH64NAME and LIBARCH32NAME.
- * Currently  only Solaris on sparc/sparcv9 and i586/amd64 is DUAL_MODE;
- * linux i586/amd64 could be defined as DUAL_MODE but that is not the
- * current policy.
- */
 
 #ifdef __solaris__
-#  ifndef LIBARCH32NAME
-#    error "The macro LIBARCH32NAME was not defined on the compile line"
-#  endif
-#  ifndef LIBARCH64NAME
-#    error "The macro LIBARCH64NAME was not defined on the compile line"
+#  ifndef LIBARCHNAME
+#    error "The macro LIBARCHNAME was not defined on the compile line"
 #  endif
 #  include <sys/systeminfo.h>
 #  include <sys/elf.h>
@@ -118,24 +105,15 @@
  *  |
  *  |
  * \|/
- *  Have Desired Model ? --> NO --> Is Dual-Mode ? --> NO --> Exit(with error)
- *  |                                          |
- *  |                                          |
- *  |                                         \|/
- *  |                                         YES
- *  |                                          |
- *  |                                          |
- *  |                                         \|/
- *  |                                CheckJvmType
- *  |                               (removes -client, -server etc.)
- *  |                                          |
- *  |                                          |
- * \|/                                        \|/
- * YES                             Find the desired executable/library
- *  |                                          |
- *  |                                          |
- * \|/                                        \|/
- * CheckJvmType                          RequiresSetenv
+ *  Have Desired Model ? --> NO --> Exit(with error)
+ *  |
+ *  |
+ * \|/
+ * YES
+ *  |
+ *  |
+ * \|/
+ * CheckJvmType
  * (removes -client, -server, etc.)
  *  |
  *  |
@@ -155,24 +133,24 @@
  *  \|/
  * RequiresSetenv
  * Is LD_LIBRARY_PATH
- * and friends set ? --> NO --> Have Desired Model ? NO --> Re-exec --> Main
+ * and friends set ? --> NO --> Have Desired Model ? NO --> Error/Exit
  *  YES                              YES --> Continue
  *   |
  *   |
  *  \|/
- * Path is desired JRE ? YES --> Have Desired Model ? NO --> Re-exec --> Main
+ * Path is desired JRE ? YES --> Have Desired Model ? NO --> Error/Exit
  *  NO                               YES --> Continue
  *   |
  *   |
  *  \|/
  * Paths have well known
- * jvm paths ?       --> NO --> Have Desired Model ? NO --> Re-exec --> Main
+ * jvm paths ?       --> NO --> Have Desired Model ? NO --> Error/Exit
  *  YES                              YES --> Continue
  *   |
  *   |
  *  \|/
  *  Does libjvm.so exit
- *  in any of them ? --> NO --> Have Desired Model ? NO --> Re-exec --> Main
+ *  in any of them ? --> NO --> Have Desired Model ? NO --> Error/Exit
  *   YES                             YES --> Continue
  *   |
  *   |
@@ -188,8 +166,6 @@
  * Main
  */
 
-#define GetArch() GetArchPath(CURRENT_DATA_MODEL)
-
 /* Store the name of the executable once computed */
 static char *execname = NULL;
 
@@ -201,21 +177,6 @@
     return execname;
 }
 
-const char *
-GetArchPath(int nbits)
-{
-    switch(nbits) {
-#ifdef DUAL_MODE
-        case 32:
-            return LIBARCH32NAME;
-        case 64:
-            return LIBARCH64NAME;
-#endif /* DUAL_MODE */
-        default:
-            return LIBARCHNAME;
-    }
-}
-
 #ifdef SETENV_REQUIRED
 static jboolean
 JvmExists(const char *path) {
@@ -228,10 +189,10 @@
     return JNI_FALSE;
 }
 /*
- * contains a lib/$LIBARCH/{server,client}/libjvm.so ?
+ * contains a lib/$LIBARCHNAME/{server,client}/libjvm.so ?
  */
 static jboolean
-ContainsLibJVM(int wanted, const char *env) {
+ContainsLibJVM(const char *env) {
     char clientPattern[PATH_MAX + 1];
     char serverPattern[PATH_MAX + 1];
     char *envpath;
@@ -245,8 +206,8 @@
     }
 
     /* the usual suspects */
-    JLI_Snprintf(clientPattern, PATH_MAX, "lib/%s/client", GetArchPath(wanted));
-    JLI_Snprintf(serverPattern, PATH_MAX, "lib/%s/server", GetArchPath(wanted));
+    JLI_Snprintf(clientPattern, PATH_MAX, "lib/%s/client", LIBARCHNAME);
+    JLI_Snprintf(serverPattern, PATH_MAX, "lib/%s/server", LIBARCHNAME);
 
     /* to optimize for time, test if any of our usual suspects are present. */
     clientPatternFound = JLI_StrStr(env, clientPattern) != NULL;
@@ -281,7 +242,7 @@
  * Test whether the environment variable needs to be set, see flowchart.
  */
 static jboolean
-RequiresSetenv(int wanted, const char *jvmpath) {
+RequiresSetenv(const char *jvmpath) {
     char jpath[PATH_MAX + 1];
     char *llp;
     char *dmllp = NULL;
@@ -289,9 +250,7 @@
 
     llp = getenv("LD_LIBRARY_PATH");
 #ifdef __solaris__
-    dmllp = (CURRENT_DATA_MODEL == 32)
-            ? getenv("LD_LIBRARY_PATH_32")
-            : getenv("LD_LIBRARY_PATH_64");
+    dmllp = getenv("LD_LIBRARY_PATH_64");
 #endif /* __solaris__ */
     /* no environment variable is a good environment variable */
     if (llp == NULL && dmllp == NULL) {
@@ -330,10 +289,10 @@
     }
 
     /* scrutinize all the paths further */
-    if (llp != NULL &&  ContainsLibJVM(wanted, llp)) {
+    if (llp != NULL &&  ContainsLibJVM(llp)) {
         return JNI_TRUE;
     }
-    if (dmllp != NULL && ContainsLibJVM(wanted, dmllp)) {
+    if (dmllp != NULL && ContainsLibJVM(dmllp)) {
         return JNI_TRUE;
     }
     return JNI_FALSE;
@@ -349,10 +308,8 @@
    * First, determine if we are running the desired data model.  If we
    * are running the desired data model, all the error messages
    * associated with calling GetJREPath, ReadKnownVMs, etc. should be
-   * output.  However, if we are not running the desired data model,
-   * some of the errors should be suppressed since it is more
-   * informative to issue an error message based on whether or not the
-   * os/processor combination has dual mode capabilities.
+   * output, otherwise we simply exit with an error, as we no longer
+   * support dual data models.
    */
     jboolean jvmpathExists;
 
@@ -361,16 +318,17 @@
 
     /* Check data model flags, and exec process, if needed */
     {
-      char *arch        = (char *)GetArch(); /* like sparc or sparcv9 */
+      char *arch        = LIBARCHNAME; /* like sparc or sparcv9 */
       char * jvmtype    = NULL;
       int  argc         = *pargc;
       char **argv       = *pargv;
       int running       = CURRENT_DATA_MODEL;
-
-      int wanted        = running;      /* What data mode is being
-                                           asked for? Current model is
-                                           fine unless another model
-                                           is asked for */
+      /*
+       * As of jdk9, there is no support for dual mode operations, however
+       * for legacy error reporting purposes and until -d options are supported
+       * we need this.
+       */
+      int wanted        = running;
 #ifdef SETENV_REQUIRED
       jboolean mustsetenv = JNI_FALSE;
       char *runpath     = NULL; /* existing effective LD_LIBRARY_PATH setting */
@@ -473,7 +431,7 @@
          * we return back, otherwise proceed to set the environment.
          */
 #ifdef SETENV_REQUIRED
-        mustsetenv = RequiresSetenv(wanted, jvmpath);
+        mustsetenv = RequiresSetenv(jvmpath);
         JLI_TraceLauncher("mustsetenv: %s\n", mustsetenv ? "TRUE" : "FALSE");
 
         if (mustsetenv == JNI_FALSE) {
@@ -481,47 +439,13 @@
             return;
         }
 #else
-        JLI_MemFree(newargv);
-        return;
+            JLI_MemFree(newargv);
+            return;
 #endif /* SETENV_REQUIRED */
-      } else {  /* do the same speculatively or exit */
-#ifdef DUAL_MODE
-        if (running != wanted) {
-          /* Find out where the JRE is that we will be using. */
-          if (!GetJREPath(jrepath, so_jrepath, GetArchPath(wanted), JNI_TRUE)) {
-            /* give up and let other code report error message */
-            JLI_ReportErrorMessage(JRE_ERROR2, wanted);
-            exit(1);
-          }
-          JLI_Snprintf(jvmcfg, so_jvmcfg, "%s%slib%s%s%sjvm.cfg",
-                       jrepath, FILESEP, FILESEP, GetArchPath(wanted), FILESEP);
-          /*
-           * Read in jvm.cfg for target data model and process vm
-           * selection options.
-           */
-          if (ReadKnownVMs(jvmcfg, JNI_TRUE) < 1) {
-            /* give up and let other code report error message */
-            JLI_ReportErrorMessage(JRE_ERROR2, wanted);
-            exit(1);
-          }
-          jvmpath[0] = '\0';
-          jvmtype = CheckJvmType(pargc, pargv, JNI_TRUE);
-          if (JLI_StrCmp(jvmtype, "ERROR") == 0) {
-            JLI_ReportErrorMessage(CFG_ERROR9);
-            exit(4);
-          }
-
-          /* exec child can do error checking on the existence of the path */
-          jvmpathExists = GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath, GetArchPath(wanted), 0);
-#ifdef SETENV_REQUIRED
-          mustsetenv = RequiresSetenv(wanted, jvmpath);
-#endif /* SETENV_REQUIRED */
-        }
-#else /* ! DUALMODE */
+    } else {  /* do the same speculatively or exit */
         JLI_ReportErrorMessage(JRE_ERROR2, wanted);
         exit(1);
-#endif /* DUAL_MODE */
-        }
+    }
 #ifdef SETENV_REQUIRED
         if (mustsetenv) {
             /*
@@ -545,10 +469,6 @@
              *
              * 2. LD_LIBRARY_PATH_64 -- overrides and replaces LD_LIBRARY_PATH
              * for 64-bit binaries.
-             *
-             * 3. LD_LIBRARY_PATH_32 -- overrides and replaces LD_LIBRARY_PATH
-             * for 32-bit binaries.
-             *
              * The vm uses LD_LIBRARY_PATH to set the java.library.path system
              * property.  To shield the vm from the complication of multiple
              * LD_LIBRARY_PATH variables, if the appropriate data model
@@ -561,21 +481,9 @@
 
             switch (wanted) {
                 case 0:
-                    if (running == 32) {
-                        dmpath = getenv("LD_LIBRARY_PATH_32");
-                        wanted = 32;
-                    } else {
-                        dmpath = getenv("LD_LIBRARY_PATH_64");
-                        wanted = 64;
-                    }
-                    break;
-
-                case 32:
-                    dmpath = getenv("LD_LIBRARY_PATH_32");
-                    break;
-
                 case 64:
                     dmpath = getenv("LD_LIBRARY_PATH_64");
+                    wanted = 64;
                     break;
 
                 default:
@@ -624,13 +532,8 @@
                         "%s/lib/%s:"
                         "%s/../lib/%s",
                         jvmpath,
-#ifdef DUAL_MODE
-                        jrepath, GetArchPath(wanted),
-                        jrepath, GetArchPath(wanted)
-#else /* !DUAL_MODE */
                         jrepath, arch,
                         jrepath, arch
-#endif /* DUAL_MODE */
                         );
 
 
@@ -681,7 +584,7 @@
              * in the environment for the exec'ed child.
              */
             if (dmpath != NULL)
-                (void)UnsetEnv((wanted == 32) ? "LD_LIBRARY_PATH_32" : "LD_LIBRARY_PATH_64");
+                (void)UnsetEnv("LD_LIBRARY_PATH_64");
 #endif /* __solaris */
 
             newenvp = environ;
@@ -689,34 +592,6 @@
 #endif /* SETENV_REQUIRED */
         {
             char *newexec = execname;
-#ifdef DUAL_MODE
-            /*
-             * If the data model is being changed, the path to the
-             * executable must be updated accordingly; the executable name
-             * and directory the executable resides in are separate.  In the
-             * case of 32 => 64, the new bits are assumed to reside in, e.g.
-             * "olddir/LIBARCH64NAME/execname"; in the case of 64 => 32,
-             * the bits are assumed to be in "olddir/../execname".  For example,
-             *
-             * olddir/sparcv9/execname
-             * olddir/amd64/execname
-             *
-             * for Solaris SPARC and Linux amd64, respectively.
-             */
-
-            if (running != wanted) {
-                char *oldexec = JLI_StrCpy(JLI_MemAlloc(JLI_StrLen(execname) + 1), execname);
-                char *olddir = oldexec;
-                char *oldbase = JLI_StrRChr(oldexec, '/');
-
-
-                newexec = JLI_MemAlloc(JLI_StrLen(execname) + 20);
-                *oldbase++ = 0;
-                sprintf(newexec, "%s/%s/%s", olddir,
-                        ((wanted == 64) ? LIBARCH64NAME : ".."), oldbase);
-                argv[0] = newexec;
-            }
-#endif /* DUAL_MODE */
             JLI_TraceLauncher("TRACER_MARKER:About to EXEC\n");
             (void) fflush(stdout);
             (void) fflush(stderr);
@@ -730,20 +605,6 @@
             execv(newexec, argv);
 #endif /* SETENV_REQUIRED */
             JLI_ReportErrorMessageSys(JRE_ERROR4, newexec);
-
-#ifdef DUAL_MODE
-            if (running != wanted) {
-                JLI_ReportErrorMessage(JRE_ERROR5, wanted, running);
-#ifdef __solaris__
-#ifdef __sparc
-                JLI_ReportErrorMessage(JRE_ERROR6);
-#else  /* ! __sparc__ */
-                JLI_ReportErrorMessage(JRE_ERROR7);
-#endif  /* __sparc */
-#endif /* __solaris__ */
-            }
-#endif /* DUAL_MODE */
-
         }
         exit(1);
     }
@@ -961,12 +822,12 @@
         char jrePath[MAXPATHLEN];
         char splashPath[MAXPATHLEN];
 
-        if (!GetJREPath(jrePath, sizeof(jrePath), GetArch(), JNI_FALSE)) {
+        if (!GetJREPath(jrePath, sizeof(jrePath), LIBARCHNAME, JNI_FALSE)) {
             JLI_ReportErrorMessage(JRE_ERROR1);
             return NULL;
         }
         ret = JLI_Snprintf(splashPath, sizeof(splashPath), "%s/lib/%s/%s",
-                     jrePath, GetArch(), SPLASHSCREEN_SO);
+                     jrePath, LIBARCHNAME, SPLASHSCREEN_SO);
 
         if (ret >= (int) sizeof(splashPath)) {
             JLI_ReportErrorMessage(JRE_ERROR11);
--- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Wed Jul 05 19:26:45 2017 +0200
@@ -54,7 +54,6 @@
 import sun.security.action.GetPropertyAction;
 import sun.security.action.GetBooleanAction;
 import sun.util.logging.PlatformLogger;
-import sun.security.util.SecurityConstants;
 
 public final class XToolkit extends UNIXToolkit implements Runnable {
     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XToolkit");
@@ -1158,7 +1157,7 @@
     public  Clipboard getSystemClipboard() {
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
-            security.checkPermission(SecurityConstants.AWT.ACCESS_CLIPBOARD_PERMISSION);
+            security.checkPermission(AWTPermissions.ACCESS_CLIPBOARD_PERMISSION);
         }
         synchronized (this) {
             if (clipboard == null) {
@@ -1171,7 +1170,7 @@
     public Clipboard getSystemSelection() {
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
-            security.checkPermission(SecurityConstants.AWT.ACCESS_CLIPBOARD_PERMISSION);
+            security.checkPermission(AWTPermissions.ACCESS_CLIPBOARD_PERMISSION);
         }
         synchronized (this) {
             if (selection == null) {
--- a/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c	Wed Jul 05 19:26:45 2017 +0200
@@ -1202,6 +1202,9 @@
 #ifdef __linux__
         mcast_set_if_by_addr_v4(env, this, fd, value);
         if (ipv6_available()) {
+            if ((*env)->ExceptionCheck(env)){
+                (*env)->ExceptionClear(env);
+            }
             mcast_set_if_by_addr_v6(env, this, fd, value);
         }
 #else  /* __linux__ not defined */
@@ -1224,6 +1227,9 @@
 #ifdef __linux__
         mcast_set_if_by_if_v4(env, this, fd, value);
         if (ipv6_available()) {
+            if ((*env)->ExceptionCheck(env)){
+                (*env)->ExceptionClear(env);
+            }
             mcast_set_if_by_if_v6(env, this, fd, value);
         }
 #else  /* __linux__ not defined */
@@ -1297,6 +1303,9 @@
 #ifdef __linux__
     mcast_set_loop_v4(env, this, fd, value);
     if (ipv6_available()) {
+        if ((*env)->ExceptionCheck(env)){
+            (*env)->ExceptionClear(env);
+        }
         mcast_set_loop_v6(env, this, fd, value);
     }
 #else  /* __linux__ not defined */
--- a/jdk/src/solaris/native/java/util/FileSystemPreferences.c	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/solaris/native/java/util/FileSystemPreferences.c	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -38,12 +38,14 @@
 JNIEXPORT jint JNICALL
 Java_java_util_prefs_FileSystemPreferences_chmod(JNIEnv *env,
                        jclass thisclass, jstring java_fname, jint permission) {
-    const char *fname = JNU_GetStringPlatformChars(env, java_fname, JNI_FALSE);
-    int result;
-    result =  chmod(fname, permission);
-    if (result != 0)
-       result = errno;
-    JNU_ReleaseStringPlatformChars(env, java_fname, fname);
+    const char *fname = JNU_GetStringPlatformChars(env, java_fname, NULL);
+    int result = -1;
+    if (fname) {
+        result =  chmod(fname, permission);
+        if (result != 0)
+            result = errno;
+        JNU_ReleaseStringPlatformChars(env, java_fname, fname);
+    }
     return (jint) result;
 }
 
@@ -61,13 +63,16 @@
 JNIEXPORT jintArray JNICALL
 Java_java_util_prefs_FileSystemPreferences_lockFile0(JNIEnv *env,
     jclass thisclass, jstring java_fname, jint permission, jboolean shared) {
-    const char *fname = JNU_GetStringPlatformChars(env, java_fname, JNI_FALSE);
+    const char *fname = JNU_GetStringPlatformChars(env, java_fname, NULL);
     int fd, rc;
     int result[2];
-    jintArray javaResult;
+    jintArray javaResult = NULL;
     int old_umask;
     FLOCK fl;
 
+    if (!fname)
+        return javaResult;
+
     fl.l_whence = SEEK_SET;
     fl.l_len = 0;
     fl.l_start = 0;
@@ -104,7 +109,8 @@
     }
     JNU_ReleaseStringPlatformChars(env, java_fname, fname);
     javaResult = (*env)->NewIntArray(env,2);
-    (*env)->SetIntArrayRegion(env, javaResult, 0, 2, result);
+    if (javaResult)
+        (*env)->SetIntArrayRegion(env, javaResult, 0, 2, result);
     return javaResult;
 }
 
--- a/jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c	Wed Jul 05 19:26:45 2017 +0200
@@ -38,6 +38,10 @@
 #include <strings.h>
 #endif
 
+#ifndef CHECK_NULL_RETURN
+#define CHECK_NULL_RETURN(x, y) if ((x) == NULL) return y;
+#endif
+
 /**
  * These functions are used by the sun.net.spi.DefaultProxySelector class
  * to access some platform specific settings.
@@ -114,18 +118,36 @@
 static jclass ptype_class;
 static jmethodID isaddr_createUnresolvedID;
 static jmethodID proxy_ctrID;
-static jfieldID pr_no_proxyID;
 static jfieldID ptype_httpID;
 static jfieldID ptype_socksID;
 
 
 static void* gconf_client = NULL;
-
 static int use_gproxyResolver = 0;
 static int use_gconf = 0;
 
-#define CHECK_NULL(X) { if ((X) == NULL) fprintf (stderr,"JNI errror at line %d\n", __LINE__); }
 
+static jobject createProxy(JNIEnv *env, jfieldID ptype_ID,
+                           const char* phost, unsigned short pport)
+{
+    jobject jProxy = NULL;
+    jobject type_proxy = NULL;
+    type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_ID);
+    if (type_proxy) {
+        jstring jhost = NULL;
+        jhost = (*env)->NewStringUTF(env, phost);
+        if (jhost) {
+            jobject isa = NULL;
+            isa = (*env)->CallStaticObjectMethod(env, isaddr_class,
+                    isaddr_createUnresolvedID, jhost, pport);
+            if (isa) {
+                jProxy = (*env)->NewObject(env, proxy_class, proxy_ctrID,
+                                          type_proxy, isa);
+            }
+        }
+    }
+    return jProxy;
+}
 
 static int initGConf() {
     /**
@@ -182,9 +204,8 @@
     int pport = 0;
     int use_proxy = 0;
     int use_same_proxy = 0;
-    jobject isa = NULL;
     jobject proxy = NULL;
-    jobject type_proxy = NULL;
+    jfieldID ptype_ID = ptype_httpID;
 
     // We only check manual proxy configurations
     mode =  (*my_get_string_func)(gconf_client, "/system/proxy/mode", NULL);
@@ -199,8 +220,6 @@
             phost = (*my_get_string_func)(gconf_client, "/system/http_proxy/host", NULL);
             pport = (*my_get_int_func)(gconf_client, "/system/http_proxy/port", NULL);
             use_proxy = (phost != NULL && pport != 0);
-            if (use_proxy)
-                type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_httpID);
         }
 
         if (!use_proxy) {
@@ -214,8 +233,6 @@
                 phost = (*my_get_string_func)(gconf_client, "/system/http_proxy/host", NULL);
                 pport = (*my_get_int_func)(gconf_client, "/system/http_proxy/port", NULL);
                 use_proxy = (phost != NULL && pport != 0);
-                if (use_proxy)
-                    type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_httpID);
             }
 
             /**
@@ -228,8 +245,6 @@
                 phost = (*my_get_string_func)(gconf_client, "/system/proxy/secure_host", NULL);
                 pport = (*my_get_int_func)(gconf_client, "/system/proxy/secure_port", NULL);
                 use_proxy = (phost != NULL && pport != 0);
-                if (use_proxy)
-                    type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_httpID);
             }
 
             /**
@@ -242,8 +257,6 @@
                 phost = (*my_get_string_func)(gconf_client, "/system/proxy/ftp_host", NULL);
                 pport = (*my_get_int_func)(gconf_client, "/system/proxy/ftp_port", NULL);
                 use_proxy = (phost != NULL && pport != 0);
-                if (use_proxy)
-                    type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_httpID);
             }
 
             /**
@@ -256,8 +269,6 @@
                 phost = (*my_get_string_func)(gconf_client, "/system/proxy/gopher_host", NULL);
                 pport = (*my_get_int_func)(gconf_client, "/system/proxy/gopher_port", NULL);
                 use_proxy = (phost != NULL && pport != 0);
-                if (use_proxy)
-                    type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_httpID);
             }
 
             /**
@@ -271,7 +282,7 @@
                 pport = (*my_get_int_func)(gconf_client, "/system/proxy/socks_port", NULL);
                 use_proxy = (phost != NULL && pport != 0);
                 if (use_proxy)
-                    type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_socksID);
+                    ptype_ID = ptype_socksID;
             }
         }
     }
@@ -302,12 +313,8 @@
                 s = strtok_r(NULL, ", ", tmpbuf);
             }
         }
-        if (use_proxy) {
-            CHECK_NULL(type_proxy);
-            jhost = (*env)->NewStringUTF(env, phost);
-            isa = (*env)->CallStaticObjectMethod(env, isaddr_class, isaddr_createUnresolvedID, jhost, pport);
-            proxy = (*env)->NewObject(env, proxy_class, proxy_ctrID, type_proxy, isa);
-        }
+        if (use_proxy)
+            proxy = createProxy(env, ptype_ID, phost, pport);
     }
 
     return proxy;
@@ -375,7 +382,7 @@
     size_t hostLen = 0;
     char* uri = NULL;
 
-    jobject objProxy = NULL;
+    jobject jProxy = NULL;
 
     resolver = (*g_proxy_resolver_get_default)();
     if (resolver == NULL) {
@@ -407,7 +414,7 @@
     if (proxies) {
         if (!error) {
             int i;
-            for(i = 0; proxies[i] && !objProxy; i++) {
+            for(i = 0; proxies[i] && !jProxy; i++) {
                 if (strcmp(proxies[i], "direct://")) {
                     GSocketConnectable* conn =
                             (*g_network_address_parse_uri)(proxies[i], 0,
@@ -418,25 +425,11 @@
                         phost = (*g_network_address_get_hostname)(conn);
                         pport = (*g_network_address_get_port)(conn);
                         if (phost && pport > 0) {
-                            jobject type_proxy = NULL;
-                            jstring jhost = NULL;
-                            jobject isa = NULL;
                             jfieldID ptype_ID = ptype_httpID;
-                            if (!strncmp(proxies[i], "socks", 5)) {
+                            if (!strncmp(proxies[i], "socks", 5))
                                 ptype_ID = ptype_socksID;
-                            }
 
-                            type_proxy = (*env)->GetStaticObjectField(env,
-                                    ptype_class, ptype_ID);
-                            CHECK_NULL(type_proxy);
-                            jhost = (*env)->NewStringUTF(env, phost);
-                            CHECK_NULL(jhost);
-                            isa = (*env)->CallStaticObjectMethod(env,
-                                    isaddr_class, isaddr_createUnresolvedID,
-                                    jhost, pport);
-                            CHECK_NULL(isa);
-                            objProxy = (*env)->NewObject(env, proxy_class,
-                                    proxy_ctrID, type_proxy, isa);
+                            jProxy = createProxy(env, ptype_ID, phost, pport);
                         }
                     }
                 }
@@ -445,33 +438,45 @@
         (*g_strfreev)(proxies);
     }
 
-    return objProxy;
+    return jProxy;
 }
 
-static void initJavaClass(JNIEnv *env) {
-    jclass cls = NULL;
-    CHECK_NULL(cls = (*env)->FindClass(env,"java/net/Proxy"));
-    proxy_class = (*env)->NewGlobalRef(env, cls);
-    CHECK_NULL(cls = (*env)->FindClass(env,"java/net/Proxy$Type"));
-    ptype_class = (*env)->NewGlobalRef(env, cls);
-    CHECK_NULL(cls = (*env)->FindClass(env, "java/net/InetSocketAddress"));
-    isaddr_class = (*env)->NewGlobalRef(env, cls);
+static int initJavaClass(JNIEnv *env) {
+    jclass proxy_cls = NULL;
+    jclass ptype_cls = NULL;
+    jclass isaddr_cls = NULL;
+
+    // Proxy initialization
+    proxy_cls = (*env)->FindClass(env,"java/net/Proxy");
+    CHECK_NULL_RETURN(proxy_cls, 0);
+    proxy_class = (*env)->NewGlobalRef(env, proxy_cls);
+    CHECK_NULL_RETURN(proxy_class, 0);
     proxy_ctrID = (*env)->GetMethodID(env, proxy_class, "<init>",
             "(Ljava/net/Proxy$Type;Ljava/net/SocketAddress;)V");
-    CHECK_NULL(proxy_ctrID);
-    pr_no_proxyID = (*env)->GetStaticFieldID(env, proxy_class, "NO_PROXY",
-            "Ljava/net/Proxy;");
-    CHECK_NULL(pr_no_proxyID);
+    CHECK_NULL_RETURN(proxy_ctrID, 0);
+
+    // Proxy$Type initialization
+    ptype_cls = (*env)->FindClass(env,"java/net/Proxy$Type");
+    CHECK_NULL_RETURN(ptype_cls, 0);
+    ptype_class = (*env)->NewGlobalRef(env, ptype_cls);
+    CHECK_NULL_RETURN(ptype_class, 0);
     ptype_httpID = (*env)->GetStaticFieldID(env, ptype_class, "HTTP",
-            "Ljava/net/Proxy$Type;");
-    CHECK_NULL(ptype_httpID);
+                                            "Ljava/net/Proxy$Type;");
+    CHECK_NULL_RETURN(ptype_httpID, 0);
     ptype_socksID = (*env)->GetStaticFieldID(env, ptype_class, "SOCKS",
-            "Ljava/net/Proxy$Type;");
-    CHECK_NULL(ptype_socksID);
+                                             "Ljava/net/Proxy$Type;");
+    CHECK_NULL_RETURN(ptype_socksID, 0);
+
+    // InetSocketAddress initialization
+    isaddr_cls = (*env)->FindClass(env, "java/net/InetSocketAddress");
+    CHECK_NULL_RETURN(isaddr_cls, 0);
+    isaddr_class = (*env)->NewGlobalRef(env, isaddr_cls);
+    CHECK_NULL_RETURN(isaddr_class, 0);
     isaddr_createUnresolvedID = (*env)->GetStaticMethodID(env, isaddr_class,
             "createUnresolved",
             "(Ljava/lang/String;I)Ljava/net/InetSocketAddress;");
-    CHECK_NULL(isaddr_createUnresolvedID);
+
+    return isaddr_createUnresolvedID != NULL ? 1 : 0;
 }
 
 
@@ -487,10 +492,10 @@
         use_gconf = initGConf();
 
     if (use_gproxyResolver || use_gconf) {
-        initJavaClass(env);
-        return JNI_TRUE;
-    } else
-        return JNI_FALSE;
+        if (initJavaClass(env))
+            return JNI_TRUE;
+    }
+    return JNI_FALSE;
 }
 
 /*
@@ -528,11 +533,6 @@
         if (isProtoCopy == JNI_TRUE)
             (*env)->ReleaseStringUTFChars(env, proto, cproto);
     }
-
-    if (proxy == NULL) {
-        CHECK_NULL(proxy = (*env)->GetStaticObjectField(env, proxy_class,
-                                                        pr_no_proxyID));
-    }
     return proxy;
 }
 
--- a/jdk/src/windows/bin/java_md.c	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/windows/bin/java_md.c	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -179,7 +179,7 @@
     int wanted = running;
 
     char** argv = *pargv;
-    for (i = 0; i < *pargc ; i++) {
+    for (i = 1; i < *pargc ; i++) {
         if (JLI_StrCmp(argv[i], "-J-d64") == 0 || JLI_StrCmp(argv[i], "-d64") == 0) {
             wanted = 64;
             continue;
@@ -188,6 +188,11 @@
             wanted = 32;
             continue;
         }
+
+        if (IsJavaArgs() && argv[i][0] != '-')
+            continue;
+        if (argv[i][0] != '-')
+            break;
     }
     if (running != wanted) {
         JLI_ReportErrorMessage(JRE_ERROR2, wanted);
--- a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java	Wed Jul 05 19:26:45 2017 +0200
@@ -37,6 +37,7 @@
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import sun.awt.AWTAutoShutdown;
+import sun.awt.AWTPermissions;
 import sun.awt.LightweightFrame;
 import sun.awt.SunToolkit;
 import sun.awt.Win32GraphicsDevice;
@@ -64,7 +65,6 @@
 import sun.font.SunFontManager;
 import sun.misc.PerformanceLogger;
 import sun.util.logging.PlatformLogger;
-import sun.security.util.SecurityConstants;
 
 public class WToolkit extends SunToolkit implements Runnable {
 
@@ -682,7 +682,7 @@
     public Clipboard getSystemClipboard() {
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
-            security.checkPermission(SecurityConstants.AWT.ACCESS_CLIPBOARD_PERMISSION);
+            security.checkPermission(AWTPermissions.ACCESS_CLIPBOARD_PERMISSION);
         }
         synchronized (this) {
             if (clipboard == null) {
--- a/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -56,7 +56,7 @@
     }
 
     public SunMSCAPI() {
-        super("SunMSCAPI", 1.8d, INFO);
+        super("SunMSCAPI", 1.9d, INFO);
 
         // if there is no security manager installed, put directly into
         // the provider. Otherwise, create a temporary map and use a
--- a/jdk/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c	Wed Jul 05 19:26:45 2017 +0200
@@ -41,7 +41,7 @@
     char buf[1];
     fd_set tbl;
     struct timeval t = { 0, 0 };
-    struct sockaddr_in rmtaddr;
+    SOCKETADDRESS rmtaddr;
     int addrlen = sizeof(rmtaddr);
 
     /*
--- a/jdk/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c	Wed Jul 05 19:26:45 2017 +0200
@@ -332,7 +332,7 @@
     char buf[1];
     fd_set tbl;
     struct timeval t = { 0, 0 };
-    struct sockaddr_in rmtaddr;
+    SOCKETADDRESS rmtaddr;
     int addrlen = sizeof(rmtaddr);
 
     /*
--- a/jdk/test/ProblemList.txt	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/ProblemList.txt	Wed Jul 05 19:26:45 2017 +0200
@@ -123,6 +123,11 @@
 # 8029415
 java/lang/reflect/Method/invoke/TestPrivateInterfaceMethodReflect.java generic-all
 
+# 8030656
+java/lang/reflect/Parameter/GetAnnotatedTypeTest.java generic-all
+java/lang/reflect/Parameter/WithParameters.java generic-all
+java/lang/reflect/Parameter/BadClassFiles.java generic-all
+
 ############################################################################
 
 # jdk_management
@@ -158,10 +163,6 @@
 # Filed 7052625
 com/sun/net/httpserver/bugs/6725892/Test.java                   generic-all
 
-# failing on vista 32/64 on nightly
-# 7102702
-java/net/PortUnreachableException/OneExceptionOnly.java         windows-all
-
 # 7148829
 sun/net/InetAddress/nameservice/simple/CacheTest.java		generic-all
 sun/net/InetAddress/nameservice/simple/DefaultCaching.java	generic-all
@@ -263,9 +264,6 @@
 
 # jdk_tools
 
-# 7132203
-sun/jvmstat/monitor/MonitoredVm/CR6672135.java                  generic-all
-
 # 8028474
 sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh      generic-all
 
@@ -280,17 +278,8 @@
 
 # jdk_jdi
 
-# Filed 6952105
-com/sun/jdi/SuspendThreadTest.java                              generic-all
-
-# Filed 6653793
-com/sun/jdi/RedefineCrossEvent.java                             generic-all
-
 ############################################################################
 
 # jdk_util
 
-# Filed 6772009
-java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java generic-all
-
 ############################################################################
--- a/jdk/test/TEST.groups	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/TEST.groups	Wed Jul 05 19:26:45 2017 +0200
@@ -267,6 +267,24 @@
     :jdk_sound \
     :jdk_imageio
 
+#############################
+#
+# Stable test groups
+#
+
+jdk_stable = \
+    :jdk_core \
+    :jdk_svc \
+    :jdk_beans \
+    :jdk_imageio \
+    :jdk_sound \
+    :jdk_sctp \
+    javax/accessibility \
+    com/sun/java/swing \
+    sun/pisces \
+    com/sun/awt  
+
+
 ###############################################################################
 # Profile-based Test Group Definitions
 #
@@ -357,8 +375,6 @@
   java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh \
   java/security/Security/ClassLoaderDeadlock/Deadlock.sh \
   java/util/jar/Manifest/CreateManifest.java \
-  java/util/logging/Listeners.java \
-  java/util/logging/ListenersWithSM.java \
   java/util/logging/TestMainAppContext.java \
   java/util/ResourceBundle/Control/Bug6530694.java \
   java/text/Bidi/BidiConformance.java \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jdi/JdbExprTest.sh	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,158 @@
+#!/bin/sh
+
+#
+# Copyright (c) 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.
+#
+# 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 4660158
+#  @author Staffan Larsen
+#  @run shell JdbExprTest.sh
+
+# These are variables that can be set to control execution
+
+#pkg=untitled7
+classname=JdbExprTest
+compileOptions=-g
+#java="java_g"
+#set -x
+
+createJavaFile()
+{
+    cat <<EOF > $classname.java.1
+import java.util.*;
+import java.net.URLClassLoader;
+import java.net.URL;
+
+class $classname {
+
+    static long aLong;
+    static int anInt;
+    static boolean aBoolean;
+
+    public static void bkpt() {
+       int i = 0;     //@1 breakpoint
+    }
+    
+    public static void main(String[] args) {
+        bkpt();
+    }
+}
+EOF
+}
+
+
+# drive jdb by sending cmds to it and examining its output
+dojdbCmds()
+{
+    setBkpts @1
+    runToBkpt @1
+
+    cmd print java.lang.Long.MAX_VALUE
+    jdbFailIfNotPresent " \= 9223372036854775807" 3
+
+    cmd print java.lang.Long.MIN_VALUE
+    jdbFailIfNotPresent " \= \-9223372036854775808" 3
+    
+    cmd print 9223372036854775807L
+    jdbFailIfNotPresent "9223372036854775807L = 9223372036854775807" 3
+    cmd print 9223372036854775807
+    jdbFailIfNotPresent "9223372036854775807 = 9223372036854775807" 3
+
+    cmd print -9223372036854775807L
+    jdbFailIfNotPresent "\-9223372036854775807L = \-9223372036854775807" 3
+    cmd print -9223372036854775807
+    jdbFailIfNotPresent "\-9223372036854775807 = \-9223372036854775807" 3
+    
+    cmd print -1
+    jdbFailIfNotPresent "\-1 = \-1" 3
+    cmd print 1L
+    jdbFailIfNotPresent "1L = 1" 3
+    cmd print -1L
+    jdbFailIfNotPresent "\-1L = \-1" 3
+    cmd print 0x1
+    jdbFailIfNotPresent "0x1 = 1" 3
+    
+    cmd set $classname.aLong = 9223372036854775807L
+    cmd print $classname.aLong
+    jdbFailIfNotPresent "$classname.aLong = 9223372036854775807" 3
+
+    cmd set $classname.anInt = java.lang.Integer.MAX_VALUE + 1
+    cmd print $classname.anInt
+    jdbFailIfNotPresent "$classname.anInt = \-2147483648" 3
+
+    cmd set $classname.aLong = java.lang.Integer.MAX_VALUE + 1L
+    cmd print $classname.aLong
+    jdbFailIfNotPresent "$classname.aLong = 2147483648" 3
+
+    cmd set $classname.anInt = 0x80000000
+    jdbFailIfNotPresent "InvalidTypeException: .* convert 2147483648 to int" 3
+    cmd set $classname.anInt = 0x8000000000000000L
+    jdbFailIfNotPresent "java.lang.NumberFormatException: For input string: \"8000000000000000\"" 3
+
+    cmd set $classname.anInt = 0x7fffffff
+    jdbFailIfNotPresent "0x7fffffff = 2147483647" 3
+    cmd set $classname.aLong = 0x7fffffffffffffff
+    jdbFailIfNotPresent "0x7fffffffffffffff = 9223372036854775807" 3
+
+    cmd print 3.1415
+    jdbFailIfNotPresent "3.1415 = 3.1415" 3
+    cmd print -3.1415
+    jdbFailIfNotPresent "\-3.1415 = \-3.1415" 3
+    cmd print 011
+    jdbFailIfNotPresent "011 = 9" 3
+
+    cmd set $classname.aBoolean = false
+    jdbFailIfNotPresent "JdbExprTest.aBoolean = false = false" 3
+    cmd print $classname.aBoolean
+    jdbFailIfNotPresent "JdbExprTest.aBoolean = false" 3
+    cmd print !$classname.aBoolean
+    jdbFailIfNotPresent "JdbExprTest.aBoolean = true" 3
+
+    cmd print ~1
+    jdbFailIfNotPresent "~1 = -2" 3
+    
+    cmd quit
+}
+
+
+mysetup()
+{
+    if [ -z "$TESTSRC" ] ; then
+        TESTSRC=.
+    fi
+
+    for ii in . $TESTSRC $TESTSRC/.. ; do
+        if [ -r "$ii/ShellScaffold.sh" ] ; then
+            . $ii/ShellScaffold.sh 
+            break
+        fi
+    done
+}
+
+# You could replace this next line with the contents
+# of ShellScaffold.sh and this script will run just the same.
+mysetup
+
+runit
+jdbFailIfNotPresent "Breakpoint hit"
+pass
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jdi/VisibleMethods.java	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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 Test ReferenceType.visibleMethods
+ *  @bug 8028430
+ *
+ *  @author Staffan Larsen
+ *
+ *  @run build TestScaffold VMConnection TargetListener TargetAdapter
+ *  @run compile -g VisibleMethods.java
+ *  @run main VisibleMethods
+ */
+import com.sun.jdi.Method;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.StackFrame;
+import com.sun.jdi.StringReference;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.event.BreakpointEvent;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/********** target program **********/
+
+interface Super {
+    public void m(Object o); // This method should not be visible in AC
+    public void m(String s); // This method should not be visible in AC
+}
+
+interface One extends Super {
+    public void m(Object o);
+    public void m1(); // Either this method or Two.m1 should be visible in AC
+}
+
+interface Two extends Super {
+    public void m(String s);
+    public void m1(); // Either this method or One.m1 should be visible in AC
+}
+
+abstract class AC implements One, Two {
+}
+
+class CC extends AC {
+    public void m(Object o) {
+    }
+    public void m(String s) {
+    }
+    public void m1() {
+    }
+    public static void main(String[] args) {
+        System.out.println("Goodbye from VisibleMethods!");
+    }
+}
+
+/********** test program **********/
+
+public class VisibleMethods extends TestScaffold {
+    ReferenceType targetClass;
+    ThreadReference mainThread;
+
+    VisibleMethods(String args[]) {
+        super(args);
+    }
+
+    public static void main(String[] args) throws Exception {
+        new VisibleMethods(args).startTests();
+    }
+
+    /********** test core **********/
+
+    protected void runTests()
+        throws Exception
+    {
+        /*
+         * Run to String.<init>
+         */
+        startToMain("CC");
+
+        ReferenceType ac = findReferenceType("AC");
+        List<String> visible = ac.visibleMethods().
+                stream().
+                map(Method::toString).
+                collect(Collectors.toList());
+
+        System.out.println("visibleMethods(): " + visible);
+
+        verifyContains(visible, 1, "Two.m(java.lang.String)");
+        verifyContains(visible, 1, "One.m(java.lang.Object)");
+        verifyContains(visible, 0, "Super.m(java.lang.Object)");
+        verifyContains(visible, 0, "Super.m(java.lang.String)");
+        verifyContains(visible, 1, "Two.m1()", "One.m1()");
+
+        /*
+         * resume the target listening for events
+         */
+        listenUntilVMDisconnect();
+    }
+
+    private void verifyContains(List<String> methods, int matches,
+            String... sigs) throws Exception {
+        if (countMatches(methods, sigs) != matches) {
+            throw new Exception("visibleMethods() should have contained "
+                    + matches + " entry/entries from " + Arrays.toString(sigs));
+        }
+    }
+
+    private int countMatches(List<String> list1, String[] list2) {
+        int count = 0;
+        for (String s1 : list1) {
+            for (String s2 : list2) {
+                if (s1.equals(s2)) {
+                    count++;
+                }
+            }
+        }
+        return count;
+    }
+}
--- a/jdk/test/com/sun/security/auth/callback/DialogCallbackHandler/Default.java	Fri Dec 13 09:35:35 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2001, 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 4470717
- * @summary fix default handling and other misc
- *
- * @ignore run these by hand
- */
-
-import com.sun.security.auth.callback.DialogCallbackHandler;
-import javax.security.auth.callback.*;
-
-public class Default {
-   public static void main(String args[]) throws Exception {
-        DialogCallbackHandler h = new DialogCallbackHandler();
-        TextOutputCallback toc = new TextOutputCallback
-                        (TextOutputCallback.INFORMATION,
-                        "hello");
-        TextOutputCallback toc2 = new TextOutputCallback
-                        (TextOutputCallback.INFORMATION,
-                        "world");
-        ConfirmationCallback cc = new ConfirmationCallback
-                        ("Correct?",
-                        ConfirmationCallback.INFORMATION,
-                        ConfirmationCallback.YES_NO_OPTION,
-                        ConfirmationCallback.NO);
-
-        Callback[] callbacks = { toc, toc2, cc };
-        h.handle(callbacks);
-
-        if (cc.getSelectedIndex() == ConfirmationCallback.YES) {
-            System.out.println("yes");
-        } else {
-            System.out.println("no");
-        }
-
-        System.exit(0);
-   }
-}
--- a/jdk/test/com/sun/security/sasl/digest/NoQuoteParams.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/com/sun/security/sasl/digest/NoQuoteParams.java	Wed Jul 05 19:26:45 2017 +0200
@@ -43,8 +43,6 @@
 import javax.security.sasl.SaslException;
 import javax.security.sasl.SaslServer;
 import javax.security.auth.callback.CallbackHandler;
-import com.sun.security.auth.callback.DialogCallbackHandler;
-import com.sun.security.auth.callback.TextCallbackHandler;
 
 /*
  * According to RFC 2831, DIGEST-MD5 servers must generate challenge strings
--- a/jdk/test/java/lang/SecurityManager/NoAWT.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/lang/SecurityManager/NoAWT.java	Wed Jul 05 19:26:45 2017 +0200
@@ -22,9 +22,9 @@
  */
 
 /* @test
- * @bug 8004502 8008793
- * @summary Sanity check that SecurityManager methods that check AWTPermission
- *   behave as expected when AWT is not present
+ * @bug 8004502 8008793 8029886
+ * @summary Sanity check that SecurityManager methods that used to check
+ *          AWTPermission now check for AllPermission
  */
 
 import java.security.AllPermission;
@@ -33,9 +33,9 @@
 public class NoAWT {
 
     static class MySecurityManager extends SecurityManager {
-        Class<?> expectedClass;
+        final Class<?> expectedClass;
 
-        void setExpectedPermissionClass(Class<?> c) {
+        MySecurityManager(Class<?> c) {
             expectedClass = c;
         }
 
@@ -48,17 +48,7 @@
     }
 
     public static void main(String[] args) {
-        Class<?> awtPermissionClass = null;
-        try {
-            awtPermissionClass = Class.forName("java.awt.AWTPermission");
-        } catch (ClassNotFoundException ignore) { }
-
-        MySecurityManager sm = new MySecurityManager();
-        if (awtPermissionClass != null) {
-            sm.setExpectedPermissionClass(awtPermissionClass);
-        } else {
-            sm.setExpectedPermissionClass(AllPermission.class);
-        }
+        MySecurityManager sm = new MySecurityManager(AllPermission.class);
 
         try {
             sm.checkAwtEventQueueAccess();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/SetPropertiesNull.java	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * This class tests to see if the system property java.version is properly
+ * reinitialized after setting System.setProperties(null).
+ *
+ * @test
+ * @bug 8030781
+ * @summary Test for System.setProperties(null).
+ */
+
+public class SetPropertiesNull {
+
+    public static void main(String args[]) {
+        final String version = System.getProperty("java.version");
+        System.setProperties(null);
+        final String newVersion = System.getProperty("java.version");
+        if (!version.equals(newVersion)) {
+            throw new RuntimeException("java.version differs: '" + version + "'  '"
+                               + newVersion + "'");
+        }
+    }
+}
--- a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Wed Jul 05 19:26:45 2017 +0200
@@ -32,17 +32,21 @@
  *
  * @build LowMemoryTest MemoryUtil
  * @run main/othervm/timeout=600 LowMemoryTest
+ * @run main/othervm/timeout=600 -XX:+UseConcMarkSweepGC LowMemoryTest
+ * @run main/othervm/timeout=600 -XX:+UseParallelGC LowMemoryTest
+ * @run main/othervm/timeout=600 -XX:+UseSerialGC LowMemoryTest
  */
 
 import java.lang.management.*;
 import java.util.*;
+import java.util.concurrent.Phaser;
 import javax.management.*;
 import javax.management.openmbean.CompositeData;
 
 public class LowMemoryTest {
-    private static MemoryMXBean mm = ManagementFactory.getMemoryMXBean();
-    private static List pools = ManagementFactory.getMemoryPoolMXBeans();
-    private static List managers = ManagementFactory.getMemoryManagerMXBeans();
+    private static final MemoryMXBean mm = ManagementFactory.getMemoryMXBean();
+    private static final List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
+    private static final Phaser phaser = new Phaser(2);
     private static MemoryPoolMXBean mpool = null;
     private static boolean trace = false;
     private static boolean testFailed = false;
@@ -50,8 +54,9 @@
     private static final int NUM_CHUNKS = 2;
     private static long chunkSize;
 
-    private static boolean listenerInvoked = false;
+    private static volatile boolean listenerInvoked = false;
     static class SensorListener implements NotificationListener {
+        @Override
         public void handleNotification(Notification notif, Object handback) {
             String type = notif.getType();
             if (type.equals(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED) ||
@@ -69,8 +74,9 @@
 
     static class TestListener implements NotificationListener {
         private int triggers = 0;
-        private long[] count = new long[NUM_TRIGGERS * 2];
-        private long[] usedMemory = new long[NUM_TRIGGERS * 2];
+        private final long[] count = new long[NUM_TRIGGERS * 2];
+        private final long[] usedMemory = new long[NUM_TRIGGERS * 2];
+        @Override
         public void handleNotification(Notification notif, Object handback) {
             MemoryNotificationInfo minfo = MemoryNotificationInfo.
                 from((CompositeData) notif.getUserData());
@@ -148,15 +154,20 @@
                 newThreshold);
         }
 
+
         allocator.start();
+        // Force Allocator start first
+        phaser.arriveAndAwaitAdvance();
         sweeper.start();
 
+
         try {
             allocator.join();
+            // Wait until AllocatorThread's done
+            phaser.arriveAndAwaitAdvance();
             sweeper.join();
         } catch (InterruptedException e) {
-            e.printStackTrace();
-            System.out.println("Unexpected exception.");
+            System.out.println("Unexpected exception:" + e);
             testFailed = true;
         }
 
@@ -173,45 +184,17 @@
         try {
             Thread.sleep(ms);
         } catch (InterruptedException e) {
-            e.printStackTrace();
-            System.out.println("Unexpected exception.");
+            System.out.println("Unexpected exception:" + e);
             testFailed = true;
         }
     }
 
-    private static Object go = new Object();
-    private static boolean waiting = false; // No thread is waiting.
-
-    // Synchronizes two thread. If no thread is waiting then wait
-    // for notification from a different thread  and if it is
-    // is waiting then send notification.
-    // In this test case this method is used to synchronize sweeper
-    // thread and alocater thread to reach a particular point.
-    private static void wait_or_notify() {
-        synchronized (go) {
-            if (waiting == false) {
-                waiting = true;
-                System.out.println(" Waiting ");
-                try {
-                    go.wait();
-                } catch (InterruptedException e) {
-                    e.printStackTrace();
-                    testFailed = true;
-                }
-                waiting = false;
-            } else {
-                System.out.println(" Notify ");
-                go.notify();
-            }
-        }
-    }
-
-    private static List objectPool = new ArrayList();
+    private static final List<Object> objectPool = new ArrayList<>();
     static class AllocatorThread extends Thread {
         public void doTask() {
             int iterations = 0;
             int numElements = (int) (chunkSize / 4); // minimal object size
-            while (!listenerInvoked) {
+            while (!listenerInvoked || mpool.getUsage().getUsed() < mpool.getUsageThreshold()) {
                 iterations++;
                 if (trace) {
                     System.out.println("   Iteration " + iterations +
@@ -234,23 +217,25 @@
                 goSleep(100);
             }
         }
+        @Override
         public void run() {
             for (int i = 1; i <= NUM_TRIGGERS; i++) {
-                System.out.println("AllocatorThread is doing task " + i);
+                // Sync with SweeperThread's second phase.
+                phaser.arriveAndAwaitAdvance();
+                System.out.println("AllocatorThread is doing task " + i +
+                    " phase " + phaser.getPhase());
                 doTask();
-                synchronized (sweep) {
-                    sweep.notify();
+                // Sync with SweeperThread's first phase.
+                phaser.arriveAndAwaitAdvance();
+                System.out.println("AllocatorThread done task " + i +
+                    " phase " + phaser.getPhase());
+                if (testFailed) {
+                    return;
                 }
-                // System.out.print(" Allocater Thread ");
-                // If sweeper thread is waiting then send notify
-                // else wait for notification from sweeper thread.
-                wait_or_notify();
-                if (testFailed) return;
             }
         }
     }
 
-    private static Object sweep = new Object();
     static class SweeperThread extends Thread {
         private void doTask() {
             for (; mpool.getUsage().getUsed() >=
@@ -261,28 +246,21 @@
                 goSleep(100);
             }
         }
+        @Override
         public void run() {
             for (int i = 1; i <= NUM_TRIGGERS; i++) {
-                synchronized (sweep) {
-                    while (!listenerInvoked) {
-                        try {
-                            sweep.wait();
-                        } catch (InterruptedException e) {
-                            e.printStackTrace();
-                            System.out.println("Unexpected exception.");
-                            testFailed = true;
-                        }
-                    }
-                }
-                System.out.println("SweepThread is doing task " + i);
+                // Sync with AllocatorThread's first phase.
+                phaser.arriveAndAwaitAdvance();
+                System.out.println("SweepThread is doing task " + i +
+                    " phase " + phaser.getPhase());
                 doTask();
 
                 listenerInvoked = false;
 
-                // System.out.print(" Sweeper Thread ");
-                // If Allocater thread is waiting wait send notify
-                // else wait for notfication from allocater thread.
-                wait_or_notify();
+                // Sync with AllocatorThread's second phase.
+                phaser.arriveAndAwaitAdvance();
+                System.out.println("SweepThread done task " + i +
+                    " phase " + phaser.getPhase());
                 if (testFailed) return;
             }
         }
--- a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTestConcMarkSweepGC.sh	Fri Dec 13 09:35:35 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-#
-# Copyright (c) 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.
-#
-# 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     4530538
-# @summary Test LowMemoryTest with concurrent mark sweep GC
-# @author  Mandy Chung
-#
-# @run build LowMemoryTest
-# @run shell/timeout=600 LowMemoryTestConcMarkSweepGC.sh
-#
-
-#Set appropriate jdk
-
-if [ ! -z "${TESTJAVA}" ] ; then
-     jdk="$TESTJAVA"
-else
-     echo "--Error: TESTJAVA must be defined as the pathname of a jdk to test."
-     exit 1
-fi
-
-runOne()
-{ 
-   echo "runOne $@"
-   $TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES $@ || exit 2
-}
-
-# Test LowMemoryTest with concurrent collector
-runOne -XX:+UseConcMarkSweepGC LowMemoryTest 
-
-exit 0
--- a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTestParallelGC.sh	Fri Dec 13 09:35:35 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-#
-# Copyright (c) 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.
-#
-# 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     4530538
-# @summary Test LowMemoryTest with parallel GC
-# @author  Mandy Chung
-#
-# @run build LowMemoryTest
-# @run shell/timeout=600 LowMemoryTestParallelGC.sh
-#
-
-#Set appropriate jdk
-
-if [ ! -z "${TESTJAVA}" ] ; then
-     jdk="$TESTJAVA"
-else
-     echo "--Error: TESTJAVA must be defined as the pathname of a jdk to test."
-     exit 1
-fi
-
-runOne()
-{ 
-   echo "runOne $@"
-   $TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES $@ || exit 2
-}
-
-# Test LowMemoryTest with parallel scavenger collector
-runOne -XX:+UseParallelGC LowMemoryTest 
-
-exit 0
--- a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTestSerialGC.sh	Fri Dec 13 09:35:35 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-#
-# Copyright (c) 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.
-#
-# 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     4530538
-# @summary Test LowMemoryTest with Serial GC
-# @author  Mandy Chung
-#
-# @run build LowMemoryTest
-# @run shell/timeout=600 LowMemoryTestSerialGC.sh
-#
-
-#Set appropriate jdk
-
-if [ ! -z "${TESTJAVA}" ] ; then
-     jdk="$TESTJAVA"
-else
-     echo "--Error: TESTJAVA must be defined as the pathname of a jdk to test."
-     exit 1
-fi
-
-runOne()
-{ 
-   echo "runOne $@"
-   $TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES $@ || exit 2
-}
-
-# Test LowMemoryTest with serial collector
-runOne -XX:+UseSerialGC LowMemoryTest 
-
-exit 0
--- a/jdk/test/java/lang/management/ThreadMXBean/ThreadBlockedCount.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadBlockedCount.java	Wed Jul 05 19:26:45 2017 +0200
@@ -26,56 +26,55 @@
  * @bug     4530538
  * @summary Basic unit test of ThreadInfo.getBlockedCount()
  * @author  Alexei Guibadoulline and Mandy Chung
+ * @author  Jaroslav Bachorik
  *
- * @build ThreadExecutionSynchronizer
  * @run main ThreadBlockedCount
  */
 
 import java.lang.management.*;
+import java.util.concurrent.Phaser;
 
 public class ThreadBlockedCount {
     final static long EXPECTED_BLOCKED_COUNT = 3;
     final static int  DEPTH = 10;
-    private static ThreadMXBean mbean
+    private static final ThreadMXBean mbean
         = ManagementFactory.getThreadMXBean();
 
-    private static Object a = new Object();
-    private static Object b = new Object();
-    private static Object c = new Object();
-    private static boolean aNotified = false;
-    private static boolean bNotified = false;
-    private static boolean cNotified = false;
-    private static Object blockedObj1 = new Object();
-    private static Object blockedObj2 = new Object();
-    private static Object blockedObj3 = new Object();
-    private static volatile boolean testFailed = false;
+    private static final Object a = new Object();
+    private static final Object b = new Object();
+    private static final Object c = new Object();
+
+    private static final Object blockedObj1 = new Object();
+    private static final Object blockedObj2 = new Object();
+    private static final Object blockedObj3 = new Object();
+    private static volatile boolean testOk = false;
     private static BlockingThread blocking;
     private static BlockedThread blocked;
-    private static ThreadExecutionSynchronizer thrsync;
 
 
 
     public static void main(String args[]) throws Exception {
-        // Create the BlockingThread before BlockedThread
-        // to make sure BlockingThread enter the lock before BlockedThread
-        thrsync = new ThreadExecutionSynchronizer();
+        final Phaser p = new Phaser(2);
 
-        blocking = new BlockingThread();
+        blocking = new BlockingThread(p);
         blocking.start();
 
-        blocked = new BlockedThread();
+        blocked = new BlockedThread(p);
         blocked.start();
 
         try {
             blocking.join();
-            blocked.join();
+
+            testOk = checkBlocked();
+            p.arriveAndAwaitAdvance(); // #5
+
         } catch (InterruptedException e) {
             System.err.println("Unexpected exception.");
             e.printStackTrace(System.err);
             throw e;
         }
 
-        if (testFailed) {
+        if (!testOk) {
             throw new RuntimeException("TEST FAILED.");
         }
         System.out.println("Test passed.");
@@ -83,29 +82,19 @@
 
 
     static class BlockedThread extends Thread {
-        // NOTE: We can't use a.wait() here because wait() call is counted
-        // as blockedCount.  Instead, we use a boolean flag and sleep.
-        //
+        private final Phaser p;
+
+        BlockedThread(Phaser p) {
+            super("BlockedThread");
+            this.p = p;
+        }
+
         public void run() {
-            // wait Blocking thread
-            thrsync.signal();
+            p.arriveAndAwaitAdvance(); // #1
 
             // Enter lock a without blocking
             synchronized (a) {
-                // wait until BlockingThread holds blockedObj1
-                while (!aNotified) {
-                    try {
-                        Thread.sleep(50);
-                    } catch (InterruptedException e) {
-                        System.err.println("Unexpected exception.");
-                        e.printStackTrace(System.err);
-                        testFailed = true;
-                        break;
-                    }
-                }
-
-                // signal BlockingThread.
-                thrsync.signal();
+                p.arriveAndAwaitAdvance(); // #2
 
                 // Block to enter blockedObj1
                 // blockedObj1 should be owned by BlockingThread
@@ -114,25 +103,10 @@
                 }
             }
 
-            // signal BlockingThread.
-            thrsync.signal();
-
             // Enter lock a without blocking
             synchronized (b) {
                 // wait until BlockingThread holds blockedObj2
-                while (!bNotified) {
-                    try {
-                        Thread.sleep(50);
-                    } catch (InterruptedException e) {
-                        System.err.println("Unexpected exception.");
-                        e.printStackTrace(System.err);
-                        testFailed = true;
-                        break;
-                    }
-                }
-
-                // signal BlockingThread.
-                thrsync.signal();
+                p.arriveAndAwaitAdvance(); // #3
 
                 // Block to enter blockedObj2
                 // blockedObj2 should be owned by BlockingThread
@@ -141,25 +115,10 @@
                 }
             }
 
-            // signal BlockingThread.
-            thrsync.signal();
-
             // Enter lock a without blocking
             synchronized (c) {
                 // wait until BlockingThread holds blockedObj3
-                while (!cNotified) {
-                    try {
-                        Thread.sleep(50);
-                    } catch (InterruptedException e) {
-                        System.err.println("Unexpected exception.");
-                        e.printStackTrace(System.err);
-                        testFailed = true;
-                        break;
-                    }
-                }
-
-                // signal BlockingThread.
-                thrsync.signal();
+                p.arriveAndAwaitAdvance(); // #4
 
                 // Block to enter blockedObj3
                 // blockedObj3 should be owned by BlockingThread
@@ -168,35 +127,23 @@
                 }
             }
 
-            // wait for the thread stats to be updated for 10 seconds
-            for (int i = 0; i < 100; i++) {
-                if (getBlockedCount() == EXPECTED_BLOCKED_COUNT) {
-                    return;
-                }
-                try {
-                    Thread.sleep(100);
-                } catch (InterruptedException e) {
-                    System.err.println("Unexpected exception.");
-                    e.printStackTrace(System.err);
-                    testFailed = true;
-                    return;
-                }
-            }
-            long count = getBlockedCount();
-            if (count != EXPECTED_BLOCKED_COUNT) {
-                System.err.println("TEST FAILED: Blocked thread has " + count +
-                                    " blocked counts. Expected " +
-                                    EXPECTED_BLOCKED_COUNT);
-                testFailed = true;
-            }
+            // wait for the main thread to check the blocked count
+            p.arriveAndAwaitAdvance(); // #5
+            // ... and we can leave now
         } // run()
-    } // BlockingThread
+    } // BlockedThread
 
     static class BlockingThread extends Thread {
-        private void waitForSignalToRelease() {
+        private final Phaser p;
 
+        BlockingThread(Phaser p) {
+            super("BlockingThread");
+            this.p = p;
+        }
+
+        private void waitForBlocked() {
             // wait for BlockedThread.
-            thrsync.waitForSignal();
+            p.arriveAndAwaitAdvance();
 
             boolean threadBlocked = false;
             while (!threadBlocked) {
@@ -206,7 +153,7 @@
                 } catch (InterruptedException e) {
                     System.err.println("Unexpected exception.");
                     e.printStackTrace(System.err);
-                    testFailed = true;
+                    testOk = false;
                     break;
                 }
                 ThreadInfo info = mbean.getThreadInfo(blocked.getId());
@@ -215,44 +162,55 @@
         }
 
         public void run() {
-            // wait for BlockedThread.
-            thrsync.waitForSignal();
+            p.arriveAndAwaitAdvance(); // #1
 
             synchronized (blockedObj1) {
                 System.out.println("BlockingThread attempts to notify a");
-                aNotified = true;
-                waitForSignalToRelease();
+                waitForBlocked(); // #2
             }
 
-            // wait for BlockedThread.
-            thrsync.waitForSignal();
-
             // block until BlockedThread is ready
             synchronized (blockedObj2) {
                 System.out.println("BlockingThread attempts to notify b");
-                bNotified = true;
-                waitForSignalToRelease();
+                waitForBlocked(); // #3
             }
 
-            // wait for BlockedThread.
-            thrsync.waitForSignal();
-
             // block until BlockedThread is ready
             synchronized (blockedObj3) {
                 System.out.println("BlockingThread attempts to notify c");
-                cNotified = true;
-                waitForSignalToRelease();
+                waitForBlocked(); // #4
             }
 
         } // run()
-    } // BlockedThread
+    } // BlockingThread
 
     private static long getBlockedCount() {
         long count;
         // Check the mbean now
-        ThreadInfo ti = mbean.getThreadInfo(Thread.currentThread().
-                getId());
+        ThreadInfo ti = mbean.getThreadInfo(blocked.getId());
         count = ti.getBlockedCount();
         return count;
     }
+
+    private static boolean checkBlocked() {
+        // wait for the thread stats to be updated for 10 seconds
+        long count = -1;
+        for (int i = 0; i < 100; i++) {
+            count = getBlockedCount();
+            if (count == EXPECTED_BLOCKED_COUNT) {
+                return true;
+            }
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+                System.err.println("Unexpected exception.");
+                e.printStackTrace(System.err);
+                return false;
+            }
+        }
+        System.err.println("TEST FAILED: Blocked thread has " + count +
+                            " blocked counts. Expected " +
+                            EXPECTED_BLOCKED_COUNT);
+        return false;
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLPermission/OpenURL.java	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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 8029354
+ * @run main/othervm OpenURL
+ */
+
+import java.net.*;
+import java.io.*;
+
+public class OpenURL {
+
+    public static void main (String[] args) throws Exception {
+
+        System.setSecurityManager(new SecurityManager());
+
+        try {
+            URL url = new URL ("http://joe@127.0.0.1/a/b");
+            HttpURLConnection urlc = (HttpURLConnection)url.openConnection();
+            InputStream is = urlc.getInputStream();
+            // error will throw exception other than SecurityException
+        } catch (SecurityException e) {
+            System.out.println("OK");
+        }
+    }
+}
--- a/jdk/test/java/net/URLPermission/URLPermissionTest.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/net/URLPermission/URLPermissionTest.java	Wed Jul 05 19:26:45 2017 +0200
@@ -26,7 +26,7 @@
 
 /**
  * @test
- * @bug 8010464 8027570 8027687
+ * @bug 8010464 8027570 8027687 8029354
  */
 
 public class URLPermissionTest {
@@ -37,7 +37,30 @@
         abstract boolean execute();
     };
 
+    // Instantiation: should succeed
+    static class CreateTest extends Test {
+        String arg;
+        CreateTest(String arg) {
+            this.arg = arg;
+        }
+
+        @Override
+        boolean execute() {
+            try {
+                URLPermission p = new URLPermission(arg);
+                return true;
+            } catch (Exception e) {
+                return false;
+            }
+        }
+    };
+
+    static CreateTest createtest(String arg) {
+        return new CreateTest(arg);
+    }
+
     // Should throw an IAE on construction
+
     static class ExTest extends Test {
         String arg;
         ExTest(String arg) {
@@ -262,6 +285,7 @@
         imtest("https://www.foo.com/a/b", "https://www.foo.com:443/a/b", true),
         imtest("https://www.foo.com:200-500/a/b", "https://www.foo.com/a/b", true),
         imtest("http://www.foo.com:*/a/b", "http://www.foo.com:1-12345/a/b", true),
+        imtest("http://host/a/b", "http://HOST/a/b", true),
 
         // misc
         imtest("https:*", "http://www.foo.com", false),
@@ -297,6 +321,16 @@
         eqtest("http://www.foo.com/a/b", "http://www.foo.com:82/a/b", false),
         eqtest("https://www.foo.com/a/b", "https://www.foo.com:443/a/b", true),
         eqtest("https://www.foo.com/a/b", "https://www.foo.com:444/a/b", false),
+        eqtest("http://michael@foo.com/bar","http://michael@foo.com/bar", true),
+        eqtest("http://Michael@foo.com/bar","http://michael@goo.com/bar",false),
+        eqtest("http://michael@foo.com/bar","http://george@foo.com/bar", true),
+        eqtest("http://@foo.com/bar","http://foo.com/bar", true)
+    };
+
+    static Test[] createTests = {
+        createtest("http://user@foo.com/a/b/c"),
+        createtest("http://user:pass@foo.com/a/b/c"),
+        createtest("http://user:@foo.com/a/b/c")
     };
 
     static boolean failed = false;
@@ -386,6 +420,17 @@
             }
         }
 
+        for (int i=0; i<createTests.length; i++) {
+            CreateTest test = (CreateTest)createTests[i];
+            boolean result = test.execute();
+            if (!result) {
+                System.out.println ("test failed: " + test.arg);
+                failed = true;
+            } else {
+                System.out.println ("create test " + i + " OK");
+            }
+        }
+
         for (int i=0; i<actionImplies.length ; i++) {
             ActionImpliesTest test = (ActionImpliesTest)actionImplies[i];
             Exception caught = null;
--- a/jdk/test/java/nio/Buffer/Chars.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/nio/Buffer/Chars.java	Wed Jul 05 19:26:45 2017 +0200
@@ -51,8 +51,8 @@
      */
     static CharBuffer randomizeRange(CharBuffer cb) {
         int mid = cb.capacity() >>> 1;
-        int start = RAND.nextInt(mid);
-        int end = mid + RAND.nextInt(mid);
+        int start = RAND.nextInt(mid + 1); // from 0 to mid
+        int end = mid + RAND.nextInt(cb.capacity() - mid + 1); // from mid to capacity
         cb.position(start);
         cb.limit(end);
         return cb;
--- a/jdk/test/java/nio/channels/AsynchronousChannelGroup/Basic.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/nio/channels/AsynchronousChannelGroup/Basic.java	Wed Jul 05 19:26:45 2017 +0200
@@ -24,8 +24,6 @@
 /* @test
  * @bug 4607272
  * @summary Unit test for AsynchronousChannelGroup
- * @build Basic
- * @run main/othervm -XX:-UseVMInterruptibleIO Basic
  */
 
 import java.nio.ByteBuffer;
@@ -37,12 +35,9 @@
 
 public class Basic {
     static final Random rand = new Random();
-    static final ThreadFactory threadFactory = new ThreadFactory() {
-        @Override
-        public Thread newThread(final Runnable r) {
-            return new Thread(r);
-        }};
-
+    static final ThreadFactory threadFactory = (Runnable r) -> {
+        return new Thread(r);
+    };
 
     public static void main(String[] args) throws Exception {
         shutdownTests();
@@ -51,6 +46,12 @@
         miscTests();
     }
 
+    static void awaitTermination(AsynchronousChannelGroup group) throws InterruptedException {
+        boolean terminated = group.awaitTermination(20, TimeUnit.SECONDS);
+        if (!terminated)
+            throw new RuntimeException("Group should have terminated");
+    }
+
     static void testShutdownWithNoChannels(ExecutorService pool,
                                            AsynchronousChannelGroup group)
         throws Exception
@@ -59,9 +60,7 @@
         if (!group.isShutdown())
             throw new RuntimeException("Group should be shutdown");
         // group should terminate quickly
-        boolean terminated = group.awaitTermination(3, TimeUnit.SECONDS);
-        if (!terminated)
-            throw new RuntimeException("Group should have terminated");
+        awaitTermination(group);
         if (pool != null && !pool.isTerminated())
             throw new RuntimeException("Executor should have terminated");
     }
@@ -86,9 +85,7 @@
         ch.close();
 
         // group should terminate quickly
-        boolean terminated = group.awaitTermination(3, TimeUnit.SECONDS);
-        if (!terminated)
-            throw new RuntimeException("Group should have terminated");
+        awaitTermination(group);
         if (pool != null && !pool.isTerminated())
             throw new RuntimeException("Executor should have terminated");
     }
@@ -153,9 +150,8 @@
         if (ch.isOpen())
             throw new RuntimeException("Channel should be closed");
 
-        boolean terminated = group.awaitTermination(3, TimeUnit.SECONDS);
-        if (!terminated)
-            throw new RuntimeException("Group should have terminated");
+        awaitTermination(group);
+
         if (pool != null && !pool.isTerminated())
             throw new RuntimeException("Executor should have terminated");
     }
@@ -260,9 +256,7 @@
         // close channel; group should terminate quickly
         ch.close();
         listener.close();
-        terminated = group.awaitTermination(3, TimeUnit.SECONDS);
-        if (!terminated)
-            throw new RuntimeException("Group should have terminated");
+        awaitTermination(group);
     }
 
     static void miscTests() throws Exception {
--- a/jdk/test/java/nio/channels/AsynchronousChannelGroup/GroupOfOne.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/nio/channels/AsynchronousChannelGroup/GroupOfOne.java	Wed Jul 05 19:26:45 2017 +0200
@@ -136,7 +136,7 @@
 
         // clean-up
         group.shutdown();
-        boolean terminated = group.awaitTermination(5, TimeUnit.SECONDS);
+        boolean terminated = group.awaitTermination(20, TimeUnit.SECONDS);
         if (!terminated)
             throw new RuntimeException("Group did not terminate");
 
--- a/jdk/test/java/nio/channels/AsynchronousChannelGroup/Restart.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/nio/channels/AsynchronousChannelGroup/Restart.java	Wed Jul 05 19:26:45 2017 +0200
@@ -24,8 +24,6 @@
 /* @test
  * @bug 4607272 6842687
  * @summary Unit test for AsynchronousChannelGroup
- * @build Restart
- * @run main/othervm -XX:-UseVMInterruptibleIO Restart
  */
 
 import java.nio.channels.*;
--- a/jdk/test/java/nio/channels/Selector/ByteServer.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/nio/channels/Selector/ByteServer.java	Wed Jul 05 19:26:45 2017 +0200
@@ -22,52 +22,54 @@
  */
 
 /**
- *
- * Utility class for tests. A simple server, which waits for a connection,
- * writes out n bytes and waits.
+ * Utility class for tests. A simple "in-thread" server to accept connections
+ * and write bytes.
  * @author kladko
  */
 
 import java.net.Socket;
 import java.net.ServerSocket;
-
-public class ByteServer {
+import java.net.SocketAddress;
+import java.net.InetSocketAddress;
+import java.io.IOException;
+import java.io.Closeable;
 
-    public static final String LOCALHOST = "localhost";
-    private int bytecount;
-    private Socket  socket;
-    private ServerSocket  serversocket;
-    private Thread serverthread;
-    volatile Exception savedException;
+public class ByteServer implements Closeable {
 
-    public ByteServer(int bytecount) throws Exception{
-        this.bytecount = bytecount;
-        serversocket = new ServerSocket(0);
+    private final ServerSocket ss;
+    private Socket s;
+
+    ByteServer() throws IOException {
+        this.ss = new ServerSocket(0);
     }
 
-    public int port() {
-        return serversocket.getLocalPort();
+    SocketAddress address() {
+        return new InetSocketAddress(ss.getInetAddress(), ss.getLocalPort());
     }
 
-    public void start() {
-        serverthread = new Thread() {
-            public void run() {
-                try {
-                    socket = serversocket.accept();
-                    socket.getOutputStream().write(new byte[bytecount]);
-                    socket.getOutputStream().flush();
-                } catch (Exception e) {
-                    System.err.println("Exception in ByteServer: " + e);
-                    System.exit(1);
-                }
-            }
-        };
-        serverthread.start();
+    void acceptConnection() throws IOException {
+        if (s != null)
+            throw new IllegalStateException("already connected");
+        this.s = ss.accept();
     }
 
-    public void exit() throws Exception {
-        serverthread.join();
-        socket.close();
-        serversocket.close();
+    void closeConnection() throws IOException {
+        Socket s = this.s;
+        if (s != null) {
+            this.s = null;
+            s.close();
+        }
+    }
+
+    void write(int count) throws IOException {
+        if (s == null)
+            throw new IllegalStateException("no connection");
+        s.getOutputStream().write(new byte[count]);
+    }
+
+    public void close() throws IOException {
+        if (s != null)
+            s.close();
+        ss.close();
     }
 }
--- a/jdk/test/java/nio/channels/Selector/ReadAfterConnect.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/nio/channels/Selector/ReadAfterConnect.java	Wed Jul 05 19:26:45 2017 +0200
@@ -27,27 +27,25 @@
  * @author kladko
  */
 
-import java.net.*;
-import java.nio.*;
-import java.nio.channels.*;
+import java.nio.channels.Selector;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.SocketChannel;
 
 public class ReadAfterConnect {
+    public static void main(String[] argv) throws Exception {
+        try (ByteServer server = new ByteServer();
+             SocketChannel sc = SocketChannel.open(server.address())) {
 
-    public static void main(String[] argv) throws Exception {
-        ByteServer server = new ByteServer(0); // server: accept connection and do nothing
-        server.start();
-        InetSocketAddress isa = new InetSocketAddress(
-                InetAddress.getByName(ByteServer.LOCALHOST), server.port());
-        Selector sel = Selector.open();
-        SocketChannel sc = SocketChannel.open();
-        sc.connect(isa);
-        sc.configureBlocking(false);
-        sc.register(sel, SelectionKey.OP_READ);
-        // Previously channel would get selected here, although there is nothing to read
-        if (sel.selectNow() != 0)
-            throw new Exception("Select returned nonzero value");
-        sc.close();
-        server.exit();
+            server.acceptConnection();
+
+            try (Selector sel = Selector.open()) {
+                sc.configureBlocking(false);
+                sc.register(sel, SelectionKey.OP_READ);
+                // Previously channel would get selected here, although there is nothing to read
+                if (sel.selectNow() != 0)
+                    throw new Exception("Select returned nonzero value");
+            }
+        }
     }
 
 }
--- a/jdk/test/java/nio/channels/Selector/SelectAfterRead.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/nio/channels/Selector/SelectAfterRead.java	Wed Jul 05 19:26:45 2017 +0200
@@ -28,60 +28,62 @@
  * @author kladko
  */
 
-import java.net.*;
-import java.nio.*;
-import java.nio.channels.*;
+import java.nio.ByteBuffer;
+import java.nio.channels.Selector;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.SocketChannel;
 
 public class SelectAfterRead {
 
-    final static int TIMEOUT = 1000;
+    private static final int TIMEOUT = 1000;
 
     public static void main(String[] argv) throws Exception {
-        InetAddress lh = InetAddress.getByName(ByteServer.LOCALHOST);
 
         // server: accept connection and write one byte
-        ByteServer server = new ByteServer(1);
-        server.start();
-        Selector sel = Selector.open();
-        SocketChannel sc = SocketChannel.open();
-        sc.connect(new InetSocketAddress(lh, server.port()));
-        sc.read(ByteBuffer.allocate(1));
-        sc.configureBlocking(false);
-        sc.register(sel, SelectionKey.OP_READ);
-        // previously on Windows select would select channel here, although there was
-        // nothing to read
-        if (sel.selectNow() != 0)
-            throw new Exception("Select returned nonzero value");
-        sc.close();
-        sel.close();
-        server.exit();
+        try (ByteServer server = new ByteServer();
+             SocketChannel sc = SocketChannel.open(server.address())) {
+
+            server.acceptConnection();
+            server.write(1);
+
+            try (Selector sel = Selector.open()) {
+                sc.read(ByteBuffer.allocate(1));
+                sc.configureBlocking(false);
+                sc.register(sel, SelectionKey.OP_READ);
+                // previously on Windows select would select channel here, although there was
+                // nothing to read
+                if (sel.selectNow() != 0)
+                    throw new Exception("Select returned nonzero value");
+            }
+        }
 
         // Now we will test a two reads combination
         // server: accept connection and write two bytes
-        server = new ByteServer(2);
-        server.start();
-        sc = SocketChannel.open();
-        sc.connect(new InetSocketAddress(lh, server.port()));
-        sc.configureBlocking(false);
-        sel = Selector.open();
-        sc.register(sel, SelectionKey.OP_READ);
-        if (sel.select(TIMEOUT) != 1)
-            throw new Exception("One selected key expected");
-        sel.selectedKeys().clear();
-        // previously on Windows a channel would get selected only once
-        if (sel.selectNow() != 1)
-            throw new Exception("One selected key expected");
-        // Previously on Windows two consequent reads would cause select()
-        // to select a channel, although there was nothing remaining to
-        // read in the channel
-        if (sc.read(ByteBuffer.allocate(1)) != 1)
-            throw new Exception("One byte expected");
-        if (sc.read(ByteBuffer.allocate(1)) != 1)
-            throw new Exception("One byte expected");
-        if (sel.selectNow() != 0)
-            throw new Exception("Select returned nonzero value");
-        sc.close();
-        sel.close();
-        server.exit();
+        try (ByteServer server = new ByteServer();
+             SocketChannel sc = SocketChannel.open(server.address())) {
+
+            server.acceptConnection();
+            server.write(2);
+
+            try (Selector sel = Selector.open()) {
+                sc.configureBlocking(false);
+                sc.register(sel, SelectionKey.OP_READ);
+                if (sel.select(TIMEOUT) != 1)
+                    throw new Exception("One selected key expected");
+                sel.selectedKeys().clear();
+                // previously on Windows a channel would get selected only once
+                if (sel.selectNow() != 1)
+                    throw new Exception("One selected key expected");
+                // Previously on Windows two consequent reads would cause select()
+                // to select a channel, although there was nothing remaining to
+                // read in the channel
+                if (sc.read(ByteBuffer.allocate(1)) != 1)
+                    throw new Exception("One byte expected");
+                if (sc.read(ByteBuffer.allocate(1)) != 1)
+                    throw new Exception("One byte expected");
+                if (sel.selectNow() != 0)
+                    throw new Exception("Select returned nonzero value");
+            }
+        }
     }
 }
--- a/jdk/test/java/nio/channels/Selector/SelectWrite.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/nio/channels/Selector/SelectWrite.java	Wed Jul 05 19:26:45 2017 +0200
@@ -22,36 +22,33 @@
  */
 
 /* @test
-   @bug 4645302
-   @summary Socket with OP_WRITE would get selected only once
-   @author kladko
+ * @bug 4645302
+ * @summary Socket with OP_WRITE would get selected only once
+ * @author kladko
  */
 
-import java.net.*;
-import java.nio.*;
-import java.nio.channels.*;
-
+import java.nio.channels.Selector;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.SocketChannel;
 
 public class SelectWrite {
 
     public static void main(String[] argv) throws Exception {
-        ByteServer server = new ByteServer(0);
-        // server: accept connection and do nothing
-        server.start();
-        InetSocketAddress isa = new InetSocketAddress(
-                InetAddress.getByName(ByteServer.LOCALHOST), server.port());
-        Selector sel = Selector.open();
-        SocketChannel sc = SocketChannel.open();
-        sc.connect(isa);
-        sc.configureBlocking(false);
-        sc.register(sel, SelectionKey.OP_WRITE);
-        sel.select();
-        sel.selectedKeys().clear();
-        if (sel.select() == 0) {
-            throw new Exception("Select returned zero");
+        try (ByteServer server = new ByteServer();
+             SocketChannel sc = SocketChannel.open(server.address())) {
+
+            server.acceptConnection();
+
+            try (Selector sel = Selector.open()) {
+                sc.configureBlocking(false);
+                sc.register(sel, SelectionKey.OP_WRITE);
+                sel.select();
+                sel.selectedKeys().clear();
+                if (sel.select() == 0) {
+                    throw new Exception("Select returned zero");
+                }
+            }
         }
-        sc.close();
-        sel.close();
     }
 
 }
--- a/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java	Wed Jul 05 19:26:45 2017 +0200
@@ -145,7 +145,9 @@
              * activation group's process hasn't gone away.
              */
             System.err.println("Ping unicast object for existence");
-            for (int i = 0; i < 10; i++) {
+            // set timeout 5 seconds
+            final long stopTime = System.currentTimeMillis() + 5000;
+            while (System.currentTimeMillis() < stopTime) {
                 unicastObj.ping();
                 Thread.sleep(500);
             }
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/Main.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/Main.java	Wed Jul 05 19:26:45 2017 +0200
@@ -43,10 +43,13 @@
  * @build bench.serial.ReplaceTrees bench.serial.ShortArrays
  * @build bench.serial.Shorts bench.serial.SmallObjTrees
  * @build bench.serial.StreamBuffer bench.serial.Strings
- * @run main/othervm/timeout=1800 bench.serial.Main -c jtreg-config
+ * @run main/othervm/timeout=1800 -Xss2m bench.serial.Main -c jtreg-config
  * @author Mike Warres, Nigel Daley
  */
 
+// The -Xss2m supplies additional stack space, as bench.serial.ClassDesc
+// consumes a considerable amount of stack.
+
 package bench.serial;
 
 import bench.ConfigFormatException;
--- a/jdk/test/java/rmi/reliability/juicer/ApplicationServer.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/rmi/reliability/juicer/ApplicationServer.java	Wed Jul 05 19:26:45 2017 +0200
@@ -21,6 +21,7 @@
  * questions.
  */
 
+import java.rmi.NotBoundException;
 import java.rmi.RemoteException;
 import java.rmi.registry.Registry;
 import java.rmi.registry.LocateRegistry;
@@ -60,27 +61,29 @@
      * On initialization, export remote objects and register
      * them with server.
      */
+    @Override
     public void run() {
         try {
             int i = 0;
 
             /*
-             * Locate apple user object in registry.  The lookup will
-             * occur until it is successful or fails LOOKUP_ATTEMPTS times.
+             * Locate apple user object in registry.  The lookup will occur
+             * every 5 seconds until it is successful or timeout 50 seconds.
              * These repeated attempts allow the ApplicationServer
              * to be started before the AppleUserImpl.
              */
             Exception exc = null;
-            for (i = 0; i < LOOKUP_ATTEMPTS; i++) {
+            long stopTime = System.currentTimeMillis() + LOOKUP_ATTEMPTS * 10000;
+            while (System.currentTimeMillis() < stopTime) {
                 try {
                     Registry registry = LocateRegistry.getRegistry(
-                           registryHost, registryPort);
+                            registryHost, registryPort);
                     user = (AppleUser) registry.lookup("AppleUser");
                     user.startTest();
                     break; //successfully obtained AppleUser
-                } catch (Exception e) {
+                } catch (RemoteException | NotBoundException e) {
                     exc = e;
-                    Thread.sleep(10000); //sleep 10 seconds and try again
+                    Thread.sleep(5000); //sleep 5 seconds and try again
                 }
             }
             if (user == null) {
@@ -113,9 +116,8 @@
                 logger.log(Level.SEVERE,
                     "Failed to register callbacks for " + apples[i] + ":", e);
                 user.reportException(e);
-                return;
             }
-        } catch (Exception e) {
+        } catch (InterruptedException | RemoteException e) {
             logger.log(Level.SEVERE, "Unexpected exception:", e);
         }
     }
@@ -143,17 +145,22 @@
         try {
             for (int i = 0; i < args.length ; i++ ) {
                 String arg = args[i];
-                if (arg.equals("-numApples")) {
-                    i++;
-                    num = Integer.parseInt(args[i]);
-                } else if (arg.equals("-registryHost")) {
-                    i++;
-                    host = args[i];
-                } else if (arg.equals("-registryPort")) {
-                    i++;
-                    port = Integer.parseInt(args[i]);
-                } else {
-                    usage();
+                switch (arg) {
+                    case "-numApples":
+                        i++;
+                        num = Integer.parseInt(args[i]);
+                        break;
+                    case "-registryHost":
+                        i++;
+                        host = args[i];
+                        break;
+                    case "-registryPort":
+                        i++;
+                        port = Integer.parseInt(args[i]);
+                        break;
+                    default:
+                        usage();
+                        break;
                 }
             }
 
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java	Wed Jul 05 19:26:45 2017 +0200
@@ -33,9 +33,8 @@
  */
 
 import java.io.*;
+import java.net.MalformedURLException;
 import java.rmi.*;
-import java.rmi.activation.*;
-import java.rmi.server.*;
 import java.rmi.registry.*;
 
 public class UseCustomSocketFactory {
@@ -51,7 +50,7 @@
 
         try {
             LocateRegistry.createRegistry(REGISTRY_PORT);
-        } catch (Exception e) {
+        } catch (RemoteException e) {
             TestLibrary.bomb("creating registry", e);
         }
 
@@ -92,15 +91,16 @@
                                          protocol[i]);
 
             System.err.println("\nusing protocol: " +
-                               (protocol[i] == "" ? "none" : protocol[i]));
+                    ("".equals(protocol[i]) ? "none" : protocol[i]));
 
             try {
                 /* spawn VM for EchoServer */
                 serverVM.start();
 
                 /* lookup server */
-                int tries = 12;        // need enough tries for slow machine.
                 echo[i] = null;
+                // 24 seconds timeout
+                long stopTime = System.currentTimeMillis() + 24000;
                 do {
                     try {
                         echo[i] = (Echo) Naming.lookup("//:" + REGISTRY_PORT +
@@ -108,15 +108,14 @@
                         break;
                     } catch (NotBoundException e) {
                         try {
-                            Thread.sleep(2000);
-                        } catch (Exception ignore) {
+                            Thread.sleep(200);
+                        } catch (InterruptedException ignore) {
                         }
-                        continue;
                     }
-                } while (--tries > 0);
+                } while (System.currentTimeMillis() < stopTime);
 
                 if (echo[i] == null)
-                    TestLibrary.bomb("server not bound in 12 tries", null);
+                    TestLibrary.bomb("server not bound in 120 tries", null);
 
                 /* invoke remote method and print result*/
                 System.err.println("Bound to " + echo[i]);
@@ -135,9 +134,8 @@
                 serverVM.destroy();
                 try {
                     Naming.unbind("//:" + REGISTRY_PORT + "/EchoServer");
-                } catch (Exception e) {
+                } catch (RemoteException | NotBoundException | MalformedURLException e) {
                     TestLibrary.bomb("unbinding EchoServer", e);
-
                 }
             }
         }
@@ -152,7 +150,7 @@
         for (int i = 0; i < echo.length; i++) {
             try {
                 System.err.println("\nusing protocol: " +
-                                   (protocol[i] == "" ? "none" : protocol[i]));
+                           ("".equals(protocol[i]) ? "none" : protocol[i]));
                 byte[] data = ("Greetings, citizen " +
                                System.getProperty("user.name") + "!").getBytes();
                 byte[] result = echo[i].echoNot(data);
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java	Wed Jul 05 19:26:45 2017 +0200
@@ -33,9 +33,9 @@
  * @run main/othervm/policy=security.policy/timeout=120 UseCustomSocketFactory
  */
 
-import java.io.*;
+import java.io.IOException;
+import java.net.MalformedURLException;
 import java.rmi.*;
-import java.rmi.server.*;
 import java.rmi.registry.*;
 
 public class UseCustomSocketFactory {
@@ -44,7 +44,7 @@
 
         int registryPort = -1;
 
-        String[] protocol = new String[] { "", "compress", "xor" };
+        String[] protocols = new String[] { "", "compress", "xor" };
 
         System.out.println("\nRegression test for bug 4127826\n");
 
@@ -53,31 +53,26 @@
         try {
             Registry registry = TestLibrary.createRegistryOnUnusedPort();
             registryPort = TestLibrary.getRegistryPort(registry);
-        } catch (Exception e) {
+        } catch (RemoteException e) {
             TestLibrary.bomb("creating registry", e);
         }
-
-        for (int i = 0; i < protocol.length; i++) {
-
+        for (String protocol : protocols) {
             System.err.println("test policy: " +
-                               TestParams.defaultPolicy);
-
-            JavaVM serverVM = new JavaVM("EchoImpl",
-                                         "-Djava.security.policy=" +
-                                         TestParams.defaultPolicy +
-                                         " -Drmi.registry.port=" +
-                                         registryPort,
-                                         protocol[i]);
+                    TestParams.defaultPolicy);
+            JavaVM serverVM = new JavaVM("EchoImpl", "-Djava.security.policy=" +
+                    TestParams.defaultPolicy +
+                    " -Drmi.registry.port=" +
+                    registryPort, protocol);
             System.err.println("\nusing protocol: " +
-                               (protocol[i] == "" ? "none" : protocol[i]));
-
+                    ("".equals(protocol) ? "none" : protocol));
             try {
                 /* spawn VM for EchoServer */
                 serverVM.start();
 
                 /* lookup server */
-                int tries = 8;
                 Echo obj = null;
+                // 16 seconds timeout
+                long stopTime = System.currentTimeMillis() + 16000;
                 do {
                     try {
                         obj = (Echo) Naming.lookup("//:" + registryPort +
@@ -85,12 +80,11 @@
                         break;
                     } catch (NotBoundException e) {
                         try {
-                            Thread.sleep(2000);
-                        } catch (Exception ignore) {
+                            Thread.sleep(200);
+                        } catch (InterruptedException ignore) {
                         }
-                        continue;
                     }
-                } while (--tries > 0);
+                } while (System.currentTimeMillis() < stopTime);
 
                 if (obj == null)
                     TestLibrary.bomb("server not bound in 8 tries", null);
@@ -98,21 +92,21 @@
                 /* invoke remote method and print result*/
                 System.err.println("Bound to " + obj);
                 byte[] data = ("Greetings, citizen " +
-                               System.getProperty("user.name") + "!"). getBytes();
+                        System.getProperty("user.name") + "!"). getBytes();
                 byte[] result = obj.echoNot(data);
                 for (int j = 0; j < result.length; j++)
                     result[j] = (byte) ~result[j];
                 System.err.println("Result: " + new String(result));
 
-            } catch (Exception e) {
+            } catch (IOException e) {
                 TestLibrary.bomb("test failed", e);
 
             } finally {
                 serverVM.destroy();
                 try {
                     Naming.unbind("//:" + registryPort +
-                                  "/EchoServer");
-                } catch (Exception e) {
+                            "/EchoServer");
+                } catch (RemoteException | NotBoundException | MalformedURLException e) {
                     TestLibrary.bomb("unbinding EchoServer", e);
 
                 }
--- a/jdk/test/java/rmi/testlibrary/ActivationLibrary.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/rmi/testlibrary/ActivationLibrary.java	Wed Jul 05 19:26:45 2017 +0200
@@ -66,7 +66,8 @@
         // We do as much as 50 deactivation trials, each separated by
         // at least 100 milliseconds sleep time (max sleep time of 5 secs).
         final long deactivateSleepTime = 100;
-        for (int i = 0; i < 50; i ++) {
+        long stopTime = System.currentTimeMillis() + deactivateSleepTime * 50;
+        while (System.currentTimeMillis() < stopTime) {
             try {
                 if (Activatable.inactive(id) == true) {
                     mesg("inactive successful");
--- a/jdk/test/java/rmi/testlibrary/JavaVM.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/rmi/testlibrary/JavaVM.java	Wed Jul 05 19:26:45 2017 +0200
@@ -59,9 +59,6 @@
         }
     }
 
-    public JavaVM(String classname) {
-        this.classname = classname;
-    }
     public JavaVM(String classname,
                   String options, String args) {
         this.classname = classname;
@@ -110,15 +107,6 @@
         return TestLibrary.getExtraProperty("jcov.options","");
     }
 
-    public void start(Runnable runnable) throws IOException {
-        if (runnable == null) {
-            throw new NullPointerException("Runnable cannot be null.");
-        }
-
-        start();
-        new JavaVMCallbackHandler(runnable).start();
-    }
-
     /**
      * Exec the VM as specified in this object's constructor.
      */
@@ -176,7 +164,7 @@
      */
     public int waitFor() throws InterruptedException {
         if (vm == null)
-            throw new IllegalStateException("can't wait for JavaVM that hasn't started");
+            throw new IllegalStateException("can't wait for JavaVM that isn't running");
 
         int status = vm.waitFor();
         outPipe.join();
@@ -191,35 +179,4 @@
         start();
         return waitFor();
     }
-
-    /**
-     * Handles calling the callback.
-     */
-    private class JavaVMCallbackHandler extends Thread {
-        Runnable runnable;
-
-        JavaVMCallbackHandler(Runnable runnable) {
-            this.runnable = runnable;
-        }
-
-
-        /**
-         * Wait for the Process to terminate and notify the callback.
-         */
-        @Override
-        public void run() {
-            if (vm != null) {
-                try {
-                    vm.waitFor();
-                } catch(InterruptedException ie) {
-                    // Restore the interrupted status
-                    Thread.currentThread().interrupt();
-                }
-            }
-
-            if (runnable != null) {
-                runnable.run();
-            }
-        }
-    }
 }
--- a/jdk/test/java/rmi/transport/readTimeout/ReadTimeoutTest.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/rmi/transport/readTimeout/ReadTimeoutTest.java	Wed Jul 05 19:26:45 2017 +0200
@@ -44,6 +44,8 @@
 import java.rmi.server.RMISocketFactory;
 import java.io.*;
 import java.net.*;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 
 public class ReadTimeoutTest
 {
@@ -86,23 +88,18 @@
             InputStream stream = DoS.getInputStream();
 
             // Read on the socket in the background
-            boolean[] successful = new boolean[] { false };
-            (new SomeReader(stream, successful)).start();
+            CountDownLatch done = new CountDownLatch(1);
+            (new SomeReader(stream, done)).start();
 
             // Wait for completion
-            int nretries = 4;
-            while (nretries-- > 0) {
-                if (successful[0])
-                    break;
-                Thread.sleep(DELAY);
-            }
-
-            if (successful[0]) {
+            if (done.await(DELAY * 4, TimeUnit.SECONDS)) {
                 System.err.println("TEST PASSED.");
             } else {
                 throw new Error("TEST FAILED.");
             }
 
+        } catch (InterruptedException ie) {
+            throw new Error("Unexpected interrupt", ie);
         } finally {
             try {
                 if (DoS != null)
@@ -120,6 +117,7 @@
     {
         private int servport = 0;
 
+        @Override
         public Socket createSocket(String h, int p)
             throws IOException
         {
@@ -130,6 +128,7 @@
          * Aborts if createServerSocket(0) is called twice, because then
          * it doesn't know whether to remember the first or second port.
          */
+        @Override
         public ServerSocket createServerSocket(int p)
             throws IOException
         {
@@ -155,22 +154,23 @@
     } // end class SomeFactory
 
     protected static class SomeReader extends Thread {
-        private InputStream readon;
-        private boolean[] vec;
+        private final InputStream readon;
+        private final CountDownLatch done;
 
-        public SomeReader(InputStream s, boolean[] successvec) {
+        public SomeReader(InputStream s, CountDownLatch done) {
             super();
             this.setDaemon(true);
             this.readon = s;
-            this.vec = successvec;
+            this.done = done;
         }
 
+        @Override
         public void run() {
             try {
                 int c = this.readon.read();
                 if (c != -1)
                     throw new Error ("Server returned " + c);
-                this.vec[0] = true;
+                done.countDown();
 
             } catch (IOException e) {
                 e.printStackTrace();
--- a/jdk/test/java/security/Provider/ProviderVersionCheck.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/security/Provider/ProviderVersionCheck.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -27,7 +27,7 @@
 
 /*
  * @test
- * @bug 7122707
+ * @bug 8030823
  * @run main/othervm ProviderVersionCheck
  * @summary Verify all providers in the default Providers list have the proper
  * version for the release
@@ -42,7 +42,7 @@
 
         for (Provider p: Security.getProviders()) {
             System.out.print(p.getName() + " ");
-            if (p.getVersion() != 1.8d) {
+            if (p.getVersion() != 1.9d) {
                 System.out.println("failed. " + "Version received was " +
                         p.getVersion());
                 failure = true;
--- a/jdk/test/java/time/tck/java/time/AbstractTCKTest.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/time/tck/java/time/AbstractTCKTest.java	Wed Jul 05 19:26:45 2017 +0200
@@ -58,17 +58,18 @@
 
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertSame;
+import static org.testng.Assert.fail;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.DataInputStream;
+import java.io.DataOutputStream;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.ObjectStreamConstants;
 import java.io.Serializable;
 import java.lang.reflect.Field;
-import java.util.Arrays;
 import java.util.Formatter;
 
 /**
@@ -164,6 +165,42 @@
         }
     }
 
+    /**
+     * Verify the class cannot be deserialized from a handcoded stream.
+     * Fail if the deserialization does <em>not</em> throw an Exception.
+     * @param serClass the class to embed in the handcoded stream
+     * @throws Exception if an unexpected condition occurs
+     */
+    protected static void assertNotSerializable(Class<?> serClass) throws Exception {
+        Field field = serClass.getDeclaredField("serialVersionUID");
+        field.setAccessible(true);
+        long serVer = (Long) field.get(null);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream out = new DataOutputStream(baos)) {
+            out.writeShort(ObjectStreamConstants.STREAM_MAGIC);
+            out.writeShort(ObjectStreamConstants.STREAM_VERSION);
+            out.writeByte(ObjectStreamConstants.TC_OBJECT);
+            out.writeByte(ObjectStreamConstants.TC_CLASSDESC);
+            out.writeUTF(serClass.getName());
+            out.writeLong(serVer);
+            out.writeByte(ObjectStreamConstants.SC_SERIALIZABLE);   // Flags ObjectStreamConstants
+            out.writeShort(0);  // number of fields
+            out.writeByte(ObjectStreamConstants.TC_ENDBLOCKDATA);
+            out.writeByte(ObjectStreamConstants.TC_NULL);  // no superclasses
+        }
+
+        byte[] bytes = baos.toByteArray();
+
+        try (ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
+            ObjectInputStream in = new ObjectInputStream(bis)) {
+            Object o = in.readObject();
+        } catch (Exception ioe) {
+            // Expected exception
+            return;
+        }
+        fail("Class should not be deserializable " + serClass.getName());
+    }
+
 
     /**
      * Utility method to dump a byte array in a java syntax.
--- a/jdk/test/java/time/tck/java/time/TCKLocalDateTime.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/time/tck/java/time/TCKLocalDateTime.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1847,7 +1847,7 @@
             LocalDateTime dt = base.plusMinutes(i);
             t = t.plusMinutes(1);
 
-            if (t == LocalTime.MIDNIGHT) {
+            if (t.equals(LocalTime.MIDNIGHT)) {
                 d = d.plusDays(1);
             }
 
@@ -2539,7 +2539,7 @@
             LocalDateTime dt = base.minusMinutes(i);
             t = t.plusMinutes(1);
 
-            if (t == LocalTime.MIDNIGHT) {
+            if (t.equals(LocalTime.MIDNIGHT)) {
                 d = d.plusDays(1);
             }
 
--- a/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateSerialization.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateSerialization.java	Wed Jul 05 19:26:45 2017 +0200
@@ -161,4 +161,25 @@
 
         assertSerializedBySer(date, hijrahDateBytes, hijrahChronoBytes, dateBytes);
     }
+
+
+    //-----------------------------------------------------------------------
+    // Regular data factory for names and descriptions of available calendars
+    //-----------------------------------------------------------------------
+    @DataProvider(name = "invalidSerialformClasses")
+    Object[][] invalid_serial_classes() {
+        return new Object[][]{
+            {JapaneseEra.class},
+            {JapaneseDate.class},
+            {MinguoDate.class},
+            {ThaiBuddhistDate.class},
+            {HijrahDate.class},
+        };
+    }
+
+    @Test(dataProvider="invalidSerialformClasses")
+    public void test_invalid_serialform(Class<?> clazz) throws Exception {
+        assertNotSerializable(clazz);
+    }
+
 }
--- a/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronologySerialization.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronologySerialization.java	Wed Jul 05 19:26:45 2017 +0200
@@ -111,4 +111,24 @@
         assertSerializedBySer(chrono, bytes);
     }
 
+
+    //-----------------------------------------------------------------------
+    // Regular data factory for names and descriptions of available calendars
+    //-----------------------------------------------------------------------
+    @DataProvider(name = "invalidSerialformClasses")
+    Object[][] invalid_serial_classes() {
+        return new Object[][]{
+            {IsoChronology.class},
+            {JapaneseChronology.class},
+            {MinguoChronology.class},
+            {ThaiBuddhistChronology.class},
+            {HijrahChronology.class},
+        };
+    }
+
+    @Test(dataProvider="invalidSerialformClasses")
+    public void test_invalid_serialform(Class<?> clazz) throws Exception {
+        assertNotSerializable(clazz);
+    }
+
 }
--- a/jdk/test/java/time/tck/java/time/serial/TCKDurationSerialization.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/time/tck/java/time/serial/TCKDurationSerialization.java	Wed Jul 05 19:26:45 2017 +0200
@@ -110,4 +110,9 @@
         assertSerializableSame(Duration.ZERO);
     }
 
+    @Test
+    public void test_invalid_serialform() throws Exception {
+        assertNotSerializable(Duration.class);
+    }
+
 }
--- a/jdk/test/java/time/tck/java/time/serial/TCKInstantSerialization.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/time/tck/java/time/serial/TCKInstantSerialization.java	Wed Jul 05 19:26:45 2017 +0200
@@ -91,5 +91,10 @@
         assertSerializedBySer(Instant.ofEpochSecond(654321, 123456789), bytes);
     }
 
+    @Test
+    public void test_invalid_serialform() throws Exception {
+        assertNotSerializable(Instant.class);
+    }
+
 
 }
--- a/jdk/test/java/time/tck/java/time/serial/TCKLocalDateSerialization.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/time/tck/java/time/serial/TCKLocalDateSerialization.java	Wed Jul 05 19:26:45 2017 +0200
@@ -102,4 +102,9 @@
         assertSerializedBySer(LocalDate.of(2012, 9, 16), bytes);
     }
 
+    @Test
+    public void test_invalid_serialform() throws Exception {
+        assertNotSerializable(LocalDate.class);
+    }
+
 }
--- a/jdk/test/java/time/tck/java/time/serial/TCKLocalDateTimeSerialization.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/time/tck/java/time/serial/TCKLocalDateTimeSerialization.java	Wed Jul 05 19:26:45 2017 +0200
@@ -99,4 +99,9 @@
         assertSerializedBySer(LocalDateTime.of(2012, 9, 16, 22, 17, 59, 459_000_000), bytes);
     }
 
+    @Test
+    public void test_invalid_serialform() throws Exception {
+        assertNotSerializable(LocalDateTime.class);
+    }
+
 }
--- a/jdk/test/java/time/tck/java/time/serial/TCKLocalTimeSerialization.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/time/tck/java/time/serial/TCKLocalTimeSerialization.java	Wed Jul 05 19:26:45 2017 +0200
@@ -141,5 +141,9 @@
         assertSerializedBySer(LocalTime.of(22, 17, 59, 459_000_000), bytes);
     }
 
+    @Test
+    public void test_invalid_serialform() throws Exception {
+        assertNotSerializable(LocalTime.class);
+    }
 
 }
--- a/jdk/test/java/time/tck/java/time/serial/TCKMonthDaySerialization.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/time/tck/java/time/serial/TCKMonthDaySerialization.java	Wed Jul 05 19:26:45 2017 +0200
@@ -99,4 +99,9 @@
         assertSerializedBySer(MonthDay.of(9, 16), bytes);
     }
 
+    @Test
+    public void test_invalid_serialform() throws Exception {
+        assertNotSerializable(MonthDay.class);
+    }
+
 }
--- a/jdk/test/java/time/tck/java/time/serial/TCKOffsetDateTimeSerialization.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/time/tck/java/time/serial/TCKOffsetDateTimeSerialization.java	Wed Jul 05 19:26:45 2017 +0200
@@ -111,4 +111,9 @@
         assertSerializedBySer(OffsetDateTime.of(ldt, ZoneOffset.ofHours(1)), bytes);
     }
 
+    @Test
+    public void test_invalid_serialform() throws Exception {
+        assertNotSerializable(OffsetDateTime.class);
+    }
+
 }
--- a/jdk/test/java/time/tck/java/time/serial/TCKOffsetTimeSerialization.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/time/tck/java/time/serial/TCKOffsetTimeSerialization.java	Wed Jul 05 19:26:45 2017 +0200
@@ -107,5 +107,9 @@
         assertSerializedBySer(OffsetTime.of(22, 17, 59, 464_000_000, ZoneOffset.ofHours(1)), bytes);
     }
 
+    @Test
+    public void test_invalid_serialform() throws Exception {
+        assertNotSerializable(OffsetTime.class);
+    }
 
 }
--- a/jdk/test/java/time/tck/java/time/serial/TCKPeriodSerialization.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/time/tck/java/time/serial/TCKPeriodSerialization.java	Wed Jul 05 19:26:45 2017 +0200
@@ -78,4 +78,9 @@
         assertSerializable(Period.of(1, 2, 3));
     }
 
+    @Test
+    public void test_invalid_serialform() throws Exception {
+        assertNotSerializable(Period.class);
+    }
+
 }
--- a/jdk/test/java/time/tck/java/time/serial/TCKYearMonthSerialization.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/time/tck/java/time/serial/TCKYearMonthSerialization.java	Wed Jul 05 19:26:45 2017 +0200
@@ -100,4 +100,9 @@
         assertSerializedBySer(YearMonth.of(2012, 9), bytes);
     }
 
+    @Test
+    public void test_invalid_serialform() throws Exception {
+        assertNotSerializable(YearMonth.class);
+    }
+
 }
--- a/jdk/test/java/time/tck/java/time/serial/TCKYearSerialization.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/time/tck/java/time/serial/TCKYearSerialization.java	Wed Jul 05 19:26:45 2017 +0200
@@ -91,4 +91,9 @@
         assertSerializedBySer(Year.of(2012), bytes);
     }
 
+    @Test
+    public void test_invalid_serialform() throws Exception {
+        assertNotSerializable(Year.class);
+    }
+
 }
--- a/jdk/test/java/time/tck/java/time/serial/TCKZoneOffsetSerialization.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/time/tck/java/time/serial/TCKZoneOffsetSerialization.java	Wed Jul 05 19:26:45 2017 +0200
@@ -114,5 +114,9 @@
         assertSerializedBySer(ZoneOffset.ofTotalSeconds(53265), bytes);
     }
 
+    @Test
+    public void test_invalid_serialform() throws Exception {
+        assertNotSerializable(ZoneOffset.class);
+    }
 
 }
--- a/jdk/test/java/time/tck/java/time/serial/TCKZonedDateTimeSerialization.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/time/tck/java/time/serial/TCKZonedDateTimeSerialization.java	Wed Jul 05 19:26:45 2017 +0200
@@ -139,4 +139,9 @@
         assertSerializedBySer(zdt, bytes);
     }
 
+    @Test
+    public void test_invalid_serialform() throws Exception {
+        assertNotSerializable(ZonedDateTime.class);
+    }
+
 }
--- a/jdk/test/java/time/tck/java/time/temporal/serial/TCKValueRangeSerialization.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/time/tck/java/time/temporal/serial/TCKValueRangeSerialization.java	Wed Jul 05 19:26:45 2017 +0200
@@ -60,11 +60,16 @@
 package tck.java.time.temporal.serial;
 
 import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.fail;
 
+import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.time.temporal.ValueRange;
+import java.util.Arrays;
 
 import org.testng.annotations.Test;
 
@@ -117,4 +122,57 @@
         }
     }
 
+    @Test
+    public void test_invalid_serialform() throws Exception {
+        byte[] template = {
+            (byte)172, (byte)237,   0,   5, 115, 114,   0,  29, 106,  97, /* \u00ac \u00ed \u0000 \u0005 s r \u0000 \u001d j a */
+            118,  97,  46, 116, 105, 109, 101,  46, 116, 101, /* v a . t i m e . t e */
+            109, 112, 111, 114,  97, 108,  46,  86,  97, 108, /* m p o r a l . V a l */
+            117, 101,  82,  97, 110, 103, 101, (byte)154, 113, (byte)169, /* u e R a n g e \u009a q \u00a9 */
+             86, (byte)242, (byte)205,  90, (byte)184,   2,   0,   4,  74,   0, /* V \u00f2 \u00cd Z \u00b8 \u0002 \u0000 \u0004 J \u0000 */
+             10, 109,  97, 120,  76,  97, 114, 103, 101, 115, /*  m a x L a r g e s */
+            116,  74,   0,  11, 109,  97, 120,  83, 109,  97, /* t J \u0000 \u000b m a x S m a */
+            108, 108, 101, 115, 116,  74,   0,  10, 109, 105,/* l l e s t J \u0000 m i */
+            110,  76,  97, 114, 103, 101, 115, 116,  74,   0, /* n L a r g e s t J \u0000 */
+             11, 109, 105, 110,  83, 109,  97, 108, 108, 101, /* \u000b m i n S m a l l e */
+            115, 116, 120, 112,   0,   0,   0,   0,   0,   0, /* s t x p \u0000 \u0000 \u0000 \u0000 \u0000 \u0000 */
+              0,  40,   0,   0,   0,   0,   0,   0,   0,  30, /* \u0000 ( \u0000 \u0000 \u0000 \u0000 \u0000 \u0000 \u0000 \u001e */
+              0,   0,   0,   0,   0,   0,   0,  20,   0,   0, /* \u0000 \u0000 \u0000 \u0000 \u0000 \u0000 \u0000 \u0014 \u0000 \u0000 */
+              0,   0,   0,   0,   0,  10,                     /* \u0000 \u0000 \u0000 \u0000 \u0000 */
+        };
+
+        // minSmallest > minLargest, insert invalid values and deserialize
+        byte[] bad1 = {0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 4};
+        byte[] val = Arrays.copyOf(template, template.length);
+        System.arraycopy(bad1, 0, val, 114, bad1.length);
+        try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(val))) {
+            in.readObject();
+            fail("Invalid minSmallest > minLargest " + ValueRange.class.getName());
+        } catch (InvalidObjectException ioe) {
+            // Expected exception
+        }
+
+        // maxSmallest > maxLargest, insert invalid values and deserialize
+        byte[] bad2 = {0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 3};
+        val = Arrays.copyOf(template, template.length);
+        System.arraycopy(bad1, 0, val, 114, bad2.length);
+        try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(val))) {
+            in.readObject();
+            fail("Invalid maxSmallest > maxLargest " + ValueRange.class.getName());
+        } catch (InvalidObjectException ioe) {
+            // Expected exception
+        }
+
+        // minLagest > maxLargest, insert invalid values and deserialize
+        byte[] bad3 = {0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 3, 0, 0, 0, 4};
+        val = Arrays.copyOf(template, template.length);
+        System.arraycopy(bad1, 0, val, 114, bad3.length);
+        try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(val))) {
+            in.readObject();
+            fail("Invalid minLagest > maxLargest " + ValueRange.class.getName());
+        } catch (InvalidObjectException ioe) {
+            // Expected exception
+        }
+    }
+
 }
--- a/jdk/test/java/time/tck/java/time/temporal/serial/TCKWeekFieldsSerialization.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/time/tck/java/time/temporal/serial/TCKWeekFieldsSerialization.java	Wed Jul 05 19:26:45 2017 +0200
@@ -56,13 +56,21 @@
  */
 package tck.java.time.temporal.serial;
 
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.fail;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 import tck.java.time.AbstractTCKTest;
 
 import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.time.DayOfWeek;
 import java.time.temporal.WeekFields;
+import java.util.Arrays;
 
 /**
  * Test serialization of WeekFields.
@@ -90,5 +98,58 @@
         return objects;
     }
 
+    @Test
+    public void test_invalid_serialform() throws Exception {
+        WeekFields wf = WeekFields.of(DayOfWeek.MONDAY, 7);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream(64);
+        ObjectOutputStream out = new ObjectOutputStream(baos);
+        out.writeObject(wf);
+        byte[] template = baos.toByteArray();
+
+        // (minimalDays = 5) {
+        byte[] good1 = {0, 0, 0, 5};
+        byte[] val = Arrays.copyOf(template, template.length);
+        System.arraycopy(good1, 0, val, 105, good1.length);
+        try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(val))) {
+            Object o = in.readObject();
+            assertEquals(o, WeekFields.of(DayOfWeek.MONDAY, 5), "Should be MONDAY, min = 5");
+        } catch (Exception ioe) {
+            fail("Unexpected exception " + ioe);
+        }
+
+        // (minimalDays < 1) {
+        byte[] bad1 = {0, 0, 0, 0};
+        val = Arrays.copyOf(template, template.length);
+        System.arraycopy(bad1, 0, val, 105, bad1.length);
+        try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(val))) {
+            in.readObject();
+            fail("Invalid minimalDays < 1 " + WeekFields.class.getName());
+        } catch (Exception ioe) {
+            // Expected exception
+        }
+
+        // (minimalDays > 7) {
+        byte[] bad2 = {0, 0, 0, 8};
+        val = Arrays.copyOf(template, template.length);
+        System.arraycopy(bad2, 0, val, 105, bad2.length);
+        try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(val))) {
+            in.readObject();
+            fail("Invalid minimalDays > 7 " + WeekFields.class.getName());
+        } catch (Exception ioe) {
+            // Expected exception
+        }
+
+        // (StartDay = null) {
+        byte[] bad3 = {0x70};
+        val = Arrays.copyOf(template, 110);
+        System.arraycopy(bad3, 0, val, 105 + 4, bad3.length);
+        try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(val))) {
+            in.readObject();
+            fail("Invalid startDay == null " + WeekFields.class.getName());
+        } catch (Exception ioe) {
+            // Expected exception
+        }
+
+    }
 
 }
--- a/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionRuleSerialization.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionRuleSerialization.java	Wed Jul 05 19:26:45 2017 +0200
@@ -133,4 +133,9 @@
         assertSerializable(test);
     }
 
+    @Test
+    public void test_invalid_serialform() throws Exception {
+        assertNotSerializable(ZoneOffsetTransitionRule.class);
+    }
+
 }
--- a/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionSerialization.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionSerialization.java	Wed Jul 05 19:26:45 2017 +0200
@@ -110,4 +110,9 @@
         assertSerializable(test);
     }
 
+    @Test
+    public void test_invalid_serialform() throws Exception {
+        assertNotSerializable(ZoneOffsetTransition.class);
+    }
+
 }
--- a/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneRulesSerialization.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneRulesSerialization.java	Wed Jul 05 19:26:45 2017 +0200
@@ -70,11 +70,13 @@
 
 import static org.testng.Assert.assertEquals;
 
+import tck.java.time.AbstractTCKTest;
+
 /**
  * Test serialization of ZoneRules.
  */
 @Test
-public class TCKZoneRulesSerialization {
+public class TCKZoneRulesSerialization extends AbstractTCKTest{
 
     public void test_serialization_loaded() throws Exception {
         assertSerialization(europeLondon());
@@ -118,5 +120,9 @@
         return ZoneId.of("America/New_York").getRules();
     }
 
+    @Test
+    public void test_invalid_serialform() throws Exception {
+        assertNotSerializable(ZoneRules.class);
+    }
 
 }
--- a/jdk/test/java/util/LinkedHashMap/Basic.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/util/LinkedHashMap/Basic.java	Wed Jul 05 19:26:45 2017 +0200
@@ -23,28 +23,29 @@
 
 /**
  * @test
- * @bug 4245809
+ * @bug 4245809 8029795
  * @summary Basic test for LinkedHashMap.  (Based on MapBash)
  */
 
 import java.util.*;
+import java.util.function.*;
 import java.io.*;
 
 public class Basic {
-    static Random rnd = new Random(666);
-    static Object nil = new Integer(0);
+    final static Random rnd = new Random(666);
+    final static Integer nil = new Integer(0);
 
     public static void main(String[] args)  throws Exception {
         int numItr =  500;
         int mapSize = 500;
 
-        // Linked List test
+        // Linked List testk
         for (int i=0; i<numItr; i++) {
-            Map m = new LinkedHashMap();
-            Object head = nil;
+            Map<Integer,Integer> m = new LinkedHashMap();
+            Integer head = nil;
 
             for (int j=0; j<mapSize; j++) {
-                Object newHead;
+                Integer newHead;
                 do {
                     newHead = new Integer(rnd.nextInt());
                 } while (m.containsKey(newHead));
@@ -57,7 +58,7 @@
             if (new HashMap(m).hashCode() != m.hashCode())
                 throw new Exception("Incorrect hashCode computation.");
 
-            Map m2 = new LinkedHashMap(); m2.putAll(m);
+            Map<Integer,Integer> m2 = new LinkedHashMap(); m2.putAll(m);
             m2.values().removeAll(m.keySet());
             if (m2.size()!= 1 || !m2.containsValue(nil))
                 throw new Exception("Collection views test failed.");
@@ -66,7 +67,7 @@
             while (head != nil) {
                 if (!m.containsKey(head))
                     throw new Exception("Linked list doesn't contain a link.");
-                Object newHead = m.get(head);
+                Integer newHead = m.get(head);
                 if (newHead == null)
                     throw new Exception("Could not retrieve a link.");
                 m.remove(head);
@@ -79,7 +80,7 @@
                 throw new Exception("Linked list size not as expected.");
         }
 
-        Map m = new LinkedHashMap();
+        Map<Integer,Integer> m = new LinkedHashMap();
         for (int i=0; i<mapSize; i++)
             if (m.put(new Integer(i), new Integer(2*i)) != null)
                 throw new Exception("put returns non-null value erroenously.");
@@ -88,12 +89,12 @@
                 throw new Exception("contains value "+i);
         if (m.put(nil, nil) == null)
             throw new Exception("put returns a null value erroenously.");
-        Map m2 = new LinkedHashMap(); m2.putAll(m);
+        Map<Integer,Integer> m2 = new LinkedHashMap(); m2.putAll(m);
         if (!m.equals(m2))
             throw new Exception("Clone not equal to original. (1)");
         if (!m2.equals(m))
             throw new Exception("Clone not equal to original. (2)");
-        Set s = m.entrySet(), s2 = m2.entrySet();
+        Set<Map.Entry<Integer,Integer>> s = m.entrySet(), s2 = m2.entrySet();
         if (!s.equals(s2))
             throw new Exception("Clone not equal to original. (3)");
         if (!s2.equals(s))
@@ -137,7 +138,7 @@
 
         // Test ordering properties with insert order
         m = new LinkedHashMap();
-        List l = new ArrayList(mapSize);
+        List<Integer> l = new ArrayList(mapSize);
         for (int i=0; i<mapSize; i++) {
             Integer x = new Integer(i);
             m.put(x, x);
@@ -164,7 +165,7 @@
         if (!m.equals(m2))
             throw new Exception("Insert-order Map != clone.");
 
-        List l2 = new ArrayList(l);
+        List<Integer> l2 = new ArrayList(l);
         Collections.shuffle(l2);
         for (int i=0; i<mapSize; i++) {
             Integer x = (Integer) l2.get(i);
@@ -175,7 +176,7 @@
             throw new Exception("Clone: altered by read.");
 
         // Test ordering properties with access order
-        m = new LinkedHashMap(1000, .75f, true);
+        m = new LinkedHashMap(2*mapSize, .75f, true);
         for (int i=0; i<mapSize; i++) {
             Integer x = new Integer(i);
             m.put(x, x);
@@ -192,6 +193,70 @@
             throw new Exception("Insert order not properly altered by read.");
 
         for (int i=0; i<mapSize; i++) {
+            Integer x = (Integer) l2.get(i);
+            if (!m.getOrDefault(x, new Integer(i + 1000)).equals(x))
+                throw new Exception("Wrong value: "+i+", "+m.get(x)+", "+x);
+        }
+        if (!new ArrayList(m.keySet()).equals(l2))
+            throw new Exception("Insert order not properly altered by read.");
+
+        for (int i=0; i<mapSize; i++) {
+            Integer x = (Integer) l2.get(i);
+            if (!m.replace(x, x).equals(x))
+                throw new Exception("Wrong value: "+i+", "+m.get(x)+", "+x);
+        }
+        if (!new ArrayList(m.keySet()).equals(l2))
+            throw new Exception("Insert order not properly altered by replace.");
+
+        for (int i=0; i<mapSize; i++) {
+            Integer x = (Integer) l2.get(i);
+            if (!m.replace(x, x, x))
+                throw new Exception("Wrong value: "+i+", "+m.get(x)+", "+x);
+        }
+        if (!new ArrayList(m.keySet()).equals(l2))
+            throw new Exception("Insert order not properly altered by replace.");
+
+        BiFunction<Integer,Integer,Integer> f = (Integer y, Integer z) -> {
+            if (!Objects.equals(y,z))
+                throw new RuntimeException("unequal " + y + "," + z);
+            return new Integer(z);
+        };
+
+        for (int i=0; i<mapSize; i++) {
+            Integer x = (Integer) l2.get(i);
+            if (!x.equals(m.merge(x, x, f)))
+                throw new Exception("Wrong value: "+i+", "+m.get(x)+", "+x);
+        }
+        if (!new ArrayList(m.keySet()).equals(l2))
+            throw new Exception("Insert order not properly altered by replace.");
+
+        for (int i=0; i<mapSize; i++) {
+            Integer x = (Integer) l2.get(i);
+            if (!x.equals(m.compute(x, f)))
+                throw new Exception("Wrong value: "+i+", "+m.get(x)+", "+x);
+        }
+        if (!new ArrayList(m.keySet()).equals(l2))
+            throw new Exception("Insert order not properly altered by replace.");
+
+        for (int i=0; i<mapSize; i++) {
+            Integer x = (Integer) l2.get(i);
+            if(!x.equals(m.remove(x)))
+              throw new Exception("Missing key: "+i+", "+x);
+            if (!x.equals(m.computeIfAbsent(x, Integer::valueOf)))
+                throw new Exception("Wrong value: "+i+", "+m.get(x)+", "+x);
+        }
+        if (!new ArrayList(m.keySet()).equals(l2))
+            throw new Exception("Insert order not properly altered by replace.");
+
+        for (int i=0; i<mapSize; i++) {
+            Integer x = (Integer) l2.get(i);
+            if (!x.equals(m.computeIfPresent(x, f)))
+                throw new Exception("Wrong value: "+i+", "+m.get(x)+", "+x);
+        }
+        if (!new ArrayList(m.keySet()).equals(l2))
+            throw new Exception("Insert order not properly altered by replace.");
+
+        for (int i=0; i<mapSize; i++) {
             Integer x = new Integer(i);
             m.put(x, x);
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/LinkedHashMap/ComputeIfAbsentAccessOrder.java	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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 8030016
+ * @summary computeIfAbsent would generate spurious access
+ */
+
+import java.util.*;
+
+public class ComputeIfAbsentAccessOrder {
+    public static void main(String args[]) throws Throwable {
+        LinkedHashMap<String,Object> map = new LinkedHashMap<>(2, 0.75f, true);
+        map.put("first", null);
+        map.put("second", null);
+
+        map.computeIfAbsent("first", l -> null); // should do nothing
+
+        String key = map.keySet().stream()
+                .findFirst()
+                .orElseThrow(() -> new RuntimeException("no value"));
+        if(!"first".equals(key)) {
+            throw new RuntimeException("not expected value " + "first" + "!=" + key);
+        }
+    }
+}
--- a/jdk/test/java/util/Map/Defaults.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/util/Map/Defaults.java	Wed Jul 05 19:26:45 2017 +0200
@@ -80,18 +80,22 @@
 
     @Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=withNull values=withNull")
     public void testPutIfAbsentNulls(String description, Map<IntegerEnum, String> map) {
+        // null -> null
         assertTrue(map.containsKey(null), "null key absent");
         assertNull(map.get(null), "value not null");
         assertNull(map.putIfAbsent(null, EXTRA_VALUE), "previous not null");
+        // null -> EXTRA_VALUE
         assertTrue(map.containsKey(null), "null key absent");
         assertSame(map.get(null), EXTRA_VALUE, "unexpected value");
         assertSame(map.putIfAbsent(null, null), EXTRA_VALUE, "previous not expected value");
         assertTrue(map.containsKey(null), "null key absent");
         assertSame(map.get(null), EXTRA_VALUE, "unexpected value");
         assertSame(map.remove(null), EXTRA_VALUE, "removed unexpected value");
+        // null -> <absent>
 
         assertFalse(map.containsKey(null), description + ": key present after remove");
         assertNull(map.putIfAbsent(null, null), "previous not null");
+        // null -> null
         assertTrue(map.containsKey(null), "null key absent");
         assertNull(map.get(null), "value not null");
         assertNull(map.putIfAbsent(null, EXTRA_VALUE), "previous not null");
@@ -100,15 +104,19 @@
 
     @Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=all values=all")
     public void testPutIfAbsent(String description, Map<IntegerEnum, String> map) {
+        // 1 -> 1
         assertTrue(map.containsKey(KEYS[1]));
         Object expected = map.get(KEYS[1]);
         assertTrue(null == expected || expected == VALUES[1]);
         assertSame(map.putIfAbsent(KEYS[1], EXTRA_VALUE), expected);
         assertSame(map.get(KEYS[1]), expected);
 
+        // EXTRA_KEY -> <absent>
         assertFalse(map.containsKey(EXTRA_KEY));
         assertSame(map.putIfAbsent(EXTRA_KEY, EXTRA_VALUE), null);
         assertSame(map.get(EXTRA_KEY), EXTRA_VALUE);
+        assertSame(map.putIfAbsent(EXTRA_KEY, VALUES[2]), EXTRA_VALUE);
+        assertSame(map.get(EXTRA_KEY), EXTRA_VALUE);
     }
 
     @Test(dataProvider = "Map<IntegerEnum,String> rw=all keys=all values=all")
@@ -268,14 +276,28 @@
 
     @Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=withNull values=withNull")
     public void testComputeIfAbsentNulls(String description, Map<IntegerEnum, String> map) {
+        // null -> null
+        assertTrue(map.containsKey(null), "null key absent");
+        assertNull(map.get(null), "value not null");
+        assertSame(map.computeIfAbsent(null, (k) -> null), null,  "not expected result");
         assertTrue(map.containsKey(null), "null key absent");
         assertNull(map.get(null), "value not null");
-        assertSame(map.computeIfAbsent(null, (k) -> EXTRA_VALUE), EXTRA_VALUE, description);
-        assertSame(map.get(null), EXTRA_VALUE, description);
+        assertSame(map.computeIfAbsent(null, (k) -> EXTRA_VALUE), EXTRA_VALUE, "not mapped to result");
+        // null -> EXTRA_VALUE
+        assertTrue(map.containsKey(null), "null key absent");
+        assertSame(map.get(null), EXTRA_VALUE,  "not expected value");
+        assertSame(map.remove(null), EXTRA_VALUE, "removed unexpected value");
+        // null -> <absent>
+        assertFalse(map.containsKey(null), "null key present");
+        assertSame(map.computeIfAbsent(null, (k) -> EXTRA_VALUE), EXTRA_VALUE, "not mapped to result");
+        // null -> EXTRA_VALUE
+        assertTrue(map.containsKey(null), "null key absent");
+        assertSame(map.get(null), EXTRA_VALUE,  "not expected value");
     }
 
     @Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=all values=all")
     public void testComputeIfAbsent(String description, Map<IntegerEnum, String> map) {
+        // 1 -> 1
         assertTrue(map.containsKey(KEYS[1]));
         Object expected = map.get(KEYS[1]);
         assertTrue(null == expected || expected == VALUES[1], description + String.valueOf(expected));
@@ -283,8 +305,12 @@
         assertSame(map.computeIfAbsent(KEYS[1], (k) -> EXTRA_VALUE), expected, description);
         assertSame(map.get(KEYS[1]), expected, description);
 
+        // EXTRA_KEY -> <absent>
+        assertFalse(map.containsKey(EXTRA_KEY));
+        assertNull(map.computeIfAbsent(EXTRA_KEY, (k) -> null));
         assertFalse(map.containsKey(EXTRA_KEY));
         assertSame(map.computeIfAbsent(EXTRA_KEY, (k) -> EXTRA_VALUE), EXTRA_VALUE);
+        // EXTRA_KEY -> EXTRA_VALUE
         assertSame(map.get(EXTRA_KEY), EXTRA_VALUE);
     }
 
@@ -741,7 +767,6 @@
         Collection<Object[]> cases = new ArrayList<>();
 
         cases.addAll(makeMergeTestCases());
-        cases.addAll(makeMergeNullValueTestCases());
 
         return cases.iterator();
     }
@@ -764,32 +789,6 @@
         return cases;
     }
 
-    static Collection<Object[]> makeMergeNullValueTestCases() {
-        Collection<Object[]> cases = new ArrayList<>();
-
-        for( Object[] mapParams : makeAllRWMapsWithNulls() ) {
-            cases.add(new Object[] { mapParams[0], mapParams[1], Merging.Value.OLDVALUE, Merging.Value.NULL, Merging.Merger.NULL, Merging.Value.ABSENT, Merging.Value.NULL });
-        }
-
-        for( Object[] mapParams : makeAllRWMapsWithNulls() ) {
-            cases.add(new Object[] { mapParams[0], mapParams[1], Merging.Value.OLDVALUE, Merging.Value.NULL, Merging.Merger.RESULT, Merging.Value.RESULT, Merging.Value.RESULT });
-        }
-
-        for( Object[] mapParams : makeAllRWMapsWithNulls() ) {
-            cases.add(new Object[] { mapParams[0], mapParams[1], Merging.Value.ABSENT, Merging.Value.NULL, Merging.Merger.UNUSED, Merging.Value.ABSENT, Merging.Value.NULL });
-        }
-
-        for( Object[] mapParams : makeAllRWMapsWithNulls() ) {
-            cases.add(new Object[] { mapParams[0], mapParams[1], Merging.Value.NULL, Merging.Value.NULL, Merging.Merger.UNUSED, Merging.Value.ABSENT, Merging.Value.NULL });
-        }
-
-        for( Object[] mapParams : makeAllRWMapsWithNulls() ) {
-            cases.add(new Object[] { mapParams[0], mapParams[1], Merging.Value.NULL, Merging.Value.NEWVALUE, Merging.Merger.UNUSED, Merging.Value.NEWVALUE, Merging.Value.NEWVALUE });
-        }
-
-        return cases;
-    }
-
     public interface Thrower<T extends Throwable> {
 
         public void run() throws T;
--- a/jdk/test/java/util/concurrent/atomic/AtomicUpdaters.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/util/concurrent/atomic/AtomicUpdaters.java	Wed Jul 05 19:26:45 2017 +0200
@@ -33,7 +33,7 @@
  */
 import java.util.concurrent.atomic.*;
 import java.lang.reflect.*;
-import java.security.AccessControlException;
+import java.security.*;
 
 public class  AtomicUpdaters {
     enum TYPE { INT, LONG, REF }
@@ -102,6 +102,8 @@
                 verbose = true;
             }
             else if ("UseSM".equals(arg)) {
+                // Ensure that the test is not influenced by the default users policy.
+                Policy.setPolicy(new NoPermissionsPolicy());
                 SecurityManager m = System.getSecurityManager();
                 if (m != null)
                     throw new RuntimeException("No security manager should initially be installed");
@@ -186,4 +188,24 @@
             throw new Error("Some tests failed - see previous stacktraces");
         }
     }
+
+    /**
+     * Policy with no permissions.
+     */
+    private static class NoPermissionsPolicy extends Policy {
+        @Override
+        public PermissionCollection getPermissions(CodeSource cs) {
+            return Policy.UNSUPPORTED_EMPTY_COLLECTION;
+        }
+
+        @Override
+        public PermissionCollection getPermissions(ProtectionDomain pd) {
+            return Policy.UNSUPPORTED_EMPTY_COLLECTION;
+        }
+
+        @Override
+        public boolean implies(ProtectionDomain pd, Permission p) {
+            return Policy.UNSUPPORTED_EMPTY_COLLECTION.implies(p);
+        }
+    }
 }
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java	Wed Jul 05 19:26:45 2017 +0200
@@ -49,14 +49,11 @@
 public final class CancelledLockLoops {
     static final Random rng = new Random();
     static boolean print = false;
-    static final int ITERS = 1000000;
+    static final int ITERS = 5000000;
     static final long TIMEOUT = 100;
 
     public static void main(String[] args) throws Exception {
-        int maxThreads = 5;
-        if (args.length > 0)
-            maxThreads = Integer.parseInt(args[0]);
-
+        int maxThreads = (args.length > 0) ? Integer.parseInt(args[0]) : 5;
         print = true;
 
         for (int i = 2; i <= maxThreads; i += (i+1) >>> 1) {
@@ -90,7 +87,7 @@
                 threads[i] = new Thread(this);
             for (int i = 0; i < threads.length; ++i)
                 threads[i].start();
-            Thread[] cancels = (Thread[]) (threads.clone());
+            Thread[] cancels = threads.clone();
             Collections.shuffle(Arrays.asList(cancels), rng);
             barrier.await();
             Thread.sleep(TIMEOUT);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/HandlersConfigTest$Configured.props	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,29 @@
+# mandatory Default properties...
+
+.level= INFO
+handlers=HandlersConfigTest$ConfiguredHandler
+
+java.util.logging.MemoryHandler.target=HandlersConfigTest$ConfiguredHandler
+
+# in addition to Default, Configured adds the following...
+
+java.util.logging.MemoryHandler.level=FINE
+java.util.logging.MemoryHandler.filter=HandlersConfigTest$ConfiguredFilter
+java.util.logging.MemoryHandler.formatter=HandlersConfigTest$ConfiguredFormatter
+java.util.logging.MemoryHandler.size=123
+java.util.logging.MemoryHandler.push=FINE
+
+java.util.logging.ConsoleHandler.level=FINE
+java.util.logging.ConsoleHandler.encoding=ASCII
+java.util.logging.ConsoleHandler.filter=HandlersConfigTest$ConfiguredFilter
+java.util.logging.ConsoleHandler.formatter=HandlersConfigTest$ConfiguredFormatter
+
+java.util.logging.StreamHandler.level=FINE
+java.util.logging.StreamHandler.encoding=ASCII
+java.util.logging.StreamHandler.filter=HandlersConfigTest$ConfiguredFilter
+java.util.logging.StreamHandler.formatter=HandlersConfigTest$ConfiguredFormatter
+
+java.util.logging.SocketHandler.level=FINE
+java.util.logging.SocketHandler.encoding=ASCII
+java.util.logging.SocketHandler.filter=HandlersConfigTest$ConfiguredFilter
+java.util.logging.SocketHandler.formatter=HandlersConfigTest$ConfiguredFormatter
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/HandlersConfigTest$Default.props	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,6 @@
+# mandatory Default properties...
+
+.level= INFO
+handlers=HandlersConfigTest$ConfiguredHandler
+
+java.util.logging.MemoryHandler.target=HandlersConfigTest$ConfiguredHandler
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/HandlersConfigTest.java	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,330 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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 8029781 8030801
+ * @summary Test which verifies that various JDK logging Handlers are
+ *          configured correctly from defaults and/or LogManager properties
+ *          as specified in javadoc and that no special
+ *          logging permission is required for instantiating them.
+ * @run main/othervm HandlersConfigTest default
+ * @run main/othervm HandlersConfigTest configured
+ */
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.reflect.Field;
+import java.net.ServerSocket;
+import java.net.URL;
+import java.util.Objects;
+import java.util.logging.ConsoleHandler;
+import java.util.logging.Filter;
+import java.util.logging.Formatter;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogManager;
+import java.util.logging.LogRecord;
+import java.util.logging.MemoryHandler;
+import java.util.logging.SimpleFormatter;
+import java.util.logging.SocketHandler;
+import java.util.logging.StreamHandler;
+import java.util.logging.XMLFormatter;
+
+public abstract class HandlersConfigTest implements Runnable {
+
+    public static void main(String[] args) {
+        switch (args.length == 1 ? args[0] : "usage") {
+            case "default":
+                new Default().run();
+                break;
+            case "configured":
+                new Configured().run();
+                break;
+            default:
+                System.err.println("Usage: HandlersConfigTest [default|configured]");
+                break;
+        }
+    }
+
+    static final String CONFIG_FILE_PROPERTY = "java.util.logging.config.file";
+    final Field memoryHandlerTarget, memoryHandlerSize, streamHandlerOutput;
+    final ServerSocket serverSocket;
+
+    HandlersConfigTest() {
+        // establish access to private fields
+        try {
+            memoryHandlerTarget = MemoryHandler.class.getDeclaredField("target");
+            memoryHandlerTarget.setAccessible(true);
+            memoryHandlerSize = MemoryHandler.class.getDeclaredField("size");
+            memoryHandlerSize.setAccessible(true);
+            streamHandlerOutput = StreamHandler.class.getDeclaredField("output");
+            streamHandlerOutput.setAccessible(true);
+        } catch (NoSuchFieldException e) {
+            throw new AssertionError(e);
+        }
+
+        // load logging.propertes for the test
+        String rname = getClass().getName().replace('.', '/') + ".props";
+        URL url = getClass().getClassLoader().getResource(rname);
+        if (url == null || !"file".equals(url.getProtocol())) {
+            throw new IllegalStateException("Resource: " + rname + " not found or not on file: " + url);
+        }
+        System.setProperty(CONFIG_FILE_PROPERTY, url.getFile());
+
+        // create ServerSocket as a target for SocketHandler
+        try {
+            serverSocket = new ServerSocket(0); // auto allocated port
+        } catch (IOException e) {
+            throw new AssertionError(e);
+        }
+
+        // activate security
+        System.setSecurityManager(new SecurityManager() {
+            @Override
+            public void checkConnect(String host, int port) {
+                // allow socket connections
+            }
+        });
+
+        // initialize logging system
+        LogManager.getLogManager();
+    }
+
+    // check that defaults are used as specified by javadoc
+
+    public static class Default extends HandlersConfigTest {
+        public static void main(String[] args) {
+            new Default().run();
+        }
+
+        @Override
+        public void run() {
+            // MemoryHandler
+
+            check(new MemoryHandler(),
+                Level.ALL, null, null, SimpleFormatter.class,
+                ConfiguredHandler.class, 1000, Level.SEVERE);
+
+            check(new MemoryHandler(new SpecifiedHandler(), 100, Level.WARNING),
+                Level.ALL, null, null, SimpleFormatter.class,
+                SpecifiedHandler.class, 100, Level.WARNING);
+
+            // StreamHandler
+
+            check(new StreamHandler(),
+                Level.INFO, null, null, SimpleFormatter.class,
+                null);
+
+            check(new StreamHandler(System.out, new SpecifiedFormatter()),
+                Level.INFO, null, null, SpecifiedFormatter.class,
+                System.out);
+
+            // ConsoleHandler
+
+            check(new ConsoleHandler(),
+                Level.INFO, null, null, SimpleFormatter.class,
+                System.err);
+
+            // SocketHandler (use the ServerSocket's port)
+
+            try {
+                check(new SocketHandler("localhost", serverSocket.getLocalPort()),
+                    Level.ALL, null, null, XMLFormatter.class);
+            } catch (IOException e) {
+                throw new RuntimeException("Can't connect to localhost:" + serverSocket.getLocalPort(), e);
+            }
+        }
+    }
+
+    // check that LogManager properties configuration is respected
+
+    public static class Configured extends HandlersConfigTest {
+        public static void main(String[] args) {
+            new Configured().run();
+        }
+
+        @Override
+        public void run() {
+            // MemoryHandler
+
+            check(new MemoryHandler(),
+                Level.FINE, null, ConfiguredFilter.class, ConfiguredFormatter.class,
+                ConfiguredHandler.class, 123, Level.FINE);
+
+            check(new MemoryHandler(new SpecifiedHandler(), 100, Level.WARNING),
+                Level.FINE, null, ConfiguredFilter.class, ConfiguredFormatter.class,
+                SpecifiedHandler.class, 100, Level.WARNING);
+
+            // StreamHandler
+
+            check(new StreamHandler(),
+                Level.FINE, "ASCII", ConfiguredFilter.class, ConfiguredFormatter.class,
+                null);
+
+            check(new StreamHandler(System.out, new SpecifiedFormatter()),
+                Level.FINE, "ASCII", ConfiguredFilter.class, SpecifiedFormatter.class,
+                System.out);
+
+            // ConsoleHandler
+
+            check(new ConsoleHandler(),
+                Level.FINE, "ASCII", ConfiguredFilter.class, ConfiguredFormatter.class,
+                System.err);
+
+            // SocketHandler (use the ServerSocket's port)
+
+            try {
+                check(new SocketHandler("localhost", serverSocket.getLocalPort()),
+                    Level.FINE, "ASCII", ConfiguredFilter.class, ConfiguredFormatter.class);
+            } catch (Exception e) {
+                throw new RuntimeException("Can't connect to localhost:" + serverSocket.getLocalPort(), e);
+            }
+        }
+    }
+
+    // test infrastructure
+
+    void check(Handler handler,
+               Level expectedLevel,
+               String expectedEncoding,
+               Class<? extends Filter> expectedFilterType,
+               Class<? extends Formatter> expectedFormatterType) {
+        checkEquals(handler, "level", handler.getLevel(), expectedLevel);
+        checkEquals(handler, "encoding", handler.getEncoding(), expectedEncoding);
+        checkType(handler, "filter", handler.getFilter(), expectedFilterType);
+        checkType(handler, "formatter", handler.getFormatter(), expectedFormatterType);
+    }
+
+    void check(MemoryHandler handler,
+               Level expectedLevel,
+               String expectedEncoding,
+               Class<? extends Filter> expectedFilterType,
+               Class<? extends Formatter> expectedFormatterType,
+               Class<? extends Handler> expextedTargetType,
+               int expextedSize,
+               Level expectedPushLevel) {
+        checkType(handler, "target", getTarget(handler), expextedTargetType);
+        checkEquals(handler, "size", getSize(handler), expextedSize);
+        checkEquals(handler, "pushLevel", handler.getPushLevel(), expectedPushLevel);
+        check(handler, expectedLevel, expectedEncoding, expectedFilterType, expectedFormatterType);
+    }
+
+    void check(StreamHandler handler,
+               Level expectedLevel,
+               String expectedEncoding,
+               Class<? extends Filter> expectedFilterType,
+               Class<? extends Formatter> expectedFormatterType,
+               OutputStream expectedOutputStream) {
+        checkEquals(handler, "outputStream", getOutput(handler), expectedOutputStream);
+        check(handler, expectedLevel, expectedEncoding, expectedFilterType, expectedFormatterType);
+    }
+
+    <T> void checkEquals(Handler handler, String property, T value, T expectedValue) {
+        if (!Objects.equals(value, expectedValue)) {
+            fail(handler, property + ": " + value + ", expected " + property + ": " + expectedValue);
+        }
+    }
+
+    <T> void checkType(Handler handler, String property, T value, Class<? extends T> expectedType) {
+        if (!(expectedType == null && value == null || expectedType != null && expectedType.isInstance(value))) {
+            Class<?> type = value == null ? null : value.getClass();
+            fail(handler, property + " type: " + type + ", expected " + property + " type: " + expectedType);
+        }
+    }
+
+    void fail(Handler handler, String message) {
+        throw new AssertionError("Handler: " + handler.getClass().getName() +
+                                 ", configured with: " + getClass().getName() +
+                                 ", " + message);
+    }
+
+    Handler getTarget(MemoryHandler memoryHandler) {
+        try {
+            return (Handler) memoryHandlerTarget.get(memoryHandler);
+        } catch (IllegalAccessException e) {
+            throw new IllegalAccessError(e.getMessage());
+        }
+    }
+
+    int getSize(MemoryHandler memoryHandler) {
+        try {
+            return (int) memoryHandlerSize.get(memoryHandler);
+        } catch (IllegalAccessException e) {
+            throw new IllegalAccessError(e.getMessage());
+        }
+    }
+
+    OutputStream getOutput(StreamHandler streamHandler) {
+        try {
+            return (OutputStream) streamHandlerOutput.get(streamHandler);
+        } catch (IllegalAccessException e) {
+            throw new IllegalAccessError(e.getMessage());
+        }
+    }
+
+    // various independent types of Formatters, Filters, Handlers...
+
+    public static class SpecifiedFormatter extends Formatter {
+        @Override
+        public String format(LogRecord record) {
+            return String.valueOf(record);
+        }
+    }
+
+    public static class SpecifiedHandler extends Handler {
+        @Override
+        public void publish(LogRecord record) { }
+
+        @Override
+        public void flush() { }
+
+        @Override
+        public void close() throws SecurityException { }
+    }
+
+    public static class ConfiguredFormatter extends Formatter {
+        @Override
+        public String format(LogRecord record) {
+            return String.valueOf(record);
+        }
+    }
+
+    public static class ConfiguredFilter implements Filter {
+        @Override
+        public boolean isLoggable(LogRecord record) {
+            return true;
+        }
+    }
+
+    public static class ConfiguredHandler extends Handler {
+        @Override
+        public void publish(LogRecord record) { }
+
+        @Override
+        public void flush() { }
+
+        @Override
+        public void close() throws SecurityException { }
+    }
+}
--- a/jdk/test/java/util/logging/Listeners.java	Fri Dec 13 09:35:35 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-/*
- * Copyright (c) 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.
- *
- * 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 7192275
- * @summary Basic test of addPropertyListener/removePropertyListener methods
- * @run main/othervm Listeners
- */
-
-import java.util.logging.LogManager;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeEvent;
-
-public class Listeners {
-
-    static void assertTrue(boolean result, String msg) {
-        if (!result)
-            throw new RuntimeException(msg);
-    }
-
-    /**
-     * A {@code PropertyChangeListener} that counts the number of times that
-     * the {@code propertyChange} method is fired, and also checks that the
-     * event source is the expected (fixed) object.
-     */
-    static class Listener implements PropertyChangeListener {
-        private final Object expectedSource;
-        private int fireCount;
-
-        Listener(Object expectedSource) {
-            this.expectedSource = expectedSource;
-        }
-
-        int fireCount() {
-            return fireCount;
-        }
-
-        Listener reset() {
-            fireCount = 0;
-            return this;
-        }
-
-        @Override
-        public void propertyChange(PropertyChangeEvent evt) {
-            assertTrue(evt.getSource() == expectedSource, "Unexpected source");
-            fireCount++;
-        }
-    }
-
-    /**
-     * Tests that the given listeners are invoked the expected number of
-     * times.
-     */
-    static void test(Listener[] listeners, int... expected) throws Exception {
-        // reset counts
-        for (Listener listener : listeners) {
-            listener.reset();
-        }
-
-        // re-reading configuration causes events to be fired
-        LogManager.getLogManager().readConfiguration();
-
-        // check event listeners invoked as expected
-        for (int i = 0; i < expected.length; i++) {
-            assertTrue(listeners[i].fireCount() == expected[i],
-                "Unexpected event count");
-        }
-    }
-
-    @SuppressWarnings("deprecation")
-    public static void main(String[] args) throws Exception {
-        LogManager logman = LogManager.getLogManager();
-
-        Listener[] listeners = new Listener[2];
-        Listener listener1 = listeners[0] = new Listener(LogManager.class);
-        Listener listener2 = listeners[1] = new Listener(LogManager.class);
-
-        // add listeners
-        logman.addPropertyChangeListener(listener1);
-        test(listeners, 1, 0);
-
-        logman.addPropertyChangeListener(listener1);
-        test(listeners, 2, 0);
-
-        logman.addPropertyChangeListener(listener2);
-        test(listeners, 2, 1);
-
-        // null handling to check for impact on the existing registrations
-        try {
-            logman.addPropertyChangeListener(null);
-            assertTrue(false, "NullPointerException expected");
-        } catch (NullPointerException expected) { }
-        test(listeners, 2, 1);
-
-        logman.removePropertyChangeListener(null);  // no-op
-        test(listeners, 2, 1);
-
-        // remove listeners
-        logman.removePropertyChangeListener(listener1);
-        test(listeners, 1, 1);
-
-        logman.removePropertyChangeListener(listener1);
-        test(listeners, 0, 1);
-
-        logman.removePropertyChangeListener(listener1);  // no-op
-        test(listeners, 0, 1);
-
-        logman.removePropertyChangeListener(listener2);
-        test(listeners, 0, 0);
-
-        logman.removePropertyChangeListener(listener2);  // no-op
-        test(listeners, 0, 0);
-    }
-}
--- a/jdk/test/java/util/logging/ListenersWithSM.java	Fri Dec 13 09:35:35 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 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.
- *
- * 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 7192275
- * @summary Basic test of addPropertyListener/removePropertyListener methods
- * @run main/othervm ListenersWithSM grant
- * @run main/othervm ListenersWithSM deny
- */
-
-import java.nio.file.Paths;
-import java.util.logging.LogManager;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeEvent;
-
-public class ListenersWithSM {
-
-    @SuppressWarnings("deprecation")
-    public static void main(String[] args) throws Exception {
-        boolean granted = args[0].equals("grant");
-
-        // need to get reference to LogManager before setting SecurityManager
-        LogManager logman = LogManager.getLogManager();
-
-        // set policy and enable security manager
-        if (granted) {
-            String testSrc = System.getProperty("test.src");
-            if (testSrc == null)
-                testSrc = ".";
-            System.setProperty("java.security.policy",
-                Paths.get(testSrc).resolve("java.policy").toString());
-        }
-        System.setSecurityManager(new SecurityManager());
-
-        PropertyChangeListener listener = new PropertyChangeListener() {
-            @Override
-            public void propertyChange(PropertyChangeEvent evt) {
-            }
-        };
-
-        if (granted) {
-            // permission granted, no security exception expected
-            logman.addPropertyChangeListener(listener);
-            logman.removePropertyChangeListener(listener);
-        } else {
-            // denied
-            try {
-                logman.addPropertyChangeListener(listener);
-                throw new RuntimeException("SecurityException expected");
-            } catch (SecurityException expected) { }
-            try {
-                logman.removePropertyChangeListener(listener);
-                throw new RuntimeException("SecurityException expected");
-            } catch (SecurityException expected) { }
-        }
-    }
-}
--- a/jdk/test/java/util/logging/Logger/setResourceBundle/TestSetResourceBundle.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/util/logging/Logger/setResourceBundle/TestSetResourceBundle.java	Wed Jul 05 19:26:45 2017 +0200
@@ -57,8 +57,8 @@
      * that was present in the last LogRecord instance published.
      */
     static final class TestHandler extends Handler {
-        ResourceBundle lastBundle = null;
-        String lastBundleName = null;
+        volatile ResourceBundle lastBundle = null;
+        volatile String lastBundleName = null;
         @Override
         public void publish(LogRecord record) {
             lastBundle = record.getResourceBundle();
@@ -186,6 +186,8 @@
 
     public static void test(String loggerName) throws Exception {
 
+        System.out.println("Starting test for " + loggerName);
+
         final ResourceBundle bundle = ResourceBundle.getBundle(LIST_BUNDLE_NAME);
         Logger foobar = Logger.getLogger(loggerName);
 
@@ -235,16 +237,21 @@
         }
 
         // Create a child logger
-        Logger foobaz = Logger.getLogger(loggerName + ".baz");
+        final Logger foobaz = Logger.getLogger(loggerName + ".baz");
+
+        if (foobar != foobaz.getParent()) {
+            throw new RuntimeException("Unexpected parent: " +
+                    foobaz.getParent() + " != " + foobar);
+        }
 
         // Check that the child logger does not have a bundle set locally
         if (foobaz.getResourceBundle() != null) {
             throw new RuntimeException("Unexpected bundle: "
-                    + foobar.getResourceBundle());
+                    + foobaz.getResourceBundle());
         }
         if (foobaz.getResourceBundleName() != null) {
             throw new RuntimeException("Unexpected bundle: "
-                    + foobar.getResourceBundleName());
+                    + foobaz.getResourceBundleName());
         }
 
 
@@ -258,39 +265,65 @@
         // checks that the message has been logged with the bundle
         // inherited from the parent logger
         if (!LIST_BUNDLE_NAME.equals(handler.lastBundleName)) {
+            debugLogger(foobaz, foobar, handler);
             throw new RuntimeException("Unexpected bundle name: "
                     + handler.lastBundleName);
         }
         if (!bundle_fr.equals(handler.lastBundle)) {
+            debugLogger(foobaz, foobar, handler);
             throw new RuntimeException("Unexpected bundle: "
                     + handler.lastBundle);
         }
 
         // Check that we can get set a bundle on the child logger
         // using Logger.getLogger.
-        foobaz = Logger.getLogger(loggerName + ".baz", PROPERTY_BUNDLE_NAME);
+        final Logger foobaz2 = Logger.getLogger(loggerName + ".baz", PROPERTY_BUNDLE_NAME);
+        if (foobaz2 != foobaz) {
+            throw new RuntimeException("Unexpected logger: " + foobaz2 + " != " + foobaz);
+        }
+        if (foobar != foobaz.getParent()) {
+            throw new RuntimeException("Unexpected parent: " +
+                    foobaz.getParent() + " != " + foobar);
+        }
 
         // check that the child logger has the correct bundle.
         // it should no longer inherit it from its parent.
-        if (!PROPERTY_BUNDLE_NAME.equals(foobaz.getResourceBundleName())) {
+        if (!PROPERTY_BUNDLE_NAME.equals(foobaz2.getResourceBundleName())) {
             throw new RuntimeException("Unexpected bundle name: "
-                    + foobaz.getResourceBundleName());
+                    + foobaz2.getResourceBundleName());
+        }
+
+        if (!PROPERTY_BUNDLE_NAME.equals(foobaz2.getResourceBundle().getBaseBundleName())) {
+            throw new RuntimeException("Unexpected bundle name: "
+                    + foobaz2.getResourceBundle().getBaseBundleName());
         }
-        if (!PROPERTY_BUNDLE_NAME.equals(foobaz.getResourceBundle().getBaseBundleName())) {
-            throw new RuntimeException("Unexpected bundle name: "
-                    + foobaz.getResourceBundle().getBaseBundleName());
+
+        boolean found = false;
+        for (Handler h : foobaz2.getHandlers()) {
+            if (h == handler) {
+                found = true;
+                break;
+            }
+        }
+
+        if (!found) {
+            throw new RuntimeException("Expected handler not found in: " +
+                    foobaz2.getName() + "(" + foobaz2.getClass().getName()+")" );
         }
 
         // log a message on the child logger
-        foobaz.severe("dummy");
+        foobaz2.severe("dummy");
+
 
         // check that the last published log record has the appropriate
         // bundle.
         if (!PROPERTY_BUNDLE_NAME.equals(handler.lastBundleName)) {
+            debugLogger(foobaz2, foobar, handler);
             throw new RuntimeException("Unexpected bundle name: "
                     + handler.lastBundleName);
         }
-        if (foobaz.getResourceBundle() != handler.lastBundle) {
+        if (foobaz2.getResourceBundle() != handler.lastBundle) {
+            debugLogger(foobaz2, foobar, handler);
             throw new RuntimeException("Unexpected bundle: "
                     + handler.lastBundle);
         }
@@ -298,7 +331,7 @@
         // try to set a bundle that has a different name, and checks that
         // it fails in IAE.
         try {
-            foobaz.setResourceBundle(bundle_fr);
+            foobaz2.setResourceBundle(bundle_fr);
             throw new RuntimeException("Expected exception not raised!");
         } catch (IllegalArgumentException x) {
             System.out.println("Got expected exception: " + x);
@@ -333,10 +366,12 @@
 
         // check that the log record had the correct bundle.
         if (! PROPERTY_BUNDLE_NAME.equals(handler2.lastBundleName)) {
+            debugLogger(customLogger, foobar, handler2);
             throw new RuntimeException("Unexpected bundle name: "
                     + handler2.lastBundleName);
         }
         if (! PROPERTY_BUNDLE_NAME.equals(customLogger.getResourceBundleName())) {
+            debugLogger(customLogger, foobar, handler2);
             throw new RuntimeException("Unexpected bundle name: "
                     + customLogger.getResourceBundleName());
         }
@@ -356,6 +391,7 @@
         // because getResourceBundleName() is called on parent logger
         //         we will have handler2.lastBundleName = PROPERTY_BUNDLE_NAME
         if (!PROPERTY_BUNDLE_NAME.equals(handler2.lastBundleName)) {
+            debugLogger(biebar, customLogger, handler2);
             throw new RuntimeException("Unexpected bundle name: "
                     + handler2.lastBundleName);
         }
@@ -363,13 +399,70 @@
         //         we will have getBaseName(handler2.lastBundle) = PROPERTY_BUNDLE_NAME
         //         and not handler2.lastBundle = bundle_fr
         if (handler2.lastBundle == null) {
+            debugLogger(biebar, customLogger, handler2);
             throw new RuntimeException("Unexpected bundle: "
                     + handler2.lastBundle);
         }
         if (!PROPERTY_BUNDLE_NAME.equals(getBaseName(handler2.lastBundle))) {
+            debugLogger(biebar, customLogger, handler2);
             throw new RuntimeException("Unexpected bundle name: "
                     + getBaseName(handler2.lastBundle));
         }
+
+        // Just make sure that these loggers won't be eagerly GCed...
+        if (foobar == null || !loggerName.equals(foobar.getName())) {
+            throw new RuntimeException("foobar is null "
+                    + "- or doesn't have the expected  name: " + foobar);
+        }
+        if (foobaz == null || !foobaz.getName().startsWith(loggerName)) {
+            throw new RuntimeException("foobaz is null "
+                    + "- or doesn't have the expected  name: " + foobaz);
+        }
+        if (foobaz2 == null || !foobaz2.getName().startsWith(loggerName)) {
+            throw new RuntimeException("foobaz2 is null "
+                    + "- or doesn't have the expected  name: " + foobaz2);
+        }
+        if (!customLogger.getName().startsWith(loggerName)) {
+            throw new RuntimeException("customLogger "
+                    + "doesn't have the expected name: " + customLogger);
+        }
+        if (!biebar.getName().startsWith(loggerName)) {
+            throw new RuntimeException("biebar "
+                    + "doesn't have the expected  name: " + biebar.getName());
+        }
+        System.out.println("Test passed for " + loggerName);
+    }
+
+    static void debugLogger(Logger logger, Logger expectedParent, TestHandler handler) {
+        final String logName = logger.getName();
+        final String prefix = "    " + logName;
+        System.err.println("Logger " + logName
+                + " logged with bundle name " + handler.lastBundleName
+                + " (" + handler.lastBundle + ")");
+        System.err.println(prefix + ".getResourceBundleName() is "
+                + logger.getResourceBundleName());
+        System.err.println(prefix + ".getResourceBundle() is "
+                + logger.getResourceBundle());
+        final Logger parent = logger.getParent();
+        final String pname = parent == null ? null : parent.getName();
+        final String pclass = parent == null ? ""
+                : ("(" + parent.getClass().getName() + ")");
+        final String presn = parent == null ? null
+                : parent.getResourceBundleName();
+        final ResourceBundle pres = parent == null ? null
+                : parent.getResourceBundle();
+        System.err.println(prefix + ".getParent() is "
+                + pname + (pname == null ? ""
+                        : (" " + pclass + ": " + parent)));
+        System.err.println("    expected parent is :" + expectedParent);
+        System.err.println(prefix + ".parent.getResourceBundleName() is "
+                + presn);
+        System.err.println(prefix + ".parent.getResourceBundle() is "
+                + pres);
+        System.err.println("    expected parent getResourceBundleName() is "
+                + expectedParent.getResourceBundleName());
+        System.err.println("    expected parent.getResourceBundle() is "
+                + expectedParent.getResourceBundle());
     }
 
     public static class SimplePolicy extends Policy {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/RootLogger/RootLevelInConfigFile.java	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,207 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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.FilePermission;
+import java.io.IOException;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.util.PropertyPermission;
+import java.util.logging.Level;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+import java.util.logging.LoggingPermission;
+import sun.misc.JavaAWTAccess;
+import sun.misc.SharedSecrets;
+
+/**
+ * @test
+ * @bug 8030850
+ * @summary Tests that setting .level=FINEST for the root logger in logging
+ *      configuration file does work.
+ * @run main/othervm RootLevelInConfigFile
+ *
+ * @author danielfuchs
+ */
+public class RootLevelInConfigFile {
+
+    public final static String CONFIG_FILE_KEY = "java.util.logging.config.file";
+
+    public static void main(String[] args) throws IOException {
+        System.setProperty(CONFIG_FILE_KEY,
+                new File(System.getProperty("test.src", "."),
+                        "rootlogger.properties").getAbsolutePath());
+        System.out.println(CONFIG_FILE_KEY + "="
+                + System.getProperty(CONFIG_FILE_KEY));
+        if (! new File(System.getProperty(CONFIG_FILE_KEY)).canRead()) {
+            throw new RuntimeException("can't read config file: "
+                    + System.getProperty(CONFIG_FILE_KEY));
+        }
+
+        final String configFile = System.getProperty(CONFIG_FILE_KEY);
+
+        test("no security");
+
+        LogManager.getLogManager().readConfiguration();
+
+        Policy.setPolicy(new SimplePolicy(configFile));
+        System.setSecurityManager(new SecurityManager());
+
+        test("security");
+
+        LogManager.getLogManager().readConfiguration();
+
+        final JavaAWTAccessStub access = new JavaAWTAccessStub();
+        SharedSecrets.setJavaAWTAccess(access);
+
+        test("security and no context");
+
+        for (Context ctx : Context.values()) {
+
+            LogManager.getLogManager().readConfiguration();
+
+            access.setContext(ctx);
+
+            test("security and context " + ctx);
+        }
+    }
+
+    public static void test(String conf) throws IOException {
+
+        System.out.println("Testing with " + conf);
+
+        testLoggableLevels();
+
+        LogManager.getLogManager().readConfiguration();
+
+        testLoggableLevels();
+
+    }
+
+    private static void testLoggableLevels() {
+
+        Logger foobar = Logger.getLogger("foo.bar");
+        if (!foobar.isLoggable(Level.FINEST)) {
+            throw new RuntimeException("Expected FINEST to be loggable in "
+                    + foobar.getName());
+        }
+        if (!foobar.getParent().isLoggable(Level.FINEST)) {
+            throw new RuntimeException("Expected FINEST to be loggable in "
+                    + foobar.getName());
+        }
+
+        Logger global = Logger.getGlobal();
+        if (!global.isLoggable(Level.FINEST)) {
+            throw new RuntimeException("Expected FINEST to be loggable in "
+                    + global.getName());
+        }
+        if (!global.getParent().isLoggable(Level.FINEST)) {
+            throw new RuntimeException("Expected FINEST to be loggable in "
+                    + global.getName());
+        }
+
+        Logger root = Logger.getLogger("");
+        if (!global.isLoggable(Level.FINEST)) {
+            throw new RuntimeException("Expected FINEST to be loggable in "
+                    + root.getName());
+        }
+        if (!global.getParent().isLoggable(Level.FINEST)) {
+            throw new RuntimeException("Expected FINEST to be loggable in "
+                    + root.getName());
+        }
+
+        root.setLevel(Level.FINER);
+
+        if (foobar.isLoggable(Level.FINEST)) {
+            throw new RuntimeException("Didn't expect FINEST to be loggable in "
+                    + foobar.getName());
+        }
+        if (foobar.getParent().isLoggable(Level.FINEST)) {
+            throw new RuntimeException("Didn't expect FINEST to be loggable in "
+                    + foobar.getName());
+        }
+        if (global.isLoggable(Level.FINEST)) {
+            throw new RuntimeException("Didn't expect FINEST to be loggable in "
+                    + global.getName());
+        }
+        if (global.getParent().isLoggable(Level.FINEST)) {
+            throw new RuntimeException("Didn't expect FINEST to be loggable in "
+                    + global.getName());
+        }
+
+        if (!foobar.isLoggable(Level.FINER)) {
+            throw new RuntimeException("Expected FINER to be loggable in "
+                    + foobar.getName());
+        }
+        if (!foobar.getParent().isLoggable(Level.FINER)) {
+            throw new RuntimeException("Expected FINER to be loggable in "
+                    + foobar.getName());
+        }
+
+        if (!global.isLoggable(Level.FINER)) {
+            throw new RuntimeException("Expected FINER to be loggable in "
+                    + global.getName());
+        }
+        if (!global.getParent().isLoggable(Level.FINER)) {
+            throw new RuntimeException("Expected FINER to be loggable in "
+                    + global.getName());
+        }
+
+    }
+
+    static final class SimplePolicy extends Policy {
+
+        final PermissionCollection perms = new Permissions();
+        public SimplePolicy(String configFile) {
+            perms.add(new LoggingPermission("control", null));
+            perms.add(new PropertyPermission("java.util.logging.config.class","read"));
+            perms.add(new PropertyPermission("java.util.logging.config.file","read"));
+            perms.add(new FilePermission(configFile, "read"));
+            perms.add(new RuntimePermission("accessClassInPackage.sun.misc"));
+        }
+
+        @Override
+        public boolean implies(ProtectionDomain domain, Permission permission) {
+            return perms.implies(permission);
+        }
+    }
+
+    static enum Context { ONE, TWO };
+
+    static final class JavaAWTAccessStub implements JavaAWTAccess {
+        private Context context;
+
+        public void setContext(Context context) {
+            this.context = context;
+        }
+
+        @Override
+        public Object getAppletContext() {
+            return context;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/RootLogger/rootlogger.properties	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,1 @@
+.level=FINEST
--- a/jdk/test/java/util/logging/TestLoggerBundleSync.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/util/logging/TestLoggerBundleSync.java	Wed Jul 05 19:26:45 2017 +0200
@@ -190,8 +190,10 @@
         final static class MyHandler extends Handler {
             volatile ResourceBundle rb;
             volatile String rbName;
+            volatile int count = 0;
             @Override
             public synchronized void publish(LogRecord record) {
+                count++;
                 rb = record.getResourceBundle();
                 rbName = record.getResourceBundleName();
             }
@@ -227,23 +229,51 @@
                         Logger ll = Logger.getLogger(l.getName()+".bie.bye");
                         ResourceBundle hrb;
                         String hrbName;
+                        if (handler.getLevel() != Level.FINEST) {
+                            throw new RuntimeException("Handler level is not finest: "
+                                    + handler.getLevel());
+                        }
+                        final int countBefore = handler.count;
                         ll.setLevel(Level.FINEST);
                         ll.addHandler(handler);
                         ll.fine("dummy");
                         ll.removeHandler(handler);
+                        final int countAfter = handler.count;
+                        if (countBefore == countAfter) {
+                            throw new RuntimeException("Handler not called for "
+                                    + ll.getName() + "("+ countAfter +")");
+                        }
                         hrb = handler.rb;
                         hrbName = handler.rbName;
                         if (name != null) {
+                            // if name is not null, then it implies that it
+                            // won't change, since setResourceBundle() cannot
+                            // replace a non null name.
+                            // Since we never set the resource bundle on 'll',
+                            // then ll must inherit its resource bundle [name]
+                            // from l - and therefor we should find it in
+                            // handler.rb/handler.rbName
                             if (!name.equals(hrbName)) {
                                 throw new RuntimeException("Unexpected bundle name: "
-                                        +hrb.getBaseBundleName());
+                                        +hrbName);
                             }
+                            // here we know that hrbName is not null so hrb
+                            // should not be null either.
                             if (!name.equals(hrb.getBaseBundleName())) {
                                 throw new RuntimeException("Unexpected bundle name: "
                                         +hrb.getBaseBundleName());
                             }
                         }
 
+                        // Make sure to refer to 'l' explicitly in order to
+                        // prevent eager garbage collecting before the end of
+                        // the test (JDK-8030192)
+                        if (!ll.getName().startsWith(l.getName())) {
+                            throw new RuntimeException("Logger " + ll.getName()
+                                    + "does not start with expected prefix "
+                                    + l.getName());
+                        }
+
                         getRBcount.incrementAndGet();
                         if (!goOn) break;
                         Thread.sleep(1);
--- a/jdk/test/java/util/logging/java.policy	Fri Dec 13 09:35:35 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-grant {
-    permission java.util.logging.LoggingPermission "control";
-};
--- a/jdk/test/java/util/stream/TestDoubleSumAverage.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/util/stream/TestDoubleSumAverage.java	Wed Jul 05 19:26:45 2017 +0200
@@ -25,17 +25,20 @@
 import java.util.function.*;
 import java.util.stream.*;
 
+import static java.lang.Double.*;
+
 /*
  * @test
- * @bug 8006572
+ * @bug 8006572 8030212
  * @summary Test for use of non-naive summation in stream-related sum and average operations.
  */
 public class TestDoubleSumAverage {
     public static void main(String... args) {
         int failures = 0;
 
+        failures += testZeroAverageOfNonEmptyStream();
         failures += testForCompenstation();
-        failures += testZeroAverageOfNonEmptyStream();
+        failures += testNonfiniteSum();
 
         if (failures > 0) {
             throw new RuntimeException("Found " + failures + " numerical failure(s).");
@@ -43,6 +46,15 @@
     }
 
     /**
+     * Test to verify that a non-empty stream with a zero average is non-empty.
+     */
+    private static int testZeroAverageOfNonEmptyStream() {
+        Supplier<DoubleStream> ds = () -> DoubleStream.iterate(0.0, e -> 0.0).limit(10);
+
+        return  compareUlpDifference(0.0, ds.get().average().getAsDouble(), 0);
+    }
+
+    /**
      * Compute the sum and average of a sequence of double values in
      * various ways and report an error if naive summation is used.
      */
@@ -83,19 +95,68 @@
         return failures;
     }
 
-    /**
-     * Test to verify that a non-empty stream with a zero average is non-empty.
-     */
-    private static int testZeroAverageOfNonEmptyStream() {
-        Supplier<DoubleStream> ds = () -> DoubleStream.iterate(0.0, e -> 0.0).limit(10);
+    private static int testNonfiniteSum() {
+        int failures = 0;
+
+        Map<Supplier<DoubleStream>, Double> testCases = new LinkedHashMap<>();
+        testCases.put(() -> DoubleStream.of(MAX_VALUE, MAX_VALUE),   POSITIVE_INFINITY);
+        testCases.put(() -> DoubleStream.of(-MAX_VALUE, -MAX_VALUE), NEGATIVE_INFINITY);
+
+        testCases.put(() -> DoubleStream.of(1.0d, POSITIVE_INFINITY, 1.0d), POSITIVE_INFINITY);
+        testCases.put(() -> DoubleStream.of(POSITIVE_INFINITY),             POSITIVE_INFINITY);
+        testCases.put(() -> DoubleStream.of(POSITIVE_INFINITY, POSITIVE_INFINITY), POSITIVE_INFINITY);
+        testCases.put(() -> DoubleStream.of(POSITIVE_INFINITY, POSITIVE_INFINITY, 0.0), POSITIVE_INFINITY);
+
+        testCases.put(() -> DoubleStream.of(1.0d, NEGATIVE_INFINITY, 1.0d), NEGATIVE_INFINITY);
+        testCases.put(() -> DoubleStream.of(NEGATIVE_INFINITY),             NEGATIVE_INFINITY);
+        testCases.put(() -> DoubleStream.of(NEGATIVE_INFINITY, NEGATIVE_INFINITY), NEGATIVE_INFINITY);
+        testCases.put(() -> DoubleStream.of(NEGATIVE_INFINITY, NEGATIVE_INFINITY, 0.0), NEGATIVE_INFINITY);
 
-        return  compareUlpDifference(0.0, ds.get().average().getAsDouble(), 0);
+        testCases.put(() -> DoubleStream.of(1.0d, NaN, 1.0d),               NaN);
+        testCases.put(() -> DoubleStream.of(NaN),                           NaN);
+        testCases.put(() -> DoubleStream.of(1.0d, NEGATIVE_INFINITY, POSITIVE_INFINITY, 1.0d), NaN);
+        testCases.put(() -> DoubleStream.of(1.0d, POSITIVE_INFINITY, NEGATIVE_INFINITY, 1.0d), NaN);
+        testCases.put(() -> DoubleStream.of(POSITIVE_INFINITY, NaN), NaN);
+        testCases.put(() -> DoubleStream.of(NEGATIVE_INFINITY, NaN), NaN);
+        testCases.put(() -> DoubleStream.of(NaN, POSITIVE_INFINITY), NaN);
+        testCases.put(() -> DoubleStream.of(NaN, NEGATIVE_INFINITY), NaN);
+
+        for(Map.Entry<Supplier<DoubleStream>, Double> testCase : testCases.entrySet()) {
+            Supplier<DoubleStream> ds = testCase.getKey();
+            double expected = testCase.getValue();
+
+            DoubleSummaryStatistics stats = ds.get().collect(DoubleSummaryStatistics::new,
+                                                             DoubleSummaryStatistics::accept,
+                                                             DoubleSummaryStatistics::combine);
+
+            failures += compareUlpDifference(expected, stats.getSum(), 0);
+            failures += compareUlpDifference(expected, stats.getAverage(), 0);
+
+            failures += compareUlpDifference(expected, ds.get().sum(), 0);
+            failures += compareUlpDifference(expected, ds.get().average().getAsDouble(), 0);
+
+            failures += compareUlpDifference(expected, ds.get().boxed().collect(Collectors.summingDouble(d -> d)), 0);
+            failures += compareUlpDifference(expected, ds.get().boxed().collect(Collectors.averagingDouble(d -> d)), 0);
+        }
+
+        return failures;
     }
 
     /**
      * Compute the ulp difference of two double values and compare against an error threshold.
      */
     private static int compareUlpDifference(double expected, double computed, double threshold) {
+        if (!Double.isFinite(expected)) {
+            // Handle NaN and infinity cases
+            if (Double.compare(expected, computed) == 0)
+                return 0;
+            else {
+                System.err.printf("Unexpected sum, %g rather than %g.%n",
+                                  computed, expected);
+                return 1;
+            }
+        }
+
         double ulpDifference = Math.abs(expected - computed) / Math.ulp(expected);
 
         if (ulpDifference > threshold) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/CountLargeTest.java	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ *
+ * 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 Tests counting of streams containing Integer.MAX_VALUE + 1 elements
+ * @bug 8031187
+ */
+
+package org.openjdk.tests.java.util.stream;
+
+import java.util.stream.LongStream;
+
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.*;
+
+@Test
+public class CountLargeTest {
+
+    static final long EXPECTED_LARGE_COUNT = 1L + Integer.MAX_VALUE;
+
+    public void testRefLarge() {
+        long count = LongStream.range(0, EXPECTED_LARGE_COUNT)
+                .mapToObj(e -> null).count();
+
+        assertEquals(count, EXPECTED_LARGE_COUNT);
+    }
+
+    public void testIntLarge() {
+        long count = LongStream.range(0, EXPECTED_LARGE_COUNT)
+                .mapToInt(e -> 0).count();
+
+        assertEquals(count, EXPECTED_LARGE_COUNT);
+    }
+
+    public void testLongLarge() {
+        long count = LongStream.range(0, EXPECTED_LARGE_COUNT)
+                .count();
+
+        assertEquals(count, EXPECTED_LARGE_COUNT);
+    }
+
+    public void testDoubleLarge() {
+        long count = LongStream.range(0, EXPECTED_LARGE_COUNT)
+                .mapToDouble(e -> 0.0).count();
+
+        assertEquals(count, EXPECTED_LARGE_COUNT);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/CountTest.java	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ *
+ * 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 Tests counting of streams
+ * @bug 8031187
+ */
+
+package org.openjdk.tests.java.util.stream;
+
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.DoubleStream;
+import java.util.stream.DoubleStreamTestDataProvider;
+import java.util.stream.IntStream;
+import java.util.stream.IntStreamTestDataProvider;
+import java.util.stream.LongStream;
+import java.util.stream.LongStreamTestDataProvider;
+import java.util.stream.OpTestCase;
+import java.util.stream.Stream;
+import java.util.stream.StreamTestDataProvider;
+import java.util.stream.TestData;
+
+import org.testng.annotations.Test;
+
+public class CountTest extends OpTestCase {
+
+    @Test(dataProvider = "StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
+    public void testOps(String name, TestData.OfRef<Integer> data) {
+        AtomicLong expectedCount = new AtomicLong();
+        data.stream().forEach(e -> expectedCount.incrementAndGet());
+
+        withData(data).
+                terminal(Stream::count).
+                expectedResult(expectedCount.get()).
+                exercise();
+    }
+
+    @Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
+    public void testOps(String name, TestData.OfInt data) {
+        AtomicLong expectedCount = new AtomicLong();
+        data.stream().forEach(e -> expectedCount.incrementAndGet());
+
+        withData(data).
+                terminal(IntStream::count).
+                expectedResult(expectedCount.get()).
+                exercise();
+    }
+
+    @Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
+    public void testOps(String name, TestData.OfLong data) {
+        AtomicLong expectedCount = new AtomicLong();
+        data.stream().forEach(e -> expectedCount.incrementAndGet());
+
+        withData(data).
+                terminal(LongStream::count).
+                expectedResult(expectedCount.get()).
+                exercise();
+    }
+
+    @Test(dataProvider = "DoubleStreamTestData", dataProviderClass = DoubleStreamTestDataProvider.class)
+    public void testOps(String name, TestData.OfDouble data) {
+        AtomicLong expectedCount = new AtomicLong();
+        data.stream().forEach(e -> expectedCount.incrementAndGet());
+
+        withData(data).
+                terminal(DoubleStream::count).
+                expectedResult(expectedCount.get()).
+                exercise();
+    }
+}
--- a/jdk/test/java/util/zip/ZipFile/FinalizeZipFile.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/util/zip/ZipFile/FinalizeZipFile.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -27,11 +27,9 @@
  */
 
 import java.io.*;
-import java.nio.*;
 import java.util.Random;
 import java.util.zip.*;
 import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
 
 public class FinalizeZipFile {
 
@@ -43,6 +41,7 @@
             super(f);
             System.out.printf("Using %s%n", f.getPath());
         }
+        @Override
         protected void finalize() throws IOException {
             System.out.printf("Killing %s%n", getName());
             super.finalize();
@@ -81,7 +80,7 @@
         makeGarbage();
 
         System.gc();
-        finalizersDone.await(5, TimeUnit.SECONDS);
+        finalizersDone.await();
 
         // Not all ZipFiles were collected?
         equal(finalizersDone.getCount(), 0L);
--- a/jdk/test/java/util/zip/ZipFile/ReadLongZipFileName.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/java/util/zip/ZipFile/ReadLongZipFileName.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -24,6 +24,7 @@
 /**
  * @test
  * @bug 6374379
+ * @library ../../../../lib/testlibrary
  * @summary Verify that we can read zip file names > 255 chars long
  */
 
@@ -31,6 +32,7 @@
 import java.util.jar.*;
 import java.util.zip.*;
 import java.util.Stack;
+import jdk.testlibrary.FileUtils;
 
 public class ReadLongZipFileName {
     private static String entryName = "testFile.txt";;
@@ -101,7 +103,12 @@
 
         while (! directories.empty()) {
             File f = directories.pop();
-            check(f.delete());
+            try {
+                FileUtils.deleteFileWithRetry(f.toPath());
+            } catch (IOException e) {
+                unexpected(e, "Fail to clean up directory, " + f);
+                break;
+            }
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/parsers/8027359/XML11EntityScannerTest.java	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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 8027359
+ * @summary test that the XML11EntityScanner refreshes cache when it loads new data
+ * @run main XML11EntityScannerTest
+ */
+
+import java.io.*;
+import java.util.regex.Pattern;
+import javax.xml.parsers.DocumentBuilderFactory;
+import org.w3c.dom.*;
+
+
+/**
+ * XML11EntityScanner functions similarly as XMLEntityScanner in handling data
+ * cache
+ */
+public class XML11EntityScannerTest {
+    static final String rawXML =
+            "<?xml version=\"1.1\" encoding=\"UTF-8\" standalone=\"no\"?>"
+            + "<WebOfTrustRC2 Version=\"4004\">"
+            + "<Identity Name=\"maggot\" PublishesTrustList=\"true\" Version=\"1\">"
+            + "<Context Name=\"Introduction\"/>"
+            + "<Context Name=\"FreetalkRC2\"/>"
+            + "<Property Name=\"IntroductionPuzzleCount\" Value=\"10\"/>"
+            + "<TrustList>"
+            + "<Trust Comment=\"\" Identity=\"USK@fdZ2In5mnLVG6RTc5hq9P~M1EG0WuH-itZ7mnQx2iuM,aUG-57VqxQLhQ4N1uNmH9kSI2syEfVFrVOIPAKTY2Yg,AQACAAE/WebOfTrustRC2/5\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@YwwRkHSo-xU8CvSFcLqlU2FFsQ3ztjr0X~xPXkX-klY,poB3tdcXrBU9naI0pyNVYp~zQmHaFkRRTj8xB8tuiPc,AQACAAE/WebOfTrustRC2/7\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@lsd~~79wrGvfb99FnAEY4VhJg2b5KFUloCOUff-Q2fk,71eV-F580euOtaCgim69Yw~2Rjh43DT49sl6zNamjk0,AQACAAE/WebOfTrustRC2/47\" Value=\"100\"/>"
+            + "<Trust Comment=\"Automatically assigned trust to a seed identity.\" Identity=\"USK@xyzElfFQnwBb4ZuSEh1aSNsbRjEGCTa-2rcjeW58A4E,TiYrXSCcoGETPf0TWLNthaimJEP1PW7nJ2tYXKxdC4s,AQACAAE/WebOfTrustRC2/456\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@pTtYoCsMO-~~2Grqya6Y7cf7nIU3VlL4168-c6EIwA8,QabBgrH1LYKKyBROnWz1r6iI8N7WFTt-mKD-0Qxsw1w,AQACAAE/WebOfTrustRC2/133\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@m~lDSvnetPNy77wsoxDZDUf7OkgX6ZAd7ob9orm3J4Y,SEX20g148KGJg3bsxvXNPNbUsVs1yQ5LfVUOGMh~1Q0,AQACAAE/WebOfTrustRC2/7\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@ss5yQit~bQL5easM68d4sImnPAxHNUbi99XtDMhpzgQ,CnpuD8dO29KvpkQyxtz1llAxHCB7yXfqrQLNRIELZow,AQACAAE/WebOfTrustRC2/2\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@krPcyGts~~wZTbABTAJ59nSplmum2~EkSD5IzinrFko,7YEbm-YEx1LFoZVHtGmIa5q0KbEjw48Rgwx2NqwrH~o,AQACAAE/WebOfTrustRC2/15\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@Usl-yNWc3VtuQWQ9srowZaWyfB6MiD9fzM5WexrlKE8,qMS83aGFsN~aFGajUmGrnbXvRIYZMd8N8IjnGmEvi-s,AQACAAE/WebOfTrustRC2/68\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@St0yKRdQJ3Lq17yoVt9h08bMfhqRhH1vtrcVVInoZVU,BaYM72qM3CYO1yzfVyO1UDUobL56CMbt9EQt3sEXabA,AQACAAE/WebOfTrustRC2/7\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@P8v4ZHUBPYGylYC-KHeWmeu5ZvB6RPYGgKcI5639Wz8,OM9PvjwMlt4L6jKRhqpvyblwpVMYumUgYFrAu3NxY~o,AQACAAE/WebOfTrustRC2/54\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@u2vn3Lh6Kte2-TgBSNKorbsKkuAt34ckoLmgx0ndXO0,4~q8q~3wIHjX9DT0yCNfQmr9oxmYrDZoQVLOdNg~yk0,AQACAAE/WebOfTrustRC2/2\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@MotrIucaZk37pJNS~HHpW5Vea3q0EZpfENPNGSjWh9s,RkFyDjl6-l7V-xYMWtGypmDYk-VehAU1LXmNYdIlHJs,AQACAAE/WebOfTrustRC2/108\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@KXAWN8DJxJ48XzZu7IBBpZ7SFc4n-OXqu4HhQC0V9Ww,DyklyACbgDCZyFpq-LeNqmuve7KWv-WDvJicd37ycn4,AQACAAE/WebOfTrustRC2/11\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@D6BZ1sSEmDMKNMPUN9I~7AalkkXockAdtbxONEN315w,0LiGUSSv4Ln4O7Xe4GQjpMEflNN7okKAH42Vlpv8d8s,AQACAAE/WebOfTrustRC2/56\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@sDehmSJoiaKYT455GIGHIVNKMs7KmiiwXXcCIcDhZ3o,upypWy-ze9Cz7WiCnbbJmoZOh7Xtveitftc5bE~p0Ug,AQACAAE/WebOfTrustRC2/6\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@GsTGXzIm9BTM5~KSZJknfTcPpJtlRs62aJtkNp05T5A,wuQcDjsdPQD9Fa21zWGB5GiiDlmf56vI9Niu5jl8eiM,AQACAAE/WebOfTrustRC2/31\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@eLFdT9VWP60iPNf8a3AkZrzgkcgje2n3Ca1yS8Tc5HU,5D0PISp19VkgzD4VSrRFTmo2CCvRoIuxlQzgMZBmj74,AQACAAE/WebOfTrustRC2/62\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@rz12UCXn-lG53i-6JswD98Kk9Zp0kt05gqIMNYc~9d0,42hoYZ5f~1fPuyvTOVYGJ~28MgYBSfoyzceR8-u1Z2I,AQACAAE/WebOfTrustRC2/126\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@5CYp3t28N5ZbPss9XhOkwUjD~T65q6-nc4aGwbV~-O0,CBfwMjYBiqKunzj3k6Ofpo9pyQsVFPz0OUWVzfd5a0c,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@dSSrRL9BY7JmTQD0dCpcIgVaLFF7pqU8EJzVUp1BYPA,EkTPkLrhEBQLPq-dRVPB1f2CAVdFGbXbUBlIww6re60,AQACAAE/WebOfTrustRC2/5\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@cw2rrCAcYTBjlO-I8DfEj-txttebZMG2LwuPGJV3Qlg,5ZcXLJW8G-R2SFqg4TEQX7IMs~e3Q4DjxUXGuHr9fxA,AQACAAE/WebOfTrustRC2/7\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@7zpRmhkkd5XcAUY6yUwp-53t7to3UN96w98~KQEwha0,30VpXev32s2mhmM5aBRJ---I0OlYbbN6~18j8rJ6qMU,AQACAAE/WebOfTrustRC2/8\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@YmCWYwlaSeE8o~8GawGYWeuPwsgVQtlBwlBkhGQFX04,H3DthY0MZXTe4rL0vsUOOMQDaj6UB9wK59yEwG8Q6No,AQACAAE/WebOfTrustRC2/13\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@aO9svsQEWmib~UyF1ihRUHA8i6uZprGy-tIS-Od9MMk,kwaMemPMVp-jcIRgGLAdF6PZimNE2cZFbvM6ShXAuZw,AQACAAE/WebOfTrustRC2/7\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@6J7FWPHwiCElTRXAO77tMGYAiLxerNF~5olAG0alQxQ,cz72iTz9FT~H57TgroVFv1eZlN5Ia5dhCtRa8bLh1KQ,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@kukYpNG56TNUnQzQe1RZvSYoqQ5B9lcoMZyDlh7xfO4,DNybejZVcWBAaByMRYYLZlgzUjQg28V8j6Zu1CtBc~g,AQACAAE/WebOfTrustRC2/27\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@a-tin0kMl1I~8xn5lkQDqYZRExKLzJITrxcNsr4T~fY,0VmnI67gAzIpdXlZFq~hYD8ikR5IEAg5QTwQv5Ifv5M,AQACAAE/WebOfTrustRC2/24\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@g~4XXw0hjp9TLocYZzunYWX6Don2AQhG-zplmzoCmY0,lyNjClSjRCrBZXVcmPKEAfvH01ySPgv1NWqL8wd11L8,AQACAAE/WebOfTrustRC2/115\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@UXgNMPe1YbVpXHOBXgMlcm9XcGY0G3gUtu43IO-YLLA,7EHSp20GHupg0rWrGPRY1g0TFJcRs-kubVtAcQRMxAc,AQACAAE/WebOfTrustRC2/69\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@lHrF2trsC9gyVeT2zpoL6IlZMz0aKlhN4xa2Ig70rmA,niASdKFC3nDfW6KMvzcv6VmRoHakE7GQAFpfz~2-v3Y,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@hp7IFNYSA97cHNAnHcreTJjQE5fF5sbsFlvbcZXaoxQ,O5h6cAcl5MvxuE2-xOkuvUP4JkT59NQNtaSmtuAS2Y8,AQACAAE/WebOfTrustRC2/16\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@QKPxALYrv6UyAGJs7tor8YlcikFzmy2msZ~42JMT~80,vx01piijkj0o3K8gzNaAOIIZ7NAtQVvPBxlRKtc4iP0,AQACAAE/WebOfTrustRC2/35\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@NmNfUNIr2WwIb9Ej1038Pk0M5gS1M0eHKvxdWqRUfTg,JUJYTsWuNQPOHK039Rczp6oPZDbfPdbO62gSaCuBXFQ,AQACAAE/WebOfTrustRC2/69\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@ONB7kRFo7mI0O3~QLRWlTbo1oB91XmGGS7KtSzz4XVI,yGiqMWRwR~i6ffAXOTBvrngHGC6nYOETUXj4L6Izj64,AQACAAE/WebOfTrustRC2/122\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@k-i0PmxoxO6Mahx8s850Rd7TEe0r4cnEohqC66aMDKw,IlTVYmQ9OSHjiu5pOLq4t-8r50SsVPNMlXn56zfpfDI,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@GtzvV-VHMGQILkpZ3O4CWBTWlhB423UUwpIlzRDgBLs,HUxBDT-Hhy6GqjBV24NRMjlK-o76YGMEgO~ZS6yighU,AQACAAE/WebOfTrustRC2/6\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@Ws0yzkcOYw6ax~kCtnzyX4MgLBHiQd5a6u9FMUmqLG4,zqNjNNGLz7HE4pdSPTovX2AwzGQWJ3-LI7YZt7aq3gg,AQACAAE/WebOfTrustRC2/30\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@6brkdrKlglWHnqMjWG6wrdLMWGPooc~7wQ7ID-PIsJk,X3RRBIdOQ5zthpkk8FjLL33LyoVVI4csJ1~g~sZ1msc,AQACAAE/WebOfTrustRC2/63\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@4DO0Yp1a3RZeAUAjeoPVu~GqpKhaX8RYqe~mwcWgjsM,klsqky963KI6uG3JqE1crihSeBbKBgkJHkIZ2xkWJ4A,AQACAAE/WebOfTrustRC2/36\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@axtoU6zHIkx3bicWK-hLNOj0br4xi0HW1qZ8H6CEv0U,SuPIncAHyYXmR9jQkTFUJd-QgGm0g9lW5ESUjzFOl~Q,AQACAAE/WebOfTrustRC2/8\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@BYsosP8TA22rSz1uA0KGbp6OVFZXhdgAlpH4R4hX9zE,o~qV5IzMR3m7ZOnnG5FPnDqpdffEpu7yOM7VEU9j6lQ,AQACAAE/WebOfTrustRC2/7\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@EilKmVin5cVL7b4FoEQ7ZoHS932O8OI880Qkd~tmzWs,8WK34lo95u~b60GLVczYU6EiRpY0LH7130~ASP9F6dU,AQACAAE/WebOfTrustRC2/75\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@xDYiCplSPLvFGC2dQjAC6eeaYVyQMtV-HmkpuKIJPgQ,CYKZcPacSNfB67IK10xlq7~bAqR-aOnZIA~yhHs2Hj0,AQACAAE/WebOfTrustRC2/71\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@DfCUA1sEJgiGzijEO0BWgeGjjHi28GGgv76H4rLujp8,1lnaOtPiXmvhpRZkBamZNF47uETNKIBgjSzElxcLhZc,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@F45FWNz9rs6TmafG~6n5Bg3Sr69YCHY9v01KTyK17lw,ikIvUS079Qw3aQknvdM8yKgr0XwjcqHgW0pWLu-1osA,AQACAAE/WebOfTrustRC2/13\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@VTDWbj9C5FUEXZBQRXmSsV1aEdOfsB9QHKzZ7-CnCh4,aDjtAVMuGPpCmw1rnCAj5myEnq9HYZeIzrfrhJO2JNw,AQACAAE/WebOfTrustRC2/52\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@dhYMUELq~HtJOweiV2JkGcoFS6hulHd9O~7a9LpGIxM,M-H3ySL8BdCctDUvwvbFNwHUyO1zghSNyotLqkKowi8,AQACAAE/WebOfTrustRC2/20\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@oRpTFVvCqp8qFWiZyCh2QhQ85eh3eP8C8G4YTFhm~rw,kyyeUPuksdt7omGFYFxoWPz3lu6e0q~G1HBx8wFztFc,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@RINL4YHPkTUGBWSoohAoO7Knzk89XSnqnQ6pUZkRY~w,OvIyTUUf4T2Tm46-em~A7zn1zBksIwe-hJP3KKdCe6s,AQACAAE/WebOfTrustRC2/4\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@sEZ-eWgUcQSj-To7lClNN6QNoKuvt0Cz3iTGKv63wQo,krEwvob7MhJ-pGvIk-RM8pVDPFSuXYTZw58oc2Lc49o,AQACAAE/WebOfTrustRC2/1\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@gNTVpdblFLSKMzUBEQM8YTfrO2fQQNIZeV7yJRTqYTQ,EKJhCmbQ5hpMU3cd-J91uneBF7CxTLPqffPs6DxoSMs,AQACAAE/WebOfTrustRC2/21\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@AV8Ubs8pbsMQ1F028a~pSJqtatznLjvhnwfSAtm1QKg,lUHPp~mgzV-pVoG9lYpceL6oOUtFRpvyQjGQdfx1GjY,AQACAAE/WebOfTrustRC2/41\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@xb3QGWdoUpeX9Fn1ZKeDwGN884c2XAMTpYLM9z4OIKo,aWNEDvjhhacFKAjiYJLaUnK1e7dQ9sCk-cnqkGZd7F8,AQACAAE/WebOfTrustRC2/9\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@MrxyFFM~n-kZ4kYvOOZodsvAA2vwp2XtAQJCrkEEU6s,tSHvx3u7uJN8ciaTqBIzt3lLmonM9mj6I7pz88MtBXc,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@-tpkd0enlFMTnjANRjzMKyfE3uyXU-WDX8VUqk3MXEg,J6h7edIdQCsiuc53qahzMzxsyNayXL~9IR0x5QoJVxk,AQACAAE/WebOfTrustRC2/15\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@gBQsXbnA9HX6wQB8x7DIEJT6e7lOxq5jGF353Po~p90,HjdyCLfG9r-zSBN6-AXwA1he9blIO2WEN9u7dMQ7H1w,AQACAAE/WebOfTrustRC2/13\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@ye~rQ4m~pu2Iu3O2TH-GOLBbSeKoQ~QR~vC6tJbKmDg,YSuI-J1nKZjGB2zmIa9Bh2Wtud~jzYBuR7OVhXYh7qM,AQACAAE/WebOfTrustRC2/99\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@HwgX8mU9A7bd2sCsM9And7fotpMGqfba9LzxZtOHHOU,10nYjjfKDH5RB3YvCCi5bpq4GPR-myd8ea7n8DRvx~c,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@qQArPJZuODDeM6C2ndbSczsFLWmLDm2SoaE-9F1hwQU,E3x6TbIvBj~6D9GrMUWSYgnNkLRg85BXXy5~mncoNEI,AQACAAE/WebOfTrustRC2/7\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@4hm9fo4IN0akORyJECttbEGZ~rPCPQ9KKAAH2AWMy8E,klvTyVp-GJznJq8Sln4W2GUfV6tVX2TI2sPCGBFU4tM,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@x7SDH5rL2-tGOaOKFFNMRrylCq94OfiZTWt4t3nwRHk,~E-kX9VqlANo4MeccvNlXDIjJ5xTWTEDNW-Qk04Ke6U,AQACAAE/WebOfTrustRC2/17\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@A9RAAKmky5yroigSupz6Bvrmc4q5FN1SXSrSXa6oRUg,s3RfurouqPnKmlGRkERao6jOJv9kcrVBBKAHqZVuQH4,AQACAAE/WebOfTrustRC2/1\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@yEstdNIW54-3~YA7QnYodpyWgPZStskrN9WXLHujUrE,j4PciAtpUHOjR2wmaaCKwiryJAi~exjETJ13UPGJLTg,AQACAAE/WebOfTrustRC2/58\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@NZSwPe8RJQOTSQ-~cAuxy97ieuX9reSft0cyD0vfbJg,99y8KOdRJmVLCWqryDzB8NdBrQGY7V9JDFtgCQBuGsU,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@Nq6iEvHP0B2VCszLCenQrfyJmkD0vas~00-9MoWgcTA,6dI2kB1z9mtjwITkhc9~V86QE5gM9CJBMjdpvRzKAoY,AQACAAE/WebOfTrustRC2/29\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@ZaNXnLCT7OQrwhp4I9V-rI1ZAV9WzegFj0HSaEJQ-Z4,i23K-dQupDenVE8O3xGv92vVanfDeyjLYWescevMbGg,AQACAAE/WebOfTrustRC2/14\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@53e9r9zEkJ0TRW~Tq8XIWjZ3WkL7Jv5Ez8LDhdwwzwM,7a0vL0OmWkHy3gC5Zs~MxB4k0QppwK4igrH6iuwls68,AQACAAE/WebOfTrustRC2/7\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@W1c~RYRC09xIHiHIucfV~Rj4J8uKAGrUeHmrH-q-U1c,niOrI75WMQ-Dtl9luIbKBmnvf6chkQEKvUvoKvSjhxI,AQACAAE/WebOfTrustRC2/4\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@G6zv74PaPcVZcf78lWp-e1TfrCSNZa1ZaPvmjm7DVzk,f4Ft3sLQ6cUEwpumpTMt5N17UORfZoXjGfmke5PJbdc,AQACAAE/WebOfTrustRC2/5\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@m5ILsPVAlcOY5D91J2iQu~PIntZb3L-B1VkONjEZs2k,592dl39JXIF1kpC4OMkw7ELOhdPrn~WXBsZln20pM7Q,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@iK69tf7gzQ53oZV60rF6ZSwwCfADMRsJeG2YmODdmJc,5czI5ZmWbWLDr2L9JdDmkt7qrr8fs55VDt3tXnrFw0E,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@bloE1LJ~qzSYUkU2nt7sB9kq060D4HTQC66pk5Q8NpA,DOOASUnp0kj6tOdhZJ-h5Tk7Ka50FSrUgsH7tCG1usU,AQACAAE/WebOfTrustRC2/58\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@0j-H~zKeP9mh6LEJUl4HSJYC-lQWstYRJeC~5E2F5~c,VbjnSixETRzKp80jYYXD-bqsTUWzxwcYmI9ZSWsBrik,AQACAAE/WebOfTrustRC2/13\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@~4ZW0eji3~hYAakiCI056soETGPf9O94GtoIpE2NGEg,GdtKsS~WeDlBS~OL1egxqZ4pr-iPXHjT2zcy8pjvEK4,AQACAAE/WebOfTrustRC2/88\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@YommlOi4fTYx9axhnl9iAi9BNHRvnM5XWjl21i0563k,5FswxS7hPf2erR8KkrBobG8R9bekaakeY1tM8DDNsjI,AQACAAE/WebOfTrustRC2/2\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@-ucM1bn8sICGRAemM8wZ~BVHgX3ZPUoutjZY64mBIcQ,Ko~kC54wZ-joCpfdc67Vds8LkAIxvTJGpMtfQSl4mAA,AQACAAE/WebOfTrustRC2/2\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@VwcZEhjtMuFcYIa8r0yksTs~FvMWB7swEz6tK67Vmsw,0blSLTQDms-WWbw1IBuKIoR2ZvSHpI21lMFeByQPuII,AQACAAE/WebOfTrustRC2/56\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@HAoXk-dW6~j5eLdAZCEjyKTVC974wkdl-4QqrPcbyzE,NlS05DkGK8QzL~EVUOfb~Jl1EZoVJTQBQBzA6N2qMn4,AQACAAE/WebOfTrustRC2/7\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@2PK-12eJFcVziT6eMpiUpOpTlmDNAoVOKZvA~8s7VSg,EaHdnKfKoWQDclX1mwcQeGr5jo1ijxyExYqL7Vsf-o8,AQACAAE/WebOfTrustRC2/33\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@8D3L5TDTyp5jnbT4imUWK12QC-B0iaSxFPOstMX2URg,ZtSShNkEVV8whaGQtIxiJ3FBroihw8YDyZrWvqncs0s,AQACAAE/WebOfTrustRC2/12\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@HKv7Hp94hFz8CKlINXCImq~XIBL9VfsPSgqfR0QIZFQ,vFM45qVvCajf3iqZm~ykZYwqM0KhaUSkU3RGaxJzHLI,AQACAAE/WebOfTrustRC2/4\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@NJu4xYtC3cgZo8s2xqmap3eh1dy60tFQFoxU8aeSnq8,fp~WLcrSSUKnr9wDDz-geb8FDwADCMCA9fjKt04Cyg8,AQACAAE/WebOfTrustRC2/4\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@IazjsmIK8VnIjDkq3-ecMEKHmi0dBT1QsNBq2mp2Fuo,uu24sWwNW~tjszdw19Mz18NBGx1MSADi03BHZnttwFo,AQACAAE/WebOfTrustRC2/8\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@IfxF-y7PNV97WUiHLqlIwXQyfVsHjI-Am4unZ0AK-Qk,Xm78gNC236A3wZ1RWBnft4oBGHU1R88Yt9AlphmtJPo,AQACAAE/WebOfTrustRC2/36\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@i1YvNnlMkd0i~0SiXiDHlGaxbtYd8ZqEUij~VzxyXmM,rxi19mph9KtHA6~gVGJ1rZ6kytff~kJDm6~NrA4YQaI,AQACAAE/WebOfTrustRC2/9\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@nXf5sbMSDqE~OkCQ~8JaMgPbj2LQJcuouvO56ADo28s,uEMqVaBzpA06TaC8A0cqKuv~lSfqZBiijasA3nlQ0Fc,AQACAAE/WebOfTrustRC2/8\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@Y8fLVylNs~pB6sdA5Dl1l6T~hXQrLNZLMgfDl5-E5Z0,n0zdN5XUa-D5Puf0L9wu~xQQmU~A5TpfqJ4RFHJLjLs,AQACAAE/WebOfTrustRC2/1\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@F0ixRao2hQlvTQDkN6rPcwLTG2nA6x0r8RrTQ0443IQ,LxN-gYvq4eWRuhjAgejmgNqYJdIw0q8IJ2XNwwVHhmQ,AQACAAE/WebOfTrustRC2/12\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@Pgk~nJzSVNAjFHh-qTovvm6muY08igdOCEWuyUrbFvk,NlwUDwfQlbXRjIaFAVljD5E1loXi31Xq6dG8YC7JOR0,AQACAAE/WebOfTrustRC2/5\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@m9gYemmVNXe32Ao6jeUgW8ttgGlMSIAW1608YZ19olE,LnEWPRzsPlPfq2~gIYQ5SVV-V2lthAx254dht9EZgyU,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@Pwiulr-xlPJelS5CO4~do78zZHTL5TNIChF5hpz8nkY,z77V~KhcKZRWLSWtVzaWO-dt~TzCCJFCHUDhHXI715M,AQACAAE/WebOfTrustRC2/8\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@OH3ZkrLAkMJbQTjVW3e9ioH04F7jpUVNMekiQAAvRjs,J6qOC05GoqRgST93M1V90HWxq9VK4PCKIpltkL8GAhg,AQACAAE/WebOfTrustRC2/5\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@nirNdzBgVyqMpnuT5UrmX~TU354qDIY7XAp04Kutysg,vpf1npG3nUARPSkFRx9xbVT~w1ELw0jQhdiXbxWcafg,AQACAAE/WebOfTrustRC2/1\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@ozK579KUDjjxkve1gKeV8IDd5qe0NPtxlFVV2-8iXrM,hlU82qnHi5ZnIfSD5~hr4wmUjNFJjQYted7FJWBj8z8,AQACAAE/WebOfTrustRC2/12\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@D6JSlrnlDDXfnGhijswHC5a4-EBuYNFhg2IyoFhzRRM,tCJy6EvZRhk-Og9CIkR3jfLD4VYxwOY5Wf991XMLdmE,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@Bn1Ozb4~Q639N~GvSXrbzZoVx9ziFfbkiKf1akXr9dQ,DrwwRjH~WrErR595BqxyDeisgcTLRZjCsQUBQSdnPLk,AQACAAE/WebOfTrustRC2/10\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@~aHztTNobVhKiaJ2eE-k6LLMy3qrRzL0zvk1UZp1xAU,xs3tuQsYRrTgxoU5qrayiwoOYEOLE6bTHvIKBQLIwco,AQACAAE/WebOfTrustRC2/3\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@jr3FrHPhtxP-IYQ-A12A3jjNNK4-KcHsUH8qNpBGHJ0,WK9IlZuG17JZ3YvaRUR-3uHf1YqkxxyGxkpkLW56ZTY,AQACAAE/WebOfTrustRC2/1\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@iBBjdbuuabx3v7iy-Pt3WZjWuixqo2-rzH~2kV4FkwE,Hll6SNQ~FXY5mrOY2W0GTfyNhJSlOrYutJmoXeSKseE,AQACAAE/WebOfTrustRC2/4\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@TKOVixP3xx6nA3-cgl2fksatQzxg4LlReoK0GFl7uAo,r~MCdO2rhGxBgRYv2EPuIE-tP7-0z6vuwbS04oyoAyI,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@bK9LQT2mqilUY4DxwmlKvKi5Jfwf4Brr~EQGa8RLIRU,Ni90~c4q-VNFrxFS7cDimQwCcRsqdScHoElWQgBpoT8,AQACAAE/WebOfTrustRC2/6\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@DYXv~V1jDo0XBhaiaGeRvy-~snqMbBiFR~R8TK8VBNg,4YYHZfVVYZmudSCOetDlNxnvbLy6IULV1SOgeC1zXmI,AQACAAE/WebOfTrustRC2/4\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@CSWvDlm9RM31O9NPpZomFvpTVM8cV0brixDXxpwnJ7A,4wfD~qxb5hFgCBN0JWgK6p11wUCpOHGOWhJ4i2FgFhY,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@sFsqYnIVQ9FwULsp3e-q0M46fRw2jVsLJYF9PUyHVME,aDhfrzYPt4O0BTuuRF3aCPTR0A~zr2rqHtPpJXeSqFU,AQACAAE/WebOfTrustRC2/4\" Value=\"100\"/>"
+            + "<Trust Comment=\"\" Identity=\"USK@1QwMtp0oc4jIh6DFUjec~U0O3ldWHrRmhh5OZd41MMo,GZ-QOMc4mAkHhG4LwJWU~-rl0zJIp90YcB5hn3M9tlg,AQACAAE/WebOfTrustRC2/4\" Value=\"100\"/>"
+            + "</TrustList>"
+            + "</Identity>"
+            + "</WebOfTrustRC2>";
+
+    /**
+     * main method.
+     *
+     * @param args Standard args.
+     */
+    public static void main(String[] args) {
+        try {
+            final Document xmlDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(rawXML.getBytes("UTF-8")));
+            final Element identityElement = (Element) xmlDoc.getElementsByTagName("Identity").item(0);
+            final Element trustListElement = (Element) identityElement.getElementsByTagName("TrustList").item(0);
+            final NodeList trustList = trustListElement.getElementsByTagName("Trust");
+            final Pattern keyPattern = Pattern.compile("USK@[%,~" + "*-_./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" + "]+");
+            for (int i = 0; i < trustList.getLength(); ++i) {
+                Element trustElement = (Element) trustList.item(i);
+                final String identity = trustElement.getAttribute("Identity");
+                if (!keyPattern.matcher(identity).matches()) {
+                    throw new RuntimeException("Parsing failure: Instead of USK URI I got: " + identity);
+                }
+            }
+        } catch (Exception ex) {
+            throw new RuntimeException(ex.getMessage());
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/parsers/8029955/EntityScannerTest.java	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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 8029955
+ * @summary test that the size of whitespace lookup buffer is adjusted as needed
+ * @run main EntityScannerTest
+ */
+
+import java.io.*;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+
+/**
+ *
+ * @author Joe Wang huizhe.wang@oracle.com
+ */
+public class EntityScannerTest {
+
+    /**
+     * main method.
+     *
+     * @param args Standard args.
+     */
+    public static void main(String[] args) {
+        try {
+            StringBuilder builder = new StringBuilder();
+            builder.append("<root attr=\"");
+            for (int i = 0; i < 200; i++) {
+                builder.append("\n");
+            }
+            builder.append("foo.");
+            builder.append("\" />");
+            final XMLReader reader = XMLReaderFactory.createXMLReader();
+            System.out.println(reader.getClass().getName());
+            reader.parse(new InputSource(new StringReader(builder.toString())));
+        } catch (ArrayIndexOutOfBoundsException e) {
+            throw new RuntimeException("Test failed: ArrayIndexOutOfBoundsException " + e.getMessage());
+        } catch (Exception e) {
+            throw new RuntimeException(e.getMessage());
+        }
+    }
+
+}
--- a/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java	Wed Jul 05 19:26:45 2017 +0200
@@ -22,11 +22,13 @@
  */
 
 import java.io.File;
+import java.io.IOException;
 import java.nio.file.FileSystem;
 import java.nio.file.FileSystems;
 import java.nio.file.Files;
 import java.nio.file.LinkOption;
 import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
 import java.nio.file.attribute.PosixFilePermission;
 import java.util.HashSet;
 import java.util.Set;
@@ -47,6 +49,7 @@
 public class CustomLauncherTest {
     private static final  String TEST_CLASSPATH = System.getProperty("test.class.path");
     private static final  String TEST_JDK = System.getProperty("test.jdk");
+    private static final  String WORK_DIR = System.getProperty("user.dir");
 
     private static final  String TEST_SRC = System.getProperty("test.src");
     private static final  String OSNAME = System.getProperty("os.name");
@@ -88,35 +91,7 @@
             return;
         }
 
-        String PLATFORM = "";
-        switch (OSNAME.toLowerCase()) {
-            case "linux": {
-                PLATFORM = "linux";
-                break;
-            }
-            case "sunos": {
-                PLATFORM = "solaris";
-                break;
-            }
-            default: {
-                System.out.println("Test not designed to run on this operating " +
-                                   "system (" + OSNAME + "), skipping...");
-                return;
-            }
-        }
-
-        String LAUNCHER = TEST_SRC + File.separator + PLATFORM + "-" + ARCH +
-                          File.separator + "launcher";
-
         final FileSystem FS = FileSystems.getDefault();
-        Path launcherPath = FS.getPath(LAUNCHER);
-
-        final boolean hasLauncher = Files.isRegularFile(launcherPath, LinkOption.NOFOLLOW_LINKS)&&
-                                    Files.isReadable(launcherPath);
-        if (!hasLauncher) {
-            System.out.println("Launcher [" + LAUNCHER + "] does not exist. Skipping the test.");
-            return;
-        }
 
         Path libjvmPath = findLibjvm(FS);
         if (libjvmPath == null) {
@@ -125,23 +100,20 @@
 
         Process serverPrc = null, clientPrc = null;
 
-        final Set<PosixFilePermission> launcherOrigPerms =
-            Files.getPosixFilePermissions(launcherPath, LinkOption.NOFOLLOW_LINKS);
         try {
-            // It is impossible to store an executable file in the source control
-            // We need to set the executable flag here
-            if (!Files.isExecutable(launcherPath)) {
-                Set<PosixFilePermission> perms = new HashSet<>(launcherOrigPerms);
-                perms.add(PosixFilePermission.OWNER_EXECUTE);
-                Files.setPosixFilePermissions(launcherPath, perms);
-            }
+            String[] launcher = getLauncher();
 
             System.out.println("Starting custom launcher:");
             System.out.println("=========================");
-            System.out.println("  launcher  : " + LAUNCHER);
+            System.out.println("  launcher  : " + launcher[0]);
             System.out.println("  libjvm    : " + libjvmPath.toString());
             System.out.println("  classpath : " + TEST_CLASSPATH);
-            ProcessBuilder server = new ProcessBuilder(LAUNCHER, libjvmPath.toString(), TEST_CLASSPATH, "TestApplication");
+            ProcessBuilder server = new ProcessBuilder(
+                launcher[1],
+                libjvmPath.toString(),
+                TEST_CLASSPATH,
+                "TestApplication"
+            );
 
             final AtomicReference<String> port = new AtomicReference<>();
             final AtomicReference<String> pid = new AtomicReference<>();
@@ -198,8 +170,6 @@
                 throw new Error("Test failed");
             }
         } finally {
-            // Let's restore the original launcher permissions
-            Files.setPosixFilePermissions(launcherPath, launcherOrigPerms);
             if (clientPrc != null) {
                 clientPrc.destroy();
                 clientPrc.waitFor();
@@ -240,4 +210,63 @@
     private static boolean isFileOk(Path path) {
         return Files.isRegularFile(path) && Files.isReadable(path);
     }
+
+    private static String getPlatform() {
+        String platform = null;
+        switch (OSNAME.toLowerCase()) {
+            case "linux": {
+                platform = "linux";
+                break;
+            }
+            case "sunos": {
+                platform = "solaris";
+                break;
+            }
+            default: {
+                System.out.println("Test not designed to run on this operating " +
+                                   "system (" + OSNAME + "), skipping...");
+            }
+        }
+
+        return platform;
+    }
+
+    private static String[] getLauncher() throws IOException {
+        String platform = getPlatform();
+        if (platform == null) {
+            return null;
+        }
+
+        String launcher = TEST_SRC + File.separator + platform + "-" + ARCH +
+                          File.separator + "launcher";
+
+        final FileSystem FS = FileSystems.getDefault();
+        Path launcherPath = FS.getPath(launcher);
+
+        final boolean hasLauncher = Files.isRegularFile(launcherPath, LinkOption.NOFOLLOW_LINKS)&&
+                                    Files.isReadable(launcherPath);
+        if (!hasLauncher) {
+            System.out.println("Launcher [" + launcher + "] does not exist. Skipping the test.");
+            return null;
+        }
+
+        // It is impossible to store an executable file in the source control
+        // We need to copy the launcher to the working directory
+        // and set the executable flag
+        Path localLauncherPath = FS.getPath(WORK_DIR, "launcher");
+        Files.copy(launcherPath, localLauncherPath,
+                   StandardCopyOption.REPLACE_EXISTING,
+                   StandardCopyOption.COPY_ATTRIBUTES);
+        if (!Files.isExecutable(localLauncherPath)) {
+            Set<PosixFilePermission> perms = new HashSet<>(
+                Files.getPosixFilePermissions(
+                    localLauncherPath,
+                    LinkOption.NOFOLLOW_LINKS
+                )
+            );
+            perms.add(PosixFilePermission.OWNER_EXECUTE);
+            Files.setPosixFilePermissions(localLauncherPath, perms);
+        }
+        return new String[] {launcher, localLauncherPath.toAbsolutePath().toString()};
+    }
 }
--- a/jdk/test/sun/nio/cs/MalformedSurrogates.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/sun/nio/cs/MalformedSurrogates.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -22,64 +22,132 @@
  */
 
 /* @test
-   @bug 4153987
-   @summary Malformed surrogates should be handled by the converter in
-   substitution mode.
+ * @bug 4153987
+ * @summary Malformed surrogates should be handled by the converter in
+ * substitution mode.
  */
-
 import java.io.*;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import java.nio.CharBuffer;
+import java.nio.ByteBuffer;
+import java.nio.charset.CodingErrorAction;
+import java.nio.charset.MalformedInputException;
+import java.nio.charset.UnmappableCharacterException;
+import java.util.SortedMap;
 
 public class MalformedSurrogates {
 
-    public static void main(String[] args) throws Exception {
-
-        String fe = System.getProperty("file.encoding");
-        if (  fe.equalsIgnoreCase("UTF8")
-              || fe.equalsIgnoreCase("UTF-8")
-              || fe.equalsIgnoreCase("UTF_8"))
-            // This test is meaningless if the default charset
-            // does handle surrogates
-            return;
+    private static final String PREFIX = "abc";
+    private static final String SUFFIX = "efgh";
+    private static final String MALFORMED_SURROGATE = PREFIX + "\uD800\uDB00" + SUFFIX;
+    private static final String NORMAL_SURROGATE = PREFIX + "\uD800\uDC00" + SUFFIX;
+    private static final String REVERSED_SURROGATE = PREFIX + "\uDC00\uD800" + SUFFIX;
+    private static final String SOLITARY_HIGH_SURROGATE = PREFIX + "\uD800" + SUFFIX;
+    private static final String SOLITARY_LOW_SURROGATE = PREFIX + "\uDC00" + SUFFIX;
 
-        System.out.println("Testing string conversion...");
-        /* Example with malformed surrogate, and an offset */
-        String t = "abc\uD800\uDB00efgh";
-        String t2 = t.substring(2);
-        byte[] b = t2.getBytes();
-        System.err.println(b.length);
-        for (int i = 0; i < b.length; i++)
-            System.err.println("[" + i + "]" + "=" + (char) b[i]
-                               + "=" + (int) b[i]);
-        if (b.length != 7) {
-            throw new Exception("Bad string conversion for bad surrogate");
+    public static void main(String[] args) throws IOException {
+        SortedMap<String, Charset> map = Charset.availableCharsets();
+        for (String name : map.keySet()) {
+            Charset charset = map.get(name);
+            if (charset.canEncode() && !charset.name().equals("x-COMPOUND_TEXT")) {
+                testNormalSurrogate(charset, NORMAL_SURROGATE);
+                testMalformedSurrogate(charset, MALFORMED_SURROGATE);
+                testMalformedSurrogate(charset, REVERSED_SURROGATE);
+                testMalformedSurrogate(charset, SOLITARY_HIGH_SURROGATE);
+                testMalformedSurrogate(charset, SOLITARY_LOW_SURROGATE);
+                testSurrogateWithReplacement(charset, NORMAL_SURROGATE);
+                testSurrogateWithReplacement(charset, MALFORMED_SURROGATE);
+                testSurrogateWithReplacement(charset, REVERSED_SURROGATE);
+                testSurrogateWithReplacement(charset, SOLITARY_HIGH_SURROGATE);
+                testSurrogateWithReplacement(charset, SOLITARY_LOW_SURROGATE);
+            }
+        }
+    }
+
+    public static void testMalformedSurrogate(Charset cs, String surrogate) throws IOException {
+        CharsetEncoder en = cs.newEncoder();
+        if (en.canEncode(surrogate)) {
+            throw new RuntimeException("testMalformedSurrogate failed with charset " + cs.name());
+        }
+
+        try {
+            en.encode(CharBuffer.wrap(surrogate));
+            throw new RuntimeException("Should throw MalformedInputException or UnmappableCharacterException");
+        } catch (MalformedInputException | UnmappableCharacterException ex) {
+        } finally {
+            en.reset();
         }
 
-        /* Example with a proper surrogate, no offset. Always worked */
-        String t3 = "abc\uD800\uDC00efgh";
-        byte[] b2 = t3.getBytes();
-        System.out.println(b2.length);
-        for(int i = 0; i < b2.length; i++)
-            System.err.println("[" + i + "]" + "=" + (char) b2[i]);
-        if (b2.length != 8) {
-            throw new Exception("Bad string conversion for good surrogate");
+        try (OutputStreamWriter osw = new OutputStreamWriter(new ByteArrayOutputStream(), en)) {
+            osw.write(surrogate);
+            throw new RuntimeException("Should throw MalformedInputException or UnmappableCharacterException");
+        } catch (MalformedInputException | UnmappableCharacterException ex) {
+        }
+    }
+
+    public static void testNormalSurrogate(Charset cs, String surrogate) throws IOException {
+        CharsetEncoder en = cs.newEncoder();
+        try {
+            en.encode(CharBuffer.wrap(surrogate));
+        } catch (UnmappableCharacterException ex) {
+        } finally {
+            en.reset();
         }
 
-        OutputStream os = new ByteArrayOutputStream();
-        OutputStreamWriter osw = new OutputStreamWriter(os);
-        System.out.println("Testing flush....");
-        /* Check for the case where the converter has a left over
-           high surrogate when flush is called on the converter */
-        osw.flush();
-        String s = "abc\uD800"; // High surrogate
-        char[] c = s.toCharArray();
-        osw.write(s, 0, 4);
-        osw.flush();
+        try (OutputStreamWriter osw = new OutputStreamWriter(new ByteArrayOutputStream(), en)) {
+            osw.write(surrogate);
+        } catch (UnmappableCharacterException ex) {
+        }
+    }
 
-        System.out.println("Testing convert...");
-        /* Verify that all other characters go through */
-        for (int k = 1; k < 65535 ; k++) {
-            osw.write("Char[" + k + "]=\"" + ((char) k) + "\"");
+    public static void testSurrogateWithReplacement(Charset cs, String surrogate) throws IOException {
+        CharsetEncoder en = cs.newEncoder();
+        CharsetDecoder de = cs.newDecoder();
+        if (!en.canEncode(NORMAL_SURROGATE)) {
+            return;
+        }
+        String expected = null;
+        String replace = new String(en.replacement(), cs);
+        switch (surrogate) {
+            case MALFORMED_SURROGATE:
+            case REVERSED_SURROGATE:
+                expected = PREFIX + replace + replace + SUFFIX;
+                break;
+            case SOLITARY_HIGH_SURROGATE:
+            case SOLITARY_LOW_SURROGATE:
+                expected = PREFIX + replace + SUFFIX;
+                break;
+            default:
+                expected = NORMAL_SURROGATE;
         }
 
+        try {
+            en.onMalformedInput(CodingErrorAction.REPLACE);
+            en.onUnmappableCharacter(CodingErrorAction.REPLACE);
+            ByteBuffer bbuf = en.encode(CharBuffer.wrap(surrogate));
+            CharBuffer cbuf = de.decode(bbuf);
+            if (!cbuf.toString().equals(expected)) {
+                throw new RuntimeException("charset " + cs.name() + " (en)decoded the surrogate " + surrogate + " to " + cbuf.toString() + " which is not same as the expected " + expected);
+            }
+        } finally {
+            en.reset();
+            de.reset();
+        }
+
+        try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
+                OutputStreamWriter osw = new OutputStreamWriter(bos, en);) {
+            osw.write(surrogate);
+            osw.flush();
+            try (InputStreamReader isr = new InputStreamReader(new ByteArrayInputStream(bos.toByteArray()), de)) {
+                CharBuffer cbuf = CharBuffer.allocate(expected.length());
+                isr.read(cbuf);
+                cbuf.rewind();
+                if (!cbuf.toString().equals(expected)) {
+                    throw new RuntimeException("charset " + cs.name() + " (en)decoded the surrogate " + surrogate + " to " + cbuf.toString() + " which is not same as the expected " + expected);
+                }
+            }
+        }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/jgss/GssMemoryIssues.java	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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 8028780
+ * @summary JDK KRB5 module throws OutOfMemoryError when CCache is corrupt
+ * @run main/othervm -Xmx8m GssMemoryIssues
+ */
+
+import org.ietf.jgss.GSSException;
+import org.ietf.jgss.GSSManager;
+import org.ietf.jgss.GSSName;
+
+public class GssMemoryIssues {
+
+    public static void main(String[] argv) throws Exception {
+        GSSManager man = GSSManager.getInstance();
+        String s = "me@REALM";
+        GSSName name = man.createName(s, GSSName.NT_USER_NAME);
+        byte[] exported = name.export();
+        // Offset of the length of the mech name. Length in big endian
+        int lenOffset = exported.length - s.length() - 4;
+        // Make it huge
+        exported[lenOffset] = 0x7f;
+        try {
+            man.createName(exported, GSSName.NT_EXPORT_NAME);
+        } catch (GSSException gsse) {
+            System.out.println(gsse);
+        }
+    }
+}
--- a/jdk/test/sun/security/krb5/TimeInCCache.java	Fri Dec 13 09:35:35 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2007, 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.
- *
- * 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 6590930
- * @run main/othervm TimeInCCache
- * @summary read/write does not match for ccache
- */
-
-import java.io.ByteArrayInputStream;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import sun.security.krb5.internal.ccache.CCacheInputStream;
-import sun.security.krb5.internal.ccache.Credentials;
-
-public class TimeInCCache {
-    public static void main(String[] args) throws Exception {
-        // A trivial cache file, with startdate and renewTill being zero.
-        // The endtime is set to sometime in year 2022, so that isValid()
-        // will always check starttime.
-        byte[] ccache = new byte[]{
-            5, 4, 0, 12, 0, 1, 0, 8, -1, -1, -1, 19, -1, -2, 89, 51,
-            0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 10, 77, 65, 88, 73,
-            46, 76, 79, 67, 65, 76, 0, 0, 0, 5, 100, 117, 109, 109, 121, 0,
-            0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 10, 77, 65, 88, 73, 46,
-            76, 79, 67, 65, 76, 0, 0, 0, 5, 100, 117, 109, 109, 121, 0, 0,
-            0, 0, 0, 0, 0, 2, 0, 0, 0, 10, 77, 65, 88, 73, 46, 76,
-            79, 67, 65, 76, 0, 0, 0, 6, 107, 114, 98, 116, 103, 116, 0, 0,
-            0, 10, 77, 65, 88, 73, 46, 76, 79, 67, 65, 76, 0, 17, 0, 0,
-            0, 16, -78, -85, -90, -50, -68, 115, 68, 8, -39, -109, 91, 61, -17, -27,
-            -122, -120, 71, 69, 16, -121, 0, 0, 0, 0, 98, 69, 16, -121, 0, 0,
-            0, 0, 0, 64, -32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-            0, 1, 0, 97, -127, -3, 48, -127, -6, -96, 3, 2, 1, 5, -95, 12,
-            27, 10, 77, 65, 88, 73, 46, 76, 79, 67, 65, 76, -94, 31, 48, 29,
-            -96, 3, 2, 1, 0, -95, 22, 48, 20, 27, 6, 107, 114, 98, 116, 103,
-            116, 27, 10, 77, 65, 88, 73, 46, 76, 79, 67, 65, 76, -93, -127, -61,
-            48, -127, -64, -96, 3, 2, 1, 17, -95, 3, 2, 1, 1, -94, -127, -77,
-            4, -127, -80, 43, 65, -66, 34, 21, -34, 37, 35, 32, 50, -14, 122, 77,
-            -3, -29, 37, 99, 50, 125, -43, -96, -78, 85, 23, 41, -80, 68, 2, -109,
-            -27, 38, -41, -72, -32, 127, 63, -76, -22, 81, 33, -114, -30, 104, 125, -81,
-            -29, 70, -25, 23, 100, -75, -25, 62, -120, -78, -61, -100, -74, 50, -117, -127,
-            -16, 79, -106, 62, -39, 91, 100, -10, 23, -88, -18, -47, 51, -19, 113, 18,
-            98, -101, 31, 98, 22, -81, 11, -41, -42, 67, 87, 92, -2, 42, -54, 79,
-            49, -90, 43, -37, 90, -102, 125, 62, -88, -77, 100, 102, 23, -57, -51, 38,
-            68, -44, -57, -102, 103, -6, 85, -58, 74, -117, -87, 67, -103, -36, 110, -122,
-            115, 12, 118, -106, -114, -51, 79, 68, 32, -91, -53, -5, -51, 89, 72, 70,
-            123, -12, -95, 9, 40, -30, -117, 74, 77, 38, 91, 126, -82, 17, 98, 98,
-            -49, 78, 36, 36, 103, -76, -100, -23, 118, -92, -8, 80, 103, -23, -98, 56,
-            21, 65, -77, 0, 0, 0, 0
-        };
-        System.setProperty("sun.security.krb5.debug", "true");  // test code changes in DEBUG
-        CCacheInputStream cis = new CCacheInputStream(new ByteArrayInputStream(ccache));
-        cis.readVersion();
-        cis.readTag();
-        cis.readPrincipal(0x504);
-        Method m = CCacheInputStream.class.getDeclaredMethod("readCred", Integer.TYPE);
-        m.setAccessible(true);
-        Credentials c = (Credentials) m.invoke(cis, new Integer(0x504));
-        sun.security.krb5.Credentials cc = c.setKrbCreds();
-
-        // 1. Make sure starttime is still null
-        if (cc.getStartTime() != null) {
-            throw new Exception("Fail, starttime should be zero here");
-        }
-
-        // 2. Make sure renewTill is still null
-        if (cc.getRenewTill() != null) {
-            throw new Exception("Fail, renewTill should be zero here");
-        }
-
-        // 3. Make sure isValid works
-        c.isValid();
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/ccache/CorruptedCC.java	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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 8028780
+ * @summary JDK KRB5 module throws OutOfMemoryError when CCache is corrupt
+ * @run main/othervm -Xmx8m CorruptedCC
+ */
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import sun.security.krb5.internal.ccache.CredentialsCache;
+
+public class CorruptedCC {
+    public static void main(String[] args) throws Exception {
+        for (int i=0; i<TimeInCCache.ccache.length; i++) {
+            byte old = TimeInCCache.ccache[i];
+            TimeInCCache.ccache[i] = 0x7f;
+            Files.write(Paths.get("tmpcc"), TimeInCCache.ccache);
+            // The next line will return null for I/O issues. That's OK.
+            CredentialsCache.getInstance("tmpcc");
+            TimeInCCache.ccache[i] = old;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/ccache/TimeInCCache.java	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2007, 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.
+ *
+ * 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 6590930
+ * @run main/othervm TimeInCCache
+ * @summary read/write does not match for ccache
+ */
+
+import java.io.ByteArrayInputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import sun.security.krb5.internal.ccache.CCacheInputStream;
+import sun.security.krb5.internal.ccache.Credentials;
+
+public class TimeInCCache {
+    // Attention: this field is also used by CorruptedCC.java test
+    public static byte[] ccache;
+
+    static {
+        // A trivial cache file, with startdate and renewTill being zero.
+        // The endtime is set to sometime in year 2022, so that isValid()
+        // will always check starttime.
+        String var =
+            /*0000*/ "05 04 00 0C 00 01 00 08 FF FF FF 13 FF FE 59 33 " +
+            /*0010*/ "00 00 00 01 00 00 00 01 00 00 00 0A 4D 41 58 49 " +
+            /*0020*/ "2E 4C 4F 43 41 4C 00 00 00 05 64 75 6D 6D 79 00 " +
+            /*0030*/ "00 00 01 00 00 00 01 00 00 00 0A 4D 41 58 49 2E " +
+            /*0040*/ "4C 4F 43 41 4C 00 00 00 05 64 75 6D 6D 79 00 00 " +
+            /*0050*/ "00 00 00 00 00 02 00 00 00 0A 4D 41 58 49 2E 4C " +
+            /*0060*/ "4F 43 41 4C 00 00 00 06 6B 72 62 74 67 74 00 00 " +
+            /*0070*/ "00 0A 4D 41 58 49 2E 4C 4F 43 41 4C 00 11 00 00 " +
+            /*0080*/ "00 10 B2 AB A6 CE BC 73 44 08 D9 93 5B 3D EF E5 " +
+            /*0090*/ "86 88 47 45 10 87 00 00 00 00 62 45 10 87 00 00 " +
+            /*00A0*/ "00 00 00 40 E0 00 00 00 00 00 00 00 00 00 00 00 " +
+            /*00B0*/ "00 01 00 61 81 FD 30 81 FA A0 03 02 01 05 A1 0C " +
+            /*00C0*/ "1B 0A 4D 41 58 49 2E 4C 4F 43 41 4C A2 1F 30 1D " +
+            /*00D0*/ "A0 03 02 01 00 A1 16 30 14 1B 06 6B 72 62 74 67 " +
+            /*00E0*/ "74 1B 0A 4D 41 58 49 2E 4C 4F 43 41 4C A3 81 C3 " +
+            /*00F0*/ "30 81 C0 A0 03 02 01 11 A1 03 02 01 01 A2 81 B3 " +
+            /*0100*/ "04 81 B0 2B 41 BE 22 15 DE 25 23 20 32 F2 7A 4D " +
+            /*0110*/ "FD E3 25 63 32 7D D5 A0 B2 55 17 29 B0 44 02 93 " +
+            /*0120*/ "E5 26 D7 B8 E0 7F 3F B4 EA 51 21 8E E2 68 7D AF " +
+            /*0130*/ "E3 46 E7 17 64 B5 E7 3E 88 B2 C3 9C B6 32 8B 81 " +
+            /*0140*/ "F0 4F 96 3E D9 5B 64 F6 17 A8 EE D1 33 ED 71 12 " +
+            /*0150*/ "62 9B 1F 62 16 AF 0B D7 D6 43 57 5C FE 2A CA 4F " +
+            /*0160*/ "31 A6 2B DB 5A 9A 7D 3E A8 B3 64 66 17 C7 CD 26 " +
+            /*0170*/ "44 D4 C7 9A 67 FA 55 C6 4A 8B A9 43 99 DC 6E 86 " +
+            /*0180*/ "73 0C 76 96 8E CD 4F 44 20 A5 CB FB CD 59 48 46 " +
+            /*0190*/ "7B F4 A1 09 28 E2 8B 4A 4D 26 5B 7E AE 11 62 62 " +
+            /*01A0*/ "CF 4E 24 24 67 B4 9C E9 76 A4 F8 50 67 E9 9E 38 " +
+            /*01B0*/ "15 41 B3 00 00 00 00 ";
+        ccache = new byte[var.length()/3];
+        for (int i=0; i<ccache.length; i++) {
+            ccache[i] = Integer.valueOf(var.substring(3*i,3*i+2), 16).byteValue();
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        System.setProperty("sun.security.krb5.debug", "true");  // test code changes in DEBUG
+        CCacheInputStream cis = new CCacheInputStream(new ByteArrayInputStream(ccache));
+        cis.readVersion();
+        cis.readTag();
+        cis.readPrincipal(0x504);
+        Method m = CCacheInputStream.class.getDeclaredMethod("readCred", Integer.TYPE);
+        m.setAccessible(true);
+        Credentials c = (Credentials) m.invoke(cis, new Integer(0x504));
+        sun.security.krb5.Credentials cc = c.setKrbCreds();
+
+        // 1. Make sure starttime is still null
+        if (cc.getStartTime() != null) {
+            throw new Exception("Fail, starttime should be zero here");
+        }
+
+        // 2. Make sure renewTill is still null
+        if (cc.getRenewTill() != null) {
+            throw new Exception("Fail, renewTill should be zero here");
+        }
+
+        // 3. Make sure isValid works
+        c.isValid();
+    }
+}
--- a/jdk/test/sun/security/pkcs11/Provider/Login.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/sun/security/pkcs11/Provider/Login.java	Wed Jul 05 19:26:45 2017 +0200
@@ -87,8 +87,6 @@
         password = new char[] { 't', 'e', 's', 't', '1', '2' };
 
         Security.setProperty("auth.login.defaultCallbackHandler", "");
-        ap.setCallbackHandler
-                (new com.sun.security.auth.callback.DialogCallbackHandler());
         ap.setCallbackHandler(new PasswordCallbackHandler());
         ap.login(new Subject(), null);
         System.out.println("test " + testnum++ + " passed");
--- a/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/DHKeyExchange/DHEKeySizing.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/DHKeyExchange/DHEKeySizing.java	Wed Jul 05 19:26:45 2017 +0200
@@ -443,7 +443,7 @@
         TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
         tmf.init(ts);
 
-        SSLContext sslCtx = SSLContext.getInstance("TLS");
+        SSLContext sslCtx = SSLContext.getInstance("TLSv1");
         sslCtx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
 
         return sslCtx;
--- a/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/EngineArgs/DebugReportsOneExtraByte.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/EngineArgs/DebugReportsOneExtraByte.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -159,7 +159,7 @@
         TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
         tmf.init(ts);
 
-        SSLContext sslCtx = SSLContext.getInstance("TLS");
+        SSLContext sslCtx = SSLContext.getInstance("TLSv1");
 
         sslCtx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
 
--- a/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/InputRecord/SSLSocketTimeoutNulls.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/InputRecord/SSLSocketTimeoutNulls.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -21,6 +21,11 @@
  * questions.
  */
 
+//
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+//
+
 /*
  * @test
  * @bug 4456039
@@ -28,9 +33,6 @@
  *      after timeout occurs.  This bug was fixed as part of 4393337,
  *      but this is another bug we want to check regressions against.
  * @run main/othervm/timeout=140 SSLSocketTimeoutNulls
- *
- *     SunJSSE does not support dynamic system properties, no way to re-use
- *     system properties in samevm/agentvm mode.
  * @author Brad Wetmore
  */
 
@@ -152,7 +154,7 @@
             caught = true;
 
             // Try to read it again after it should be available.
-            Thread.sleep(5000);
+            Thread.sleep(6500);
             if (sslIS.read() == 85)
                 System.out.println("Read the right value");
             else
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLContextImpl/CustomizedDefaultProtocols.java	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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.
+ */
+
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+
+/*
+ * @test
+ * @bug 7093640
+ * @summary Enable TLS 1.1 and TLS 1.2 by default in client side of SunJSSE
+ * @run main/othervm -Djdk.tls.client.protocols="SSLv3,TLSv1,TLSv1.1"
+ *      CustomizedDefaultProtocols
+ */
+
+import javax.net.*;
+import javax.net.ssl.*;
+import java.util.Arrays;
+
+public class CustomizedDefaultProtocols {
+    static enum ContextVersion {
+        TLS_CV_01("SSL",
+                new String[] {"SSLv3", "TLSv1", "TLSv1.1"}),
+        TLS_CV_02("TLS",
+                new String[] {"SSLv3", "TLSv1", "TLSv1.1"}),
+        TLS_CV_03("SSLv3",
+                new String[] {"SSLv3", "TLSv1"}),
+        TLS_CV_04("TLSv1",
+                new String[] {"SSLv3", "TLSv1"}),
+        TLS_CV_05("TLSv1.1",
+                new String[] {"SSLv3", "TLSv1", "TLSv1.1"}),
+        TLS_CV_06("TLSv1.2",
+                new String[] {"SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"}),
+        TLS_CV_07("Default",
+                new String[] {"SSLv3", "TLSv1", "TLSv1.1"});
+
+        final String contextVersion;
+        final String[] enabledProtocols;
+        final static String[] supportedProtocols = new String[] {
+                "SSLv2Hello", "SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"};
+
+        ContextVersion(String contextVersion, String[] enabledProtocols) {
+            this.contextVersion = contextVersion;
+            this.enabledProtocols = enabledProtocols;
+        }
+    }
+
+    private static boolean checkProtocols(String[] target, String[] expected) {
+        boolean success = true;
+        if (target.length == 0) {
+            System.out.println("\tError: No protocols");
+            success = false;
+        }
+
+        if (!Arrays.equals(target, expected)) {
+            System.out.println("\tError: Expected to get protocols " +
+                    Arrays.toString(expected));
+            System.out.println("\tError: The actual protocols " +
+                    Arrays.toString(target));
+            success = false;
+        }
+
+        return success;
+    }
+
+    private static boolean checkCipherSuites(String[] target) {
+        boolean success = true;
+        if (target.length == 0) {
+            System.out.println("\tError: No cipher suites");
+            success = false;
+        }
+
+        return success;
+    }
+
+    public static void main(String[] args) throws Exception {
+        boolean failed = false;
+        for (ContextVersion cv : ContextVersion.values()) {
+            System.out.println("Checking SSLContext of " + cv.contextVersion);
+            SSLContext context = SSLContext.getInstance(cv.contextVersion);
+
+            // Default SSLContext is initialized automatically.
+            if (!cv.contextVersion.equals("Default")) {
+                // Use default TK, KM and random.
+                context.init((KeyManager[])null, (TrustManager[])null, null);
+            }
+
+            //
+            // Check SSLContext
+            //
+            // Check default SSLParameters of SSLContext
+            System.out.println("\tChecking default SSLParameters");
+            SSLParameters parameters = context.getDefaultSSLParameters();
+
+            String[] protocols = parameters.getProtocols();
+            failed |= !checkProtocols(protocols, cv.enabledProtocols);
+
+            String[] ciphers = parameters.getCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            // Check supported SSLParameters of SSLContext
+            System.out.println("\tChecking supported SSLParameters");
+            parameters = context.getSupportedSSLParameters();
+
+            protocols = parameters.getProtocols();
+            failed |= !checkProtocols(protocols, cv.supportedProtocols);
+
+            ciphers = parameters.getCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            //
+            // Check SSLEngine
+            //
+            // Check SSLParameters of SSLEngine
+            System.out.println();
+            System.out.println("\tChecking SSLEngine of this SSLContext");
+            System.out.println("\tChecking SSLEngine.getSSLParameters()");
+            SSLEngine engine = context.createSSLEngine();
+            engine.setUseClientMode(true);
+            parameters = engine.getSSLParameters();
+
+            protocols = parameters.getProtocols();
+            failed |= !checkProtocols(protocols, cv.enabledProtocols);
+
+            ciphers = parameters.getCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            System.out.println("\tChecking SSLEngine.getEnabledProtocols()");
+            protocols = engine.getEnabledProtocols();
+            failed |= !checkProtocols(protocols, cv.enabledProtocols);
+
+            System.out.println("\tChecking SSLEngine.getEnabledCipherSuites()");
+            ciphers = engine.getEnabledCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            System.out.println("\tChecking SSLEngine.getSupportedProtocols()");
+            protocols = engine.getSupportedProtocols();
+            failed |= !checkProtocols(protocols, cv.supportedProtocols);
+
+            System.out.println(
+                    "\tChecking SSLEngine.getSupportedCipherSuites()");
+            ciphers = engine.getSupportedCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            //
+            // Check SSLSocket
+            //
+            // Check SSLParameters of SSLSocket
+            System.out.println();
+            System.out.println("\tChecking SSLSocket of this SSLContext");
+            System.out.println("\tChecking SSLSocket.getSSLParameters()");
+            SocketFactory fac = context.getSocketFactory();
+            SSLSocket socket = (SSLSocket)fac.createSocket();
+            parameters = socket.getSSLParameters();
+
+            protocols = parameters.getProtocols();
+            failed |= !checkProtocols(protocols, cv.enabledProtocols);
+
+            ciphers = parameters.getCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            System.out.println("\tChecking SSLEngine.getEnabledProtocols()");
+            protocols = socket.getEnabledProtocols();
+            failed |= !checkProtocols(protocols, cv.enabledProtocols);
+
+            System.out.println("\tChecking SSLEngine.getEnabledCipherSuites()");
+            ciphers = socket.getEnabledCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            System.out.println("\tChecking SSLEngine.getSupportedProtocols()");
+            protocols = socket.getSupportedProtocols();
+            failed |= !checkProtocols(protocols, cv.supportedProtocols);
+
+            System.out.println(
+                    "\tChecking SSLEngine.getSupportedCipherSuites()");
+            ciphers = socket.getSupportedCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            //
+            // Check SSLServerSocket
+            //
+            // Check SSLParameters of SSLServerSocket
+            System.out.println();
+            System.out.println("\tChecking SSLServerSocket of this SSLContext");
+            System.out.println("\tChecking SSLServerSocket.getSSLParameters()");
+            SSLServerSocketFactory sf = context.getServerSocketFactory();
+            SSLServerSocket ssocket = (SSLServerSocket)sf.createServerSocket();
+            parameters = ssocket.getSSLParameters();
+
+            protocols = parameters.getProtocols();
+            failed |= !checkProtocols(protocols, cv.supportedProtocols);
+
+            ciphers = parameters.getCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            System.out.println("\tChecking SSLEngine.getEnabledProtocols()");
+            protocols = ssocket.getEnabledProtocols();
+            failed |= !checkProtocols(protocols, cv.supportedProtocols);
+
+            System.out.println("\tChecking SSLEngine.getEnabledCipherSuites()");
+            ciphers = ssocket.getEnabledCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            System.out.println("\tChecking SSLEngine.getSupportedProtocols()");
+            protocols = ssocket.getSupportedProtocols();
+            failed |= !checkProtocols(protocols, cv.supportedProtocols);
+
+            System.out.println(
+                    "\tChecking SSLEngine.getSupportedCipherSuites()");
+            ciphers = ssocket.getSupportedCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+        }
+
+        if (failed) {
+            throw new Exception("Run into problems, see log for more details");
+        } else {
+            System.out.println("\t... Success");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLContextImpl/DefaultEnabledProtocols.java	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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.
+ */
+
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+
+/*
+ * @test
+ * @bug 7093640
+ * @summary Enable TLS 1.1 and TLS 1.2 by default in client side of SunJSSE
+ * @run main/othervm DefaultEnabledProtocols
+ */
+
+import javax.net.*;
+import javax.net.ssl.*;
+import java.util.Arrays;
+
+public class DefaultEnabledProtocols {
+    static enum ContextVersion {
+        TLS_CV_01("SSL",
+                new String[] {"SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"}),
+        TLS_CV_02("TLS",
+                new String[] {"SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"}),
+        TLS_CV_03("SSLv3",
+                new String[] {"SSLv3", "TLSv1"}),
+        TLS_CV_04("TLSv1",
+                new String[] {"SSLv3", "TLSv1"}),
+        TLS_CV_05("TLSv1.1",
+                new String[] {"SSLv3", "TLSv1", "TLSv1.1"}),
+        TLS_CV_06("TLSv1.2",
+                new String[] {"SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"}),
+        TLS_CV_07("Default",
+                new String[] {"SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"});
+
+        final String contextVersion;
+        final String[] enabledProtocols;
+        final static String[] supportedProtocols = new String[] {
+                "SSLv2Hello", "SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"};
+
+        ContextVersion(String contextVersion, String[] enabledProtocols) {
+            this.contextVersion = contextVersion;
+            this.enabledProtocols = enabledProtocols;
+        }
+    }
+
+    private static boolean checkProtocols(String[] target, String[] expected) {
+        boolean success = true;
+        if (target.length == 0) {
+            System.out.println("\tError: No protocols");
+            success = false;
+        }
+
+        if (!Arrays.equals(target, expected)) {
+            System.out.println("\tError: Expected to get protocols " +
+                    Arrays.toString(expected));
+            System.out.println("\tError: The actual protocols " +
+                    Arrays.toString(target));
+            success = false;
+        }
+
+        return success;
+    }
+
+    private static boolean checkCipherSuites(String[] target) {
+        boolean success = true;
+        if (target.length == 0) {
+            System.out.println("\tError: No cipher suites");
+            success = false;
+        }
+
+        return success;
+    }
+
+    public static void main(String[] args) throws Exception {
+        boolean failed = false;
+        for (ContextVersion cv : ContextVersion.values()) {
+            System.out.println("Checking SSLContext of " + cv.contextVersion);
+            SSLContext context = SSLContext.getInstance(cv.contextVersion);
+
+            // Default SSLContext is initialized automatically.
+            if (!cv.contextVersion.equals("Default")) {
+                // Use default TK, KM and random.
+                context.init((KeyManager[])null, (TrustManager[])null, null);
+            }
+
+            //
+            // Check SSLContext
+            //
+            // Check default SSLParameters of SSLContext
+            System.out.println("\tChecking default SSLParameters");
+            SSLParameters parameters = context.getDefaultSSLParameters();
+
+            String[] protocols = parameters.getProtocols();
+            failed |= !checkProtocols(protocols, cv.enabledProtocols);
+
+            String[] ciphers = parameters.getCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            // Check supported SSLParameters of SSLContext
+            System.out.println("\tChecking supported SSLParameters");
+            parameters = context.getSupportedSSLParameters();
+
+            protocols = parameters.getProtocols();
+            failed |= !checkProtocols(protocols, cv.supportedProtocols);
+
+            ciphers = parameters.getCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            //
+            // Check SSLEngine
+            //
+            // Check SSLParameters of SSLEngine
+            System.out.println();
+            System.out.println("\tChecking SSLEngine of this SSLContext");
+            System.out.println("\tChecking SSLEngine.getSSLParameters()");
+            SSLEngine engine = context.createSSLEngine();
+            engine.setUseClientMode(true);
+            parameters = engine.getSSLParameters();
+
+            protocols = parameters.getProtocols();
+            failed |= !checkProtocols(protocols, cv.enabledProtocols);
+
+            ciphers = parameters.getCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            System.out.println("\tChecking SSLEngine.getEnabledProtocols()");
+            protocols = engine.getEnabledProtocols();
+            failed |= !checkProtocols(protocols, cv.enabledProtocols);
+
+            System.out.println("\tChecking SSLEngine.getEnabledCipherSuites()");
+            ciphers = engine.getEnabledCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            System.out.println("\tChecking SSLEngine.getSupportedProtocols()");
+            protocols = engine.getSupportedProtocols();
+            failed |= !checkProtocols(protocols, cv.supportedProtocols);
+
+            System.out.println(
+                    "\tChecking SSLEngine.getSupportedCipherSuites()");
+            ciphers = engine.getSupportedCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            //
+            // Check SSLSocket
+            //
+            // Check SSLParameters of SSLSocket
+            System.out.println();
+            System.out.println("\tChecking SSLSocket of this SSLContext");
+            System.out.println("\tChecking SSLSocket.getSSLParameters()");
+            SocketFactory fac = context.getSocketFactory();
+            SSLSocket socket = (SSLSocket)fac.createSocket();
+            parameters = socket.getSSLParameters();
+
+            protocols = parameters.getProtocols();
+            failed |= !checkProtocols(protocols, cv.enabledProtocols);
+
+            ciphers = parameters.getCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            System.out.println("\tChecking SSLEngine.getEnabledProtocols()");
+            protocols = socket.getEnabledProtocols();
+            failed |= !checkProtocols(protocols, cv.enabledProtocols);
+
+            System.out.println("\tChecking SSLEngine.getEnabledCipherSuites()");
+            ciphers = socket.getEnabledCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            System.out.println("\tChecking SSLEngine.getSupportedProtocols()");
+            protocols = socket.getSupportedProtocols();
+            failed |= !checkProtocols(protocols, cv.supportedProtocols);
+
+            System.out.println(
+                    "\tChecking SSLEngine.getSupportedCipherSuites()");
+            ciphers = socket.getSupportedCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            //
+            // Check SSLServerSocket
+            //
+            // Check SSLParameters of SSLServerSocket
+            System.out.println();
+            System.out.println("\tChecking SSLServerSocket of this SSLContext");
+            System.out.println("\tChecking SSLServerSocket.getSSLParameters()");
+            SSLServerSocketFactory sf = context.getServerSocketFactory();
+            SSLServerSocket ssocket = (SSLServerSocket)sf.createServerSocket();
+            parameters = ssocket.getSSLParameters();
+
+            protocols = parameters.getProtocols();
+            failed |= !checkProtocols(protocols, cv.supportedProtocols);
+
+            ciphers = parameters.getCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            System.out.println("\tChecking SSLEngine.getEnabledProtocols()");
+            protocols = ssocket.getEnabledProtocols();
+            failed |= !checkProtocols(protocols, cv.supportedProtocols);
+
+            System.out.println("\tChecking SSLEngine.getEnabledCipherSuites()");
+            ciphers = ssocket.getEnabledCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            System.out.println("\tChecking SSLEngine.getSupportedProtocols()");
+            protocols = ssocket.getSupportedProtocols();
+            failed |= !checkProtocols(protocols, cv.supportedProtocols);
+
+            System.out.println(
+                    "\tChecking SSLEngine.getSupportedCipherSuites()");
+            ciphers = ssocket.getSupportedCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+        }
+
+        if (failed) {
+            throw new Exception("Run into problems, see log for more details");
+        } else {
+            System.out.println("\t... Success");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLContextImpl/IllegalProtocolProperty.java	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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.
+ */
+
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+
+/*
+ * @test
+ * @bug 7093640
+ * @summary Enable TLS 1.1 and TLS 1.2 by default in client side of SunJSSE
+ * @run main/othervm -Djdk.tls.client.protocols="XSLv3,TLSv1"
+ *      IllegalProtocolProperty
+ */
+
+import javax.net.ssl.*;
+import java.security.NoSuchAlgorithmException;
+
+public class IllegalProtocolProperty {
+    static enum ContextVersion {
+        TLS_CV_01("SSL", "TLSv1", "TLSv1.2", true),
+        TLS_CV_02("TLS", "TLSv1", "TLSv1.2", true),
+        TLS_CV_03("SSLv3", "TLSv1", "TLSv1.2", false),
+        TLS_CV_04("TLSv1", "TLSv1", "TLSv1.2", false),
+        TLS_CV_05("TLSv1.1", "TLSv1.1", "TLSv1.2", false),
+        TLS_CV_06("TLSv1.2", "TLSv1.2", "TLSv1.2", false),
+        TLS_CV_07("Default", "TLSv1", "TLSv1.2", true);
+
+        final String contextVersion;
+        final String defaultProtocolVersion;
+        final String supportedProtocolVersion;
+        final boolean impacted;
+
+        ContextVersion(String contextVersion, String defaultProtocolVersion,
+                String supportedProtocolVersion, boolean impacted) {
+            this.contextVersion = contextVersion;
+            this.defaultProtocolVersion = defaultProtocolVersion;
+            this.supportedProtocolVersion = supportedProtocolVersion;
+            this.impacted = impacted;
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        for (ContextVersion cv : ContextVersion.values()) {
+            System.out.println("Checking SSLContext of " + cv.contextVersion);
+
+            SSLContext context;
+            try {
+                context = SSLContext.getInstance(cv.contextVersion);
+                if (cv.impacted) {
+                    throw new Exception(
+                        "illegal system property jdk.tls.client.protocols: " +
+                        System.getProperty("jdk.tls.client.protocols"));
+                }
+            } catch (NoSuchAlgorithmException nsae) {
+                if (cv.impacted) {
+                    System.out.println(
+                        "\tIgnore: illegal system property " +
+                        "jdk.tls.client.protocols=" +
+                        System.getProperty("jdk.tls.client.protocols"));
+                    continue;
+                } else {
+                    throw nsae;
+                }
+            }
+
+            // Default SSLContext is initialized automatically.
+            if (!cv.contextVersion.equals("Default")) {
+                // Use default TK, KM and random.
+                context.init((KeyManager[])null, (TrustManager[])null, null);
+            }
+
+            SSLParameters parameters = context.getDefaultSSLParameters();
+
+            String[] protocols = parameters.getProtocols();
+            String[] ciphers = parameters.getCipherSuites();
+
+            if (protocols.length == 0 || ciphers.length == 0) {
+                throw new Exception("No default protocols or cipher suites");
+            }
+
+            boolean isMatch = false;
+            for (String protocol : protocols) {
+                System.out.println("\tdefault protocol version " + protocol);
+                if (protocol.equals(cv.defaultProtocolVersion)) {
+                    isMatch = true;
+                    break;
+                }
+            }
+
+            if (!isMatch) {
+                throw new Exception("No matched default protocol");
+            }
+
+            parameters = context.getSupportedSSLParameters();
+
+            protocols = parameters.getProtocols();
+            ciphers = parameters.getCipherSuites();
+
+            if (protocols.length == 0 || ciphers.length == 0) {
+                throw new Exception("No supported protocols or cipher suites");
+            }
+
+            isMatch = false;
+            for (String protocol : protocols) {
+                System.out.println("\tsupported protocol version " + protocol);
+                if (protocol.equals(cv.supportedProtocolVersion)) {
+                    isMatch = true;
+                    break;
+                }
+            }
+
+            if (!isMatch) {
+                throw new Exception("No matched supported protocol");
+            }
+            System.out.println("\t... Success");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLContextImpl/NoOldVersionContext.java	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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.
+ */
+
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+
+/*
+ * @test
+ * @bug 7093640
+ * @summary Enable TLS 1.1 and TLS 1.2 by default in client side of SunJSSE
+ * @run main/othervm -Djdk.tls.client.protocols="TLSv1,TLSv1.1,TLSv1.2"
+ *      NoOldVersionContext
+ */
+
+import javax.net.*;
+import javax.net.ssl.*;
+import java.util.Arrays;
+
+public class NoOldVersionContext {
+    static enum ContextVersion {
+        TLS_CV_01("SSL",
+                new String[] {"TLSv1", "TLSv1.1", "TLSv1.2"}),
+        TLS_CV_02("TLS",
+                new String[] {"TLSv1", "TLSv1.1", "TLSv1.2"}),
+        TLS_CV_03("SSLv3",
+                new String[] {"SSLv3", "TLSv1"}),
+        TLS_CV_04("TLSv1",
+                new String[] {"SSLv3", "TLSv1"}),
+        TLS_CV_05("TLSv1.1",
+                new String[] {"SSLv3", "TLSv1", "TLSv1.1"}),
+        TLS_CV_06("TLSv1.2",
+                new String[] {"SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"}),
+        TLS_CV_07("Default",
+                new String[] {"TLSv1", "TLSv1.1", "TLSv1.2"});
+
+        final String contextVersion;
+        final String[] enabledProtocols;
+        final static String[] supportedProtocols = new String[] {
+                "SSLv2Hello", "SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"};
+
+        ContextVersion(String contextVersion, String[] enabledProtocols) {
+            this.contextVersion = contextVersion;
+            this.enabledProtocols = enabledProtocols;
+        }
+    }
+
+    private static boolean checkProtocols(String[] target, String[] expected) {
+        boolean success = true;
+        if (target.length == 0) {
+            System.out.println("\tError: No protocols");
+            success = false;
+        }
+
+        if (!Arrays.equals(target, expected)) {
+            System.out.println("\tError: Expected to get protocols " +
+                    Arrays.toString(expected));
+            System.out.println("\tError: The actual protocols " +
+                    Arrays.toString(target));
+            success = false;
+        }
+
+        return success;
+    }
+
+    private static boolean checkCipherSuites(String[] target) {
+        boolean success = true;
+        if (target.length == 0) {
+            System.out.println("\tError: No cipher suites");
+            success = false;
+        }
+
+        return success;
+    }
+
+    public static void main(String[] args) throws Exception {
+        boolean failed = false;
+        for (ContextVersion cv : ContextVersion.values()) {
+            System.out.println("Checking SSLContext of " + cv.contextVersion);
+            SSLContext context = SSLContext.getInstance(cv.contextVersion);
+
+            // Default SSLContext is initialized automatically.
+            if (!cv.contextVersion.equals("Default")) {
+                // Use default TK, KM and random.
+                context.init((KeyManager[])null, (TrustManager[])null, null);
+            }
+
+            //
+            // Check SSLContext
+            //
+            // Check default SSLParameters of SSLContext
+            System.out.println("\tChecking default SSLParameters");
+            SSLParameters parameters = context.getDefaultSSLParameters();
+
+            String[] protocols = parameters.getProtocols();
+            failed |= !checkProtocols(protocols, cv.enabledProtocols);
+
+            String[] ciphers = parameters.getCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            // Check supported SSLParameters of SSLContext
+            System.out.println("\tChecking supported SSLParameters");
+            parameters = context.getSupportedSSLParameters();
+
+            protocols = parameters.getProtocols();
+            failed |= !checkProtocols(protocols, cv.supportedProtocols);
+
+            ciphers = parameters.getCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            //
+            // Check SSLEngine
+            //
+            // Check SSLParameters of SSLEngine
+            System.out.println();
+            System.out.println("\tChecking SSLEngine of this SSLContext");
+            System.out.println("\tChecking SSLEngine.getSSLParameters()");
+            SSLEngine engine = context.createSSLEngine();
+            engine.setUseClientMode(true);
+            parameters = engine.getSSLParameters();
+
+            protocols = parameters.getProtocols();
+            failed |= !checkProtocols(protocols, cv.enabledProtocols);
+
+            ciphers = parameters.getCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            System.out.println("\tChecking SSLEngine.getEnabledProtocols()");
+            protocols = engine.getEnabledProtocols();
+            failed |= !checkProtocols(protocols, cv.enabledProtocols);
+
+            System.out.println("\tChecking SSLEngine.getEnabledCipherSuites()");
+            ciphers = engine.getEnabledCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            System.out.println("\tChecking SSLEngine.getSupportedProtocols()");
+            protocols = engine.getSupportedProtocols();
+            failed |= !checkProtocols(protocols, cv.supportedProtocols);
+
+            System.out.println(
+                    "\tChecking SSLEngine.getSupportedCipherSuites()");
+            ciphers = engine.getSupportedCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            //
+            // Check SSLSocket
+            //
+            // Check SSLParameters of SSLSocket
+            System.out.println();
+            System.out.println("\tChecking SSLSocket of this SSLContext");
+            System.out.println("\tChecking SSLSocket.getSSLParameters()");
+            SocketFactory fac = context.getSocketFactory();
+            SSLSocket socket = (SSLSocket)fac.createSocket();
+            parameters = socket.getSSLParameters();
+
+            protocols = parameters.getProtocols();
+            failed |= !checkProtocols(protocols, cv.enabledProtocols);
+
+            ciphers = parameters.getCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            System.out.println("\tChecking SSLEngine.getEnabledProtocols()");
+            protocols = socket.getEnabledProtocols();
+            failed |= !checkProtocols(protocols, cv.enabledProtocols);
+
+            System.out.println("\tChecking SSLEngine.getEnabledCipherSuites()");
+            ciphers = socket.getEnabledCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            System.out.println("\tChecking SSLEngine.getSupportedProtocols()");
+            protocols = socket.getSupportedProtocols();
+            failed |= !checkProtocols(protocols, cv.supportedProtocols);
+
+            System.out.println(
+                    "\tChecking SSLEngine.getSupportedCipherSuites()");
+            ciphers = socket.getSupportedCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            //
+            // Check SSLServerSocket
+            //
+            // Check SSLParameters of SSLServerSocket
+            System.out.println();
+            System.out.println("\tChecking SSLServerSocket of this SSLContext");
+            System.out.println("\tChecking SSLServerSocket.getSSLParameters()");
+            SSLServerSocketFactory sf = context.getServerSocketFactory();
+            SSLServerSocket ssocket = (SSLServerSocket)sf.createServerSocket();
+            parameters = ssocket.getSSLParameters();
+
+            protocols = parameters.getProtocols();
+            failed |= !checkProtocols(protocols, cv.supportedProtocols);
+
+            ciphers = parameters.getCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            System.out.println("\tChecking SSLEngine.getEnabledProtocols()");
+            protocols = ssocket.getEnabledProtocols();
+            failed |= !checkProtocols(protocols, cv.supportedProtocols);
+
+            System.out.println("\tChecking SSLEngine.getEnabledCipherSuites()");
+            ciphers = ssocket.getEnabledCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+
+            System.out.println("\tChecking SSLEngine.getSupportedProtocols()");
+            protocols = ssocket.getSupportedProtocols();
+            failed |= !checkProtocols(protocols, cv.supportedProtocols);
+
+            System.out.println(
+                    "\tChecking SSLEngine.getSupportedCipherSuites()");
+            ciphers = ssocket.getSupportedCipherSuites();
+            failed |= !checkCipherSuites(ciphers);
+        }
+
+        if (failed) {
+            throw new Exception("Run into problems, see log for more details");
+        } else {
+            System.out.println("\t... Success");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLContextImpl/SSLContextVersion.java	Wed Jul 05 19:26:45 2017 +0200
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2011, 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.
+ *
+ * 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.
+ */
+
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+
+/*
+ * @test
+ * @bug 6976117
+ * @summary SSLContext.getInstance("TLSv1.1") returns SSLEngines/SSLSockets
+ *          without TLSv1.1 enabled
+ * @run main/othervm SSLContextVersion
+ */
+
+import javax.net.ssl.*;
+
+public class SSLContextVersion {
+    static enum ContextVersion {
+        TLS_CV_01("SSL", "TLSv1.2", "TLSv1.2"),
+        TLS_CV_02("TLS", "TLSv1.2", "TLSv1.2"),
+        TLS_CV_03("SSLv3", "TLSv1", "TLSv1.2"),
+        TLS_CV_04("TLSv1", "TLSv1", "TLSv1.2"),
+        TLS_CV_05("TLSv1.1", "TLSv1.1", "TLSv1.2"),
+        TLS_CV_06("TLSv1.2", "TLSv1.2", "TLSv1.2"),
+        TLS_CV_07("Default", "TLSv1.2", "TLSv1.2");
+
+        final String contextVersion;
+        final String defaultProtocolVersion;
+        final String supportedProtocolVersion;
+
+        ContextVersion(String contextVersion, String defaultProtocolVersion,
+                String supportedProtocolVersion) {
+            this.contextVersion = contextVersion;
+            this.defaultProtocolVersion = defaultProtocolVersion;
+            this.supportedProtocolVersion = supportedProtocolVersion;
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        for (ContextVersion cv : ContextVersion.values()) {
+            System.out.println("Checking SSLContext of " + cv.contextVersion);
+            SSLContext context = SSLContext.getInstance(cv.contextVersion);
+
+            // Default SSLContext is initialized automatically.
+            if (!cv.contextVersion.equals("Default")) {
+                // Use default TK, KM and random.
+                context.init((KeyManager[])null, (TrustManager[])null, null);
+            }
+
+            SSLParameters parameters = context.getDefaultSSLParameters();
+
+            String[] protocols = parameters.getProtocols();
+            String[] ciphers = parameters.getCipherSuites();
+
+            if (protocols.length == 0 || ciphers.length == 0) {
+                throw new Exception("No default protocols or cipher suites");
+            }
+
+            boolean isMatch = false;
+            for (String protocol : protocols) {
+                System.out.println("\tdefault protocol version " + protocol);
+                if (protocol.equals(cv.defaultProtocolVersion)) {
+                    isMatch = true;
+                    break;
+                }
+            }
+
+            if (!isMatch) {
+                throw new Exception("No matched default protocol");
+            }
+
+            parameters = context.getSupportedSSLParameters();
+
+            protocols = parameters.getProtocols();
+            ciphers = parameters.getCipherSuites();
+
+            if (protocols.length == 0 || ciphers.length == 0) {
+                throw new Exception("No supported protocols or cipher suites");
+            }
+
+            isMatch = false;
+            for (String protocol : protocols) {
+                System.out.println("\tsupported protocol version " + protocol);
+                if (protocol.equals(cv.supportedProtocolVersion)) {
+                    isMatch = true;
+                    break;
+                }
+            }
+
+            if (!isMatch) {
+                throw new Exception("No matched supported protocol");
+            }
+            System.out.println("\t... Success");
+        }
+    }
+}
--- a/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/SSLSocketImplThrowsWrongExceptions.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/SSLSocketImplThrowsWrongExceptions.java	Wed Jul 05 19:26:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -21,15 +21,17 @@
  * questions.
  */
 
+//
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+//
+
 /*
  * @test
  * @bug 4361124 4325806
  * @summary SSLServerSocket isn't throwing exceptions when negotiations are
  *      failing & java.net.SocketException: occures in Auth and clientmode
  * @run main/othervm SSLSocketImplThrowsWrongExceptions
- *
- *     SunJSSE does not support dynamic system properties, no way to re-use
- *     system properties in samevm/agentvm mode.
  * @author Brad Wetmore
  */
 
@@ -184,34 +186,76 @@
      * Fork off the other side, then do your work.
      */
     SSLSocketImplThrowsWrongExceptions () throws Exception {
-        if (separateServerThread) {
-            startServer(true);
-            startClient(false);
-        } else {
-            startClient(true);
-            startServer(false);
+        Exception startException = null;
+        try {
+            if (separateServerThread) {
+                startServer(true);
+                startClient(false);
+            } else {
+                startClient(true);
+                startServer(false);
+            }
+        } catch (Exception e) {
+            startException = e;
         }
 
         /*
          * Wait for other side to close down.
          */
         if (separateServerThread) {
-            serverThread.join();
+            if (serverThread != null) {
+                serverThread.join();
+            }
         } else {
-            clientThread.join();
+            if (clientThread != null) {
+                clientThread.join();
+            }
         }
 
         /*
          * When we get here, the test is pretty much over.
-         *
-         * If the main thread excepted, that propagates back
-         * immediately.  If the other thread threw an exception, we
-         * should report back.
+         * Which side threw the error?
+         */
+        Exception local;
+        Exception remote;
+
+        if (separateServerThread) {
+            remote = serverException;
+            local = clientException;
+        } else {
+            remote = clientException;
+            local = serverException;
+        }
+
+        Exception exception = null;
+
+        /*
+         * Check various exception conditions.
          */
-        if (serverException != null)
-            throw serverException;
-        if (clientException != null)
-            throw clientException;
+        if ((local != null) && (remote != null)) {
+            // If both failed, return the curthread's exception.
+            local.initCause(remote);
+            exception = local;
+        } else if (local != null) {
+            exception = local;
+        } else if (remote != null) {
+            exception = remote;
+        } else if (startException != null) {
+            exception = startException;
+        }
+
+        /*
+         * If there was an exception *AND* a startException,
+         * output it.
+         */
+        if (exception != null) {
+            if (exception != startException && startException != null) {
+                exception.addSuppressed(startException);
+            }
+            throw exception;
+        }
+
+        // Fall-through: no exception to throw!
     }
 
     void startServer(boolean newThread) throws Exception {
@@ -226,7 +270,7 @@
                          *
                          * Release the client, if not active already...
                          */
-                        System.out.println("Server died...");
+                        System.err.println("Server died...");
                         serverReady = true;
                         serverException = e;
                     }
@@ -234,7 +278,13 @@
             };
             serverThread.start();
         } else {
-            doServerSide();
+            try {
+                doServerSide();
+            } catch (Exception e) {
+                serverException = e;
+            } finally {
+                serverReady = true;
+            }
         }
     }
 
@@ -248,14 +298,18 @@
                         /*
                          * Our client thread just died.
                          */
-                        System.out.println("Client died...");
+                        System.err.println("Client died...");
                         clientException = e;
                     }
                 }
             };
             clientThread.start();
         } else {
-            doClientSide();
+            try {
+                doClientSide();
+            } catch (Exception e) {
+                clientException = e;
+            }
         }
     }
 }
--- a/jdk/test/sun/security/ssl/javax/net/ssl/SSLContextVersion.java	Fri Dec 13 09:35:35 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2011, 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.
- *
- * 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 6976117
- * @summary SSLContext.getInstance("TLSv1.1") returns SSLEngines/SSLSockets
- *          without TLSv1.1 enabled
- */
-
-import javax.net.ssl.*;
-
-public class SSLContextVersion {
-    static enum ContextVersion {
-        TLS_CV_01("SSL", "TLSv1", "TLSv1.2"),
-        TLS_CV_02("TLS", "TLSv1", "TLSv1.2"),
-        TLS_CV_03("SSLv3", "TLSv1", "TLSv1.2"),
-        TLS_CV_04("TLSv1", "TLSv1", "TLSv1.2"),
-        TLS_CV_05("TLSv1.1", "TLSv1.1", "TLSv1.2"),
-        TLS_CV_06("TLSv1.2", "TLSv1.2", "TLSv1.2"),
-        TLS_CV_07("Default", "TLSv1", "TLSv1.2");
-
-        final String contextVersion;
-        final String defaultProtocolVersion;
-        final String supportedProtocolVersion;
-
-        ContextVersion(String contextVersion, String defaultProtocolVersion,
-                String supportedProtocolVersion) {
-            this.contextVersion = contextVersion;
-            this.defaultProtocolVersion = defaultProtocolVersion;
-            this.supportedProtocolVersion = supportedProtocolVersion;
-        }
-    }
-
-    public static void main(String[] args) throws Exception {
-        for (ContextVersion cv : ContextVersion.values()) {
-            System.out.println("Checking SSLContext of " + cv.contextVersion);
-            SSLContext context = SSLContext.getInstance(cv.contextVersion);
-
-            // Default SSLContext is initialized automatically.
-            if (!cv.contextVersion.equals("Default")) {
-                // Use default TK, KM and random.
-                context.init((KeyManager[])null, (TrustManager[])null, null);
-            }
-
-            SSLParameters parameters = context.getDefaultSSLParameters();
-
-            String[] protocols = parameters.getProtocols();
-            String[] ciphers = parameters.getCipherSuites();
-
-            if (protocols.length == 0 || ciphers.length == 0) {
-                throw new Exception("No default protocols or cipher suites");
-            }
-
-            boolean isMatch = false;
-            for (String protocol : protocols) {
-                System.out.println("\tdefault protocol version " + protocol);
-                if (protocol.equals(cv.defaultProtocolVersion)) {
-                    isMatch = true;
-                    break;
-                }
-            }
-
-            if (!isMatch) {
-                throw new Exception("No matched default protocol");
-            }
-
-            parameters = context.getSupportedSSLParameters();
-
-            protocols = parameters.getProtocols();
-            ciphers = parameters.getCipherSuites();
-
-            if (protocols.length == 0 || ciphers.length == 0) {
-                throw new Exception("No supported protocols or cipher suites");
-            }
-
-            isMatch = false;
-            for (String protocol : protocols) {
-                System.out.println("\tsupported protocol version " + protocol);
-                if (protocol.equals(cv.supportedProtocolVersion)) {
-                    isMatch = true;
-                    break;
-                }
-            }
-
-            if (!isMatch) {
-                throw new Exception("No matched supported protocol");
-            }
-            System.out.println("\t... Success");
-        }
-    }
-}
--- a/jdk/test/sun/security/ssl/templates/SSLSocketSSLEngineTemplate.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/sun/security/ssl/templates/SSLSocketSSLEngineTemplate.java	Wed Jul 05 19:26:45 2017 +0200
@@ -221,6 +221,9 @@
 
         try {
             boolean closed = false;
+            // will try to read one more time in case client message
+            // is fragmented to multiple pieces
+            boolean retry = true;
 
             InputStream is = socket.getInputStream();
             OutputStream os = socket.getOutputStream();
@@ -295,8 +298,14 @@
                     /*
                      * A sanity check to ensure we got what was sent.
                      */
-                    if (serverIn.remaining() != clientMsg.length) {
-                        throw new Exception("Client:  Data length error");
+                    if (serverIn.remaining() !=  clientMsg.length) {
+                        if (retry && serverIn.remaining() < clientMsg.length) {
+                            log("Need to read more from client");
+                            retry = false;
+                            continue;
+                        } else {
+                            throw new Exception("Client:  Data length error");
+                        }
                     }
 
                     for (int i = 0; i < clientMsg.length; i++) {
--- a/jdk/test/tools/launcher/ChangeDataModel.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/tools/launcher/ChangeDataModel.java	Wed Jul 05 19:26:45 2017 +0200
@@ -23,41 +23,43 @@
 
 /**
  * @test
- * @bug 4894330 4810347 6277269
+ * @bug 4894330 4810347 6277269 8029388
  * @compile -XDignore.symbol.file ChangeDataModel.java
  * @run main ChangeDataModel
  * @summary Verify -d32 and -d64 options are accepted(rejected) on all platforms
  * @author Joseph D. Darcy, ksrini
  */
 import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
 
 public class ChangeDataModel extends TestHelper {
     private static final File TestJar      = new File("test" + JAR_FILE_EXT);
+    private static final String OptionName = "Args";
+    private static final File TestOptionJar  = new File(OptionName + JAR_FILE_EXT);
     private static final String OPT_PREFIX = "ARCH_OPT:";
 
-    public static void main(String... args) throws Exception {
+    static void createTestJar() throws Exception {
         String[] code = {
             "   public static void main(String argv[]) {",
             "      System.out.println(\"" + OPT_PREFIX + "-d\" + System.getProperty(\"sun.arch.data.model\", \"none\"));",
-            "   }",
-        };
+            "   }",};
         createJar(TestJar, code);
+    }
+    public static void main(String... args) throws Exception {
+        createTestJar();
+        createOptionsJar();
 
-        // verify if data model flag for default data model is accepted
+        // verify if data model flag for default data model is accepted, also
+        // verify if the complimentary data model is rejected.
         if (is32Bit) {
             checkAcceptance(javaCmd, "-d32");
+            checkRejection(javaCmd, "-d64");
+            checkOption(javaCmd, "-d64");
         } else if (is64Bit) {
             checkAcceptance(javaCmd, "-d64");
-        } else {
-            throw new Error("unsupported data model");
-        }
-
-        // Negative tests: ensure that non-dual mode systems reject the
-        // complementary (other) data model
-        if (is32Bit) {
-            checkRejection(javaCmd, "-d64");
-        } else if (is64Bit) {
             checkRejection(javaCmd, "-d32");
+            checkOption(javaCmd, "-d32");
         } else {
             throw new Error("unsupported data model");
         }
@@ -81,4 +83,44 @@
             throw new RuntimeException(message);
         }
     }
+
+    static void checkOption(String cmd, String dmodel) throws Exception {
+        TestResult tr = doExec(cmd, "-jar", TestOptionJar.getAbsolutePath(), dmodel);
+        verifyOption(tr, dmodel);
+
+        tr = doExec(cmd, "-cp", ".", OptionName, dmodel);
+        verifyOption(tr, dmodel);
+    }
+
+    static void verifyOption(TestResult tr, String dmodel) {
+        if (!tr.contains(OPT_PREFIX + dmodel)) {
+            System.out.println(tr);
+            String message = "app argument: " + dmodel + " not found.";
+            throw new RuntimeException(message);
+        }
+        if (!tr.isOK()) {
+            System.out.println(tr);
+            String message = "app argument: " + dmodel + " interpreted ?";
+            throw new RuntimeException(message);
+        }
+    }
+
+    static void createOptionsJar() throws Exception {
+        List<String> code = new ArrayList<>();
+        code.add("public class Args {");
+        code.add("   public static void main(String argv[]) {");
+        code.add("       for (String x : argv)");
+        code.add("           System.out.println(\"" + OPT_PREFIX + "\" + x);");
+        code.add("   }");
+        code.add("}");
+        File optionsJava  = new File(OptionName + JAVA_FILE_EXT);
+        createFile(optionsJava, code);
+        File optionsClass = new File(OptionName + CLASS_FILE_EXT);
+
+        compile(optionsJava.getName());
+        createJar("cvfe",
+                  TestOptionJar.getName(),
+                  OptionName,
+                  optionsClass.getName());
+    }
 }
--- a/jdk/test/tools/launcher/ExecutionEnvironment.java	Fri Dec 13 09:35:35 2013 -0800
+++ b/jdk/test/tools/launcher/ExecutionEnvironment.java	Wed Jul 05 19:26:45 2017 +0200
@@ -46,9 +46,6 @@
  *            b. LD_LIBRARY_PATH32 is ignored if set
  *   5. no extra symlink exists on Solaris ie.
  *      jre/lib/$arch/libjvm.so -> client/libjvm.so
- *   6. Since 32-bit Solaris is no longer supported we continue to ensure that
- *      the appropriate paths are ignored or used, additionally we also test to
- *      ensure the 64-bit isadir exists and contains appropriate links.
  * TODO:
  *      a. perhaps we need to add a test to audit all environment variables are
  *         in pristine condition after the launch, there may be a few that the
@@ -57,17 +54,10 @@
  */
 import java.io.File;
 import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.nio.file.DirectoryStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import static java.nio.file.LinkOption.*;
-import java.util.regex.Pattern;
-
 
 public class ExecutionEnvironment extends TestHelper {
     static final String LD_LIBRARY_PATH    = TestHelper.isMacOSX
@@ -270,56 +260,6 @@
             throw new RuntimeException("symlink exists " + symLink.getAbsolutePath());
         }
     }
-
-    /*
-     * verify if all the symlinks in the images are created correctly,
-     * only on solaris, this test works only on images.
-     */
-    @Test
-    void testSymLinks() throws Exception {
-        if (!isSolaris)
-            return;
-        verifySymLinks(JAVA_BIN);
-        verifySymLinks(JAVA_JRE_BIN);
-    }
-    // exclude non-consequential binaries or scripts co-packaged in other
-    // build phases
-    private final String excludeRE =
-            ".*jvisualvm.*" +
-            "|.*javaws.*" +
-            "|.*ControlPanel.*" +
-            "|.*java-rmi.cgi" +
-            "|.*jcontrol.*";
-    private final Pattern symlinkExcludes = Pattern.compile(excludeRE);
-
-    private void verifySymLinks(String bindir) throws IOException {
-        File binDir = new File(bindir);
-        System.err.println("verifying links in: " + bindir);
-        File isaDir = new File(binDir, getArch()).getAbsoluteFile();
-        if (!isaDir.exists()) {
-            throw new RuntimeException("dir: " + isaDir + " does not exist");
-        }
-        try (DirectoryStream<Path> ds = Files.newDirectoryStream(binDir.toPath())) {
-            for (Path p : ds) {
-                if (symlinkExcludes.matcher(p.toString()).matches() ||
-                        Files.isDirectory(p, NOFOLLOW_LINKS)) {
-                    continue;
-                }
-                Path link = new File(isaDir, p.getFileName().toString()).toPath();
-                if (Files.isSymbolicLink(link)) {
-                    Path target = Files.readSymbolicLink(link);
-                    if (target.startsWith("..") && p.endsWith(target.getFileName())) {
-                        // System.out.println(target + " OK");
-                        continue;
-                    }
-                    System.err.println("target:" + target);
-                    System.err.println("file:" + p);
-                }
-                throw new RuntimeException("could not find link to " + p);
-            }
-        }
-
-    }
     public static void main(String... args) throws Exception {
         if (isWindows) {
             System.err.println("Warning: test not applicable to windows");
--- a/jdk/test/tools/pack200/NoBeans.java	Fri Dec 13 09:35:35 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 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.
- *
- * 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 8004931
- * @compile NoBeans.java
- * @summary A compile-only test to ensure that implementations of Packer
- *   and Unpacker can be compiled without implementating the
- *   addPropertyChangeListener and removePropertyChangeListener methods.
- */
-
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-
-public class NoBeans {
-
-    static class MyPacker implements Pack200.Packer {
-        public SortedMap<String,String> properties() { return null; }
-        public void pack(JarFile in, OutputStream out) { }
-        public void pack(JarInputStream in, OutputStream out) { }
-    }
-
-    static class MyUnpacker implements Pack200.Unpacker {
-        public SortedMap<String,String> properties() { return null; }
-        public void unpack(InputStream in, JarOutputStream out) { }
-        public void unpack(File in, JarOutputStream out) { }
-    }
-}
--- a/jdk/test/tools/pack200/Reflect.java	Fri Dec 13 09:35:35 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 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.
- *
- * 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 Invoke getDeclaredMethods on Packer and Unpacker to ensure
- *    that all types referenced in the method signatures is present.
- */
-
-import java.util.jar.Pack200;
-import java.util.jar.Pack200.Packer;
-import java.util.jar.Pack200.Unpacker;
-import java.lang.reflect.Method;
-
-public class Reflect {
-    static void printMethods(Class<?> c) {
-        System.out.println(c);
-        for (Method m: c.getDeclaredMethods()) {
-            System.out.println("    " + m);
-        }
-    }
-    public static void main(String[] args) {
-        printMethods(Pack200.Packer.class);
-        printMethods(Pack200.Unpacker.class);
-        printMethods(Pack200.newPacker().getClass());
-        printMethods(Pack200.newUnpacker().getClass());
-    }
-}
--- a/make/Javadoc.gmk	Fri Dec 13 09:35:35 2013 -0800
+++ b/make/Javadoc.gmk	Wed Jul 05 19:26:45 2017 +0200
@@ -265,7 +265,6 @@
     -quiet \
     -use \
     -keywords \
-    -Xdoclint:none \
     -Xprofilespath $(JDK_TOPDIR)/make/profile-rtjar-includes.txt \
     $(ADDITIONAL_JAVADOCFLAGS)
 
@@ -381,6 +380,7 @@
 $(COREAPI_OPTIONS_FILE): $(COREAPI_OVERVIEW)
 	$(prep-target)
 	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
+	  $(call OptionOnly,-Xdoclint:none) ; \
 	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
 	  $(call OptionPair,-encoding,ISO-8859-1) ; \
 	  $(call OptionPair,-tag,beaninfo:X) ; \
@@ -456,6 +456,7 @@
 $(DOCLETAPI_OPTIONS_FILE):
 	$(prep-target)
 	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
+	  $(call OptionOnly,-Xdoclint:none) ; \
 	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-breakiterator) ; \
@@ -512,6 +513,7 @@
 $(TAGLETAPI_OPTIONS_FILE):
 	$(prep-target)
 	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
+	  $(call OptionOnly,-Xdoclint:none) ; \
 	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-nonavbar) ; \
@@ -563,6 +565,7 @@
 $(DOMAPI_OPTIONS_FILE):
 	$(prep-target)
 	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
+	  $(call OptionOnly,-Xdoclint:none) ; \
 	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-splitIndex) ; \
@@ -625,6 +628,7 @@
 $(JDI_OPTIONS_FILE): $(JDI_OVERVIEW)
 	$(prep-target)
 	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
+	  $(call OptionOnly,-Xdoclint:none) ; \
 	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionPair,-overview,$(JDI_OVERVIEW)) ; \
@@ -712,6 +716,7 @@
 $(JAAS_OPTIONS_FILE): $(JAAS_OVERVIEW)
 	$(prep-target)
 	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
+	  $(call OptionOnly,-Xdoclint:none) ; \
 	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionPair,-overview,$(JAAS_OVERVIEW)) ; \
@@ -764,6 +769,7 @@
 $(JGSS_OPTIONS_FILE): $(JGSS_OVERVIEW)
 	$(prep-target)
 	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
+	  $(call OptionOnly,-Xdoclint:none) ; \
 	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-nodeprecatedlist) ; \
@@ -816,6 +822,7 @@
 $(SMARTCARDIO_OPTIONS_FILE):
 	$(prep-target)
 	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
+	  $(call OptionOnly,-Xdoclint:none) ; \
 	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-nodeprecatedlist) ; \
@@ -866,6 +873,7 @@
 $(HTTPSERVER_OPTIONS_FILE):
 	$(prep-target)
 	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
+	  $(call OptionOnly,-Xdoclint:none) ; \
 	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-nodeprecatedlist) ; \
@@ -926,6 +934,7 @@
 $(MGMT_OPTIONS_FILE): $(MGMT_OVERVIEW)
 	$(prep-target)
 	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
+	  $(call OptionOnly,-Xdoclint:none) ; \
 	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-nodeprecatedlist) ; \
@@ -977,6 +986,7 @@
 $(ATTACH_OPTIONS_FILE):
 	$(prep-target)
 	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
+	  $(call OptionOnly,-Xdoclint:none) ; \
 	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-nodeprecatedlist) ; \
@@ -1027,6 +1037,7 @@
 $(JCONSOLE_OPTIONS_FILE):
 	$(prep-target)
 	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
+	  $(call OptionOnly,-Xdoclint:none) ; \
 	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-nodeprecatedlist) ; \
@@ -1079,6 +1090,7 @@
 $(TREEAPI_OPTIONS_FILE):
 	$(prep-target)
 	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
+	  $(call OptionOnly,-Xdoclint:none) ; \
 	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionPair,-doctitle,$(TREEAPI_DOCTITLE)) ; \
@@ -1130,6 +1142,7 @@
 $(SCTPAPI_OPTIONS_FILE):
 	$(prep-target)
 	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
+	  $(call OptionOnly,-Xdoclint:none) ; \
 	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-nodeprecatedlist) ; \
--- a/make/Jprt.gmk	Fri Dec 13 09:35:35 2013 -0800
+++ b/make/Jprt.gmk	Wed Jul 05 19:26:45 2017 +0200
@@ -23,148 +23,7 @@
 # questions.
 #
 
-# This file is included by the root NewerMakefile and contains targets
-# and utilities needed by JPRT.
-
-# Utilities used in this Makefile. Most of this makefile executes without
-# the context of a spec file from configure.
-CAT=cat
-CMP=cmp
-CP=cp
-ECHO=echo
-MKDIR=mkdir
-PRINTF=printf
-PWD=pwd
-# Insure we have a path that looks like it came from pwd
-# (This is mostly for Windows sake and drive letters)
-define UnixPath # path
-$(shell (cd "$1" && $(PWD)))
-endef
-
-BUILD_DIR_ROOT:=$(root_dir)/build
-
-ifdef OPENJDK
-  OPEN_BUILD=true
-else
-  OPEN_BUILD := $(if $(or $(wildcard $(root_dir)/jdk/src/closed), \
-      $(wildcard $(root_dir)/jdk/make/closed), \
-      $(wildcard $(root_dir)/jdk/test/closed), \
-      $(wildcard $(root_dir)/hotspot/src/closed), \
-      $(wildcard $(root_dir)/hotspot/make/closed), \
-      $(wildcard $(root_dir)/hotspot/test/closed)), \
-      false,true)
-endif
-
-HOTSPOT_AVAILABLE := $(if $(wildcard $(root_dir)/hotspot),true,false)
-
-###########################################################################
-# To help in adoption of the new configure&&make build process, a bridge
-# build will use the old settings to run configure and do the build.
-
-# Build with the configure bridge. After running configure, restart make
-# to parse the new spec file.
-BRIDGE_TARGETS := all
-# Add bootcycle-images target if legacy variable is set.
-ifeq ($(SKIP_BOOT_CYCLE),false)
-  BRIDGE_TARGETS += bootcycle-images
-endif
-bridgeBuild: bridge2configure
-	@cd $(root_dir) && $(MAKE) -f Makefile $(BRIDGE_TARGETS)
-
-# Bridge from old Makefile ALT settings to configure options
-bridge2configure: $(BUILD_DIR_ROOT)/.bridge2configureOpts
-	bash ./configure $(strip $(shell $(CAT) $<))
-
-# Create a file with configure options created from old Makefile mechanisms.
-$(BUILD_DIR_ROOT)/.bridge2configureOpts: $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest
-	$(RM) $@
-	$(CP) $< $@
-
-# Use this file to only change when obvious things have changed
-$(BUILD_DIR_ROOT)/.bridge2configureOptsLatest: FRC
-	$(RM) $@.tmp
-	$(MKDIR) -p $(BUILD_DIR_ROOT)
-	@$(ECHO) " --with-debug-level=$(if $(DEBUG_LEVEL),$(DEBUG_LEVEL),release) " >> $@.tmp
-        ifdef ARCH_DATA_MODEL
-	  @$(ECHO) " --with-target-bits=$(ARCH_DATA_MODEL) " >> $@.tmp
-        endif
-        ifeq ($(ARCH_DATA_MODEL),32)
-	  @$(ECHO) " --with-jvm-variants=client,server " >> $@.tmp
-        endif
-        ifdef ALT_PARALLEL_COMPILE_JOBS
-	  @$(ECHO) " --with-num-cores=$(ALT_PARALLEL_COMPILE_JOBS) " >> $@.tmp
-        endif
-        ifdef ALT_BOOTDIR
-	  @$(ECHO) " --with-boot-jdk=$(call UnixPath,$(ALT_BOOTDIR)) " >> $@.tmp
-        endif
-        ifdef ALT_CUPS_HEADERS_PATH
-	  @$(ECHO) " --with-cups-include=$(call UnixPath,$(ALT_CUPS_HEADERS_PATH)) " >> $@.tmp
-        endif
-        ifdef ALT_FREETYPE_HEADERS_PATH
-	  @$(ECHO) " --with-freetype=$(call UnixPath,$(ALT_FREETYPE_HEADERS_PATH)/..) " >> $@.tmp
-        endif
-        ifdef ENABLE_SJAVAC
-	  @$(ECHO) " --enable-sjavac" >> $@.tmp
-        endif
-        ifeq ($(HOTSPOT_AVAILABLE),false)
-          ifdef ALT_JDK_IMPORT_PATH
-	    @$(ECHO) " --with-import-hotspot=$(call UnixPath,$(ALT_JDK_IMPORT_PATH)) " >> $@.tmp
-          endif
-        endif
-        ifeq ($(OPEN_BUILD),true)
-	  @$(ECHO) " --enable-openjdk-only " >> $@.tmp
-        else
-#         Todo: move to closed?
-          ifdef ALT_MOZILLA_HEADERS_PATH
-	    @$(ECHO) " --with-mozilla-headers=$(call UnixPath,$(ALT_MOZILLA_HEADERS_PATH)) " >> $@.tmp
-          endif
-          ifdef ALT_JUNIT_DIR
-	    @$(ECHO) " --with-junit-dir=$(call UnixPath,$(ALT_JUNIT_DIR)) " >> $@.tmp
-          endif
-          ifdef ANT_HOME
-	    @$(ECHO) " --with-ant-home=$(call UnixPath,$(ANT_HOME)) " >> $@.tmp
-          endif
-          ifdef ALT_JAVAFX_ZIP_DIR
-	    @$(ECHO) " --with-javafx-zip-dir=$(call UnixPath,$(ALT_JAVAFX_ZIP_DIR)) " >> $@.tmp
-          endif
-          ifdef ALT_JMC_ZIP_DIR
-	    @$(ECHO) " --with-jmc-zip-dir=$(call UnixPath,$(ALT_JMC_ZIP_DIR)) " >> $@.tmp
-          endif
-          ifdef ALT_WIXDIR
-	    @$(ECHO) " --with-wix=$(call UnixPath,$(ALT_WIXDIR)) " >> $@.tmp
-          endif
-          ifdef ALT_INSTALL_LZMA_PATH
-	    @$(ECHO) " --with-lzma-path=$(call UnixPath,$(ALT_INSTALL_LZMA_PATH)) " >> $@.tmp
-          endif
-          ifdef ALT_INSTALL_UPX_PATH
-	    @$(ECHO) " --with-upx-path=$(call UnixPath,$(ALT_INSTALL_UPX_PATH)) " >> $@.tmp
-          endif
-          ifdef ALT_INSTALL_UPX_FILENAME
-	    @$(ECHO) " --with-upx-filename=$(call UnixPath,$(ALT_INSTALL_UPX_FILENAME)) " >> $@.tmp
-          endif
-          ifdef ALT_CCSS_SIGNING_DIR
-	    @$(ECHO) " --with-ccss-signing=$(call UnixPath,$(ALT_CCSS_SIGNING_DIR)) " >> $@.tmp
-          endif
-          ifdef ALT_SLASH_JAVA
-	    @$(ECHO) " --with-java-devtools=$(call UnixPath,$(ALT_SLASH_JAVA)/devtools) " >> $@.tmp
-          endif
-          ifdef ALT_SPARKLE_FRAMEWORK_DIR
-	    @$(ECHO) " --with-sparkle-framework=$(call UnixPath,$(ALT_SPARKLE_FRAMEWORK_DIR)) " >> $@.tmp
-          endif
-        endif
-	@if [ -f $@ ] ; then \
-	  if ! $(CMP) $@ $@.tmp > /dev/null ; then \
-	    $(CP) $@.tmp $@ ; \
-	  fi ; \
-	else \
-	  $(CP) $@.tmp $@ ; \
-	fi
-	$(RM) $@.tmp
-
-PHONY_LIST += bridge2configure bridgeBuild
-
-###########################################################################
-# JPRT targets
+# This file is contains targets utilities needed by JPRT.
 
 ifndef JPRT_ARCHIVE_BUNDLE
   JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/j2sdk-image.zip
@@ -173,23 +32,6 @@
   JPRT_ARCHIVE_INSTALL_BUNDLE=/tmp/jprt_bundles/product-install.zip
 endif
 
-# These targets execute in a SPEC free context, before calling bridgeBuild
-# to generate the SPEC.
-jprt_build_product: DEBUG_LEVEL=release
-jprt_build_product: BUILD_DIRNAME=*-release
-jprt_build_product: jprt_build_generic
-
-jprt_build_fastdebug: DEBUG_LEVEL=fastdebug
-jprt_build_fastdebug: BUILD_DIRNAME=*-fastdebug
-jprt_build_fastdebug: jprt_build_generic
-
-jprt_build_debug: DEBUG_LEVEL=slowdebug
-jprt_build_debug: BUILD_DIRNAME=*-debug
-jprt_build_debug: jprt_build_generic
-
-jprt_build_generic: BRIDGE_TARGETS+=jprt_bundle
-jprt_build_generic: bridgeBuild
-
 # This target must be called in the context of a SPEC file
 jprt_bundle: $(JPRT_ARCHIVE_BUNDLE)
 	@$(call CheckIfMakeAtEnd)
@@ -235,14 +77,6 @@
 	@$(call TargetExit)
 
 
-# Keep track of phony targets
-PHONY_LIST += jprt_build_product jprt_build_fastdebug jprt_build_debug \
-    jprt_build_generic bundles jprt_bundle \
-    final-images final-images-only
-
 ###########################################################################
 # Phony targets
-.PHONY: $(PHONY_LIST)
-
-# Force target
-FRC:
+.PHONY: jprt_bundle bundles bundles-only final-images final-images-only
--- a/make/Main.gmk	Fri Dec 13 09:35:35 2013 -0800
+++ b/make/Main.gmk	Wed Jul 05 19:26:45 2017 +0200
@@ -242,4 +242,6 @@
 .PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-nashorn clean-images clean-docs clean-test clean-overlay-images clean-bootcycle-build
 .PHONY: profiles profiles-only profiles-oscheck
 
+include $(root_dir)/make/Jprt.gmk
+
 FRC: # Force target
--- a/make/MakeHelpers.gmk	Fri Dec 13 09:35:35 2013 -0800
+++ b/make/MakeHelpers.gmk	Wed Jul 05 19:26:45 2017 +0200
@@ -50,7 +50,7 @@
 
 # Global targets are possible to run either with or without a SPEC. The prototypical
 # global target is "help".
-global_targets=help jprt% bridgeBuild bridge2configure
+global_targets=help
 
 ##############################
 # Functions
--- a/make/jprt.properties	Fri Dec 13 09:35:35 2013 -0800
+++ b/make/jprt.properties	Wed Jul 05 19:26:45 2017 +0200
@@ -26,7 +26,7 @@
 # Properties for jprt
 
 # Locked down to jdk8
-jprt.tools.default.release=jdk8
+jprt.tools.default.release=jdk9
 
 # Unix toolkit to use for building on windows
 jprt.windows.jdk8.build.unix.toolkit=cygwin
@@ -151,3 +151,23 @@
 # Directories to be excluded from the source bundles
 jprt.bundle.exclude.src.dirs=build dist webrev
 
+# Instruct jprt to use configure when building
+jprt.build.use.configure=true
+jprt.build.flavor.product.target=jprt_bundle
+jprt.build.flavor.fastdebug.target=jprt_bundle
+jprt.build.flavor.debug.target=jprt_bundle
+
+# Add these configure args to all builds
+jprt.build.configure.args= \
+    --with-boot-jdk=$ALT_BOOTDIR \
+    --with-jobs=$ALT_PARALLEL_COMPILE_JOBS
+
+# Add these configure args to 32 bit builds
+jprt.i586.build.configure.args= \
+    --with-target-bits=32 \
+    --with-jvm-variants=client,server
+
+# Use these configure args to define debug level.
+jprt.product.build.configure.args=--with-debug-level=release
+jprt.fastdebug.build.configure.args=--with-debug-level=fastdebug
+jprt.debug.build.configure.args=--with-debug-level=slowdebug
--- a/nashorn/.hgtags	Fri Dec 13 09:35:35 2013 -0800
+++ b/nashorn/.hgtags	Wed Jul 05 19:26:45 2017 +0200
@@ -230,3 +230,4 @@
 8d014b039b44c23fa520ce20c2c27f7aa91441e9 jdk8-b118
 c3343930c73c58a22c1d58719bb988aeb25a871f jdk8-b119
 55cbc2d00c93f82513ce33819d41dc67e71aaefd jdk8-b120
+32631eed0fad2b31346eb41b29a50227bd29e2ec jdk9-b00
--- a/nashorn/.jcheck/conf	Fri Dec 13 09:35:35 2013 -0800
+++ b/nashorn/.jcheck/conf	Wed Jul 05 19:26:45 2017 +0200
@@ -1,1 +1,1 @@
-project=jdk8
+project=jdk9