Merge jdk9-b01
authorduke
Wed, 05 Jul 2017 19:26:54 +0200
changeset 22173 f130ca87de66
parent 22172 7897c70becec (diff)
parent 22028 2c05c93cf5cc (current diff)
child 22174 8e60d3ed2968
child 22175 6b94deb0d9c9
child 22176 3dae78c445a6
child 22185 405de9b5ccee
child 22186 c97a9d47d257
child 22187 a0970a09d423
child 22203 d748cd0e8b1e
child 22208 fb1e20bd389f
child 22253 4f8a178f0d26
child 22254 8550495a4d78
child 22360 7b79ed24795a
child 22361 ac542ac9f21d
child 22365 895bfde469d4
child 22381 2b9e9a95f353
child 22406 5859ce0651ae
child 22414 796c8cc1bc35
child 22415 4e3bef0828af
child 22421 255768a1ad11
child 22422 d78560f1057f
child 22426 5c17942d8707
child 22437 1e02a089b961
child 22438 a41a8bfccea7
child 22864 f476f1ae4bd3
child 23476 78871f5c479b
Merge
--- a/.hgtags-top-repo	Wed Jul 05 19:26:09 2017 +0200
+++ b/.hgtags-top-repo	Wed Jul 05 19:26:54 2017 +0200
@@ -242,3 +242,4 @@
 0a6db1aac998cdc88e52f9adb97d40ca5b0f1da6 jdk8-b118
 9e90215673be68a3e77a9e444e4232076373734d jdk8-b119
 cd3825b2983045784d6fc6d1729c799b08215752 jdk8-b120
+1e1f86d5d4e22c15a9bf9f1581acddb8c59abae2 jdk9-b00
--- a/.jcheck/conf	Wed Jul 05 19:26:09 2017 +0200
+++ b/.jcheck/conf	Wed Jul 05 19:26:54 2017 +0200
@@ -1,1 +1,1 @@
-project=jdk8
+project=jdk9
--- a/Makefile	Wed Jul 05 19:26:09 2017 +0200
+++ b/Makefile	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/common/autoconf/generated-configure.sh	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/common/autoconf/toolchain.m4	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/common/autoconf/version-numbers	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/.hgtags	Wed Jul 05 19:26:54 2017 +0200
@@ -242,3 +242,4 @@
 d6820a414f182a011a53a29a52370c696cd58dab jdk8-b118
 379fc7609beb7a3d85ebc0cc21a8a51c60d3c7d3 jdk8-b119
 53fd772d28c8a9f0f43adfc06f75f6b3cfa93cb5 jdk8-b120
+a7d3638deb2f4e33217b1ecf889479e90f9e5b50 jdk9-b00
--- a/corba/.jcheck/conf	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/.jcheck/conf	Wed Jul 05 19:26:54 2017 +0200
@@ -1,1 +1,1 @@
-project=jdk8
+project=jdk9
--- a/corba/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/StubDelegateImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_de.properties	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_es.properties	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_fr.properties	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_it.properties	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ja.properties	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ko.properties	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_pt_BR.properties	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_sv.properties	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_CN.properties	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLNameTranslatorImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/InvocationHandlerFactoryImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/transport/DefaultSocketFactoryImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandlerImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/tools/corba/se/idl/idl_ja.prp	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/tools/corba/se/idl/idl_zh_CN.prp	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_ja.prp	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_zh_CN.prp	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/javax/rmi/CORBA/Stub.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/javax/rmi/CORBA/Util.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/javax/rmi/PortableRemoteObject.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/corba/src/share/classes/sun/rmi/rmic/iiop/CompoundType.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/hotspot/.hgtags	Wed Jul 05 19:26:54 2017 +0200
@@ -402,3 +402,4 @@
 ce42d815dd2130250acf6132b51b624001638f0d jdk8-b119
 05fedd51e40da22c9460bf17c7185889e435db3d hs25-b62
 fca262db9c4309f99d2f5542ab0780e45c2f1578 jdk8-b120
+ce2d7e46f3c7e41241f3b407705a4071323a11ab jdk9-b00
--- a/hotspot/.jcheck/conf	Wed Jul 05 19:26:09 2017 +0200
+++ b/hotspot/.jcheck/conf	Wed Jul 05 19:26:54 2017 +0200
@@ -1,1 +1,1 @@
-project=jdk8
+project=jdk9
--- a/jaxp/.hgtags	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/.hgtags	Wed Jul 05 19:26:54 2017 +0200
@@ -242,3 +242,4 @@
 e4e5069250e717defcb556e2f6be291460988c51 jdk8-b118
 69a930376c70beb9877970128bad0f04cb0c6eb1 jdk8-b119
 64d8b228a72cf9082b1a9a881c81188ccffde234 jdk8-b120
+4045edd35e8ba73bfdc23ce8961b9640d4145fe5 jdk9-b00
--- a/jaxp/.jcheck/conf	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/.jcheck/conf	Wed Jul 05 19:26:54 2017 +0200
@@ -1,1 +1,1 @@
-project=jdk8
+project=jdk9
--- a/jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/FeatureManager.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/FeaturePropertyBase.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/Constants.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/PropertyManager.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StAXValidatorHelper.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/util/SymbolTable.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/com/sun/xml/internal/stream/Entity.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/com/sun/xml/internal/stream/StaxXMLInputSource.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/com/sun/xml/internal/stream/XMLEntityStorage.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/com/sun/xml/internal/stream/writers/WriterUtility.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/javax/xml/XMLConstants.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/javax/xml/parsers/SAXParser.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/javax/xml/stream/XMLOutputFactory.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/javax/xml/validation/Validator.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/javax/xml/xpath/XPathException.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/javax/xml/xpath/XPathFactory.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/org/xml/sax/helpers/NewInstance.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/org/xml/sax/helpers/ParserAdapter.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/org/xml/sax/helpers/ParserFactory.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/org/xml/sax/helpers/SecuritySupport.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxp/src/org/xml/sax/helpers/XMLReaderFactory.java	Wed Jul 05 19:26:54 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/jaxws/.hgtags	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxws/.hgtags	Wed Jul 05 19:26:54 2017 +0200
@@ -242,3 +242,4 @@
 76a598cf50c4e1dc1fc8adc08b451943aa1a3179 jdk8-b118
 172b8e056ff259044ca48c5425d643dc8e2e05c8 jdk8-b119
 6c152deb600d8a11bc46149ace317b1c9fce1482 jdk8-b120
+32050ab53c8a8e4cb09f04b88db78258a480fb61 jdk9-b00
--- a/jaxws/.jcheck/conf	Wed Jul 05 19:26:09 2017 +0200
+++ b/jaxws/.jcheck/conf	Wed Jul 05 19:26:54 2017 +0200
@@ -1,1 +1,1 @@
-project=jdk8
+project=jdk9
--- a/jdk/.hgtags	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/.hgtags	Wed Jul 05 19:26:54 2017 +0200
@@ -242,3 +242,4 @@
 28ca338366ff2774ac9002f9f6eaff4101a3ea3b jdk8-b118
 e4499a6529e8c3e762ba86f45cdd774c92a8e7bc jdk8-b119
 d31cd980e1da31fa496a359caaf1a165aeb5791a jdk8-b120
+27b384262cba51dd0fe3e3534820189b46abc8cb jdk9-b00
--- a/jdk/.jcheck/conf	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/.jcheck/conf	Wed Jul 05 19:26:54 2017 +0200
@@ -1,1 +1,1 @@
-project=jdk8
+project=jdk9
--- a/jdk/make/CompileDemos.gmk	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/make/CompileDemos.gmk	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/make/CreateJars.gmk	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/make/Images.gmk	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/make/Tools.gmk	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/make/profile-rtjar-includes.txt	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ /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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/macosx/classes/apple/security/AppleProvider.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/com/sun/crypto/provider/SunJCE.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/PackerImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/PropMap.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/com/sun/naming/internal/ResourceManager.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ /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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/com/sun/security/sasl/Provider.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/Expr.jj	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParser.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParserConstants.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParserTokenManager.java	Wed Jul 05 19:26:54 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:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/LValue.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/ParseException.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/Token.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/com/sun/tools/jdi/ArrayTypeImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/com/sun/tools/jdi/ClassTypeImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/awt/Dialog.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/awt/MouseInfo.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/awt/Robot.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/awt/SystemTray.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/awt/TextComponent.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/awt/Toolkit.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/awt/Window.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/awt/event/InputEvent.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/lang/Enum.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/lang/Integer.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/lang/SecurityManager.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/lang/annotation/Annotation.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/lang/management/ManagementFactory.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/lang/reflect/AnnotatedElement.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/lang/reflect/Constructor.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/lang/reflect/Executable.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/lang/reflect/Method.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/math/BigInteger.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/net/Inet6Address.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/net/URL.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/net/URLConnection.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/net/URLPermission.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/net/URLStreamHandler.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/nio/channels/spi/SelectorProvider.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/nio/charset/spi/CharsetProvider.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/security/Provider.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/security/UnresolvedPermission.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/Duration.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/Instant.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/LocalDate.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/LocalDateTime.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/LocalTime.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/MonthDay.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/OffsetDateTime.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/OffsetTime.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/Period.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/Year.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/YearMonth.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/ZoneId.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/ZoneOffset.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/ZoneRegion.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/ZonedDateTime.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/chrono/AbstractChronology.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/chrono/ChronoPeriodImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTimeImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/chrono/HijrahChronology.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/chrono/HijrahDate.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/chrono/IsoChronology.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/chrono/JapaneseChronology.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/chrono/JapaneseDate.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/chrono/JapaneseEra.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/chrono/MinguoChronology.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/chrono/MinguoDate.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/chrono/ThaiBuddhistDate.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/temporal/ValueRange.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/temporal/WeekFields.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/zone/ZoneOffsetTransition.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/zone/ZoneOffsetTransitionRule.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/time/zone/ZoneRules.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/AbstractCollection.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/AbstractList.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/AbstractMap.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/AbstractSequentialList.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/AbstractSet.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/ArrayDeque.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/ArrayList.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/ArrayPrefixHelpers.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/Arrays.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/ArraysParallelSortHelpers.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/Calendar.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/Collections.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/Formatter.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/HashMap.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/HashSet.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/Hashtable.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/IdentityHashMap.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/LinkedHashMap.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/LinkedList.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/ListResourceBundle.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/Map.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/PriorityQueue.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/ResourceBundle.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/StringTokenizer.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/TreeMap.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/TreeSet.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/Vector.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/WeakHashMap.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentMap.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/jar/Attributes.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/jar/JarFile.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/jar/JarVerifier.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/jar/Manifest.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/jar/Pack200.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/logging/ConsoleHandler.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/logging/Handler.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/logging/LogManager.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/logging/LogRecord.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/logging/Logger.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/logging/MemoryHandler.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/logging/SocketHandler.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/logging/StreamHandler.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/logging/XMLFormatter.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/prefs/AbstractPreferences.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/prefs/XmlSupport.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/regex/Pattern.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/stream/Collectors.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/stream/DoublePipeline.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/stream/IntPipeline.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/java/util/stream/SortedOps.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/javax/xml/crypto/dsig/CanonicalizationMethod.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/javax/xml/crypto/dsig/DigestMethod.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/javax/xml/crypto/dsig/Reference.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/javax/xml/crypto/dsig/SignatureMethod.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/javax/xml/crypto/dsig/TransformService.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/javax/xml/crypto/dsig/XMLSignContext.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/javax/xml/crypto/dsig/XMLSignature.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/javax/xml/crypto/dsig/XMLValidateContext.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/XMLDSigRI.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/applet/AppletSecurity.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ /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:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/awt/SunToolkit.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/misc/Cache.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/misc/SoftCache.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/rmi/rmic/Main.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/rmi/rmic/resources/rmic.properties	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/ec/SunEC.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/jca/ProviderConfig.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/jgss/GSSNameImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/jgss/SunProvider.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCCacheConstants.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/provider/MD4.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/provider/PolicyFile.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/provider/Sun.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/provider/VerificationProvider.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/provider/certpath/ForwardBuilder.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/provider/certpath/RevocationChecker.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/provider/certpath/ldap/LDAPCertStore.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/rsa/SunRsaSign.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/smartcardio/SunPCSC.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/ssl/JsseJce.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/ssl/ProtocolVersion.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/ssl/SunJSSE.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/tools/policytool/PolicyTool.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/util/SecurityConstants.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/x509/CRLExtensions.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/x509/CertificateExtensions.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/security/x509/X509CertImpl.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/swing/SwingUtilities2.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/tools/jconsole/Messages.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/tools/jconsole/SummaryTab.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/tools/jconsole/ThreadTab.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/tools/jconsole/resources/messages.properties	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/tools/jconsole/resources/messages_ja.properties	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/tools/jconsole/resources/messages_zh_CN.properties	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/classes/sun/tools/jinfo/JInfo.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/share/native/java/nio/Bits.c	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/solaris/bin/java_md_solinux.c	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/solaris/native/java/util/FileSystemPreferences.c	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/windows/bin/java_md.c	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/ProblemList.txt	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/TEST.groups	Wed Jul 05 19:26:54 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:54 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:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ /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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/com/sun/security/sasl/digest/NoQuoteParams.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/lang/SecurityManager/NoAWT.java	Wed Jul 05 19:26:54 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:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ /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	Wed Jul 05 19:26:09 2017 +0200
+++ /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	Wed Jul 05 19:26:09 2017 +0200
+++ /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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadBlockedCount.java	Wed Jul 05 19:26:54 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:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/net/URLPermission/URLPermissionTest.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/nio/Buffer/Chars.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/nio/channels/AsynchronousChannelGroup/Basic.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/nio/channels/AsynchronousChannelGroup/GroupOfOne.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/nio/channels/AsynchronousChannelGroup/Restart.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/nio/channels/Selector/ByteServer.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/nio/channels/Selector/ReadAfterConnect.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/nio/channels/Selector/SelectAfterRead.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/nio/channels/Selector/SelectWrite.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/Main.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/rmi/reliability/juicer/ApplicationServer.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/rmi/testlibrary/ActivationLibrary.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/rmi/testlibrary/JavaVM.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/rmi/transport/readTimeout/ReadTimeoutTest.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/security/Provider/ProviderVersionCheck.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/time/tck/java/time/AbstractTCKTest.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/time/tck/java/time/TCKLocalDateTime.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateSerialization.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronologySerialization.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/time/tck/java/time/serial/TCKDurationSerialization.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/time/tck/java/time/serial/TCKInstantSerialization.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/time/tck/java/time/serial/TCKLocalDateSerialization.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/time/tck/java/time/serial/TCKLocalDateTimeSerialization.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/time/tck/java/time/serial/TCKLocalTimeSerialization.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/time/tck/java/time/serial/TCKMonthDaySerialization.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/time/tck/java/time/serial/TCKOffsetDateTimeSerialization.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/time/tck/java/time/serial/TCKOffsetTimeSerialization.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/time/tck/java/time/serial/TCKPeriodSerialization.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/time/tck/java/time/serial/TCKYearMonthSerialization.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/time/tck/java/time/serial/TCKYearSerialization.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/time/tck/java/time/serial/TCKZoneOffsetSerialization.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/time/tck/java/time/serial/TCKZonedDateTimeSerialization.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/time/tck/java/time/temporal/serial/TCKValueRangeSerialization.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/time/tck/java/time/temporal/serial/TCKWeekFieldsSerialization.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionRuleSerialization.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionSerialization.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneRulesSerialization.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/util/LinkedHashMap/Basic.java	Wed Jul 05 19:26:54 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:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/util/Map/Defaults.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/util/concurrent/atomic/AtomicUpdaters.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java	Wed Jul 05 19:26:54 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:54 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:54 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:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ /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	Wed Jul 05 19:26:09 2017 +0200
+++ /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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/util/logging/Logger/setResourceBundle/TestSetResourceBundle.java	Wed Jul 05 19:26:54 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:54 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:54 2017 +0200
@@ -0,0 +1,1 @@
+.level=FINEST
--- a/jdk/test/java/util/logging/TestLoggerBundleSync.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/util/logging/TestLoggerBundleSync.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ /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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/util/stream/TestDoubleSumAverage.java	Wed Jul 05 19:26:54 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:54 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:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/util/zip/ZipFile/FinalizeZipFile.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/java/util/zip/ZipFile/ReadLongZipFileName.java	Wed Jul 05 19:26:54 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:54 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:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/sun/nio/cs/MalformedSurrogates.java	Wed Jul 05 19:26:54 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:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ /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:54 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:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/sun/security/pkcs11/Provider/Login.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/DHKeyExchange/DHEKeySizing.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/EngineArgs/DebugReportsOneExtraByte.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/InputRecord/SSLSocketTimeoutNulls.java	Wed Jul 05 19:26:54 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:54 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:54 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:54 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:54 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:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/SSLSocketImplThrowsWrongExceptions.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ /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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/sun/security/ssl/templates/SSLSocketSSLEngineTemplate.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/tools/launcher/ChangeDataModel.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/jdk/test/tools/launcher/ExecutionEnvironment.java	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ /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	Wed Jul 05 19:26:09 2017 +0200
+++ /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/langtools/.hgtags	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/.hgtags	Wed Jul 05 19:26:54 2017 +0200
@@ -242,3 +242,4 @@
 4fd6a7ff8c068eceaaaf8bf12a394195203b99b3 jdk8-b118
 43a80d75d06ed22d6942f25f067587a3be3a129d jdk8-b119
 b3d7e86a06474fe5100a7b15a95eaa10d41509a6 jdk8-b120
+afe63d41c699e0e2ee910ef20c41b60603c852a1 jdk9-b00
--- a/langtools/.jcheck/conf	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/.jcheck/conf	Wed Jul 05 19:26:54 2017 +0200
@@ -1,1 +1,1 @@
-project=jdk8
+project=jdk9
--- a/langtools/src/share/classes/com/sun/source/doctree/AttributeTree.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/source/doctree/AttributeTree.java	Wed Jul 05 19:26:54 2017 +0200
@@ -36,7 +36,7 @@
 @jdk.Exported
 public interface AttributeTree extends DocTree {
     @jdk.Exported
-    enum ValueKind { EMPTY, UNQUOTED, SINGLE, DOUBLE };
+    enum ValueKind { EMPTY, UNQUOTED, SINGLE, DOUBLE }
 
     Name getName();
     ValueKind getValueKind();
--- a/langtools/src/share/classes/com/sun/source/doctree/DocTree.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/source/doctree/DocTree.java	Wed Jul 05 19:26:54 2017 +0200
@@ -236,7 +236,7 @@
         Kind(String tagName) {
             this.tagName = tagName;
         }
-    };
+    }
 
     /**
      * Gets the kind of this tree.
--- a/langtools/src/share/classes/com/sun/source/tree/LambdaExpressionTree.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/source/tree/LambdaExpressionTree.java	Wed Jul 05 19:26:54 2017 +0200
@@ -49,7 +49,7 @@
         /** enum constant for expression lambdas */
         EXPRESSION,
         /** enum constant for statement lambdas */
-        STATEMENT;
+        STATEMENT
     }
 
     List<? extends VariableTree> getParameters();
--- a/langtools/src/share/classes/com/sun/source/util/TaskEvent.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/source/util/TaskEvent.java	Wed Jul 05 19:26:54 2017 +0200
@@ -69,7 +69,7 @@
          * For events relating to an individual annotation processing round.
          **/
         ANNOTATION_PROCESSING_ROUND
-    };
+    }
 
     public TaskEvent(Kind kind) {
         this(kind, null, null, null);
--- a/langtools/src/share/classes/com/sun/source/util/Trees.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/source/util/Trees.java	Wed Jul 05 19:26:54 2017 +0200
@@ -82,8 +82,8 @@
             ClassLoader cl = arg.getClass().getClassLoader();
             Class<?> c = Class.forName("com.sun.tools.javac.api.JavacTrees", false, cl);
             argType = Class.forName(argType.getName(), false, cl);
-            Method m = c.getMethod("instance", new Class<?>[] { argType });
-            return (Trees) m.invoke(null, new Object[] { arg });
+            Method m = c.getMethod("instance", argType);
+            return (Trees) m.invoke(null, arg);
         } catch (Throwable e) {
             throw new AssertionError(e);
         }
--- a/langtools/src/share/classes/com/sun/tools/classfile/AccessFlags.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/classfile/AccessFlags.java	Wed Jul 05 19:26:54 2017 +0200
@@ -58,7 +58,7 @@
     public static final int ACC_ENUM          = 0x4000; // class, inner, field
     public static final int ACC_MANDATED      = 0x8000; // class, inner, field, method
 
-    public static enum Kind { Class, InnerClass, Field, Method};
+    public static enum Kind { Class, InnerClass, Field, Method}
 
     AccessFlags(ClassReader cr) throws IOException {
         this(cr.readUnsignedShort());
@@ -159,7 +159,7 @@
     }
 
     private static Set<String> getModifiers(int flags, int[] modifierFlags, Kind t) {
-        Set<String> s = new LinkedHashSet<String>();
+        Set<String> s = new LinkedHashSet<>();
         for (int m: modifierFlags) {
             if ((flags & m) != 0)
                 s.add(flagToModifier(m, t));
@@ -168,7 +168,7 @@
     }
 
     private Set<String> getFlags(int[] expectedFlags, Kind t) {
-        Set<String> s = new LinkedHashSet<String>();
+        Set<String> s = new LinkedHashSet<>();
         int f = flags;
         for (int e: expectedFlags) {
             if ((f & e) != 0) {
--- a/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java	Wed Jul 05 19:26:54 2017 +0200
@@ -90,7 +90,7 @@
                     try {
                         Class<?>[] constrArgTypes = {ClassReader.class, int.class, int.class};
                         Constructor<? extends Attribute> constr = attrClass.getDeclaredConstructor(constrArgTypes);
-                        return constr.newInstance(new Object[] { cr, name_index, data.length });
+                        return constr.newInstance(cr, name_index, data.length);
                     } catch (Throwable t) {
                         reasonForDefaultAttr = t.toString();
                         // fall through and use DefaultAttribute
@@ -107,7 +107,7 @@
         }
 
         protected void init() {
-            standardAttributes = new HashMap<String,Class<? extends Attribute>>();
+            standardAttributes = new HashMap<>();
             standardAttributes.put(AnnotationDefault, AnnotationDefault_attribute.class);
             standardAttributes.put(BootstrapMethods, BootstrapMethods_attribute.class);
             standardAttributes.put(CharacterRangeTable, CharacterRangeTable_attribute.class);
--- a/langtools/src/share/classes/com/sun/tools/classfile/Attributes.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/classfile/Attributes.java	Wed Jul 05 19:26:54 2017 +0200
@@ -38,8 +38,12 @@
  *  deletion without notice.</b>
  */
 public class Attributes implements Iterable<Attribute> {
+
+    public final Attribute[] attrs;
+    public final Map<String, Attribute> map;
+
     Attributes(ClassReader cr) throws IOException {
-        map = new HashMap<String,Attribute>();
+        map = new HashMap<>();
         int attrs_count = cr.readUnsignedShort();
         attrs = new Attribute[attrs_count];
         for (int i = 0; i < attrs_count; i++) {
@@ -55,9 +59,8 @@
 
     public Attributes(ConstantPool constant_pool, Attribute[] attrs) {
         this.attrs = attrs;
-        map = new HashMap<String,Attribute>();
-        for (int i = 0; i < attrs.length; i++) {
-            Attribute attr = attrs[i];
+        map = new HashMap<>();
+        for (Attribute attr : attrs) {
             try {
                 map.put(attr.getName(constant_pool), attr);
             } catch (ConstantPoolException e) {
@@ -101,7 +104,4 @@
             length += a.byteLength();
         return length;
     }
-
-    public final Attribute[] attrs;
-    public final Map<String, Attribute> map;
 }
--- a/langtools/src/share/classes/com/sun/tools/classfile/CharacterRangeTable_attribute.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/classfile/CharacterRangeTable_attribute.java	Wed Jul 05 19:26:54 2017 +0200
@@ -86,5 +86,5 @@
         public final int character_range_start;
         public final int character_range_end;
         public final int flags;
-    };
+    }
 }
--- a/langtools/src/share/classes/com/sun/tools/classfile/ClassWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/classfile/ClassWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -57,11 +57,8 @@
      * Write a ClassFile data structure to a file.
      */
     public void write(ClassFile classFile, File f) throws IOException {
-        FileOutputStream f_out = new FileOutputStream(f);
-        try {
+        try (FileOutputStream f_out = new FileOutputStream(f)) {
             write(classFile, f_out);
-        } finally {
-            f_out.close();
         }
     }
 
--- a/langtools/src/share/classes/com/sun/tools/classfile/Dependencies.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/classfile/Dependencies.java	Wed Jul 05 19:26:54 2017 +0200
@@ -245,7 +245,7 @@
             ClassFileReader classFinder, Set<String> rootClassNames,
             boolean transitiveClosure)
             throws ClassFileNotFoundException {
-        final Set<Dependency> results = new HashSet<Dependency>();
+        final Set<Dependency> results = new HashSet<>();
         Recorder r = new Recorder() {
             public void addDependency(Dependency d) {
                 results.add(d);
@@ -276,7 +276,7 @@
             ClassFileReader classFinder, Set<String> rootClassNames,
             boolean transitiveClosure, Recorder recorder)
             throws ClassFileNotFoundException {
-        Set<String> doneClasses = new HashSet<String>();
+        Set<String> doneClasses = new HashSet<>();
 
         getFinder();  // ensure initialized
         getFilter();  // ensure initialized
@@ -284,7 +284,7 @@
         // Work queue of names of classfiles to be searched.
         // Entries will be unique, and for classes that do not yet have
         // dependencies in the results map.
-        Deque<String> deque = new LinkedList<String>(rootClassNames);
+        Deque<String> deque = new LinkedList<>(rootClassNames);
 
         String className;
         while ((className = deque.poll()) != null) {
@@ -560,7 +560,7 @@
     }
 
     static abstract class BasicDependencyFinder implements Finder {
-        private Map<String,Location> locations = new HashMap<String,Location>();
+        private Map<String,Location> locations = new HashMap<>();
 
         Location getLocation(String className) {
             Location l = locations.get(className);
@@ -578,7 +578,7 @@
                 try {
                     constant_pool = classFile.constant_pool;
                     origin = getLocation(classFile.getName());
-                    deps = new HashSet<Dependency>();
+                    deps = new HashSet<>();
                 } catch (ConstantPoolException e) {
                     throw new ClassFileError(e);
                 }
--- a/langtools/src/share/classes/com/sun/tools/classfile/Instruction.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/classfile/Instruction.java	Wed Jul 05 19:26:54 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -25,6 +25,8 @@
 
 package com.sun.tools.classfile;
 
+import java.util.Locale;
+
 /**
  * See JVMS, chapter 6.
  *
@@ -91,7 +93,7 @@
         /** The length, in bytes, of this kind of instruction, or -1 is the
          *  length depends on the specific instruction. */
         public final int length;
-    };
+    }
 
     /** A utility visitor to help decode the operands of an instruction.
      *  @see Instruction#accept */
@@ -211,7 +213,7 @@
         if (opcode == null)
             return "bytecode " + getUnsignedByte(0);
         else
-            return opcode.toString().toLowerCase();
+            return opcode.toString().toLowerCase(Locale.US);
     }
 
     /** Get the length, in bytes, of this instruction, including the opcode
--- a/langtools/src/share/classes/com/sun/tools/classfile/Opcode.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/classfile/Opcode.java	Wed Jul 05 19:26:54 2017 +0200
@@ -468,5 +468,5 @@
         /** Standard opcodes. */
         STANDARD,
         /** Legacy support for PicoJava opcodes. */
-        PICOJAVA  };
+        PICOJAVA  }
 }
--- a/langtools/src/share/classes/com/sun/tools/classfile/ReferenceFinder.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/classfile/ReferenceFinder.java	Wed Jul 05 19:26:54 2017 +0200
@@ -94,7 +94,7 @@
      * @throws ConstantPoolException if an error of the constant pool
      */
     public boolean parse(ClassFile cf) throws ConstantPoolException {
-        List<Integer> cprefs = new ArrayList<Integer>();
+        List<Integer> cprefs = new ArrayList<>();
         int index = 1;
         for (ConstantPool.CPInfo cpInfo : cf.constant_pool.entries()) {
             if (cpInfo.accept(cpVisitor, cf.constant_pool)) {
@@ -108,7 +108,7 @@
         }
 
         for (Method m : cf.methods) {
-            Set<Integer> ids = new HashSet<Integer>();
+            Set<Integer> ids = new HashSet<>();
             Code_attribute c_attr = (Code_attribute) m.attributes.get(Attribute.Code);
             if (c_attr != null) {
                 for (Instruction instr : c_attr.getInstructions()) {
@@ -119,7 +119,7 @@
                 }
             }
             if (ids.size() > 0) {
-                List<CPRefInfo> refInfos = new ArrayList<CPRefInfo>(ids.size());
+                List<CPRefInfo> refInfos = new ArrayList<>(ids.size());
                 for (int id : ids) {
                     refInfos.add(CPRefInfo.class.cast(cf.constant_pool.get(id)));
                 }
--- a/langtools/src/share/classes/com/sun/tools/classfile/Signature.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/classfile/Signature.java	Wed Jul 05 19:26:54 2017 +0200
@@ -96,7 +96,7 @@
             while (sigp < sig.length() && sig.charAt(sigp) == '^') {
                 sigp++;
                 if (throwsTypes == null)
-                    throwsTypes = new ArrayList<Type>();
+                    throwsTypes = new ArrayList<>();
                 throwsTypes.add(parseTypeSignature());
             }
             return new MethodType(typeParamTypes, paramTypes, returnType, throwsTypes);
@@ -108,7 +108,7 @@
             List<Type> superinterfaces = null;
             while (sigp < sig.length()) {
                 if (superinterfaces == null)
-                    superinterfaces = new ArrayList<Type>();
+                    superinterfaces = new ArrayList<>();
                 superinterfaces.add(parseTypeSignature());
             }
             return new ClassSigType(typeParamTypes, superclass, superinterfaces);
@@ -183,7 +183,7 @@
 
     private List<Type> parseTypeSignatures(char term) {
         sigp++;
-        List<Type> types = new ArrayList<Type>();
+        List<Type> types = new ArrayList<>();
         while (sig.charAt(sigp) != term)
             types.add(parseTypeSignature());
         sigp++;
@@ -229,7 +229,7 @@
     private List<TypeParamType> parseTypeParamTypes() {
         assert sig.charAt(sigp) == '<';
         sigp++;
-        List<TypeParamType> types = new ArrayList<TypeParamType>();
+        List<TypeParamType> types = new ArrayList<>();
         while (sig.charAt(sigp) != '>')
             types.add(parseTypeParamType());
         sigp++;
@@ -247,7 +247,7 @@
         while (sig.charAt(sigp) == ':') {
             sigp++;
             if (interfaceBounds == null)
-                interfaceBounds = new ArrayList<Type>();
+                interfaceBounds = new ArrayList<>();
             interfaceBounds.add(parseTypeSignature());
         }
         return new TypeParamType(name, classBound, interfaceBounds);
--- a/langtools/src/share/classes/com/sun/tools/classfile/Type.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/classfile/Type.java	Wed Jul 05 19:26:54 2017 +0200
@@ -103,7 +103,7 @@
             return primitiveTypes.contains(name);
         }
         // where
-        private static final Set<String> primitiveTypes = new HashSet<String>(Arrays.asList(
+        private static final Set<String> primitiveTypes = new HashSet<>(Arrays.asList(
             "boolean", "byte", "char", "double", "float", "int", "long", "short", "void"));
 
         @Override
@@ -344,7 +344,8 @@
      *          {@code -}
      */
     public static class WildcardType extends Type {
-        public enum Kind { UNBOUNDED, EXTENDS, SUPER };
+        public enum Kind { UNBOUNDED, EXTENDS, SUPER }
+
         public WildcardType() {
             this(Kind.UNBOUNDED, null);
         }
--- a/langtools/src/share/classes/com/sun/tools/classfile/TypeAnnotation.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/classfile/TypeAnnotation.java	Wed Jul 05 19:26:54 2017 +0200
@@ -165,7 +165,7 @@
 
         { // Write type path
             int len = cr.readUnsignedByte();
-            List<Integer> loc = new ArrayList<Integer>(len);
+            List<Integer> loc = new ArrayList<>(len);
             for (int i = 0; i < len * TypePathEntry.bytesPerEntry; ++i)
                 loc.add(cr.readUnsignedByte());
             position.location = Position.getTypePathFromBinary(loc);
@@ -342,7 +342,7 @@
 
         // For generic/array types.
         // TODO: or should we use null? Noone will use this object.
-        public List<TypePathEntry> location = new ArrayList<TypePathEntry>(0);
+        public List<TypePathEntry> location = new ArrayList<>(0);
 
         // Tree position.
         public int pos = -1;
@@ -498,7 +498,7 @@
          * @param list The bytecode representation of the type path.
          */
         public static List<TypePathEntry> getTypePathFromBinary(List<Integer> list) {
-            List<TypePathEntry> loc = new ArrayList<TypePathEntry>(list.size() / TypePathEntry.bytesPerEntry);
+            List<TypePathEntry> loc = new ArrayList<>(list.size() / TypePathEntry.bytesPerEntry);
             int idx = 0;
             while (idx < list.size()) {
                 if (idx + 1 == list.size()) {
@@ -511,7 +511,7 @@
         }
 
         public static List<Integer> getBinaryFromTypePath(List<TypePathEntry> locs) {
-            List<Integer> loc = new ArrayList<Integer>(locs.size() * TypePathEntry.bytesPerEntry);
+            List<Integer> loc = new ArrayList<>(locs.size() * TypePathEntry.bytesPerEntry);
             for (TypePathEntry tpe : locs) {
                 loc.add(tpe.tag.tag);
                 loc.add(tpe.arg);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -268,13 +268,13 @@
 
     protected ClassDoc implementsMethodInIntfac(MethodDoc method,
                                                 ClassDoc[] intfacs) {
-        for (int i = 0; i < intfacs.length; i++) {
-            MethodDoc[] methods = intfacs[i].methods();
+        for (ClassDoc intf : intfacs) {
+            MethodDoc[] methods = intf.methods();
             if (methods.length > 0) {
-                for (int j = 0; j < methods.length; j++) {
-                    if (methods[j].name().equals(method.name()) &&
-                          methods[j].signature().equals(method.signature())) {
-                        return intfacs[i];
+                for (MethodDoc md : methods) {
+                    if (md.name().equals(method.name()) &&
+                        md.signature().equals(method.signature())) {
+                        return intf;
                     }
                 }
             }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -101,14 +101,13 @@
         // Display the list only if there are elements to be displayed.
         if (memberListSize > 0) {
             Content dl = new HtmlTree(HtmlTag.DL);
-            for (int i = 0; i < memberListSize; i++) {
-                Doc element = memberlist.get(i);
+            for (Doc element : memberlist) {
                 if (element instanceof MemberDoc) {
-                    addDescription((MemberDoc)element, dl);
+                    addDescription((MemberDoc) element, dl);
                 } else if (element instanceof ClassDoc) {
-                    addDescription((ClassDoc)element, dl);
+                    addDescription((ClassDoc) element, dl);
                 } else if (element instanceof PackageDoc) {
-                    addDescription((PackageDoc)element, dl);
+                    addDescription((PackageDoc) element, dl);
                 }
             }
             contentTree.addContent(dl);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -52,7 +52,7 @@
     protected final ConfigurationImpl configuration;
     protected final SubWriterHolderWriter writer;
     protected final ClassDoc classdoc;
-    protected Map<String,Integer> typeMap = new LinkedHashMap<String,Integer>();
+    protected Map<String,Integer> typeMap = new LinkedHashMap<>();
     protected Set<MethodTypes> methodTypes = EnumSet.noneOf(MethodTypes.class);
     private int methodTypesOr = 0;
     public final boolean nodepr;
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -87,14 +87,13 @@
         int size = list.size();
         if (size > 0) {
             Content ul = new HtmlTree(HtmlTag.UL);
-            for (int i = 0; i < size; i++) {
-                ClassDoc local = list.get(i);
+            for (ClassDoc local : list) {
                 HtmlTree li = new HtmlTree(HtmlTag.LI);
                 li.addAttr(HtmlAttr.TYPE, LI_CIRCLE);
                 addPartialInfo(local, li);
                 addExtendsImplements(parent, local, li);
                 addLevelInfo(local, classtree.subs(local, isEnum),
-                        isEnum, li);   // Recurse
+                             isEnum, li);   // Recurse
                 ul.addContent(li);
             }
             contentTree.addContent(ul);
@@ -135,10 +134,10 @@
         if (interfaces.length > (cd.isInterface()? 1 : 0)) {
             Arrays.sort(interfaces);
             int counter = 0;
-            for (int i = 0; i < interfaces.length; i++) {
-                if (parent != interfaces[i]) {
-                    if (! (interfaces[i].isPublic() ||
-                            Util.isLinkable(interfaces[i], configuration))) {
+            for (ClassDoc intf : interfaces) {
+                if (parent != intf) {
+                    if (!(intf.isPublic() ||
+                          Util.isLinkable(intf, configuration))) {
                         continue;
                     }
                     if (counter == 0) {
@@ -153,7 +152,7 @@
                         contentTree.addContent(", ");
                     }
                     addPreQualifiedClassLink(LinkInfoImpl.Kind.TREE,
-                            interfaces[i], contentTree);
+                                             intf, contentTree);
                     counter++;
                 }
             }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -150,9 +150,9 @@
      * @param content HtmlTree content to which the links will be added
      */
     protected void addContents(List<Doc> classlist, boolean wantFrames,
-            Content content) {
-        for (int i = 0; i < classlist.size(); i++) {
-            ClassDoc cd = (ClassDoc)classlist.get(i);
+                               Content content) {
+        for (Doc doc : classlist) {
+            ClassDoc cd = (ClassDoc) doc;
             if (!Util.isCoreClass(cd)) {
                 continue;
             }
@@ -160,7 +160,7 @@
             Content linkContent;
             if (wantFrames) {
                 linkContent = getLink(new LinkInfoImpl(configuration,
-                        LinkInfoImpl.Kind.ALL_CLASSES_FRAME, cd).label(label).target("classFrame"));
+                                                       LinkInfoImpl.Kind.ALL_CLASSES_FRAME, cd).label(label).target("classFrame"));
             } else {
                 linkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, cd).label(label));
             }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -103,9 +103,9 @@
         super(configuration, filename);
         this.classdoc = classdoc;
         if (mapper.classToPackageAnnotations.containsKey(classdoc.qualifiedName()))
-                pkgToPackageAnnotations = new TreeSet<PackageDoc>(mapper.classToPackageAnnotations.get(classdoc.qualifiedName()));
+                pkgToPackageAnnotations = new TreeSet<>(mapper.classToPackageAnnotations.get(classdoc.qualifiedName()));
         configuration.currentcd = classdoc;
-        this.pkgSet = new TreeSet<PackageDoc>();
+        this.pkgSet = new TreeSet<>();
         this.pkgToClassTypeParameter = pkgDivide(mapper.classToClassTypeParam);
         this.pkgToClassAnnotations = pkgDivide(mapper.classToClassAnnotations);
         this.pkgToMethodTypeParameter = pkgDivide(mapper.classToExecMemberDocTypeParam);
@@ -159,38 +159,34 @@
     public static void generate(ConfigurationImpl configuration,
                                 ClassTree classtree)  {
         ClassUseMapper mapper = new ClassUseMapper(configuration.root, classtree);
-        ClassDoc[] classes = configuration.root.classes();
-        for (int i = 0; i < classes.length; i++) {
+        for (ClassDoc aClass : configuration.root.classes()) {
             // If -nodeprecated option is set and the containing package is marked
             // as deprecated, do not generate the class-use page. We will still generate
             // the class-use page if the class is marked as deprecated but the containing
             // package is not since it could still be linked from that package-use page.
             if (!(configuration.nodeprecated &&
-                    Util.isDeprecated(classes[i].containingPackage())))
-                ClassUseWriter.generate(configuration, mapper, classes[i]);
+                  Util.isDeprecated(aClass.containingPackage())))
+                ClassUseWriter.generate(configuration, mapper, aClass);
         }
-        PackageDoc[] pkgs = configuration.packages;
-        for (int i = 0; i < pkgs.length; i++) {
+        for (PackageDoc pkg : configuration.packages) {
             // If -nodeprecated option is set and the package is marked
             // as deprecated, do not generate the package-use page.
-            if (!(configuration.nodeprecated && Util.isDeprecated(pkgs[i])))
-                PackageUseWriter.generate(configuration, mapper, pkgs[i]);
+            if (!(configuration.nodeprecated && Util.isDeprecated(pkg)))
+                PackageUseWriter.generate(configuration, mapper, pkg);
         }
     }
 
     private Map<String,List<ProgramElementDoc>> pkgDivide(Map<String,? extends List<? extends ProgramElementDoc>> classMap) {
-        Map<String,List<ProgramElementDoc>> map = new HashMap<String,List<ProgramElementDoc>>();
+        Map<String,List<ProgramElementDoc>> map = new HashMap<>();
         List<? extends ProgramElementDoc> list= classMap.get(classdoc.qualifiedName());
         if (list != null) {
             Collections.sort(list);
-            Iterator<? extends ProgramElementDoc> it = list.iterator();
-            while (it.hasNext()) {
-                ProgramElementDoc doc = it.next();
+            for (ProgramElementDoc doc : list) {
                 PackageDoc pkg = doc.containingPackage();
                 pkgSet.add(pkg);
                 List<ProgramElementDoc> inPkg = map.get(pkg.name());
                 if (inPkg == null) {
-                    inPkg = new ArrayList<ProgramElementDoc>();
+                    inPkg = new ArrayList<>();
                     map.put(pkg.name(), inPkg);
                 }
                 inPkg.add(doc);
@@ -336,13 +332,12 @@
     protected void addClassList(Content contentTree) throws IOException {
         HtmlTree ul = new HtmlTree(HtmlTag.UL);
         ul.addStyle(HtmlStyle.blockList);
-        for (Iterator<PackageDoc> it = pkgSet.iterator(); it.hasNext();) {
-            PackageDoc pkg = it.next();
+        for (PackageDoc pkg : pkgSet) {
             Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(pkg.name()));
             Content link = getResource("doclet.ClassUse_Uses.of.0.in.1",
-                    getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER,
-                    classdoc)),
-                    getPackageLink(pkg, Util.getPackageName(pkg)));
+                                       getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER,
+                                                                classdoc)),
+                                       getPackageLink(pkg, Util.getPackageName(pkg)));
             Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link);
             li.addContent(heading);
             addClassUse(pkg, li);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Wed Jul 05 19:26:54 2017 +0200
@@ -273,21 +273,20 @@
         Type[] implIntfacs = classDoc.interfaceTypes();
         if (implIntfacs != null && implIntfacs.length > 0) {
             int counter = 0;
-            for (int i = 0; i < implIntfacs.length; i++) {
-                ClassDoc classDoc = implIntfacs[i].asClassDoc();
-                if (! (classDoc.isPublic() ||
-                        Util.isLinkable(classDoc, configuration))) {
+            for (Type implType : implIntfacs) {
+                ClassDoc classDoc = implType.asClassDoc();
+                if (!(classDoc.isPublic() || Util.isLinkable(classDoc, configuration))) {
                     continue;
                 }
                 if (counter == 0) {
                     pre.addContent(DocletConstants.NL);
-                    pre.addContent(isInterface? "extends " : "implements ");
+                    pre.addContent(isInterface ? "extends " : "implements ");
                 } else {
                     pre.addContent(", ");
                 }
                 Content link = getLink(new LinkInfoImpl(configuration,
-                        LinkInfoImpl.Kind.CLASS_SIGNATURE_PARENT_NAME,
-                        implIntfacs[i]));
+                                                        LinkInfoImpl.Kind.CLASS_SIGNATURE_PARENT_NAME,
+                                                        implType));
                 pre.addContent(link);
                 counter++;
             }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java	Wed Jul 05 19:26:54 2017 +0200
@@ -37,6 +37,7 @@
 import com.sun.tools.doclint.DocLint;
 import com.sun.tools.javac.file.JavacFileManager;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.StringUtils;
 import com.sun.tools.javadoc.RootDocImpl;
 
 /**
@@ -177,7 +178,7 @@
     /**
      * Collected set of doclint options
      */
-    public Set<String> doclintOpts = new LinkedHashSet<String>();
+    public Set<String> doclintOpts = new LinkedHashSet<>();
 
     /**
      * Unique Resource Handler for this package.
@@ -237,7 +238,7 @@
     public void setSpecificDocletOptions(String[][] options) {
         for (int oi = 0; oi < options.length; ++oi) {
             String[] os = options[oi];
-            String opt = os[0].toLowerCase();
+            String opt = StringUtils.toLowerCase(os[0]);
             if (opt.equals("-footer")) {
                 footer = os[1];
             } else if (opt.equals("-header")) {
@@ -285,12 +286,12 @@
             }
         }
         if (root.specifiedClasses().length > 0) {
-            Map<String,PackageDoc> map = new HashMap<String,PackageDoc>();
+            Map<String,PackageDoc> map = new HashMap<>();
             PackageDoc pd;
             ClassDoc[] classes = root.classes();
-            for (int i = 0; i < classes.length; i++) {
-                pd = classes[i].containingPackage();
-                if(! map.containsKey(pd.name())) {
+            for (ClassDoc aClass : classes) {
+                pd = aClass.containingPackage();
+                if (!map.containsKey(pd.name())) {
                     map.put(pd.name(), pd);
                 }
             }
@@ -325,7 +326,7 @@
             return result;
         }
         // otherwise look for the options we have added
-        option = option.toLowerCase();
+        option = StringUtils.toLowerCase(option);
         if (option.equals("-nodeprecatedlist") ||
             option.equals("-noindex") ||
             option.equals("-notree") ||
@@ -389,7 +390,7 @@
         // otherwise look at our options
         for (int oi = 0; oi < options.length; ++oi) {
             String[] os = options[oi];
-            String opt = os[0].toLowerCase();
+            String opt = StringUtils.toLowerCase(os[0]);
             if (opt.equals("-helpfile")) {
                 if (nohelp == true) {
                     reporter.printError(getText("doclet.Option_conflict",
@@ -511,18 +512,17 @@
         if (!nodeprecated) {
             return classarr[0];
         }
-        for (int i = 0; i < classarr.length; i++) {
-            if (classarr[i].tags("deprecated").length == 0) {
-                return classarr[i];
+        for (ClassDoc cd : classarr) {
+            if (cd.tags("deprecated").length == 0) {
+                return cd;
             }
         }
         return null;
     }
 
     protected boolean checkForDeprecation(RootDoc root) {
-        ClassDoc[] classarr = root.classes();
-        for (int i = 0; i < classarr.length; i++) {
-            if (isGeneratedDoc(classarr[i])) {
+        for (ClassDoc cd : root.classes()) {
+            if (isGeneratedDoc(cd)) {
                 return true;
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java	Wed Jul 05 19:26:54 2017 +0200
@@ -61,10 +61,9 @@
         super(writer, classDoc);
         VisibleMemberMap visibleMemberMap = new VisibleMemberMap(classDoc,
             VisibleMemberMap.CONSTRUCTORS, configuration);
-        List<ProgramElementDoc> constructors = new ArrayList<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc));
-        for (int i = 0; i < constructors.size(); i++) {
-            if ((constructors.get(i)).isProtected() ||
-                (constructors.get(i)).isPrivate()) {
+        List<ProgramElementDoc> constructors = new ArrayList<>(visibleMemberMap.getMembersFor(classDoc));
+        for (ProgramElementDoc constructor : constructors) {
+            if (constructor.isProtected() || constructor.isPrivate()) {
                 setFoundNonPubConstructor(true);
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -34,6 +34,7 @@
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.taglets.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
+import com.sun.tools.javac.util.StringUtils;
 
 /**
  * Class for the Html Format Code Generation specific to JavaDoc.
@@ -138,17 +139,17 @@
         if (index < 0) {
             return htmlstr;
         }
-        String lowerHtml = htmlstr.toLowerCase();
+        String lowerHtml = StringUtils.toLowerCase(htmlstr);
+        final String docroot = "{@docroot}";
         // Return index of first occurrence of {@docroot}
         // Note: {@docRoot} is not case sensitive when passed in w/command line option
-        index = lowerHtml.indexOf("{@docroot}", index);
+        index = lowerHtml.indexOf(docroot, index);
         if (index < 0) {
             return htmlstr;
         }
         StringBuilder buf = new StringBuilder();
         int previndex = 0;
         while (true) {
-            final String docroot = "{@docroot}";
             // Search for lowercase version of {@docRoot}
             index = lowerHtml.indexOf(docroot, previndex);
             // If next {@docRoot} tag not found, append rest of htmlstr and exit loop
@@ -408,8 +409,8 @@
             head.addContent(meta);
         }
         if (metakeywords != null) {
-            for (int i=0; i < metakeywords.length; i++) {
-                Content meta = HtmlTree.META("keywords", metakeywords[i]);
+            for (String metakeyword : metakeywords) {
+                Content meta = HtmlTree.META("keywords", metakeyword);
                 head.addContent(meta);
             }
         }
@@ -1012,9 +1013,8 @@
     public Content getPackageLink(PackageDoc pkg, Content label) {
         boolean included = pkg != null && pkg.isIncluded();
         if (! included) {
-            PackageDoc[] packages = configuration.packages;
-            for (int i = 0; i < packages.length; i++) {
-                if (packages[i].equals(pkg)) {
+            for (PackageDoc p : configuration.packages) {
+                if (p.equals(pkg)) {
                     included = true;
                     break;
                 }
@@ -1363,7 +1363,7 @@
             return new ContentBuilder();
         }
 
-        String seetext = replaceDocRootDir(see.text());
+        String seetext = replaceDocRootDir(Util.normalizeNewlines(see.text()));
 
         //Check if @see is an href or "string"
         if (seetext.startsWith("<") || seetext.startsWith("\"")) {
@@ -1689,13 +1689,13 @@
         }
 
         //Redirect all relative links.
-        int end, begin = text.toLowerCase().indexOf("<a");
+        int end, begin = StringUtils.toLowerCase(text).indexOf("<a");
         if(begin >= 0){
             StringBuilder textBuff = new StringBuilder(text);
 
             while(begin >=0){
                 if (textBuff.length() > begin + 2 && ! Character.isWhitespace(textBuff.charAt(begin+2))) {
-                    begin = textBuff.toString().toLowerCase().indexOf("<a", begin + 1);
+                    begin = StringUtils.toLowerCase(textBuff.toString()).indexOf("<a", begin + 1);
                     continue;
                 }
 
@@ -1713,7 +1713,7 @@
                     //might be missing '>' character because the href has an inline tag.
                     break;
                 }
-                if (textBuff.substring(begin, end).indexOf("\"") != -1){
+                if (textBuff.substring(begin, end).contains("\"")){
                     begin = textBuff.indexOf("\"", begin) + 1;
                     end = textBuff.indexOf("\"", begin +1);
                     if (begin == 0 || end == -1){
@@ -1722,22 +1722,23 @@
                     }
                 }
                 String relativeLink = textBuff.substring(begin, end);
-                if (!(relativeLink.toLowerCase().startsWith("mailto:") ||
-                        relativeLink.toLowerCase().startsWith("http:") ||
-                        relativeLink.toLowerCase().startsWith("https:") ||
-                        relativeLink.toLowerCase().startsWith("file:"))) {
+                String relativeLinkLowerCase = StringUtils.toLowerCase(relativeLink);
+                if (!(relativeLinkLowerCase.startsWith("mailto:") ||
+                        relativeLinkLowerCase.startsWith("http:") ||
+                        relativeLinkLowerCase.startsWith("https:") ||
+                        relativeLinkLowerCase.startsWith("file:"))) {
                     relativeLink = "{@"+(new DocRootTaglet()).getName() + "}/"
                         + redirectPathFromRoot.resolve(relativeLink).getPath();
                     textBuff.replace(begin, end, relativeLink);
                 }
-                begin = textBuff.toString().toLowerCase().indexOf("<a", begin + 1);
+                begin = StringUtils.toLowerCase(textBuff.toString()).indexOf("<a", begin + 1);
             }
             return textBuff.toString();
         }
         return text;
     }
 
-    static final Set<String> blockTags = new HashSet<String>();
+    static final Set<String> blockTags = new HashSet<>();
     static {
         for (HtmlTag t: HtmlTag.values()) {
             if (t.blockType == HtmlTag.BlockType.BLOCK)
@@ -1771,7 +1772,7 @@
                     break main;
                 ch = text.charAt(currPos);
             }
-            if (ch == '>' && blockTags.contains(text.substring(tagPos, currPos).toLowerCase())) {
+            if (ch == '>' && blockTags.contains(StringUtils.toLowerCase(text.substring(tagPos, currPos)))) {
                 result.append(text, startPos, lessThanPos);
                 startPos = currPos + 1;
             }
@@ -1943,17 +1944,17 @@
      */
     public List<Content> getAnnotations(int indent, AnnotationDesc[] descList, boolean linkBreak,
             boolean isJava5DeclarationLocation) {
-        List<Content> results = new ArrayList<Content>();
+        List<Content> results = new ArrayList<>();
         ContentBuilder annotation;
-        for (int i = 0; i < descList.length; i++) {
-            AnnotationTypeDoc annotationDoc = descList[i].annotationType();
+        for (AnnotationDesc aDesc : descList) {
+            AnnotationTypeDoc annotationDoc = aDesc.annotationType();
             // If an annotation is not documented, do not add it to the list. If
             // the annotation is of a repeatable type, and if it is not documented
             // and also if its container annotation is not documented, do not add it
             // to the list. If an annotation of a repeatable type is not documented
             // but its container is documented, it will be added to the list.
-            if (! Util.isDocumentedAnnotation(annotationDoc) &&
-                    (!isAnnotationDocumented && !isContainerDocumented)) {
+            if (!Util.isDocumentedAnnotation(annotationDoc) &&
+                (!isAnnotationDocumented && !isContainerDocumented)) {
                 continue;
             }
             /* TODO: check logic here to correctly handle declaration
@@ -1964,13 +1965,13 @@
             annotation = new ContentBuilder();
             isAnnotationDocumented = false;
             LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
-                LinkInfoImpl.Kind.ANNOTATION, annotationDoc);
-            AnnotationDesc.ElementValuePair[] pairs = descList[i].elementValues();
+                                                     LinkInfoImpl.Kind.ANNOTATION, annotationDoc);
+            AnnotationDesc.ElementValuePair[] pairs = aDesc.elementValues();
             // If the annotation is synthesized, do not print the container.
-            if (descList[i].isSynthesized()) {
-                for (int j = 0; j < pairs.length; j++) {
-                    AnnotationValue annotationValue = pairs[j].value();
-                    List<AnnotationValue> annotationTypeValues = new ArrayList<AnnotationValue>();
+            if (aDesc.isSynthesized()) {
+                for (AnnotationDesc.ElementValuePair pair : pairs) {
+                    AnnotationValue annotationValue = pair.value();
+                    List<AnnotationValue> annotationTypeValues = new ArrayList<>();
                     if (annotationValue.value() instanceof AnnotationValue[]) {
                         AnnotationValue[] annotationArray =
                                 (AnnotationValue[]) annotationValue.value();
@@ -1993,7 +1994,7 @@
                 if (pairs.length == 1 && isAnnotationDocumented) {
                     AnnotationValue[] annotationArray =
                             (AnnotationValue[]) (pairs[0].value()).value();
-                    List<AnnotationValue> annotationTypeValues = new ArrayList<AnnotationValue>();
+                    List<AnnotationValue> annotationTypeValues = new ArrayList<>();
                     annotationTypeValues.addAll(Arrays.asList(annotationArray));
                     String sep = "";
                     for (AnnotationValue av : annotationTypeValues) {
@@ -2006,12 +2007,12 @@
                 // repeatable type annotation is not documented, print the container.
                 else {
                     addAnnotations(annotationDoc, linkInfo, annotation, pairs,
-                        indent, false);
+                                   indent, false);
                 }
             }
             else {
                 addAnnotations(annotationDoc, linkInfo, annotation, pairs,
-                        indent, linkBreak);
+                               indent, linkBreak);
             }
             annotation.addContent(linkBreak ? DocletConstants.NL : "");
             results.add(annotation);
@@ -2051,7 +2052,7 @@
                         pairs[j].element(), pairs[j].element().name(), false));
                 annotation.addContent("=");
                 AnnotationValue annotationValue = pairs[j].value();
-                List<AnnotationValue> annotationTypeValues = new ArrayList<AnnotationValue>();
+                List<AnnotationValue> annotationTypeValues = new ArrayList<>();
                 if (annotationValue.value() instanceof AnnotationValue[]) {
                     AnnotationValue[] annotationArray =
                             (AnnotationValue[]) annotationValue.value();
@@ -2083,8 +2084,8 @@
      */
     private boolean isAnnotationArray(AnnotationDesc.ElementValuePair[] pairs) {
         AnnotationValue annotationValue;
-        for (int j = 0; j < pairs.length; j++) {
-            annotationValue = pairs[j].value();
+        for (AnnotationDesc.ElementValuePair pair : pairs) {
+            annotationValue = pair.value();
             if (annotationValue.value() instanceof AnnotationValue[]) {
                 AnnotationValue[] annotationArray =
                         (AnnotationValue[]) annotationValue.value();
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java	Wed Jul 05 19:26:54 2017 +0200
@@ -31,6 +31,7 @@
 import com.sun.tools.doclets.formats.html.markup.*;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
+import com.sun.tools.javac.util.StringUtils;
 
 /**
  * Writes method documentation in HTML format.
@@ -338,7 +339,7 @@
             return "";
         }
 
-        String lc = tag.toLowerCase();
+        String lc = StringUtils.toLowerCase(tag);
         int begin = lc.indexOf("<code>");
         int end = lc.indexOf("</code>");
         if(begin == -1 || end == -1 || end <= begin){
@@ -359,8 +360,7 @@
         ImplementedMethods implementedMethodsFinder =
                 new ImplementedMethods(method, writer.configuration);
         MethodDoc[] implementedMethods = implementedMethodsFinder.build();
-        for (int i = 0; i < implementedMethods.length; i++) {
-            MethodDoc implementedMeth = implementedMethods[i];
+        for (MethodDoc implementedMeth : implementedMethods) {
             Type intfac = implementedMethodsFinder.getMethodHolder(implementedMeth);
             Content intfaclink = writer.getLink(new LinkInfoImpl(
                     writer.configuration, LinkInfoImpl.Kind.METHOD_SPECIFIED_BY, intfac));
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -76,7 +76,7 @@
         super(configuration, DocPath.forPackage(packageDoc).resolve(DocPaths.PACKAGE_FRAME));
         this.packageDoc = packageDoc;
         if (configuration.root.specifiedPackages().length == 0) {
-            documentedClasses = new HashSet<ClassDoc>(Arrays.asList(configuration.root.classes()));
+            documentedClasses = new HashSet<>(Arrays.asList(configuration.root.classes()));
         }
     }
 
@@ -167,25 +167,24 @@
             boolean printedHeader = false;
             HtmlTree ul = new HtmlTree(HtmlTag.UL);
             ul.setTitle(labelContent);
-            for (int i = 0; i < arr.length; i++) {
-                if (documentedClasses != null &&
-                        !documentedClasses.contains(arr[i])) {
+            for (ClassDoc classDoc : arr) {
+                if (documentedClasses != null && !documentedClasses.contains(classDoc)) {
                     continue;
                 }
-                if (!Util.isCoreClass(arr[i]) || !
-                        configuration.isGeneratedDoc(arr[i])) {
+                if (!Util.isCoreClass(classDoc) || !configuration.isGeneratedDoc(classDoc)) {
                     continue;
                 }
                 if (!printedHeader) {
                     Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
-                            true, labelContent);
+                                                       true, labelContent);
                     contentTree.addContent(heading);
                     printedHeader = true;
                 }
-                Content arr_i_name = new StringContent(arr[i].name());
-                if (arr[i].isInterface()) arr_i_name = HtmlTree.SPAN(HtmlStyle.interfaceName, arr_i_name);
+                Content arr_i_name = new StringContent(classDoc.name());
+                if (classDoc.isInterface())
+                    arr_i_name = HtmlTree.SPAN(HtmlStyle.interfaceName, arr_i_name);
                 Content link = getLink(new LinkInfoImpl(configuration,
-                        LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i]).label(arr_i_name).target("classFrame"));
+                                                        LinkInfoImpl.Kind.PACKAGE_FRAME, classDoc).label(arr_i_name).target("classFrame"));
                 Content li = HtmlTree.LI(link);
                 ul.addContent(li);
             }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -85,12 +85,12 @@
         Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
         HtmlTree ul = new HtmlTree(HtmlTag.UL);
         ul.setTitle(packagesLabel);
-        for(int i = 0; i < packages.length; i++) {
+        for (PackageDoc aPackage : packages) {
             // Do not list the package if -nodeprecated option is set and the
             // package is marked as deprecated.
-            if (packages[i] != null &&
-                    (!(configuration.nodeprecated && Util.isDeprecated(packages[i])))) {
-                ul.addContent(getPackage(packages[i]));
+            if (aPackage != null &&
+                (!(configuration.nodeprecated && Util.isDeprecated(aPackage)))) {
+                ul.addContent(getPackage(aPackage));
             }
         }
         div.addContent(ul);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -109,13 +109,12 @@
      * @param body the documentation tree to which the index will be added
      */
     protected void addIndex(Content body) {
-        for (int i = 0; i < groupList.size(); i++) {
-        String groupname = groupList.get(i);
-        List<PackageDoc> list = groupPackageMap.get(groupname);
+        for (String groupname : groupList) {
+            List<PackageDoc> list = groupPackageMap.get(groupname);
             if (list != null && list.size() > 0) {
                 addIndexContents(list.toArray(new PackageDoc[list.size()]),
-                        groupname, configuration.getText("doclet.Member_Table_Summary",
-                        groupname, configuration.getText("doclet.packages")), body);
+                                 groupname, configuration.getText("doclet.Member_Table_Summary",
+                                                                  groupname, configuration.getText("doclet.packages")), body);
             }
         }
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -47,7 +47,7 @@
 public class PackageUseWriter extends SubWriterHolderWriter {
 
     final PackageDoc pkgdoc;
-    final SortedMap<String,Set<ClassDoc>> usingPackageToUsedClasses = new TreeMap<String,Set<ClassDoc>>();
+    final SortedMap<String,Set<ClassDoc>> usingPackageToUsedClasses = new TreeMap<>();
 
     /**
      * Constructor.
@@ -65,18 +65,15 @@
         // by examining all classes in this package, find what packages
         // use these classes - produce a map between using package and
         // used classes.
-        ClassDoc[] content = pkgdoc.allClasses();
-        for (int i = 0; i < content.length; ++i) {
-            ClassDoc usedClass = content[i];
+        for (ClassDoc usedClass : pkgdoc.allClasses()) {
             Set<ClassDoc> usingClasses = mapper.classToClass.get(usedClass.qualifiedName());
             if (usingClasses != null) {
-                for (Iterator<ClassDoc> it = usingClasses.iterator(); it.hasNext(); ) {
-                    ClassDoc usingClass = it.next();
+                for (ClassDoc usingClass : usingClasses) {
                     PackageDoc usingPackage = usingClass.containingPackage();
                     Set<ClassDoc> usedClasses = usingPackageToUsedClasses
-                        .get(usingPackage.name());
+                            .get(usingPackage.name());
                     if (usedClasses == null) {
-                        usedClasses = new TreeSet<ClassDoc>();
+                        usedClasses = new TreeSet<>();
                         usingPackageToUsedClasses.put(Util.getPackageName(usingPackage),
                                                       usedClasses);
                     }
@@ -185,9 +182,7 @@
                     configuration.getText("doclet.Class"),
                     configuration.getText("doclet.Description"))
         };
-        Iterator<String> itp = usingPackageToUsedClasses.keySet().iterator();
-        while (itp.hasNext()) {
-            String packageName = itp.next();
+        for (String packageName : usingPackageToUsedClasses.keySet()) {
             PackageDoc usingPackage = configuration.root.packageNamed(packageName);
             HtmlTree li = new HtmlTree(HtmlTag.LI);
             li.addStyle(HtmlStyle.blockList);
@@ -195,12 +190,12 @@
                 li.addContent(getMarkerAnchor(usingPackage.name()));
             }
             String tableSummary = configuration.getText("doclet.Use_Table_Summary",
-                    configuration.getText("doclet.classes"));
+                                                        configuration.getText("doclet.classes"));
             Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, tableSummary,
-                    getTableCaption(configuration.getResource(
-                    "doclet.ClassUse_Classes.in.0.used.by.1",
-                    getPackageLink(pkgdoc, Util.getPackageName(pkgdoc)),
-                    getPackageLink(usingPackage, Util.getPackageName(usingPackage)))));
+                                           getTableCaption(configuration.getResource(
+                                                   "doclet.ClassUse_Classes.in.0.used.by.1",
+                                                   getPackageLink(pkgdoc, Util.getPackageName(pkgdoc)),
+                                                   getPackageLink(usingPackage, Util.getPackageName(usingPackage)))));
             table.addContent(getSummaryTableHeader(classTableHeader, "col"));
             Content tbody = new HtmlTree(HtmlTag.TBODY);
             Iterator<ClassDoc> itc =
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -159,24 +159,25 @@
             boolean printedHeader = false;
             HtmlTree ul = new HtmlTree(HtmlTag.UL);
             ul.setTitle(labelContent);
-            for (int i = 0; i < arr.length; i++) {
-                if (!isTypeInProfile(arr[i], profileValue)) {
+            for (ClassDoc classDoc : arr) {
+                if (!isTypeInProfile(classDoc, profileValue)) {
                     continue;
                 }
-                if (!Util.isCoreClass(arr[i]) || !
-                        configuration.isGeneratedDoc(arr[i])) {
+                if (!Util.isCoreClass(classDoc) || !
+                        configuration.isGeneratedDoc(classDoc)) {
                     continue;
                 }
                 if (!printedHeader) {
                     Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
-                            true, labelContent);
+                                                       true, labelContent);
                     contentTree.addContent(heading);
                     printedHeader = true;
                 }
-                Content arr_i_name = new StringContent(arr[i].name());
-                if (arr[i].isInterface()) arr_i_name = HtmlTree.SPAN(HtmlStyle.interfaceName, arr_i_name);
+                Content arr_i_name = new StringContent(classDoc.name());
+                if (classDoc.isInterface())
+                    arr_i_name = HtmlTree.SPAN(HtmlStyle.interfaceName, arr_i_name);
                 Content link = getLink(new LinkInfoImpl(configuration,
-                        LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i]).label(arr_i_name).target("classFrame"));
+                                                        LinkInfoImpl.Kind.PACKAGE_FRAME, classDoc).label(arr_i_name).target("classFrame"));
                 Content li = HtmlTree.LI(link);
                 ul.addContent(li);
             }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -93,9 +93,9 @@
         HtmlTree ul = new HtmlTree(HtmlTag.UL);
         ul.setTitle(packagesLabel);
         PackageDoc[] packages = configuration.profilePackages.get(profileName);
-        for (int i = 0; i < packages.length; i++) {
-            if ((!(configuration.nodeprecated && Util.isDeprecated(packages[i])))) {
-                ul.addContent(getPackage(packages[i], profileName));
+        for (PackageDoc packageDoc : packages) {
+            if ((!(configuration.nodeprecated && Util.isDeprecated(packageDoc)))) {
+                ul.addContent(getPackage(packageDoc, profileName));
             }
         }
         div.addContent(ul);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -95,21 +95,19 @@
         if (rootDoc == null || outputdir == null) {
             return;
         }
-        PackageDoc[] pds = rootDoc.specifiedPackages();
-        for (int i = 0; i < pds.length; i++) {
+        for (PackageDoc pd : rootDoc.specifiedPackages()) {
             // If -nodeprecated option is set and the package is marked as deprecated,
             // do not convert the package files to HTML.
-            if (!(configuration.nodeprecated && Util.isDeprecated(pds[i])))
-                convertPackage(pds[i], outputdir);
+            if (!(configuration.nodeprecated && Util.isDeprecated(pd)))
+                convertPackage(pd, outputdir);
         }
-        ClassDoc[] cds = rootDoc.specifiedClasses();
-        for (int i = 0; i < cds.length; i++) {
+        for (ClassDoc cd : rootDoc.specifiedClasses()) {
             // If -nodeprecated option is set and the class is marked as deprecated
             // or the containing package is deprecated, do not convert the
             // package files to HTML.
             if (!(configuration.nodeprecated &&
-                    (Util.isDeprecated(cds[i]) || Util.isDeprecated(cds[i].containingPackage()))))
-                convertClass(cds[i], outputdir);
+                  (Util.isDeprecated(cd) || Util.isDeprecated(cd.containingPackage()))))
+                convertClass(cd, outputdir);
         }
     }
 
@@ -123,14 +121,13 @@
         if (pd == null) {
             return;
         }
-        ClassDoc[] cds = pd.allClasses();
-        for (int i = 0; i < cds.length; i++) {
+        for (ClassDoc cd : pd.allClasses()) {
             // If -nodeprecated option is set and the class is marked as deprecated,
             // do not convert the package files to HTML. We do not check for
             // containing package deprecation since it is already check in
             // the calling method above.
-            if (!(configuration.nodeprecated && Util.isDeprecated(cds[i])))
-                convertClass(cds[i], outputdir);
+            if (!(configuration.nodeprecated && Util.isDeprecated(cd)))
+                convertClass(cd, outputdir);
         }
     }
 
@@ -161,7 +158,6 @@
                     return;
                 r = new FileReader(file);
             }
-            LineNumberReader reader = new LineNumberReader(r);
             int lineno = 1;
             String line;
             relativePath = DocPaths.SOURCE_OUTPUT
@@ -169,14 +165,12 @@
                     .invert();
             Content body = getHeader();
             Content pre = new HtmlTree(HtmlTag.PRE);
-            try {
+            try (LineNumberReader reader = new LineNumberReader(r)) {
                 while ((line = reader.readLine()) != null) {
                     addLineNo(pre, lineno);
                     addLine(pre, line, lineno);
                     lineno++;
                 }
-            } finally {
-                reader.close();
             }
             addBlankLines(pre);
             Content div = HtmlTree.DIV(HtmlStyle.sourceContainer, pre);
@@ -204,11 +198,8 @@
         Content htmlDocument = new HtmlDocument(htmlDocType, htmlTree);
         configuration.message.notice("doclet.Generating_0", path.getPath());
         DocFile df = DocFile.createFileForOutput(configuration, path);
-        Writer w = df.openWriter();
-        try {
+        try (Writer w = df.openWriter()) {
             htmlDocument.write(w, true);
-        } finally {
-            w.close();
         }
 
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -95,8 +95,8 @@
         Content table = HtmlTree.TABLE(HtmlStyle.memberSummary, 0, 3, 0,
                 mw.getTableSummary(), caption);
         table.addContent(getSummaryTableHeader(mw.getSummaryTableHeader(cd), "col"));
-        for (int i = 0; i < tableContents.size(); i++) {
-            table.addContent(tableContents.get(i));
+        for (Content tableContent : tableContents) {
+            table.addContent(tableContent);
         }
         return table;
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java	Wed Jul 05 19:26:54 2017 +0200
@@ -197,9 +197,9 @@
     public Content seeTagOutput(Doc holder, SeeTag[] seeTags) {
         ContentBuilder body = new ContentBuilder();
         if (seeTags.length > 0) {
-            for (int i = 0; i < seeTags.length; ++i) {
+            for (SeeTag seeTag : seeTags) {
                 appendSeparatorIfNotEmpty(body);
-                body.addContent(htmlWriter.seeTagToContent(seeTags[i]));
+                body.addContent(htmlWriter.seeTagToContent(seeTag));
             }
         }
         if (holder.isField() && ((FieldDoc)holder).constantValue() != null &&
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/ContentBuilder.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/ContentBuilder.java	Wed Jul 05 19:26:54 2017 +0200
@@ -90,6 +90,6 @@
 
     private void ensureMutableContents() {
         if (contents.isEmpty())
-            contents = new ArrayList<Content>();
+            contents = new ArrayList<>();
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlAttr.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlAttr.java	Wed Jul 05 19:26:54 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -25,6 +25,8 @@
 
 package com.sun.tools.doclets.formats.html.markup;
 
+import com.sun.tools.javac.util.StringUtils;
+
 /**
  * Enum representing HTML tag attributes.
  *
@@ -64,7 +66,7 @@
     private final String value;
 
     HtmlAttr() {
-        this.value = name().toLowerCase();
+        this.value = StringUtils.toLowerCase(name());
     }
 
     HtmlAttr(String name) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocument.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocument.java	Wed Jul 05 19:26:54 2017 +0200
@@ -54,7 +54,7 @@
      * @param htmlTree HTML tree of the document
      */
     public HtmlDocument(Content docType, Content docComment, Content htmlTree) {
-        docContent = new ArrayList<Content>();
+        docContent = new ArrayList<>();
         addContent(nullCheck(docType));
         addContent(nullCheck(docComment));
         addContent(nullCheck(htmlTree));
@@ -67,7 +67,7 @@
      * @param htmlTree HTML tree of the document
      */
     public HtmlDocument(Content docType, Content htmlTree) {
-        docContent = new ArrayList<Content>();
+        docContent = new ArrayList<>();
         addContent(nullCheck(docType));
         addContent(nullCheck(htmlTree));
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java	Wed Jul 05 19:26:54 2017 +0200
@@ -98,5 +98,5 @@
     typeNameLabel,
     typeNameLink,
     typeSummary,
-    useSummary;
+    useSummary
 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTag.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTag.java	Wed Jul 05 19:26:54 2017 +0200
@@ -25,7 +25,7 @@
 
 package com.sun.tools.doclets.formats.html.markup;
 
-import java.util.Locale;
+import com.sun.tools.javac.util.StringUtils;
 
 /**
  * Enum representing HTML tags.
@@ -99,7 +99,7 @@
     public static enum BlockType {
         BLOCK,
         INLINE,
-        OTHER;
+        OTHER
     }
 
     /**
@@ -107,7 +107,7 @@
      */
     public static enum EndTag {
         END,
-        NOEND;
+        NOEND
     }
 
     HtmlTag() {
@@ -117,7 +117,7 @@
     HtmlTag(BlockType blockType, EndTag endTag ) {
         this.blockType = blockType;
         this.endTag = endTag;
-        this.value = name().toLowerCase(Locale.US);
+        this.value = StringUtils.toLowerCase(name());
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java	Wed Jul 05 19:26:54 2017 +0200
@@ -79,7 +79,7 @@
      */
     public void addAttr(HtmlAttr attrName, String attrValue) {
         if (attrs.isEmpty())
-            attrs = new LinkedHashMap<HtmlAttr,String>(3);
+            attrs = new LinkedHashMap<>(3);
         attrs.put(nullCheck(attrName), escapeHtmlChars(attrValue));
     }
 
@@ -109,7 +109,7 @@
         }
         else if (tagContent == HtmlTree.EMPTY || tagContent.isValid()) {
             if (content.isEmpty())
-                content = new ArrayList<Content>();
+                content = new ArrayList<>();
             content.add(tagContent);
         }
     }
@@ -196,10 +196,8 @@
     }
 
     private static String encodeURL(String url) {
-        byte[] urlBytes = url.getBytes(Charset.forName("UTF-8"));
         StringBuilder sb = new StringBuilder();
-        for (int i = 0; i < urlBytes.length; i++) {
-            int c = urlBytes[i];
+        for (byte c : url.getBytes(Charset.forName("UTF-8"))) {
             if (NONENCODING_CHARS.get(c & 0xFF)) {
                 sb.append((char) c);
             } else {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/RawHtml.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/RawHtml.java	Wed Jul 05 19:26:54 2017 +0200
@@ -95,7 +95,7 @@
         return rawHtmlContent;
     }
 
-    private enum State { TEXT, ENTITY, TAG, STRING };
+    private enum State { TEXT, ENTITY, TAG, STRING }
 
     @Override
     public int charCount() {
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java	Wed Jul 05 19:26:54 2017 +0200
@@ -188,8 +188,8 @@
     protected void generateClassFiles(RootDoc root, ClassTree classtree) {
         generateClassFiles(classtree);
         PackageDoc[] packages = root.specifiedPackages();
-        for (int i = 0; i < packages.length; i++) {
-            generateClassFiles(packages[i].allClasses(), classtree);
+        for (PackageDoc pkg : packages) {
+            generateClassFiles(pkg.allClasses(), classtree);
         }
     }
 
@@ -200,10 +200,9 @@
      */
     private void generateClassFiles(ClassTree classtree) {
         String[] packageNames = configuration.classDocCatalog.packageNames();
-        for (int packageNameIndex = 0; packageNameIndex < packageNames.length;
-                packageNameIndex++) {
+        for (String packageName : packageNames) {
             generateClassFiles(configuration.classDocCatalog.allClasses(
-                packageNames[packageNameIndex]), classtree);
+                    packageName), classtree);
         }
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Wed Jul 05 19:26:54 2017 +0200
@@ -29,6 +29,7 @@
 import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import javax.tools.JavaFileManager;
 
 import com.sun.javadoc.*;
 import com.sun.tools.javac.sym.Profiles;
@@ -36,7 +37,7 @@
 import com.sun.tools.doclets.internal.toolkit.builders.BuilderFactory;
 import com.sun.tools.doclets.internal.toolkit.taglets.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
-import javax.tools.JavaFileManager;
+import com.sun.tools.javac.util.StringUtils;
 
 /**
  * Configure the output based on the options. Doclets should sub-class
@@ -306,8 +307,8 @@
         message =
             new MessageRetriever(this,
             "com.sun.tools.doclets.internal.toolkit.resources.doclets");
-        excludedDocFileDirs = new HashSet<String>();
-        excludedQualifiers = new HashSet<String>();
+        excludedDocFileDirs = new HashSet<>();
+        excludedQualifiers = new HashSet<>();
         setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
     }
 
@@ -337,39 +338,40 @@
      * Negative value means error occurred.
      */
     public int optionLength(String option) {
-        option = option.toLowerCase();
-        if (option.equals("-author") ||
-            option.equals("-docfilessubdirs") ||
-            option.equals("-javafx") ||
-            option.equals("-keywords") ||
-            option.equals("-linksource") ||
-            option.equals("-nocomment") ||
-            option.equals("-nodeprecated") ||
-            option.equals("-nosince") ||
-            option.equals("-notimestamp") ||
-            option.equals("-quiet") ||
-            option.equals("-xnodate") ||
-            option.equals("-version")) {
-            return 1;
-        } else if (option.equals("-d") ||
-                   option.equals("-docencoding") ||
-                   option.equals("-encoding") ||
-                   option.equals("-excludedocfilessubdir") ||
-                   option.equals("-link") ||
-                   option.equals("-sourcetab") ||
-                   option.equals("-noqualifier") ||
-                   option.equals("-output") ||
-                   option.equals("-sourcepath") ||
-                   option.equals("-tag") ||
-                   option.equals("-taglet") ||
-                   option.equals("-tagletpath") ||
-                   option.equals("-xprofilespath")) {
-            return 2;
-        } else if (option.equals("-group") ||
-                   option.equals("-linkoffline")) {
-            return 3;
-        } else {
-            return -1;  // indicate we don't know about it
+        option = StringUtils.toLowerCase(option);
+        switch (option) {
+            case "-author":
+            case "-docfilessubdirs":
+            case "-javafx":
+            case "-keywords":
+            case "-linksource":
+            case "-nocomment":
+            case "-nodeprecated":
+            case "-nosince":
+            case "-notimestamp":
+            case "-quiet":
+            case "-xnodate":
+            case "-version":
+                return 1;
+            case "-d":
+            case "-docencoding":
+            case "-encoding":
+            case "-excludedocfilessubdir":
+            case "-link":
+            case "-sourcetab":
+            case "-noqualifier":
+            case "-output":
+            case "-sourcepath":
+            case "-tag":
+            case "-taglet":
+            case "-tagletpath":
+            case "-xprofilespath":
+                return 2;
+            case "-group":
+            case "-linkoffline":
+                return 3;
+            default:
+                return -1;  // indicate we don't know about it
         }
     }
 
@@ -390,8 +392,7 @@
 
         // Group the packages to be documented by the lowest profile (if any)
         // in which each appears
-        Map<Profile, List<PackageDoc>> interimResults =
-                new EnumMap<Profile, List<PackageDoc>>(Profile.class);
+        Map<Profile, List<PackageDoc>> interimResults = new EnumMap<>(Profile.class);
         for (Profile p: Profile.values())
             interimResults.put(p, new ArrayList<PackageDoc>());
 
@@ -410,7 +411,7 @@
         }
 
         // Build the profilePackages structure used by the doclet
-        profilePackages = new HashMap<String,PackageDoc[]>();
+        profilePackages = new HashMap<>();
         List<PackageDoc> prev = Collections.<PackageDoc>emptyList();
         int size;
         for (Map.Entry<Profile,List<PackageDoc>> e: interimResults.entrySet()) {
@@ -432,12 +433,11 @@
     }
 
     private void initPackageArray() {
-        Set<PackageDoc> set = new HashSet<PackageDoc>(Arrays.asList(root.specifiedPackages()));
-        ClassDoc[] classes = root.specifiedClasses();
-        for (int i = 0; i < classes.length; i++) {
-            set.add(classes[i].containingPackage());
+        Set<PackageDoc> set = new HashSet<>(Arrays.asList(root.specifiedPackages()));
+        for (ClassDoc aClass : root.specifiedClasses()) {
+            set.add(aClass.containingPackage());
         }
-        ArrayList<PackageDoc> results = new ArrayList<PackageDoc>(set);
+        ArrayList<PackageDoc> results = new ArrayList<>(set);
         Collections.sort(results);
         packages = results.toArray(new PackageDoc[] {});
     }
@@ -448,13 +448,12 @@
      * @param options the two dimensional array of options.
      */
     public void setOptions(String[][] options) throws Fault {
-        LinkedHashSet<String[]> customTagStrs = new LinkedHashSet<String[]>();
+        LinkedHashSet<String[]> customTagStrs = new LinkedHashSet<>();
 
         // Some options, specifically -link and -linkoffline, require that
         // the output directory has already been created: so do that first.
-        for (int oi = 0; oi < options.length; ++oi) {
-            String[] os = options[oi];
-            String opt = os[0].toLowerCase();
+        for (String[] os : options) {
+            String opt = StringUtils.toLowerCase(os[0]);
             if (opt.equals("-d")) {
                 destDirName = addTrailingFileSep(os[1]);
                 docFileDestDirName = destDirName;
@@ -463,9 +462,8 @@
             }
         }
 
-        for (int oi = 0; oi < options.length; ++oi) {
-            String[] os = options[oi];
-            String opt = os[0].toLowerCase();
+        for (String[] os : options) {
+            String opt = StringUtils.toLowerCase(os[0]);
             if (opt.equals("-docfilessubdirs")) {
                 copydocfilesubdirs = true;
             } else if (opt.equals("-docencoding")) {
@@ -587,15 +585,13 @@
         tagletManager = tagletManager == null ?
             new TagletManager(nosince, showversion, showauthor, javafx, message) :
             tagletManager;
-        String[] args;
-        for (Iterator<String[]> it = customTagStrs.iterator(); it.hasNext(); ) {
-            args = it.next();
+        for (String[] args : customTagStrs) {
             if (args[0].equals("-taglet")) {
                 tagletManager.addCustomTag(args[1], getFileManager(), tagletpath);
                 continue;
             }
             String[] tokens = tokenize(args[1],
-                TagletManager.SIMPLE_TAGLET_OPT_SEPARATOR, 3);
+                                       TagletManager.SIMPLE_TAGLET_OPT_SEPARATOR, 3);
             if (tokens.length == 1) {
                 String tagName = args[1];
                 if (tagletManager.isKnownCustomTag(tagName)) {
@@ -632,7 +628,7 @@
      * @return an array of tokens.
      */
     private String[] tokenize(String s, char separator, int maxTokens) {
-        List<String> tokens = new ArrayList<String>();
+        List<String> tokens = new ArrayList<>();
         StringBuilder  token = new StringBuilder ();
         boolean prevIsEscapeChar = false;
         for (int i = 0; i < s.length(); i += Character.charCount(i)) {
@@ -708,7 +704,7 @@
         String encoding = "";
         for (int oi = 0; oi < options.length; oi++) {
             String[] os = options[oi];
-            String opt = os[0].toLowerCase();
+            String opt = StringUtils.toLowerCase(os[0]);
             if (opt.equals("-docencoding")) {
                 docencodingfound = true;
                 if (!checkOutputFileEncoding(os[1], reporter)) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeFieldBuilder.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeFieldBuilder.java	Wed Jul 05 19:26:54 2017 +0200
@@ -87,8 +87,7 @@
         this.writer = writer;
         this.visibleMemberMap = new VisibleMemberMap(classDoc, memberType,
             configuration);
-        this.members = new ArrayList<ProgramElementDoc>(
-            this.visibleMemberMap.getMembersFor(classDoc));
+        this.members = new ArrayList<>(this.visibleMemberMap.getMembersFor(classDoc));
         if (configuration.getMemberComparator() != null) {
             Collections.sort(this.members, configuration.getMemberComparator());
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java	Wed Jul 05 19:26:54 2017 +0200
@@ -87,8 +87,7 @@
         this.writer = writer;
         this.visibleMemberMap = new VisibleMemberMap(classDoc, memberType,
             configuration);
-        this.members = new ArrayList<ProgramElementDoc>(
-            this.visibleMemberMap.getMembersFor(classDoc));
+        this.members = new ArrayList<>(this.visibleMemberMap.getMembersFor(classDoc));
         if (configuration.getMemberComparator() != null) {
             Collections.sort(this.members, configuration.getMemberComparator());
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java	Wed Jul 05 19:26:54 2017 +0200
@@ -68,7 +68,7 @@
         this.configuration = configuration;
         this.writerFactory = configuration.getWriterFactory();
 
-        Set<String> containingPackagesSeen = new HashSet<String>();
+        Set<String> containingPackagesSeen = new HashSet<>();
         context = new AbstractBuilder.Context(configuration, containingPackagesSeen,
                 LayoutParser.getInstance(configuration));
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java	Wed Jul 05 19:26:54 2017 +0200
@@ -97,7 +97,7 @@
             ConstantsSummaryWriter writer) {
         super(context);
         this.writer = writer;
-        this.classDocsWithConstFields = new HashSet<ClassDoc>();
+        this.classDocsWithConstFields = new HashSet<>();
     }
 
     /**
@@ -151,13 +151,12 @@
      */
     public void buildContents(XMLNode node, Content contentTree) {
         Content contentListTree = writer.getContentsHeader();
-        PackageDoc[] packages = configuration.packages;
-        printedPackageHeaders = new HashSet<String>();
-        for (int i = 0; i < packages.length; i++) {
-            if (hasConstantField(packages[i]) && ! hasPrintedPackageIndex(packages[i].name())) {
-                writer.addLinkToPackageContent(packages[i],
-                    parsePackageName(packages[i].name()),
-                    printedPackageHeaders, contentListTree);
+        printedPackageHeaders = new HashSet<>();
+        for (PackageDoc pkg : configuration.packages) {
+            if (hasConstantField(pkg) && !hasPrintedPackageIndex(pkg.name())) {
+                writer.addLinkToPackageContent(pkg,
+                                               parsePackageName(pkg.name()),
+                                               printedPackageHeaders, contentListTree);
             }
         }
         contentTree.addContent(writer.getContentsList(contentListTree));
@@ -170,12 +169,11 @@
      * @param contentTree the tree to which the summaries will be added
      */
     public void buildConstantSummaries(XMLNode node, Content contentTree) {
-        PackageDoc[] packages = configuration.packages;
-        printedPackageHeaders = new HashSet<String>();
+        printedPackageHeaders = new HashSet<>();
         Content summariesTree = writer.getConstantSummaries();
-        for (int i = 0; i < packages.length; i++) {
-            if (hasConstantField(packages[i])) {
-                currentPackage = packages[i];
+        for (PackageDoc aPackage : configuration.packages) {
+            if (hasConstantField(aPackage)) {
+                currentPackage = aPackage;
                 //Build the documentation for the current package.
                 buildChildren(node, summariesTree);
             }
@@ -211,12 +209,12 @@
                 DocletConstants.DEFAULT_PACKAGE_NAME);
         Arrays.sort(classes);
         Content classConstantTree = writer.getClassConstantHeader();
-        for (int i = 0; i < classes.length; i++) {
-            if (! classDocsWithConstFields.contains(classes[i]) ||
-                ! classes[i].isIncluded()) {
+        for (ClassDoc doc : classes) {
+            if (!classDocsWithConstFields.contains(doc) ||
+                !doc.isIncluded()) {
                 continue;
             }
-            currentClass = classes[i];
+            currentClass = doc;
             //Build the documentation for the current class.
             buildChildren(node, classConstantTree);
         }
@@ -241,16 +239,13 @@
      * @return true if the given package has constant fields to document.
      */
     private boolean hasConstantField(PackageDoc pkg) {
-        ClassDoc[] classes;
-        if (pkg.name().length() > 0) {
-            classes = pkg.allClasses();
-        } else {
-            classes = configuration.classDocCatalog.allClasses(
-                DocletConstants.DEFAULT_PACKAGE_NAME);
-        }
+        ClassDoc[] classes
+                = (pkg.name().length() > 0)
+                  ? pkg.allClasses()
+                  : configuration.classDocCatalog.allClasses(DocletConstants.DEFAULT_PACKAGE_NAME);
         boolean found = false;
-        for (int j = 0; j < classes.length; j++){
-            if (classes[j].isIncluded() && hasConstantField(classes[j])) {
+        for (ClassDoc doc : classes) {
+            if (doc.isIncluded() && hasConstantField(doc)) {
                 found = true;
             }
         }
@@ -267,8 +262,8 @@
         VisibleMemberMap visibleMemberMapFields = new VisibleMemberMap(classDoc,
             VisibleMemberMap.FIELDS, configuration);
         List<?> fields = visibleMemberMapFields.getLeafClassMembers(configuration);
-        for (Iterator<?> iter = fields.iterator(); iter.hasNext(); ) {
-            FieldDoc field = (FieldDoc) iter.next();
+        for (Object f : fields) {
+            FieldDoc field = (FieldDoc) f;
             if (field.constantValueExpression() != null) {
                 classDocsWithConstFields.add(classDoc);
                 return true;
@@ -285,8 +280,8 @@
      */
     private boolean hasPrintedPackageIndex(String pkgname) {
         String[] list = printedPackageHeaders.toArray(new String[] {});
-        for (int i = 0; i < list.length; i++) {
-            if (pkgname.startsWith(list[i])) {
+        for (String packageHeader : list) {
+            if (pkgname.startsWith(packageHeader)) {
                 return true;
             }
         }
@@ -336,7 +331,7 @@
          *                          will be added
          */
         protected void buildMembersSummary(XMLNode node, Content classConstantTree) {
-            List<FieldDoc> members = new ArrayList<FieldDoc>(members());
+            List<FieldDoc> members = new ArrayList<>(members());
             if (members.size() > 0) {
                 Collections.sort(members);
                 writer.addConstantMembers(classdoc, members, classConstantTree);
@@ -357,7 +352,7 @@
             } else {
                 return null;
             }
-            List<FieldDoc> inclList = new LinkedList<FieldDoc>();
+            List<FieldDoc> inclList = new LinkedList<>();
             FieldDoc member;
             while(iter.hasNext()){
                 member = (FieldDoc)iter.next();
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java	Wed Jul 05 19:26:54 2017 +0200
@@ -94,11 +94,9 @@
                 classDoc,
                 VisibleMemberMap.CONSTRUCTORS,
                 configuration);
-        constructors =
-                new ArrayList<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc));
-        for (int i = 0; i < constructors.size(); i++) {
-            if (constructors.get(i).isProtected()
-                    || constructors.get(i).isPrivate()) {
+        constructors = new ArrayList<>(visibleMemberMap.getMembersFor(classDoc));
+        for (ProgramElementDoc constructor : constructors) {
+            if (constructor.isProtected() || constructor.isPrivate()) {
                 writer.setFoundNonPubConstructor(true);
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java	Wed Jul 05 19:26:54 2017 +0200
@@ -88,8 +88,7 @@
                 classDoc,
                 VisibleMemberMap.ENUM_CONSTANTS,
                 configuration);
-        enumConstants =
-                new ArrayList<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc));
+        enumConstants = new ArrayList<>(visibleMemberMap.getMembersFor(classDoc));
         if (configuration.getMemberComparator() != null) {
             Collections.sort(enumConstants, configuration.getMemberComparator());
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java	Wed Jul 05 19:26:54 2017 +0200
@@ -89,9 +89,7 @@
                 classDoc,
                 VisibleMemberMap.FIELDS,
                 configuration);
-        fields =
-                new ArrayList<ProgramElementDoc>(visibleMemberMap.getLeafClassMembers(
-                configuration));
+        fields = new ArrayList<>(visibleMemberMap.getLeafClassMembers(configuration));
         if (configuration.getMemberComparator() != null) {
             Collections.sort(fields, configuration.getMemberComparator());
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java	Wed Jul 05 19:26:54 2017 +0200
@@ -60,7 +60,7 @@
     private boolean isParsing;
 
     private LayoutParser(Configuration configuration) {
-        xmlElementsMap = new HashMap<String,XMLNode>();
+        xmlElementsMap = new HashMap<>();
         this.configuration = configuration;
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java	Wed Jul 05 19:26:54 2017 +0200
@@ -330,11 +330,11 @@
      */
     private void buildSummary(MemberSummaryWriter writer,
             VisibleMemberMap visibleMemberMap, LinkedList<Content> summaryTreeList) {
-        List<ProgramElementDoc> members = new ArrayList<ProgramElementDoc>(visibleMemberMap.getLeafClassMembers(
+        List<ProgramElementDoc> members = new ArrayList<>(visibleMemberMap.getLeafClassMembers(
                 configuration));
         if (members.size() > 0) {
             Collections.sort(members);
-            List<Content> tableContents = new LinkedList<Content>();
+            List<Content> tableContents = new LinkedList<>();
             for (int i = 0; i < members.size(); i++) {
                 ProgramElementDoc member = members.get(i);
                 final ProgramElementDoc propertyDoc =
@@ -384,13 +384,13 @@
                 commentTextBuilder.append(
                         MessageFormat.format(
                                 configuration.getText("doclet.PropertySetterWithName"),
-                                Util.propertyNameFromMethodName(member.name())));
+                                Util.propertyNameFromMethodName(configuration, member.name())));
             }
             if (isGetter) {
                 commentTextBuilder.append(
                         MessageFormat.format(
                                 configuration.getText("doclet.PropertyGetterWithName"),
-                                Util.propertyNameFromMethodName(member.name())));
+                                Util.propertyNameFromMethodName(configuration, member.name())));
             }
             if (propertyDoc.commentText() != null
                         && !propertyDoc.commentText().isEmpty()) {
@@ -400,7 +400,7 @@
         commentTextBuilder.append(propertyDoc.commentText());
 
         // copy certain tags
-        List<Tag> allTags = new LinkedList<Tag>();
+        List<Tag> allTags = new LinkedList<>();
         String[] tagNames = {"@defaultValue", "@since"};
         for (String tagName: tagNames) {
             Tag[] tags = propertyDoc.tags(tagName);
@@ -475,11 +475,9 @@
      */
     private void buildInheritedSummary(MemberSummaryWriter writer,
             VisibleMemberMap visibleMemberMap, LinkedList<Content> summaryTreeList) {
-        for (Iterator<ClassDoc> iter = visibleMemberMap.getVisibleClassesList().iterator();
-                iter.hasNext();) {
-            ClassDoc inhclass = iter.next();
-            if (! (inhclass.isPublic() ||
-                    Util.isLinkable(inhclass, configuration))) {
+        for (ClassDoc inhclass : visibleMemberMap.getVisibleClassesList()) {
+            if (!(inhclass.isPublic() ||
+                  Util.isLinkable(inhclass, configuration))) {
                 continue;
             }
             if (inhclass == classDoc) {
@@ -493,7 +491,7 @@
                 for (int j = 0; j < inhmembers.size(); ++j) {
                     writer.addInheritedMemberSummary(
                             inhclass.isPackagePrivate() &&
-                            ! Util.isLinkable(inhclass, configuration) ?
+                            !Util.isLinkable(inhclass, configuration) ?
                             classDoc : inhclass,
                             inhmembers.get(j),
                             j == 0,
@@ -516,15 +514,15 @@
     private void addSummary(MemberSummaryWriter writer,
             VisibleMemberMap visibleMemberMap, boolean showInheritedSummary,
             Content memberSummaryTree) {
-        LinkedList<Content> summaryTreeList = new LinkedList<Content>();
+        LinkedList<Content> summaryTreeList = new LinkedList<>();
         buildSummary(writer, visibleMemberMap, summaryTreeList);
         if (showInheritedSummary)
             buildInheritedSummary(writer, visibleMemberMap, summaryTreeList);
         if (!summaryTreeList.isEmpty()) {
             Content memberTree = writer.getMemberSummaryHeader(
                     classDoc, memberSummaryTree);
-            for (int i = 0; i < summaryTreeList.size(); i++) {
-                memberTree.addContent(summaryTreeList.get(i));
+            for (Content aSummaryTreeList : summaryTreeList) {
+                memberTree.addContent(aSummaryTreeList);
             }
             memberSummaryTree.addContent(writer.getMemberTree(memberTree));
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java	Wed Jul 05 19:26:54 2017 +0200
@@ -90,8 +90,7 @@
                 VisibleMemberMap.METHODS,
                 configuration);
         methods =
-                new ArrayList<ProgramElementDoc>(visibleMemberMap.getLeafClassMembers(
-                configuration));
+                new ArrayList<>(visibleMemberMap.getLeafClassMembers(configuration));
         if (configuration.getMemberComparator() != null) {
             Collections.sort(methods, configuration.getMemberComparator());
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java	Wed Jul 05 19:26:54 2017 +0200
@@ -166,8 +166,8 @@
      */
     public void buildPackageSummary(XMLNode node, Content summaryContentTree) {
         PackageDoc[] packages = configuration.profilePackages.get(profile.name);
-        for (int i = 0; i < packages.length; i++) {
-            this.pkg = packages[i];
+        for (PackageDoc aPackage : packages) {
+            this.pkg = aPackage;
             Content packageSummaryContentTree = profileWriter.getPackageSummaryHeader(this.pkg);
             buildChildren(node, packageSummaryContentTree);
             summaryContentTree.addContent(profileWriter.getPackageSummaryTree(
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PropertyBuilder.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PropertyBuilder.java	Wed Jul 05 19:26:54 2017 +0200
@@ -90,7 +90,7 @@
                 VisibleMemberMap.PROPERTIES,
                 configuration);
         properties =
-                new ArrayList<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc));
+                new ArrayList<>(visibleMemberMap.getMembersFor(classDoc));
         if (configuration.getMemberComparator() != null) {
             Collections.sort(properties, configuration.getMemberComparator());
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java	Wed Jul 05 19:26:54 2017 +0200
@@ -31,6 +31,7 @@
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
+import com.sun.tools.javac.util.StringUtils;
 
 /**
  * Builds the serialized form.
@@ -161,9 +162,8 @@
      */
     public void buildSerializedFormSummaries(XMLNode node, Content serializedTree) {
         Content serializedSummariesTree = writer.getSerializedSummariesHeader();
-        PackageDoc[] packages = configuration.packages;
-        for (int i = 0; i < packages.length; i++) {
-            currentPackage = packages[i];
+        for (PackageDoc pkg : configuration.packages) {
+            currentPackage = pkg;
             buildChildren(node, serializedSummariesTree);
         }
         serializedTree.addContent(writer.getSerializedContent(
@@ -214,12 +214,12 @@
         Content classSerializedTree = writer.getClassSerializedHeader();
         ClassDoc[] classes = currentPackage.allClasses(false);
         Arrays.sort(classes);
-        for (int j = 0; j < classes.length; j++) {
-            currentClass = classes[j];
+        for (ClassDoc classDoc : classes) {
+            currentClass = classDoc;
             fieldWriter = writer.getSerialFieldWriter(currentClass);
             methodWriter = writer.getSerialMethodWriter(currentClass);
-            if(currentClass.isClass() && currentClass.isSerializable()) {
-                if(!serialClassInclude(currentClass)) {
+            if (currentClass.isClass() && currentClass.isSerializable()) {
+                if (!serialClassInclude(currentClass)) {
                     continue;
                 }
                 Content classTree = writer.getClassHeader(currentClass);
@@ -238,12 +238,11 @@
      */
     public void buildSerialUIDInfo(XMLNode node, Content classTree) {
         Content serialUidTree = writer.getSerialUIDInfoHeader();
-        FieldDoc[] fields = currentClass.fields(false);
-        for (int i = 0; i < fields.length; i++) {
-            if (fields[i].name().equals("serialVersionUID") &&
-                fields[i].constantValueExpression() != null) {
+        for (FieldDoc field : currentClass.fields(false)) {
+            if (field.name().equals("serialVersionUID") &&
+                field.constantValueExpression() != null) {
                 writer.addSerialUIDInfo(SERIAL_VERSION_UID_HEADER,
-                        fields[i].constantValueExpression(), serialUidTree);
+                                        field.constantValueExpression(), serialUidTree);
                 break;
             }
         }
@@ -567,10 +566,10 @@
         }
         Tag[] serial = doc.tags("serial");
         if (serial.length > 0) {
-            String serialtext = serial[0].text().toLowerCase();
-            if (serialtext.indexOf("exclude") >= 0) {
+            String serialtext = StringUtils.toLowerCase(serial[0].text());
+            if (serialtext.contains("exclude")) {
                 return false;
-            } else if (serialtext.indexOf("include") >= 0) {
+            } else if (serialtext.contains("include")) {
                 return true;
             }
         }
@@ -584,8 +583,8 @@
      * @return true if any of the given classes have a @serialinclude tag.
      */
     private boolean serialClassFoundToDocument(ClassDoc[] classes) {
-        for (int i = 0; i < classes.length; i++) {
-            if (serialClassInclude(classes[i])) {
+        for (ClassDoc aClass : classes) {
+            if (serialClassInclude(aClass)) {
                 return true;
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/XMLNode.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/XMLNode.java	Wed Jul 05 19:26:54 2017 +0200
@@ -42,8 +42,8 @@
     XMLNode(XMLNode parent, String qname) {
         this.parent = parent;
         name = qname;
-        attrs = new HashMap<String,String>();
-        children = new ArrayList<XMLNode>();
+        attrs = new HashMap<>();
+        children = new ArrayList<>();
 
         if (parent != null)
             parent.children.add(this);
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java	Wed Jul 05 19:26:54 2017 +0200
@@ -63,7 +63,7 @@
         if (params == null) {
             return null;
         }
-        HashMap<String,String> result = new HashMap<String,String>();
+        HashMap<String,String> result = new HashMap<>();
         for (int i = 0; i < params.length; i++) {
             String name = params[i] instanceof Parameter ?
                 ((Parameter) params[i]).name() :
@@ -106,13 +106,13 @@
         Map<String, String> rankMap = getRankMap(input.isTypeVariableParamTag ?
             (Object[]) ((MethodDoc)input.element).typeParameters() :
             (Object[]) ((MethodDoc)input.element).parameters());
-        for (int i = 0; i < tags.length; i++) {
-            if (rankMap.containsKey(tags[i].parameterName()) &&
-                    rankMap.get(tags[i].parameterName()).equals((input.tagId))) {
+        for (ParamTag tag : tags) {
+            if (rankMap.containsKey(tag.parameterName()) &&
+                rankMap.get(tag.parameterName()).equals((input.tagId))) {
                 output.holder = input.element;
-                output.holderTag = tags[i];
+                output.holderTag = tag;
                 output.inlineTags = input.isFirstSentence ?
-                    tags[i].firstSentenceTags() : tags[i].inlineTags();
+                                    tag.firstSentenceTags() : tag.inlineTags();
                 return;
             }
         }
@@ -195,7 +195,7 @@
     private Content getTagletOutput(boolean isNonTypeParams, Doc holder,
             TagletWriter writer, Object[] formalParameters, ParamTag[] paramTags) {
         Content result = writer.getOutputInstance();
-        Set<String> alreadyDocumented = new HashSet<String>();
+        Set<String> alreadyDocumented = new HashSet<>();
         if (paramTags.length > 0) {
             result.addContent(
                 processParamTags(isNonTypeParams, paramTags,
@@ -269,27 +269,26 @@
             Set<String> alreadyDocumented) {
         Content result = writer.getOutputInstance();
         if (paramTags.length > 0) {
-            for (int i = 0; i < paramTags.length; ++i) {
-                ParamTag pt = paramTags[i];
+            for (ParamTag pt : paramTags) {
                 String paramName = isNonTypeParams ?
-                    pt.parameterName() : "<" + pt.parameterName() + ">";
-                if (! rankMap.containsKey(pt.parameterName())) {
+                                   pt.parameterName() : "<" + pt.parameterName() + ">";
+                if (!rankMap.containsKey(pt.parameterName())) {
                     writer.getMsgRetriever().warning(pt.position(),
-                        isNonTypeParams ?
-                            "doclet.Parameters_warn" :
-                            "doclet.Type_Parameters_warn",
-                        paramName);
+                                                     isNonTypeParams ?
+                                                     "doclet.Parameters_warn" :
+                                                     "doclet.Type_Parameters_warn",
+                                                     paramName);
                 }
                 String rank = rankMap.get(pt.parameterName());
                 if (rank != null && alreadyDocumented.contains(rank)) {
                     writer.getMsgRetriever().warning(pt.position(),
-                       isNonTypeParams ?
-                           "doclet.Parameters_dup_warn" :
-                           "doclet.Type_Parameters_dup_warn",
-                       paramName);
+                                                     isNonTypeParams ?
+                                                     "doclet.Parameters_dup_warn" :
+                                                     "doclet.Type_Parameters_dup_warn",
+                                                     paramName);
                 }
                 result.addContent(processParamTag(isNonTypeParams, writer, pt,
-                     pt.parameterName(), alreadyDocumented.size() == 0));
+                                                  pt.parameterName(), alreadyDocumented.size() == 0));
                 alreadyDocumented.add(rank);
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/SimpleTaglet.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/SimpleTaglet.java	Wed Jul 05 19:26:54 2017 +0200
@@ -28,6 +28,7 @@
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.internal.toolkit.Content;
 import com.sun.tools.doclets.internal.toolkit.util.DocFinder;
+import com.sun.tools.javac.util.StringUtils;
 
 /**
  * A simple single argument custom tag.
@@ -110,8 +111,8 @@
     public SimpleTaglet(String tagName, String header, String locations) {
         this.tagName = tagName;
         this.header = header;
-        locations = locations.toLowerCase();
-        if (locations.indexOf(ALL) != -1 && locations.indexOf(EXCLUDED) == -1) {
+        locations = StringUtils.toLowerCase(locations);
+        if (locations.contains(ALL) && !locations.contains(EXCLUDED)) {
             this.locations = PACKAGE + TYPE + FIELD + METHOD + CONSTRUCTOR + OVERVIEW;
         } else {
             this.locations = locations;
@@ -133,7 +134,7 @@
      * otherwise.
      */
     public boolean inConstructor() {
-        return locations.indexOf(CONSTRUCTOR) != -1 && locations.indexOf(EXCLUDED) == -1;
+        return locations.contains(CONSTRUCTOR) && !locations.contains(EXCLUDED);
     }
 
     /**
@@ -144,7 +145,7 @@
      * otherwise.
      */
     public boolean inField() {
-        return locations.indexOf(FIELD) != -1 && locations.indexOf(EXCLUDED) == -1;
+        return locations.contains(FIELD) && !locations.contains(EXCLUDED);
     }
 
     /**
@@ -155,7 +156,7 @@
      * otherwise.
      */
     public boolean inMethod() {
-        return locations.indexOf(METHOD) != -1 && locations.indexOf(EXCLUDED) == -1;
+        return locations.contains(METHOD) && !locations.contains(EXCLUDED);
     }
 
     /**
@@ -166,7 +167,7 @@
      * otherwise.
      */
     public boolean inOverview() {
-        return locations.indexOf(OVERVIEW) != -1 && locations.indexOf(EXCLUDED) == -1;
+        return locations.contains(OVERVIEW) && !locations.contains(EXCLUDED);
     }
 
     /**
@@ -177,7 +178,7 @@
      * otherwise.
      */
     public boolean inPackage() {
-        return locations.indexOf(PACKAGE) != -1 && locations.indexOf(EXCLUDED) == -1;
+        return locations.contains(PACKAGE) && !locations.contains(EXCLUDED);
     }
 
     /**
@@ -188,7 +189,7 @@
      * otherwise.
      */
     public boolean inType() {
-        return locations.indexOf(TYPE) != -1&& locations.indexOf(EXCLUDED) == -1;
+        return locations.contains(TYPE) && !locations.contains(EXCLUDED);
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java	Wed Jul 05 19:26:54 2017 +0200
@@ -35,6 +35,7 @@
 
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
+import com.sun.tools.javac.util.StringUtils;
 
 /**
  * Manages the<code>Taglet</code>s used by doclets.
@@ -172,12 +173,12 @@
     public TagletManager(boolean nosince, boolean showversion,
                          boolean showauthor, boolean javafx,
                          MessageRetriever message) {
-        overridenStandardTags = new HashSet<String>();
-        potentiallyConflictingTags = new HashSet<String>();
-        standardTags = new HashSet<String>();
-        standardTagsLowercase = new HashSet<String>();
-        unseenCustomTags = new HashSet<String>();
-        customTags = new LinkedHashMap<String,Taglet>();
+        overridenStandardTags = new HashSet<>();
+        potentiallyConflictingTags = new HashSet<>();
+        standardTags = new HashSet<>();
+        standardTagsLowercase = new HashSet<>();
+        unseenCustomTags = new HashSet<>();
+        customTags = new LinkedHashMap<>();
         this.nosince = nosince;
         this.showversion = showversion;
         this.showauthor = showauthor;
@@ -234,11 +235,11 @@
 
             customTagClass = tagClassLoader.loadClass(classname);
             Method meth = customTagClass.getMethod("register",
-                                                   new Class<?>[] {java.util.Map.class});
+                                                   Map.class);
             Object[] list = customTags.values().toArray();
             Taglet lastTag = (list != null && list.length > 0)
                 ? (Taglet) list[list.length-1] : null;
-            meth.invoke(null, new Object[] {customTags});
+            meth.invoke(null, customTags);
             list = customTags.values().toArray();
             Object newLastTag = (list != null&& list.length > 0)
                 ? list[list.length-1] : null;
@@ -275,7 +276,7 @@
      * @return the resulting array of directory and JAR file URLs
      */
     private URL[] pathToURLs(String path) {
-        Set<URL> urls = new LinkedHashSet<URL>();
+        Set<URL> urls = new LinkedHashSet<>();
         for (String s: path.split(File.pathSeparator)) {
             if (s.isEmpty()) continue;
             try {
@@ -304,7 +305,7 @@
             return;
         }
         Taglet tag = customTags.get(tagName);
-        locations = locations.toLowerCase();
+        locations = StringUtils.toLowerCase(locations);
         if (tag == null || header != null) {
             customTags.remove(tagName);
             customTags.put(tagName, new SimpleTaglet(tagName, header, locations));
@@ -369,37 +370,37 @@
             return;
         }
         Taglet taglet;
-        for (int i = 0; i < tags.length; i++) {
-            String name = tags[i].name();
+        for (Tag tag : tags) {
+            String name = tag.name();
             if (name.length() > 0 && name.charAt(0) == '@') {
                 name = name.substring(1, name.length());
             }
             if (! (standardTags.contains(name) || customTags.containsKey(name))) {
-                if (standardTagsLowercase.contains(name.toLowerCase())) {
-                    message.warning(tags[i].position(), "doclet.UnknownTagLowercase", tags[i].name());
+                if (standardTagsLowercase.contains(StringUtils.toLowerCase(name))) {
+                    message.warning(tag.position(), "doclet.UnknownTagLowercase", tag.name());
                     continue;
                 } else {
-                    message.warning(tags[i].position(), "doclet.UnknownTag", tags[i].name());
+                    message.warning(tag.position(), "doclet.UnknownTag", tag.name());
                     continue;
                 }
             }
             //Check if this tag is being used in the wrong location.
             if ((taglet = customTags.get(name)) != null) {
                 if (areInlineTags && ! taglet.isInlineTag()) {
-                    printTagMisuseWarn(taglet, tags[i], "inline");
+                    printTagMisuseWarn(taglet, tag, "inline");
                 }
                 if ((doc instanceof RootDoc) && ! taglet.inOverview()) {
-                    printTagMisuseWarn(taglet, tags[i], "overview");
+                    printTagMisuseWarn(taglet, tag, "overview");
                 } else if ((doc instanceof PackageDoc) && ! taglet.inPackage()) {
-                    printTagMisuseWarn(taglet, tags[i], "package");
+                    printTagMisuseWarn(taglet, tag, "package");
                 } else if ((doc instanceof ClassDoc) && ! taglet.inType()) {
-                    printTagMisuseWarn(taglet, tags[i], "class");
+                    printTagMisuseWarn(taglet, tag, "class");
                 } else if ((doc instanceof ConstructorDoc) && ! taglet.inConstructor()) {
-                    printTagMisuseWarn(taglet, tags[i], "constructor");
+                    printTagMisuseWarn(taglet, tag, "constructor");
                 } else if ((doc instanceof FieldDoc) && ! taglet.inField()) {
-                    printTagMisuseWarn(taglet, tags[i], "field");
+                    printTagMisuseWarn(taglet, tag, "field");
                 } else if ((doc instanceof MethodDoc) && ! taglet.inMethod()) {
-                    printTagMisuseWarn(taglet, tags[i], "method");
+                    printTagMisuseWarn(taglet, tag, "method");
                 }
             }
         }
@@ -413,7 +414,7 @@
      * @param holderType the type of documentation that the misused tag was found in.
      */
     private void printTagMisuseWarn(Taglet taglet, Tag tag, String holderType) {
-        Set<String> locationsSet = new LinkedHashSet<String>();
+        Set<String> locationsSet = new LinkedHashSet<>();
         if (taglet.inOverview()) {
             locationsSet.add("overview");
         }
@@ -581,14 +582,14 @@
      */
     private void initCustomTagletArrays() {
         Iterator<Taglet> it = customTags.values().iterator();
-        ArrayList<Taglet> pTags = new ArrayList<Taglet>(customTags.size());
-        ArrayList<Taglet> tTags = new ArrayList<Taglet>(customTags.size());
-        ArrayList<Taglet> fTags = new ArrayList<Taglet>(customTags.size());
-        ArrayList<Taglet> cTags = new ArrayList<Taglet>(customTags.size());
-        ArrayList<Taglet> mTags = new ArrayList<Taglet>(customTags.size());
-        ArrayList<Taglet> iTags = new ArrayList<Taglet>(customTags.size());
-        ArrayList<Taglet> oTags = new ArrayList<Taglet>(customTags.size());
-        ArrayList<Taglet> sTags = new ArrayList<Taglet>();
+        ArrayList<Taglet> pTags = new ArrayList<>(customTags.size());
+        ArrayList<Taglet> tTags = new ArrayList<>(customTags.size());
+        ArrayList<Taglet> fTags = new ArrayList<>(customTags.size());
+        ArrayList<Taglet> cTags = new ArrayList<>(customTags.size());
+        ArrayList<Taglet> mTags = new ArrayList<>(customTags.size());
+        ArrayList<Taglet> iTags = new ArrayList<>(customTags.size());
+        ArrayList<Taglet> oTags = new ArrayList<>(customTags.size());
+        ArrayList<Taglet> sTags = new ArrayList<>();
         Taglet current;
         while (it.hasNext()) {
             current = it.next();
@@ -706,9 +707,8 @@
      * Initialize lowercase version of standard Javadoc tags.
      */
     private void initStandardTagsLowercase() {
-        Iterator<String> it = standardTags.iterator();
-        while (it.hasNext()) {
-            standardTagsLowercase.add(it.next().toLowerCase());
+        for (String standardTag : standardTags) {
+            standardTagsLowercase.add(StringUtils.toLowerCase(standardTag));
         }
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -204,30 +204,30 @@
         tagletManager.checkTags(doc, doc.tags(), false);
         tagletManager.checkTags(doc, doc.inlineTags(), true);
         Content currentOutput = null;
-        for (int i = 0; i < taglets.length; i++) {
+        for (Taglet taglet : taglets) {
             currentOutput = null;
-            if (doc instanceof ClassDoc && taglets[i] instanceof ParamTaglet) {
+            if (doc instanceof ClassDoc && taglet instanceof ParamTaglet) {
                 //The type parameters are documented in a special section away
                 //from the tag info, so skip here.
                 continue;
             }
-            if (taglets[i] instanceof DeprecatedTaglet) {
+            if (taglet instanceof DeprecatedTaglet) {
                 //Deprecated information is documented "inline", not in tag info
                 //section.
                 continue;
             }
             try {
-                currentOutput = taglets[i].getTagletOutput(doc, writer);
+                currentOutput = taglet.getTagletOutput(doc, writer);
             } catch (IllegalArgumentException e) {
                 //The taglet does not take a member as an argument.  Let's try
                 //a single tag.
-                Tag[] tags = doc.tags(taglets[i].getName());
+                Tag[] tags = doc.tags(taglet.getName());
                 if (tags.length > 0) {
-                    currentOutput = taglets[i].getTagletOutput(tags[0], writer);
+                    currentOutput = taglet.getTagletOutput(tags[0], writer);
                 }
             }
             if (currentOutput != null) {
-                tagletManager.seenCustomTag(taglets[i].getName());
+                tagletManager.seenCustomTag(taglet.getName());
                 output.addContent(currentOutput);
             }
         }
@@ -246,15 +246,15 @@
             Tag holderTag, Tag inlineTag, TagletWriter tagletWriter) {
         Taglet[] definedTags = tagletManager.getInlineCustomTaglets();
         //This is a custom inline tag.
-        for (int j = 0; j < definedTags.length; j++) {
-            if (("@"+definedTags[j].getName()).equals(inlineTag.name())) {
+        for (Taglet definedTag : definedTags) {
+            if (("@" + definedTag.getName()).equals(inlineTag.name())) {
                 //Given a name of a seen custom tag, remove it from the
                 // set of unseen custom tags.
-                tagletManager.seenCustomTag(definedTags[j].getName());
-                Content output = definedTags[j].getTagletOutput(
-                    holderTag != null &&
-                        definedTags[j].getName().equals("inheritDoc") ?
-                            holderTag : inlineTag, tagletWriter);
+                tagletManager.seenCustomTag(definedTag.getName());
+                Content output = definedTag.getTagletOutput(
+                        holderTag != null &&
+                        definedTag.getName().equals("inheritDoc") ?
+                        holderTag : inlineTag, tagletWriter);
                 return output;
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ThrowsTaglet.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ThrowsTaglet.java	Wed Jul 05 19:26:54 2017 +0200
@@ -64,19 +64,18 @@
             exception = input.element.containingClass().findClass(input.tagId);
         }
 
-        ThrowsTag[] tags = ((MethodDoc)input.element).throwsTags();
-        for (int i = 0; i < tags.length; i++) {
-            if (input.tagId.equals(tags[i].exceptionName()) ||
-                (tags[i].exception() != null &&
-                    (input.tagId.equals(tags[i].exception().qualifiedName())))) {
+        for (ThrowsTag tag : ((MethodDoc)input.element).throwsTags()) {
+            if (input.tagId.equals(tag.exceptionName()) ||
+                (tag.exception() != null &&
+                 (input.tagId.equals(tag.exception().qualifiedName())))) {
                 output.holder = input.element;
-                output.holderTag = tags[i];
+                output.holderTag = tag;
                 output.inlineTags = input.isFirstSentence ?
-                    tags[i].firstSentenceTags() : tags[i].inlineTags();
-                output.tagList.add(tags[i]);
-            } else if (exception != null && tags[i].exception() != null &&
-                    tags[i].exception().subclassOf(exception)) {
-                output.tagList.add(tags[i]);
+                                    tag.firstSentenceTags() : tag.inlineTags();
+                output.tagList.add(tag);
+            } else if (exception != null && tag.exception() != null &&
+                     tag.exception().subclassOf(exception)) {
+                output.tagList.add(tag);
             }
         }
     }
@@ -89,17 +88,17 @@
             TagletWriter writer) {
         Content result = writer.getOutputInstance();
         //Add links to the exceptions declared but not documented.
-        for (int i = 0; i < declaredExceptionTypes.length; i++) {
-            if (declaredExceptionTypes[i].asClassDoc() != null &&
-                ! alreadyDocumented.contains(
-                        declaredExceptionTypes[i].asClassDoc().name()) &&
-                ! alreadyDocumented.contains(
-                    declaredExceptionTypes[i].asClassDoc().qualifiedName())) {
+        for (Type declaredExceptionType : declaredExceptionTypes) {
+            if (declaredExceptionType.asClassDoc() != null &&
+                !alreadyDocumented.contains(
+                        declaredExceptionType.asClassDoc().name()) &&
+                !alreadyDocumented.contains(
+                        declaredExceptionType.asClassDoc().qualifiedName())) {
                 if (alreadyDocumented.size() == 0) {
                     result.addContent(writer.getThrowsHeader());
                 }
-                result.addContent(writer.throwsTagOutput(declaredExceptionTypes[i]));
-                alreadyDocumented.add(declaredExceptionTypes[i].asClassDoc().name());
+                result.addContent(writer.throwsTagOutput(declaredExceptionType));
+                alreadyDocumented.add(declaredExceptionType.asClassDoc().name());
             }
         }
         return result;
@@ -114,15 +113,15 @@
             TagletWriter writer) {
         Content result = writer.getOutputInstance();
         if (holder instanceof MethodDoc) {
-            Set<Tag> declaredExceptionTags = new LinkedHashSet<Tag>();
-            for (int j = 0; j < declaredExceptionTypes.length; j++) {
+            Set<Tag> declaredExceptionTags = new LinkedHashSet<>();
+            for (Type declaredExceptionType : declaredExceptionTypes) {
                 DocFinder.Output inheritedDoc =
-                    DocFinder.search(new DocFinder.Input((MethodDoc) holder, this,
-                        declaredExceptionTypes[j].typeName()));
+                        DocFinder.search(new DocFinder.Input((MethodDoc) holder, this,
+                                                             declaredExceptionType.typeName()));
                 if (inheritedDoc.tagList.size() == 0) {
                     inheritedDoc = DocFinder.search(new DocFinder.Input(
-                        (MethodDoc) holder, this,
-                        declaredExceptionTypes[j].qualifiedTypeName()));
+                            (MethodDoc) holder, this,
+                            declaredExceptionType.qualifiedTypeName()));
                 }
                 declaredExceptionTags.addAll(inheritedDoc.tagList);
             }
@@ -140,7 +139,7 @@
         ExecutableMemberDoc execHolder = (ExecutableMemberDoc) holder;
         ThrowsTag[] tags = execHolder.throwsTags();
         Content result = writer.getOutputInstance();
-        HashSet<String> alreadyDocumented = new HashSet<String>();
+        HashSet<String> alreadyDocumented = new HashSet<>();
         if (tags.length > 0) {
             result.addContent(throwsTagsOutput(
                 execHolder.throwsTags(), writer, alreadyDocumented, true));
@@ -167,11 +166,10 @@
         TagletWriter writer, Set<String> alreadyDocumented, boolean allowDups) {
         Content result = writer.getOutputInstance();
         if (throwTags.length > 0) {
-            for (int i = 0; i < throwTags.length; ++i) {
-                ThrowsTag tt = throwTags[i];
+            for (ThrowsTag tt : throwTags) {
                 ClassDoc cd = tt.exception();
                 if ((!allowDups) && (alreadyDocumented.contains(tt.exceptionName()) ||
-                    (cd != null && alreadyDocumented.contains(cd.qualifiedName())))) {
+                                     (cd != null && alreadyDocumented.contains(cd.qualifiedName())))) {
                     continue;
                 }
                 if (alreadyDocumented.size() == 0) {
@@ -179,7 +177,7 @@
                 }
                 result.addContent(writer.throwsTagOutput(tt));
                 alreadyDocumented.add(cd != null ?
-                    cd.qualifiedName() : tt.exceptionName());
+                                      cd.qualifiedName() : tt.exceptionName());
             }
         }
         return result;
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ValueTaglet.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ValueTaglet.java	Wed Jul 05 19:26:54 2017 +0200
@@ -150,10 +150,9 @@
         if (cd == null) {
             return null;
         }
-        FieldDoc[] fields = cd.fields();
-        for (int i = 0; i < fields.length; i++) {
-            if (fields[i].name().equals(memberName)) {
-                return fields[i];
+        for (FieldDoc field : cd.fields()) {
+            if (field.name().equals(memberName)) {
+                return field;
             }
         }
         return null;
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java	Wed Jul 05 19:26:54 2017 +0200
@@ -100,8 +100,8 @@
      public ClassDocCatalog (ClassDoc[] classdocs, Configuration config) {
          init();
          this.configuration = config;
-         for (int i = 0; i < classdocs.length; i++) {
-             addClassDoc(classdocs[i]);
+         for (ClassDoc classdoc : classdocs) {
+             addClassDoc(classdoc);
          }
      }
 
@@ -114,14 +114,14 @@
      }
 
      private void init() {
-         allClasses = new HashMap<String,Set<ClassDoc>>();
-         ordinaryClasses = new HashMap<String,Set<ClassDoc>>();
-         exceptions = new HashMap<String,Set<ClassDoc>>();
-         enums = new HashMap<String,Set<ClassDoc>>();
-         annotationTypes = new HashMap<String,Set<ClassDoc>>();
-         errors = new HashMap<String,Set<ClassDoc>>();
-         interfaces = new HashMap<String,Set<ClassDoc>>();
-         packageSet = new HashSet<String>();
+         allClasses = new HashMap<>();
+         ordinaryClasses = new HashMap<>();
+         exceptions = new HashMap<>();
+         enums = new HashMap<>();
+         annotationTypes = new HashMap<>();
+         errors = new HashMap<>();
+         interfaces = new HashMap<>();
+         packageSet = new HashSet<>();
      }
 
      /**
@@ -166,7 +166,7 @@
           Set<ClassDoc> s = map.get(key);
           if (s == null) {
               packageSet.add(key);
-              s = new HashSet<ClassDoc>();
+              s = new HashSet<>();
           }
           s.add(classdoc);
           map.put(key, s);
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java	Wed Jul 05 19:26:54 2017 +0200
@@ -51,35 +51,35 @@
      * List of baseclasses. Contains only java.lang.Object. Can be used to get
      * the mapped listing of sub-classes.
      */
-    private List<ClassDoc> baseclasses = new ArrayList<ClassDoc>();
+    private List<ClassDoc> baseclasses = new ArrayList<>();
 
     /**
     * Mapping for each Class with their SubClasses
     */
-    private Map<ClassDoc,List<ClassDoc>> subclasses = new HashMap<ClassDoc,List<ClassDoc>>();
+    private Map<ClassDoc,List<ClassDoc>> subclasses = new HashMap<>();
 
     /**
      * List of base-interfaces. Contains list of all the interfaces who do not
      * have super-interfaces. Can be used to get the mapped listing of
      * sub-interfaces.
      */
-    private List<ClassDoc> baseinterfaces = new ArrayList<ClassDoc>();
+    private List<ClassDoc> baseinterfaces = new ArrayList<>();
 
     /**
     * Mapping for each Interface with their SubInterfaces
     */
-    private Map<ClassDoc,List<ClassDoc>> subinterfaces = new HashMap<ClassDoc,List<ClassDoc>>();
+    private Map<ClassDoc,List<ClassDoc>> subinterfaces = new HashMap<>();
 
-    private List<ClassDoc> baseEnums = new ArrayList<ClassDoc>();
-    private Map<ClassDoc,List<ClassDoc>> subEnums = new HashMap<ClassDoc,List<ClassDoc>>();
+    private List<ClassDoc> baseEnums = new ArrayList<>();
+    private Map<ClassDoc,List<ClassDoc>> subEnums = new HashMap<>();
 
-    private List<ClassDoc> baseAnnotationTypes = new ArrayList<ClassDoc>();
-    private Map<ClassDoc,List<ClassDoc>> subAnnotationTypes = new HashMap<ClassDoc,List<ClassDoc>>();
+    private List<ClassDoc> baseAnnotationTypes = new ArrayList<>();
+    private Map<ClassDoc,List<ClassDoc>> subAnnotationTypes = new HashMap<>();
 
     /**
     * Mapping for each Interface with classes who implement it.
     */
-    private Map<ClassDoc,List<ClassDoc>> implementingclasses = new HashMap<ClassDoc,List<ClassDoc>>();
+    private Map<ClassDoc,List<ClassDoc>> implementingclasses = new HashMap<>();
 
     /**
      * Constructor. Build the Tree using the Root of this Javadoc run.
@@ -123,43 +123,43 @@
      * @param configuration the current configuration of the doclet.
      */
     private void buildTree(ClassDoc[] classes, Configuration configuration) {
-        for (int i = 0; i < classes.length; i++) {
+        for (ClassDoc aClass : classes) {
             // In the tree page (e.g overview-tree.html) do not include
             // information of classes which are deprecated or are a part of a
             // deprecated package.
             if (configuration.nodeprecated &&
-                    (Util.isDeprecated(classes[i]) ||
-                    Util.isDeprecated(classes[i].containingPackage()))) {
+                    (Util.isDeprecated(aClass) ||
+                    Util.isDeprecated(aClass.containingPackage()))) {
                 continue;
             }
 
             if (configuration.javafx
-                    && classes[i].tags("treatAsPrivate").length > 0) {
+                    && aClass.tags("treatAsPrivate").length > 0) {
                 continue;
             }
 
-            if (classes[i].isEnum()) {
-                processType(classes[i], configuration, baseEnums, subEnums);
-            } else if (classes[i].isClass()) {
-                processType(classes[i], configuration, baseclasses, subclasses);
-            } else if (classes[i].isInterface()) {
-                processInterface(classes[i]);
-                List<ClassDoc> list = implementingclasses.get(classes[i]);
+            if (aClass.isEnum()) {
+                processType(aClass, configuration, baseEnums, subEnums);
+            } else if (aClass.isClass()) {
+                processType(aClass, configuration, baseclasses, subclasses);
+            } else if (aClass.isInterface()) {
+                processInterface(aClass);
+                List<ClassDoc> list = implementingclasses.get(aClass);
                 if (list != null) {
                     Collections.sort(list);
                 }
-            } else if (classes[i].isAnnotationType()) {
-                processType(classes[i], configuration, baseAnnotationTypes,
+            } else if (aClass.isAnnotationType()) {
+                processType(aClass, configuration, baseAnnotationTypes,
                     subAnnotationTypes);
             }
         }
 
         Collections.sort(baseinterfaces);
-        for (Iterator<List<ClassDoc>> it = subinterfaces.values().iterator(); it.hasNext(); ) {
-            Collections.sort(it.next());
+        for (List<ClassDoc> docs : subinterfaces.values()) {
+            Collections.sort(docs);
         }
-        for (Iterator<List<ClassDoc>> it = subclasses.values().iterator(); it.hasNext(); ) {
-            Collections.sort(it.next());
+        for (List<ClassDoc> docs : subclasses.values()) {
+            Collections.sort(docs);
         }
     }
 
@@ -190,8 +190,8 @@
             }
         }
         List<Type> intfacs = Util.getAllInterfaces(cd, configuration);
-        for (Iterator<Type> iter = intfacs.iterator(); iter.hasNext();) {
-            add(implementingclasses, iter.next().asClassDoc(), cd);
+        for (Type intfac : intfacs) {
+            add(implementingclasses, intfac.asClassDoc(), cd);
         }
     }
 
@@ -206,11 +206,11 @@
     private void processInterface(ClassDoc cd) {
         ClassDoc[] intfacs = cd.interfaces();
         if (intfacs.length > 0) {
-            for (int i = 0; i < intfacs.length; i++) {
-                if (!add(subinterfaces, intfacs[i], cd)) {
+            for (ClassDoc intfac : intfacs) {
+                if (!add(subinterfaces, intfac, cd)) {
                     return;
                 } else {
-                    processInterface(intfacs[i]);   // Recurse
+                    processInterface(intfac);   // Recurse
                 }
             }
         } else {
@@ -234,7 +234,7 @@
     private boolean add(Map<ClassDoc,List<ClassDoc>> map, ClassDoc superclass, ClassDoc cd) {
         List<ClassDoc> list = map.get(superclass);
         if (list == null) {
-            list = new ArrayList<ClassDoc>();
+            list = new ArrayList<>();
             map.put(superclass, list);
         }
         if (list.contains(cd)) {
@@ -256,7 +256,7 @@
     private List<ClassDoc> get(Map<ClassDoc,List<ClassDoc>> map, ClassDoc cd) {
         List<ClassDoc> list = map.get(cd);
         if (list == null) {
-            return new ArrayList<ClassDoc>();
+            return new ArrayList<>();
         }
         return list;
     }
@@ -341,8 +341,7 @@
         for (int i = 0; i < list.size(); i++) {
             cd = list.get(i);
             List<ClassDoc> tlist = subs(cd, isEnum);
-            for (int j = 0; j < tlist.size(); j++) {
-                ClassDoc tcd = tlist.get(j);
+            for (ClassDoc tcd : tlist) {
                 if (!list.contains(tcd)) {
                     list.add(tcd);
                 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java	Wed Jul 05 19:26:54 2017 +0200
@@ -48,182 +48,180 @@
      * Mapping of ClassDocs to set of PackageDoc used by that class.
      * Entries may be null.
      */
-    public Map<String,Set<PackageDoc>> classToPackage = new HashMap<String,Set<PackageDoc>>();
+    public Map<String,Set<PackageDoc>> classToPackage = new HashMap<>();
 
     /**
      * Mapping of Annotations to set of PackageDoc that use the annotation.
      */
-    public Map<String,List<PackageDoc>> classToPackageAnnotations = new HashMap<String,List<PackageDoc>>();
+    public Map<String,List<PackageDoc>> classToPackageAnnotations = new HashMap<>();
 
     /**
      * Mapping of ClassDocs to set of ClassDoc used by that class.
      * Entries may be null.
      */
-    public Map<String,Set<ClassDoc>> classToClass = new HashMap<String,Set<ClassDoc>>();
+    public Map<String,Set<ClassDoc>> classToClass = new HashMap<>();
 
     /**
      * Mapping of ClassDocs to list of ClassDoc which are direct or
      * indirect subclasses of that class.
      * Entries may be null.
      */
-    public Map<String,List<ClassDoc>> classToSubclass = new HashMap<String,List<ClassDoc>>();
+    public Map<String,List<ClassDoc>> classToSubclass = new HashMap<>();
 
     /**
      * Mapping of ClassDocs to list of ClassDoc which are direct or
      * indirect subinterfaces of that interface.
      * Entries may be null.
      */
-    public Map<String,List<ClassDoc>> classToSubinterface = new HashMap<String,List<ClassDoc>>();
+    public Map<String,List<ClassDoc>> classToSubinterface = new HashMap<>();
 
     /**
      * Mapping of ClassDocs to list of ClassDoc which implement
      * this interface.
      * Entries may be null.
      */
-    public Map<String,List<ClassDoc>> classToImplementingClass = new HashMap<String,List<ClassDoc>>();
+    public Map<String,List<ClassDoc>> classToImplementingClass = new HashMap<>();
 
     /**
      * Mapping of ClassDocs to list of FieldDoc declared as that class.
      * Entries may be null.
      */
-    public Map<String,List<FieldDoc>> classToField = new HashMap<String,List<FieldDoc>>();
+    public Map<String,List<FieldDoc>> classToField = new HashMap<>();
 
     /**
      * Mapping of ClassDocs to list of MethodDoc returning that class.
      * Entries may be null.
      */
-    public Map<String,List<MethodDoc>> classToMethodReturn = new HashMap<String,List<MethodDoc>>();
+    public Map<String,List<MethodDoc>> classToMethodReturn = new HashMap<>();
 
     /**
      * Mapping of ClassDocs to list of MethodDoc having that class
      * as an arg.
      * Entries may be null.
      */
-    public Map<String,List<ExecutableMemberDoc>> classToMethodArgs = new HashMap<String,List<ExecutableMemberDoc>>();
+    public Map<String,List<ExecutableMemberDoc>> classToMethodArgs = new HashMap<>();
 
     /**
      * Mapping of ClassDocs to list of MethodDoc which throws that class.
      * Entries may be null.
      */
-    public Map<String,List<ExecutableMemberDoc>> classToMethodThrows = new HashMap<String,List<ExecutableMemberDoc>>();
+    public Map<String,List<ExecutableMemberDoc>> classToMethodThrows = new HashMap<>();
 
     /**
      * Mapping of ClassDocs to list of ConstructorDoc having that class
      * as an arg.
      * Entries may be null.
      */
-    public Map<String,List<ExecutableMemberDoc>> classToConstructorArgs = new HashMap<String,List<ExecutableMemberDoc>>();
+    public Map<String,List<ExecutableMemberDoc>> classToConstructorArgs = new HashMap<>();
 
     /**
      * Mapping of ClassDocs to list of ConstructorDoc which throws that class.
      * Entries may be null.
      */
-    public Map<String,List<ExecutableMemberDoc>> classToConstructorThrows = new HashMap<String,List<ExecutableMemberDoc>>();
+    public Map<String,List<ExecutableMemberDoc>> classToConstructorThrows = new HashMap<>();
 
     /**
      * The mapping of AnnotationTypeDocs to constructors that use them.
      */
-    public Map<String,List<ConstructorDoc>> classToConstructorAnnotations = new HashMap<String,List<ConstructorDoc>>();
+    public Map<String,List<ConstructorDoc>> classToConstructorAnnotations = new HashMap<>();
 
     /**
      * The mapping of AnnotationTypeDocs to Constructor parameters that use them.
      */
-    public Map<String,List<ExecutableMemberDoc>> classToConstructorParamAnnotation = new HashMap<String,List<ExecutableMemberDoc>>();
+    public Map<String,List<ExecutableMemberDoc>> classToConstructorParamAnnotation = new HashMap<>();
 
     /**
      * The mapping of ClassDocs to Constructor arguments that use them as type parameters.
      */
-    public Map<String,List<ExecutableMemberDoc>> classToConstructorDocArgTypeParam = new HashMap<String,List<ExecutableMemberDoc>>();
+    public Map<String,List<ExecutableMemberDoc>> classToConstructorDocArgTypeParam = new HashMap<>();
 
     /**
      * The mapping of ClassDocs to ClassDocs that use them as type parameters.
      */
-    public Map<String,List<ClassDoc>> classToClassTypeParam = new HashMap<String,List<ClassDoc>>();
+    public Map<String,List<ClassDoc>> classToClassTypeParam = new HashMap<>();
 
     /**
      * The mapping of AnnotationTypeDocs to ClassDocs that use them.
      */
-    public Map<String,List<ClassDoc>> classToClassAnnotations = new HashMap<String,List<ClassDoc>>();
+    public Map<String,List<ClassDoc>> classToClassAnnotations = new HashMap<>();
 
     /**
      * The mapping of ClassDocs to ExecutableMemberDocs that use them as type parameters.
      */
-    public Map<String,List<MethodDoc>> classToExecMemberDocTypeParam = new HashMap<String,List<MethodDoc>>();
+    public Map<String,List<MethodDoc>> classToExecMemberDocTypeParam = new HashMap<>();
 
     /**
      * The mapping of ClassDocs to ExecutableMemberDocs arguments that use them as type parameters.
      */
-    public Map<String,List<ExecutableMemberDoc>> classToExecMemberDocArgTypeParam = new HashMap<String,List<ExecutableMemberDoc>>();
+    public Map<String,List<ExecutableMemberDoc>> classToExecMemberDocArgTypeParam = new HashMap<>();
 
     /**
      * The mapping of AnnotationTypeDocs to ExecutableMemberDocs that use them.
      */
-    public Map<String,List<MethodDoc>> classToExecMemberDocAnnotations = new HashMap<String,List<MethodDoc>>();
+    public Map<String,List<MethodDoc>> classToExecMemberDocAnnotations = new HashMap<>();
 
     /**
      * The mapping of ClassDocs to ExecutableMemberDocs that have return type
      * with type parameters of that class.
      */
-    public Map<String,List<MethodDoc>> classToExecMemberDocReturnTypeParam = new HashMap<String,List<MethodDoc>>();
+    public Map<String,List<MethodDoc>> classToExecMemberDocReturnTypeParam = new HashMap<>();
 
     /**
      * The mapping of AnnotationTypeDocs to MethodDoc parameters that use them.
      */
-    public Map<String,List<ExecutableMemberDoc>> classToExecMemberDocParamAnnotation = new HashMap<String,List<ExecutableMemberDoc>>();
+    public Map<String,List<ExecutableMemberDoc>> classToExecMemberDocParamAnnotation = new HashMap<>();
 
     /**
      * The mapping of ClassDocs to FieldDocs that use them as type parameters.
      */
-    public Map<String,List<FieldDoc>> classToFieldDocTypeParam = new HashMap<String,List<FieldDoc>>();
+    public Map<String,List<FieldDoc>> classToFieldDocTypeParam = new HashMap<>();
 
     /**
      * The mapping of AnnotationTypeDocs to FieldDocs that use them.
      */
-    public Map<String,List<FieldDoc>> annotationToFieldDoc = new HashMap<String,List<FieldDoc>>();
+    public Map<String,List<FieldDoc>> annotationToFieldDoc = new HashMap<>();
 
 
     public ClassUseMapper(RootDoc root, ClassTree classtree) {
         this.classtree = classtree;
 
         // Map subclassing, subinterfacing implementing, ...
-        for (Iterator<ClassDoc> it = classtree.baseclasses().iterator(); it.hasNext();) {
-            subclasses(it.next());
+        for (ClassDoc doc : classtree.baseclasses()) {
+            subclasses(doc);
         }
-        for (Iterator<ClassDoc> it = classtree.baseinterfaces().iterator(); it.hasNext();) {
+        for (ClassDoc doc : classtree.baseinterfaces()) {
             // does subinterfacing as side-effect
-            implementingClasses(it.next());
+            implementingClasses(doc);
         }
         // Map methods, fields, constructors using a class.
         ClassDoc[] classes = root.classes();
-        for (int i = 0; i < classes.length; i++) {
-            PackageDoc pkg = classes[i].containingPackage();
+        for (ClassDoc aClass : classes) {
+            PackageDoc pkg = aClass.containingPackage();
             mapAnnotations(classToPackageAnnotations, pkg, pkg);
-            ClassDoc cd = classes[i];
+            ClassDoc cd = aClass;
             mapTypeParameters(classToClassTypeParam, cd, cd);
             mapAnnotations(classToClassAnnotations, cd, cd);
             FieldDoc[] fields = cd.fields();
-            for (int j = 0; j < fields.length; j++) {
-                FieldDoc fd = fields[j];
+            for (FieldDoc fd : fields) {
                 mapTypeParameters(classToFieldDocTypeParam, fd, fd);
                 mapAnnotations(annotationToFieldDoc, fd, fd);
-                if (! fd.type().isPrimitive()) {
+                if (!fd.type().isPrimitive()) {
                     add(classToField, fd.type().asClassDoc(), fd);
                 }
             }
             ConstructorDoc[] cons = cd.constructors();
-            for (int j = 0; j < cons.length; j++) {
-                mapAnnotations(classToConstructorAnnotations, cons[j], cons[j]);
-                mapExecutable(cons[j]);
+            for (ConstructorDoc con : cons) {
+                mapAnnotations(classToConstructorAnnotations, con, con);
+                mapExecutable(con);
             }
             MethodDoc[] meths = cd.methods();
-            for (int j = 0; j < meths.length; j++) {
-                MethodDoc md = meths[j];
+            for (MethodDoc md : meths) {
                 mapExecutable(md);
                 mapTypeParameters(classToExecMemberDocTypeParam, md, md);
                 mapAnnotations(classToExecMemberDocAnnotations, md, md);
-                if (! (md.returnType().isPrimitive() || md.returnType() instanceof TypeVariable)) {
+                if (!(md.returnType().isPrimitive() || md.returnType() instanceof TypeVariable)) {
                     mapTypeParameters(classToExecMemberDocReturnTypeParam,
-                        md.returnType(), md);
+                                      md.returnType(), md);
                     add(classToMethodReturn, md.returnType().asClassDoc(), md);
                 }
             }
@@ -236,12 +234,12 @@
     private Collection<ClassDoc> subclasses(ClassDoc cd) {
         Collection<ClassDoc> ret = classToSubclass.get(cd.qualifiedName());
         if (ret == null) {
-            ret = new TreeSet<ClassDoc>();
+            ret = new TreeSet<>();
             List<ClassDoc> subs = classtree.subclasses(cd);
             if (subs != null) {
                 ret.addAll(subs);
-                for (Iterator<ClassDoc> it = subs.iterator(); it.hasNext();) {
-                    ret.addAll(subclasses(it.next()));
+                for (ClassDoc sub : subs) {
+                    ret.addAll(subclasses(sub));
                 }
             }
             addAll(classToSubclass, cd, ret);
@@ -255,12 +253,12 @@
     private Collection<ClassDoc> subinterfaces(ClassDoc cd) {
         Collection<ClassDoc> ret = classToSubinterface.get(cd.qualifiedName());
         if (ret == null) {
-            ret = new TreeSet<ClassDoc>();
+            ret = new TreeSet<>();
             List<ClassDoc> subs = classtree.subinterfaces(cd);
             if (subs != null) {
                 ret.addAll(subs);
-                for (Iterator<ClassDoc> it = subs.iterator(); it.hasNext();) {
-                    ret.addAll(subinterfaces(it.next()));
+                for (ClassDoc sub : subs) {
+                    ret.addAll(subinterfaces(sub));
                 }
             }
             addAll(classToSubinterface, cd, ret);
@@ -277,16 +275,16 @@
     private Collection<ClassDoc> implementingClasses(ClassDoc cd) {
         Collection<ClassDoc> ret = classToImplementingClass.get(cd.qualifiedName());
         if (ret == null) {
-            ret = new TreeSet<ClassDoc>();
+            ret = new TreeSet<>();
             List<ClassDoc> impl = classtree.implementingclasses(cd);
             if (impl != null) {
                 ret.addAll(impl);
-                for (Iterator<ClassDoc> it = impl.iterator(); it.hasNext();) {
-                    ret.addAll(subclasses(it.next()));
+                for (ClassDoc anImpl : impl) {
+                    ret.addAll(subclasses(anImpl));
                 }
             }
-            for (Iterator<ClassDoc> it = subinterfaces(cd).iterator(); it.hasNext();) {
-                ret.addAll(implementingClasses(it.next()));
+            for (ClassDoc doc : subinterfaces(cd)) {
+                ret.addAll(implementingClasses(doc));
             }
             addAll(classToImplementingClass, cd, ret);
         }
@@ -298,40 +296,37 @@
      * inverse mapped.
      */
     private void mapExecutable(ExecutableMemberDoc em) {
-        Parameter[] params = em.parameters();
         boolean isConstructor = em.isConstructor();
-        List<Type> classArgs = new ArrayList<Type>();
-        for (int k = 0; k < params.length; k++) {
-            Type pcd = params[k].type();
+        List<Type> classArgs = new ArrayList<>();
+        for (Parameter param : em.parameters()) {
+            Type pcd = param.type();
             // primitives don't get mapped, also avoid dups
-            if ((! params[k].type().isPrimitive()) &&
-                 ! classArgs.contains(pcd) &&
-                 ! (pcd instanceof TypeVariable)) {
-                add(isConstructor? classToConstructorArgs :classToMethodArgs,
-                        pcd.asClassDoc(), em);
+            if ((!param.type().isPrimitive()) &&
+                !classArgs.contains(pcd) &&
+                !(pcd instanceof TypeVariable)) {
+                add(isConstructor ? classToConstructorArgs : classToMethodArgs,
+                    pcd.asClassDoc(), em);
                 classArgs.add(pcd);
-                mapTypeParameters(isConstructor?
-                   classToConstructorDocArgTypeParam : classToExecMemberDocArgTypeParam,
-                   pcd, em);
+                mapTypeParameters(isConstructor ?
+                                  classToConstructorDocArgTypeParam : classToExecMemberDocArgTypeParam,
+                                  pcd, em);
             }
             mapAnnotations(
-                isConstructor ?
+                    isConstructor ?
                     classToConstructorParamAnnotation :
                     classToExecMemberDocParamAnnotation,
-                params[k], em);
+                    param, em);
         }
-        ClassDoc[] thr = em.thrownExceptions();
-        for (int k = 0; k < thr.length; k++) {
-            add(isConstructor? classToConstructorThrows : classToMethodThrows,
-                    thr[k], em);
+        for (ClassDoc anException : em.thrownExceptions()) {
+            add(isConstructor ? classToConstructorThrows : classToMethodThrows,
+                anException, em);
         }
     }
 
     private <T> List<T> refList(Map<String,List<T>> map, ClassDoc cd) {
         List<T> list = map.get(cd.qualifiedName());
         if (list == null) {
-            List<T> l = new ArrayList<T>();
-            list = l;
+            list = new ArrayList<>();
             map.put(cd.qualifiedName(), list);
         }
         return list;
@@ -340,7 +335,7 @@
     private Set<PackageDoc> packageSet(ClassDoc cd) {
         Set<PackageDoc> pkgSet = classToPackage.get(cd.qualifiedName());
         if (pkgSet == null) {
-            pkgSet = new TreeSet<PackageDoc>();
+            pkgSet = new TreeSet<>();
             classToPackage.put(cd.qualifiedName(), pkgSet);
         }
         return pkgSet;
@@ -349,8 +344,7 @@
     private Set<ClassDoc> classSet(ClassDoc cd) {
         Set<ClassDoc> clsSet = classToClass.get(cd.qualifiedName());
         if (clsSet == null) {
-            Set<ClassDoc> s = new TreeSet<ClassDoc>();
-            clsSet = s;
+            clsSet = new TreeSet<>();
             classToClass.put(cd.qualifiedName(), clsSet);
         }
         return clsSet;
@@ -378,8 +372,7 @@
         Set<PackageDoc> pkgSet = packageSet(cd);
         Set<ClassDoc> clsSet = classSet(cd);
         // add ref's package to package map and class map
-        for (Iterator<ClassDoc> it = refs.iterator(); it.hasNext();) {
-            ClassDoc cls = it.next();
+        for (ClassDoc cls : refs) {
             pkgSet.add(cls.containingPackage());
             clsSet.add(cls);
 
@@ -400,19 +393,16 @@
         if (doc instanceof ClassDoc) {
             typeVariables = ((ClassDoc) doc).typeParameters();
         } else if (doc instanceof WildcardType) {
-            Type[] extendsBounds = ((WildcardType) doc).extendsBounds();
-            for (int k = 0; k < extendsBounds.length; k++) {
-                addTypeParameterToMap(map, extendsBounds[k], holder);
+            for (Type extendsBound : ((WildcardType) doc).extendsBounds()) {
+                addTypeParameterToMap(map, extendsBound, holder);
             }
-            Type[] superBounds = ((WildcardType) doc).superBounds();
-            for (int k = 0; k < superBounds.length; k++) {
-                addTypeParameterToMap(map, superBounds[k], holder);
+            for (Type superBound : ((WildcardType) doc).superBounds()) {
+                addTypeParameterToMap(map, superBound, holder);
             }
             return;
         } else if (doc instanceof ParameterizedType) {
-            Type[] typeArguments = ((ParameterizedType) doc).typeArguments();
-            for (int k = 0; k < typeArguments.length; k++) {
-                addTypeParameterToMap(map, typeArguments[k], holder);
+            for (Type typeArgument : ((ParameterizedType) doc).typeArguments()) {
+                addTypeParameterToMap(map, typeArgument, holder);
             }
             return;
         } else if (doc instanceof ExecutableMemberDoc) {
@@ -424,10 +414,9 @@
         } else {
             return;
         }
-        for (int i = 0; i < typeVariables.length; i++) {
-            Type[] bounds = typeVariables[i].bounds();
-            for (int j = 0; j < bounds.length; j++) {
-                addTypeParameterToMap(map, bounds[j], holder);
+        for (TypeVariable typeVariable : typeVariables) {
+            for (Type bound : typeVariable.bounds()) {
+                addTypeParameterToMap(map, bound, holder);
             }
         }
     }
@@ -454,8 +443,8 @@
         } else {
             throw new DocletAbortException("should not happen");
         }
-        for (int i = 0; i < annotations.length; i++) {
-            AnnotationTypeDoc annotationDoc = annotations[i].annotationType();
+        for (AnnotationDesc annotation : annotations) {
+            AnnotationTypeDoc annotationDoc = annotation.annotationType();
             if (isPackage)
                 refList(map, annotationDoc).add(holder);
             else
@@ -474,10 +463,8 @@
      */
     private <T extends PackageDoc> void mapAnnotations(Map<String,List<T>> map, PackageDoc doc,
             T holder) {
-        AnnotationDesc[] annotations;
-        annotations = doc.annotations();
-        for (int i = 0; i < annotations.length; i++) {
-            AnnotationTypeDoc annotationDoc = annotations[i].annotationType();
+        for (AnnotationDesc annotation : doc.annotations()) {
+            AnnotationTypeDoc annotationDoc = annotation.annotationType();
             refList(map, annotationDoc).add(holder);
         }
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java	Wed Jul 05 19:26:54 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, 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
@@ -69,7 +69,7 @@
      * @param configuration the current configuration of the doclet
      */
     public DeprecatedAPIListBuilder(Configuration configuration) {
-        deprecatedLists = new ArrayList<List<Doc>>();
+        deprecatedLists = new ArrayList<>();
         for (int i = 0; i < NUM_TYPES; i++) {
             deprecatedLists.add(i, new ArrayList<Doc>());
         }
@@ -85,16 +85,12 @@
      */
     private void buildDeprecatedAPIInfo(Configuration configuration) {
         PackageDoc[] packages = configuration.packages;
-        PackageDoc pkg;
-        for (int c = 0; c < packages.length; c++) {
-            pkg = packages[c];
+        for (PackageDoc pkg : packages) {
             if (Util.isDeprecated(pkg)) {
                 getList(PACKAGE).add(pkg);
             }
         }
-        ClassDoc[] classes = configuration.root.classes();
-        for (int i = 0; i < classes.length; i++) {
-            ClassDoc cd = classes[i];
+        for (ClassDoc cd : configuration.root.classes()) {
             if (Util.isDeprecated(cd)) {
                 if (cd.isOrdinaryClass()) {
                     getList(CLASS).add(cd);
@@ -118,7 +114,7 @@
             }
             if (cd.isAnnotationType()) {
                 composeDeprecatedList(getList(ANNOTATION_TYPE_MEMBER),
-                        ((AnnotationTypeDoc) cd).elements());
+                                      ((AnnotationTypeDoc) cd).elements());
             }
         }
         sortDeprecatedLists();
@@ -131,9 +127,9 @@
      * @param members members to be added in the list.
      */
     private void composeDeprecatedList(List<Doc> list, MemberDoc[] members) {
-        for (int i = 0; i < members.length; i++) {
-            if (Util.isDeprecated(members[i])) {
-                list.add(members[i]);
+        for (MemberDoc member : members) {
+            if (Util.isDeprecated(member)) {
+                list.add(member);
             }
         }
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFile.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFile.java	Wed Jul 05 19:26:54 2017 +0200
@@ -132,19 +132,15 @@
      * Copy the contents of another file directly to this file.
      */
     public void copyFile(DocFile fromFile) throws IOException {
-        InputStream input = fromFile.openInputStream();
-        OutputStream output = openOutputStream();
-        try {
+        try (OutputStream output = openOutputStream();
+             InputStream input = fromFile.openInputStream()) {
             byte[] bytearr = new byte[1024];
             int len;
             while ((len = input.read(bytearr)) != -1) {
                 output.write(bytearr, 0, len);
             }
-        } catch (FileNotFoundException exc) {
-        } catch (SecurityException exc) {
-        } finally {
-            input.close();
-            output.close();
+        }
+        catch (FileNotFoundException | SecurityException exc) {
         }
     }
 
@@ -165,35 +161,26 @@
             if (in == null)
                 return;
 
-            OutputStream out = openOutputStream();
-            try {
+            try (OutputStream out = openOutputStream()) {
                 if (!replaceNewLine) {
                     byte[] buf = new byte[2048];
                     int n;
-                    while((n = in.read(buf))>0) out.write(buf,0,n);
+                    while ((n = in.read(buf)) > 0)
+                        out.write(buf, 0, n);
                 } else {
-                    BufferedReader reader = new BufferedReader(new InputStreamReader(in));
-                    BufferedWriter writer;
-                    if (configuration.docencoding == null) {
-                        writer = new BufferedWriter(new OutputStreamWriter(out));
-                    } else {
-                        writer = new BufferedWriter(new OutputStreamWriter(out,
-                                configuration.docencoding));
-                    }
-                    try {
+                    try (BufferedReader reader = new BufferedReader(new InputStreamReader(in));
+                         BufferedWriter writer = new BufferedWriter(configuration.docencoding == null
+                                                                    ? new OutputStreamWriter(out)
+                                                                    : new OutputStreamWriter(out, configuration.docencoding))) {
                         String line;
                         while ((line = reader.readLine()) != null) {
                             writer.write(line);
                             writer.write(DocletConstants.NL);
                         }
-                    } finally {
-                        reader.close();
-                        writer.close();
                     }
                 }
             } finally {
                 in.close();
-                out.close();
             }
         } catch (IOException e) {
             e.printStackTrace(System.err);
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFileFactory.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFileFactory.java	Wed Jul 05 19:26:54 2017 +0200
@@ -46,8 +46,7 @@
  * @since 1.8
  */
 abstract class DocFileFactory {
-    private static final Map<Configuration, DocFileFactory> factories =
-            new WeakHashMap<Configuration, DocFileFactory>();
+    private static final Map<Configuration, DocFileFactory> factories = new WeakHashMap<>();
 
     /**
      * Get the appropriate factory, based on the file manager given in the
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFinder.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFinder.java	Wed Jul 05 19:26:54 2017 +0200
@@ -171,7 +171,7 @@
          * subclass of IOException.  This subclass of DocFinder.Output allows
          * multiple tag inheritence.
          */
-        public List<Tag> tagList  = new ArrayList<Tag>();
+        public List<Tag> tagList  = new ArrayList<>();
     }
 
     /**
@@ -220,8 +220,8 @@
             //       appropriate element here.
             MethodDoc[] implementedMethods =
                 (new ImplementedMethods((MethodDoc) input.element, null)).build(false);
-            for (int i = 0; i < implementedMethods.length; i++) {
-                inheritedSearchInput.element = implementedMethods[i];
+            for (MethodDoc implementedMethod : implementedMethods) {
+                inheritedSearchInput.element = implementedMethod;
                 output = search(inheritedSearchInput);
                 output.isValidInheritDocTag = true;
                 if (output.inlineTags.length > 0) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPaths.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPaths.java	Wed Jul 05 19:26:54 2017 +0200
@@ -68,7 +68,7 @@
     public static final DocPath INDEX_FILES = DocPath.create("index-files");
 
     /** Generate the name of one of the files in the split index. */
-    public static final DocPath indexN(int n) {
+    public static DocPath indexN(int n) {
         return DocPath.create("index-" + n + ".html");
     }
 
@@ -88,22 +88,22 @@
     public static final DocPath PACKAGE_FRAME = DocPath.create("package-frame.html");
 
     /** The name of the file for the profile frame. */
-     public static final DocPath profileFrame(String profileName) {
+     public static DocPath profileFrame(String profileName) {
         return DocPath.create(profileName + "-frame.html");
     }
 
     /** The name of the file for the profile package frame. */
-     public static final DocPath profilePackageFrame(String profileName) {
+     public static DocPath profilePackageFrame(String profileName) {
         return DocPath.create(profileName + "-package-frame.html");
     }
 
     /** The name of the file for the profile package summary. */
-     public static final DocPath profilePackageSummary(String profileName) {
+     public static DocPath profilePackageSummary(String profileName) {
         return DocPath.create(profileName + "-package-summary.html");
     }
 
     /** The name of the file for the profile summary. */
-     public static final DocPath profileSummary(String profileName) {
+     public static DocPath profileSummary(String profileName) {
         return DocPath.create(profileName + "-summary.html");
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java	Wed Jul 05 19:26:54 2017 +0200
@@ -104,7 +104,7 @@
             this.path = path;
             this.relative = relative;
             if (packageToItemMap == null) {
-                packageToItemMap = new HashMap<String,Item>();
+                packageToItemMap = new HashMap<>();
             }
             if (!packageToItemMap.containsKey(packageName)) { // save the previous
                 packageToItemMap.put(packageName, this);        // mapped location
@@ -234,11 +234,10 @@
         try {
             URL link = pkglisturlpath.toURI().resolve(DocPaths.PACKAGE_LIST.getPath()).toURL();
             readPackageList(link.openStream(), urlpath, false);
-        } catch (URISyntaxException exc) {
+        } catch (URISyntaxException | MalformedURLException exc) {
             throw new Fault(configuration.getText("doclet.MalformedURL", pkglisturlpath.toString()), exc);
-        } catch (MalformedURLException exc) {
-            throw new Fault(configuration.getText("doclet.MalformedURL", pkglisturlpath.toString()), exc);
-        } catch (IOException exc) {
+        }
+        catch (IOException exc) {
             throw new Fault(configuration.getText("doclet.URL_error", pkglisturlpath.toString()), exc);
         }
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java	Wed Jul 05 19:26:54 2017 +0200
@@ -61,24 +61,24 @@
     /**
      * Map of regular expressions with the corresponding group name.
      */
-    private Map<String,String> regExpGroupMap = new HashMap<String,String>();
+    private Map<String,String> regExpGroupMap = new HashMap<>();
 
     /**
      * List of regular expressions sorted according to the length. Regular
      * expression with longest length will be first in the sorted order.
      */
-    private List<String> sortedRegExpList = new ArrayList<String>();
+    private List<String> sortedRegExpList = new ArrayList<>();
 
     /**
      * List of group names in the same order as given on the command line.
      */
-    private List<String> groupList = new ArrayList<String>();
+    private List<String> groupList = new ArrayList<>();
 
     /**
      * Map of non-regular expressions(possible package names) with the
      * corresponding group name.
      */
-    private Map<String,String> pkgNameGroupMap = new HashMap<String,String>();
+    private Map<String,String> pkgNameGroupMap = new HashMap<>();
 
     /**
      * The global configuration information for this run.
@@ -176,7 +176,7 @@
      * @param packages Packages specified on the command line.
      */
     public Map<String,List<PackageDoc>> groupPackages(PackageDoc[] packages) {
-        Map<String,List<PackageDoc>> groupPackageMap = new HashMap<String,List<PackageDoc>>();
+        Map<String,List<PackageDoc>> groupPackageMap = new HashMap<>();
         String defaultGroupName =
             (pkgNameGroupMap.isEmpty() && regExpGroupMap.isEmpty())?
                 configuration.message.getText("doclet.Packages") :
@@ -185,8 +185,7 @@
         if (!groupList.contains(defaultGroupName)) {
             groupList.add(defaultGroupName);
         }
-        for (int i = 0; i < packages.length; i++) {
-            PackageDoc pkg = packages[i];
+        for (PackageDoc pkg : packages) {
             String pkgName = pkg.name();
             String groupName = pkgNameGroupMap.get(pkgName);
             // if this package is not explicitly assigned to a group,
@@ -212,8 +211,7 @@
      * expression list.
      */
     String regExpGroupName(String pkgName) {
-        for (int j = 0; j < sortedRegExpList.size(); j++) {
-            String regexp = sortedRegExpList.get(j);
+        for (String regexp : sortedRegExpList) {
             if (pkgName.startsWith(regexp)) {
                 return regExpGroupMap.get(regexp);
             }
@@ -231,7 +229,7 @@
     List<PackageDoc> getPkgList(Map<String,List<PackageDoc>> map, String groupname) {
         List<PackageDoc> list = map.get(groupname);
         if (list == null) {
-            list = new ArrayList<PackageDoc>();
+            list = new ArrayList<>();
             map.put(groupname, list);
         }
         return list;
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java	Wed Jul 05 19:26:54 2017 +0200
@@ -43,8 +43,8 @@
  */
 public class ImplementedMethods {
 
-    private Map<MethodDoc,Type> interfaces = new HashMap<MethodDoc,Type>();
-    private List<MethodDoc> methlist = new ArrayList<MethodDoc>();
+    private Map<MethodDoc,Type> interfaces = new HashMap<>();
+    private List<MethodDoc> methlist = new ArrayList<>();
     private Configuration configuration;
     private final ClassDoc classdoc;
     private final MethodDoc method;
@@ -89,8 +89,7 @@
      */
     private void buildImplementedMethodList(boolean sort) {
         List<Type> intfacs = Util.getAllInterfaces(classdoc, configuration, sort);
-        for (Iterator<Type> iter = intfacs.iterator(); iter.hasNext(); ) {
-            Type interfaceType = iter.next();
+        for (Type interfaceType : intfacs) {
             MethodDoc found = Util.findMethod(interfaceType.asClassDoc(), method);
             if (found != null) {
                 removeOverriddenMethod(found);
@@ -132,8 +131,7 @@
      */
     private boolean overridingMethodFound(MethodDoc method) {
         ClassDoc containingClass = method.containingClass();
-        for (int i = 0; i < methlist.size(); i++) {
-            MethodDoc listmethod = methlist.get(i);
+        for (MethodDoc listmethod : methlist) {
             if (containingClass == listmethod.containingClass()) {
                 // it's the same method.
                 return true;
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java	Wed Jul 05 19:26:54 2017 +0200
@@ -51,7 +51,7 @@
      * Mapping of each Unicode Character with the member list containing
      * members with names starting with it.
      */
-    private Map<Character,List<Doc>> indexmap = new HashMap<Character,List<Doc>>();
+    private Map<Character,List<Doc>> indexmap = new HashMap<>();
 
     /**
      * Don't generate deprecated information if true.
@@ -132,8 +132,8 @@
      * sort each element which is a list.
      */
     protected void sortIndexMap() {
-        for (Iterator<List<Doc>> it = indexmap.values().iterator(); it.hasNext(); ) {
-            Collections.sort(it.next(), new DocComparator());
+        for (List<Doc> docs : indexmap.values()) {
+            Collections.sort(docs, new DocComparator());
         }
     }
 
@@ -149,10 +149,9 @@
         ClassDoc[] classes = root.classes();
         if (!classesOnly) {
             if (packages.length == 0) {
-                Set<PackageDoc> set = new HashSet<PackageDoc>();
-                PackageDoc pd;
-                for (int i = 0; i < classes.length; i++) {
-                    pd = classes[i].containingPackage();
+                Set<PackageDoc> set = new HashSet<>();
+                for (ClassDoc aClass : classes) {
+                    PackageDoc pd = aClass.containingPackage();
                     if (pd != null && pd.name().length() > 0) {
                         set.add(pd);
                     }
@@ -164,9 +163,9 @@
         }
         adjustIndexMap(classes);
         if (!classesOnly) {
-            for (int i = 0; i < classes.length; i++) {
-                if (shouldAddToIndexMap(classes[i])) {
-                    putMembersInIndexMap(classes[i]);
+            for (ClassDoc aClass : classes) {
+                if (shouldAddToIndexMap(aClass)) {
+                    putMembersInIndexMap(aClass);
                 }
             }
         }
@@ -194,19 +193,19 @@
      * @param elements Array of members.
      */
     protected void adjustIndexMap(Doc[] elements) {
-        for (int i = 0; i < elements.length; i++) {
-            if (shouldAddToIndexMap(elements[i])) {
-                String name = elements[i].name();
-                char ch = (name.length()==0)?
-                    '*' :
-                    Character.toUpperCase(name.charAt(0));
-                Character unicode = new Character(ch);
+        for (Doc element : elements) {
+            if (shouldAddToIndexMap(element)) {
+                String name = element.name();
+                char ch = (name.length() == 0) ?
+                          '*' :
+                          Character.toUpperCase(name.charAt(0));
+                Character unicode = ch;
                 List<Doc> list = indexmap.get(unicode);
                 if (list == null) {
-                    list = new ArrayList<Doc>();
+                    list = new ArrayList<>();
                     indexmap.put(unicode, list);
                 }
-                list.add(elements[i]);
+                list.add(element);
             }
         }
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java	Wed Jul 05 19:26:54 2017 +0200
@@ -71,7 +71,7 @@
      * definitions are on separate pages.
      */
     public String[] getMetaKeywords(ClassDoc classdoc) {
-        ArrayList<String> results = new ArrayList<String>();
+        ArrayList<String> results = new ArrayList<>();
 
         // Add field and method keywords only if -keywords option is used
         if( configuration.keywords ) {
@@ -88,7 +88,7 @@
      */
     protected ArrayList<String> getClassKeyword(ClassDoc classdoc) {
         String cltypelower = classdoc.isInterface() ? "interface" : "class";
-        ArrayList<String> metakeywords = new ArrayList<String>(1);
+        ArrayList<String> metakeywords = new ArrayList<>(1);
         metakeywords.add(classdoc.qualifiedName() + " " + cltypelower);
         return metakeywords;
     }
@@ -145,12 +145,11 @@
      * @param memberdocs  array of MemberDoc objects to be added to keywords
      */
     protected ArrayList<String> getMemberKeywords(MemberDoc[] memberdocs) {
-        ArrayList<String> results = new ArrayList<String>();
+        ArrayList<String> results = new ArrayList<>();
         String membername;
-        for (int i=0; i < memberdocs.length; i++) {
-            membername = memberdocs[i].name()
-                             + (memberdocs[i].isMethod() ? "()" : "");
-            if ( ! results.contains(membername) ) {
+        for (MemberDoc memberdoc : memberdocs) {
+            membername = memberdoc.name() + (memberdoc.isMethod() ? "()" : "");
+            if (!results.contains(membername)) {
                 results.add(membername);
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MethodFinder.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MethodFinder.java	Wed Jul 05 19:26:54 2017 +0200
@@ -62,9 +62,9 @@
 
     public MethodDoc searchInterfaces(ClassDoc cd, MethodDoc method) {
         MethodDoc[] implementedMethods = (new ImplementedMethods(method, null)).build();
-        for (int i = 0; i < implementedMethods.length; i++) {
-            if (isCorrectMethod(implementedMethods[i])) {
-                return implementedMethods[i];
+        for (MethodDoc implementedMethod : implementedMethods) {
+            if (isCorrectMethod(implementedMethod)) {
+                return implementedMethod;
             }
         }
         return null;
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -76,17 +76,16 @@
     }
 
     protected void generatePackageListFile(RootDoc root) {
-        PackageDoc[] packages = configuration.packages;
-        ArrayList<String> names = new ArrayList<String>();
-        for (int i = 0; i < packages.length; i++) {
+        ArrayList<String> names = new ArrayList<>();
+        for (PackageDoc pkg : configuration.packages) {
             // if the -nodeprecated option is set and the package is marked as
             // deprecated, do not include it in the packages list.
-            if (!(configuration.nodeprecated && Util.isDeprecated(packages[i])))
-                names.add(packages[i].name());
+            if (!(configuration.nodeprecated && Util.isDeprecated(pkg)))
+                names.add(pkg.name());
         }
         Collections.sort(names);
-        for (int i = 0; i < names.size(); i++) {
-            println(names.get(i));
+        for (String name : names) {
+            println(name);
         }
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PathDocFileFactory.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PathDocFileFactory.java	Wed Jul 05 19:26:54 2017 +0200
@@ -102,7 +102,7 @@
         if (location != StandardLocation.SOURCE_PATH)
             throw new IllegalArgumentException();
 
-        Set<DocFile> files = new LinkedHashSet<DocFile>();
+        Set<DocFile> files = new LinkedHashSet<>();
         if (fileManager.hasLocation(location)) {
             for (Path f: fileManager.getLocation(location)) {
                 if (Files.isDirectory(f)) {
@@ -221,7 +221,7 @@
 
         /** If the file is a directory, list its contents. */
         public Iterable<DocFile> list() throws IOException {
-            List<DocFile> files = new ArrayList<DocFile>();
+            List<DocFile> files = new ArrayList<>();
             try (DirectoryStream<Path> ds = Files.newDirectoryStream(file)) {
                 for (Path f: ds) {
                     files.add(new StandardDocFile(f));
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SimpleDocFileFactory.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SimpleDocFileFactory.java	Wed Jul 05 19:26:54 2017 +0200
@@ -83,7 +83,7 @@
         if (location != StandardLocation.SOURCE_PATH)
             throw new IllegalArgumentException();
 
-        Set<DocFile> files = new LinkedHashSet<DocFile>();
+        Set<DocFile> files = new LinkedHashSet<>();
         for (String s : configuration.sourcepath.split(File.pathSeparator)) {
             if (s.isEmpty())
                 continue;
@@ -206,7 +206,7 @@
 
         /** If the file is a directory, list its contents. */
         public Iterable<DocFile> list() {
-            List<DocFile> files = new ArrayList<DocFile>();
+            List<DocFile> files = new ArrayList<>();
             for (File f: file.listFiles()) {
                 files.add(new SimpleDocFile(f));
             }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/StandardDocFileFactory.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/StandardDocFileFactory.java	Wed Jul 05 19:26:54 2017 +0200
@@ -105,7 +105,7 @@
         if (location != StandardLocation.SOURCE_PATH)
             throw new IllegalArgumentException();
 
-        Set<DocFile> files = new LinkedHashSet<DocFile>();
+        Set<DocFile> files = new LinkedHashSet<>();
         Location l = fileManager.hasLocation(StandardLocation.SOURCE_PATH)
                 ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH;
         for (File f: fileManager.getLocation(l)) {
@@ -231,7 +231,7 @@
 
         /** If the file is a directory, list its contents. */
         public Iterable<DocFile> list() {
-            List<DocFile> files = new ArrayList<DocFile>();
+            List<DocFile> files = new ArrayList<>();
             for (File f: file.listFiles()) {
                 files.add(new StandardDocFile(f));
             }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Wed Jul 05 19:26:54 2017 +0200
@@ -26,13 +26,16 @@
 package com.sun.tools.doclets.internal.toolkit.util;
 
 import java.io.*;
+import java.lang.annotation.Documented;
 import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
 import java.util.*;
+import javax.tools.StandardLocation;
 
 import com.sun.javadoc.*;
 import com.sun.javadoc.AnnotationDesc.ElementValuePair;
 import com.sun.tools.doclets.internal.toolkit.*;
-import javax.tools.StandardLocation;
+import com.sun.tools.javac.util.StringUtils;
 
 /**
  * Utilities Class for Doclets.
@@ -73,10 +76,10 @@
      */
     public static List<ProgramElementDoc> excludeDeprecatedMembersAsList(
         ProgramElementDoc[] members) {
-        List<ProgramElementDoc> list = new ArrayList<ProgramElementDoc>();
-        for (int i = 0; i < members.length; i++) {
-            if (members[i].tags("deprecated").length == 0) {
-                list.add(members[i]);
+        List<ProgramElementDoc> list = new ArrayList<>();
+        for (ProgramElementDoc member : members) {
+            if (member.tags("deprecated").length == 0) {
+                list.add(member);
             }
         }
         Collections.sort(list);
@@ -101,8 +104,8 @@
      * @return boolean True if non-public member found, false otherwise.
      */
     public static boolean nonPublicMemberFound(ProgramElementDoc[] members) {
-        for (int i = 0; i < members.length; i++) {
-            if (!members[i].isPublic()) {
+        for (ProgramElementDoc member : members) {
+            if (!member.isPublic()) {
                 return true;
             }
         }
@@ -118,9 +121,9 @@
      */
     public static MethodDoc findMethod(ClassDoc cd, MethodDoc method) {
         MethodDoc[] methods = cd.methods();
-        for (int i = 0; i < methods.length; i++) {
-            if (executableMembersEqual(method, methods[i])) {
-                return methods[i];
+        for (MethodDoc m : methods) {
+            if (executableMembersEqual(method, m)) {
+                return m;
 
             }
         }
@@ -240,9 +243,7 @@
 
                 first = false;
             }
-        } catch (SecurityException exc) {
-            throw new DocletAbortException(exc);
-        } catch (IOException exc) {
+        } catch (SecurityException | IOException exc) {
             throw new DocletAbortException(exc);
         }
     }
@@ -253,8 +254,8 @@
      */
     private static class TypeComparator implements Comparator<Type> {
         public int compare(Type type1, Type type2) {
-            return type1.qualifiedTypeName().toLowerCase().compareTo(
-                type2.qualifiedTypeName().toLowerCase());
+            return type1.qualifiedTypeName().compareToIgnoreCase(
+                type2.qualifiedTypeName());
         }
     }
 
@@ -272,7 +273,9 @@
      */
     public static List<Type> getAllInterfaces(Type type,
             Configuration configuration, boolean sort) {
-        Map<ClassDoc,Type> results = sort ? new TreeMap<ClassDoc,Type>() : new LinkedHashMap<ClassDoc,Type>();
+        Map<ClassDoc,Type> results = sort ?
+                new TreeMap<ClassDoc,Type>() :
+                new LinkedHashMap<ClassDoc,Type>();
         Type[] interfaceTypes = null;
         Type superType = null;
         if (type instanceof ParameterizedType) {
@@ -286,29 +289,26 @@
             superType = type.asClassDoc().superclassType();
         }
 
-        for (int i = 0; i < interfaceTypes.length; i++) {
-            Type interfaceType = interfaceTypes[i];
+        for (Type interfaceType : interfaceTypes) {
             ClassDoc interfaceClassDoc = interfaceType.asClassDoc();
-            if (! (interfaceClassDoc.isPublic() ||
-                (configuration == null ||
-                isLinkable(interfaceClassDoc, configuration)))) {
+            if (!(interfaceClassDoc.isPublic() ||
+                  (configuration == null ||
+                   isLinkable(interfaceClassDoc, configuration)))) {
                 continue;
             }
             results.put(interfaceClassDoc, interfaceType);
-            List<Type> superInterfaces = getAllInterfaces(interfaceType, configuration, sort);
-            for (Iterator<Type> iter = superInterfaces.iterator(); iter.hasNext(); ) {
-                Type t = iter.next();
+            for (Type t : getAllInterfaces(interfaceType, configuration, sort)) {
                 results.put(t.asClassDoc(), t);
             }
         }
         if (superType == null)
-            return new ArrayList<Type>(results.values());
+            return new ArrayList<>(results.values());
         //Try walking the tree.
         addAllInterfaceTypes(results,
             superType,
             interfaceTypesOf(superType),
             false, configuration);
-        List<Type> resultsList = new ArrayList<Type>(results.values());
+        List<Type> resultsList = new ArrayList<>(results.values());
         if (sort) {
                 Collections.sort(resultsList, new TypeComparator());
         }
@@ -350,20 +350,18 @@
     private static void addAllInterfaceTypes(Map<ClassDoc,Type> results, Type type,
             Type[] interfaceTypes, boolean raw,
             Configuration configuration) {
-        for (int i = 0; i < interfaceTypes.length; i++) {
-            Type interfaceType = interfaceTypes[i];
+        for (Type interfaceType : interfaceTypes) {
             ClassDoc interfaceClassDoc = interfaceType.asClassDoc();
-            if (! (interfaceClassDoc.isPublic() ||
-                (configuration != null &&
-                isLinkable(interfaceClassDoc, configuration)))) {
+            if (!(interfaceClassDoc.isPublic() ||
+                  (configuration != null &&
+                   isLinkable(interfaceClassDoc, configuration)))) {
                 continue;
             }
             if (raw)
                 interfaceType = interfaceType.asClassDoc();
             results.put(interfaceClassDoc, interfaceType);
             List<Type> superInterfaces = getAllInterfaces(interfaceType, configuration);
-            for (Iterator<Type> iter = superInterfaces.iterator(); iter.hasNext(); ) {
-                Type superInterface = iter.next();
+            for (Type superInterface : superInterfaces) {
                 results.put(superInterface.asClassDoc(), superInterface);
             }
         }
@@ -428,10 +426,9 @@
      * @return true return true if it should be documented and false otherwise.
      */
     public static boolean isDocumentedAnnotation(AnnotationTypeDoc annotationDoc) {
-        AnnotationDesc[] annotationDescList = annotationDoc.annotations();
-        for (int i = 0; i < annotationDescList.length; i++) {
-            if (annotationDescList[i].annotationType().qualifiedName().equals(
-                   java.lang.annotation.Documented.class.getName())){
+        for (AnnotationDesc anno : annotationDoc.annotations()) {
+            if (anno.annotationType().qualifiedName().equals(
+                    Documented.class.getName())) {
                 return true;
             }
         }
@@ -447,13 +444,12 @@
             || !(elems[0].value().value() instanceof AnnotationValue[]))
             return true;    // error recovery
 
-        AnnotationValue[] values = (AnnotationValue[])elems[0].value().value();
-        for (int i = 0; i < values.length; i++) {
-            Object value = values[i].value();
+        for (AnnotationValue aValue : (AnnotationValue[])elems[0].value().value()) {
+            Object value = aValue.value();
             if (!(value instanceof FieldDoc))
                 return true; // error recovery
 
-            FieldDoc eValue = (FieldDoc)value;
+            FieldDoc eValue = (FieldDoc) value;
             if (Util.isJava5DeclarationElementType(eValue)) {
                 return true;
             }
@@ -479,10 +475,10 @@
         // Annotations with no target are treated as declaration as well
         if (annotationDescList.length==0)
             return true;
-        for (int i = 0; i < annotationDescList.length; i++) {
-            if (annotationDescList[i].annotationType().qualifiedName().equals(
-                    java.lang.annotation.Target.class.getName())) {
-                if (isDeclarationTarget(annotationDescList[i]))
+        for (AnnotationDesc anno : annotationDescList) {
+            if (anno.annotationType().qualifiedName().equals(
+                    Target.class.getName())) {
+                if (isDeclarationTarget(anno))
                     return true;
             }
         }
@@ -589,7 +585,7 @@
             typeName = "doclet.Enum";
         }
         return config.getText(
-            lowerCaseOnly ? typeName.toLowerCase() : typeName);
+            lowerCaseOnly ? StringUtils.toLowerCase(typeName) : typeName);
     }
 
     /**
@@ -601,7 +597,7 @@
      * @return the text with all tabs expanded
      */
     public static String replaceTabs(Configuration configuration, String text) {
-        if (text.indexOf("\t") == -1)
+        if (!text.contains("\t"))
             return text;
 
         final int tabLength = configuration.sourcetab;
@@ -663,32 +659,30 @@
      */
     public static void setEnumDocumentation(Configuration configuration,
             ClassDoc classDoc) {
-        MethodDoc[] methods = classDoc.methods();
-        for (int j = 0; j < methods.length; j++) {
-            MethodDoc currentMethod = methods[j];
+        for (MethodDoc currentMethod : classDoc.methods()) {
             if (currentMethod.name().equals("values") &&
-                    currentMethod.parameters().length == 0) {
+                currentMethod.parameters().length == 0) {
                 StringBuilder sb = new StringBuilder();
                 sb.append(configuration.getText("doclet.enum_values_doc.main", classDoc.name()));
                 sb.append("\n@return ");
                 sb.append(configuration.getText("doclet.enum_values_doc.return"));
                 currentMethod.setRawCommentText(sb.toString());
             } else if (currentMethod.name().equals("valueOf") &&
-                    currentMethod.parameters().length == 1) {
+                     currentMethod.parameters().length == 1) {
                 Type paramType = currentMethod.parameters()[0].type();
                 if (paramType != null &&
-                        paramType.qualifiedTypeName().equals(String.class.getName())) {
-                StringBuilder sb = new StringBuilder();
-                sb.append(configuration.getText("doclet.enum_valueof_doc.main", classDoc.name()));
-                sb.append("\n@param name ");
-                sb.append(configuration.getText("doclet.enum_valueof_doc.param_name"));
-                sb.append("\n@return ");
-                sb.append(configuration.getText("doclet.enum_valueof_doc.return"));
-                sb.append("\n@throws IllegalArgumentException ");
-                sb.append(configuration.getText("doclet.enum_valueof_doc.throws_ila"));
-                sb.append("\n@throws NullPointerException ");
-                sb.append(configuration.getText("doclet.enum_valueof_doc.throws_npe"));
-                currentMethod.setRawCommentText(sb.toString());
+                    paramType.qualifiedTypeName().equals(String.class.getName())) {
+                    StringBuilder sb = new StringBuilder();
+                    sb.append(configuration.getText("doclet.enum_valueof_doc.main", classDoc.name()));
+                    sb.append("\n@param name ");
+                    sb.append(configuration.getText("doclet.enum_valueof_doc.param_name"));
+                    sb.append("\n@return ");
+                    sb.append(configuration.getText("doclet.enum_valueof_doc.return"));
+                    sb.append("\n@throws IllegalArgumentException ");
+                    sb.append(configuration.getText("doclet.enum_valueof_doc.throws_ila"));
+                    sb.append("\n@throws NullPointerException ");
+                    sb.append(configuration.getText("doclet.enum_valueof_doc.throws_npe"));
+                    currentMethod.setRawCommentText(sb.toString());
                 }
             }
         }
@@ -709,9 +703,9 @@
             annotationDescList = ((PackageDoc)doc).annotations();
         else
             annotationDescList = ((ProgramElementDoc)doc).annotations();
-        for (int i = 0; i < annotationDescList.length; i++) {
-            if (annotationDescList[i].annotationType().qualifiedName().equals(
-                   java.lang.Deprecated.class.getName())){
+        for (AnnotationDesc anno : annotationDescList) {
+            if (anno.annotationType().qualifiedName().equals(
+                    Deprecated.class.getName())) {
                 return true;
             }
         }
@@ -724,7 +718,7 @@
      * @param name name of the getter or setter method.
      * @return the name of the property of the given setter of getter.
      */
-    public static String propertyNameFromMethodName(String name) {
+    public static String propertyNameFromMethodName(Configuration configuration, String name) {
         String propertyName = null;
         if (name.startsWith("get") || name.startsWith("set")) {
             propertyName = name.substring(3);
@@ -734,7 +728,7 @@
         if ((propertyName == null) || propertyName.isEmpty()){
             return "";
         }
-        return propertyName.substring(0, 1).toLowerCase()
+        return propertyName.substring(0, 1).toLowerCase(configuration.getLocale())
                 + propertyName.substring(1);
     }
 
@@ -752,8 +746,7 @@
         if (!javafx) {
             return classes;
         }
-        final List<ClassDoc> filteredOutClasses =
-                new ArrayList<ClassDoc>(classes.length);
+        final List<ClassDoc> filteredOutClasses = new ArrayList<>(classes.length);
         for (ClassDoc classDoc : classes) {
             if (classDoc.isPrivate() || classDoc.isPackagePrivate()) {
                 continue;
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java	Wed Jul 05 19:26:54 2017 +0200
@@ -70,19 +70,19 @@
     /**
      * List of ClassDoc objects for which ClassMembers objects are built.
      */
-    private final List<ClassDoc> visibleClasses = new ArrayList<ClassDoc>();
+    private final List<ClassDoc> visibleClasses = new ArrayList<>();
 
     /**
      * Map for each member name on to a map which contains members with same
      * name-signature. The mapped map will contain mapping for each MemberDoc
      * onto it's respecive level string.
      */
-    private final Map<Object,Map<ProgramElementDoc,String>> memberNameMap = new HashMap<Object,Map<ProgramElementDoc,String>>();
+    private final Map<Object,Map<ProgramElementDoc,String>> memberNameMap = new HashMap<>();
 
     /**
      * Map of class and it's ClassMembers object.
      */
-    private final Map<ClassDoc,ClassMembers> classMap = new HashMap<ClassDoc,ClassMembers>();
+    private final Map<ClassDoc,ClassMembers> classMap = new HashMap<>();
 
     /**
      * Type whose visible members are requested.  This is the leaf of
@@ -100,12 +100,9 @@
      */
     private final Configuration configuration;
 
-    private static final Map<ClassDoc, ProgramElementDoc[]> propertiesCache =
-            new HashMap<ClassDoc, ProgramElementDoc[]>();
-    private static final Map<ProgramElementDoc, ProgramElementDoc> classPropertiesMap =
-            new HashMap<ProgramElementDoc, ProgramElementDoc>();
-    private static final Map<ProgramElementDoc, GetterSetter> getterSetterMap =
-            new HashMap<ProgramElementDoc, GetterSetter>();
+    private static final Map<ClassDoc, ProgramElementDoc[]> propertiesCache = new HashMap<>();
+    private static final Map<ProgramElementDoc, ProgramElementDoc> classPropertiesMap = new HashMap<>();
+    private static final Map<ProgramElementDoc, GetterSetter> getterSetterMap = new HashMap<>();
 
     /**
      * Construct a VisibleMemberMap of the given type for the given
@@ -172,9 +169,8 @@
      * @return the package private members inherited by the class.
      */
     private List<ProgramElementDoc> getInheritedPackagePrivateMethods(Configuration configuration) {
-        List<ProgramElementDoc> results = new ArrayList<ProgramElementDoc>();
-        for (Iterator<ClassDoc> iter = visibleClasses.iterator(); iter.hasNext(); ) {
-            ClassDoc currentClass = iter.next();
+        List<ProgramElementDoc> results = new ArrayList<>();
+        for (ClassDoc currentClass : visibleClasses) {
             if (currentClass != classdoc &&
                 currentClass.isPackagePrivate() &&
                 !Util.isLinkable(currentClass, configuration)) {
@@ -209,7 +205,7 @@
     public List<ProgramElementDoc> getMembersFor(ClassDoc cd) {
         ClassMembers clmembers = classMap.get(cd);
         if (clmembers == null) {
-            return new ArrayList<ProgramElementDoc>();
+            return new ArrayList<>();
         }
         return clmembers.getMembers();
     }
@@ -219,13 +215,13 @@
      * classes followed by interfaces traversed. Don't sort alphabetically.
      */
     private void sort(List<ClassDoc> list) {
-        List<ClassDoc> classes = new ArrayList<ClassDoc>();
-        List<ClassDoc> interfaces = new ArrayList<ClassDoc>();
-        for (int i = 0; i < list.size(); i++) {
-            ClassDoc cd = list.get(i);
+        List<ClassDoc> classes = new ArrayList<>();
+        List<ClassDoc> interfaces = new ArrayList<>();
+        for (ClassDoc cd : list) {
             if (cd.isClass()) {
                 classes.add(cd);
-            } else {
+            }
+            else {
                 interfaces.add(cd);
             }
         }
@@ -235,23 +231,23 @@
     }
 
     private void fillMemberLevelMap(List<ProgramElementDoc> list, String level) {
-        for (int i = 0; i < list.size(); i++) {
-            Object key = getMemberKey(list.get(i));
-            Map<ProgramElementDoc,String> memberLevelMap = memberNameMap.get(key);
+        for (ProgramElementDoc element : list) {
+            Object key = getMemberKey(element);
+            Map<ProgramElementDoc, String> memberLevelMap = memberNameMap.get(key);
             if (memberLevelMap == null) {
-                memberLevelMap = new HashMap<ProgramElementDoc,String>();
+                memberLevelMap = new HashMap<>();
                 memberNameMap.put(key, memberLevelMap);
             }
-            memberLevelMap.put(list.get(i), level);
+            memberLevelMap.put(element, level);
         }
     }
 
     private void purgeMemberLevelMap(List<ProgramElementDoc> list, String level) {
-        for (int i = 0; i < list.size(); i++) {
-            Object key = getMemberKey(list.get(i));
+        for (ProgramElementDoc element : list) {
+            Object key = getMemberKey(element);
             Map<ProgramElementDoc, String> memberLevelMap = memberNameMap.get(key);
-            if (level.equals(memberLevelMap.get(list.get(i))))
-                memberLevelMap.remove(list.get(i));
+            if (level.equals(memberLevelMap.get(element)))
+                memberLevelMap.remove(element);
         }
     }
 
@@ -264,7 +260,7 @@
         private Set<ProgramElementDoc> members;
 
         public ClassMember(ProgramElementDoc programElementDoc) {
-            members = new HashSet<ProgramElementDoc>();
+            members = new HashSet<>();
             members.add(programElementDoc);
         }
 
@@ -273,11 +269,10 @@
         }
 
         public boolean isEqual(MethodDoc member) {
-            for (Iterator<ProgramElementDoc> iter = members.iterator(); iter.hasNext(); ) {
-                MethodDoc member2 = (MethodDoc) iter.next();
-                if (Util.executableMembersEqual(member, member2)) {
+            for (ProgramElementDoc element : members) {
+                if (Util.executableMembersEqual(member, (MethodDoc) element)) {
                     members.add(member);
-                        return true;
+                    return true;
                 }
             }
             return false;
@@ -299,7 +294,7 @@
         /**
          * List of inherited members from the mapping class.
          */
-        private List<ProgramElementDoc> members = new ArrayList<ProgramElementDoc>();
+        private List<ProgramElementDoc> members = new ArrayList<>();
 
         /**
          * Level/Depth of inheritance.
@@ -345,9 +340,9 @@
         private void mapClass() {
             addMembers(mappingClass);
             ClassDoc[] interfaces = mappingClass.interfaces();
-            for (int i = 0; i < interfaces.length; i++) {
+            for (ClassDoc anInterface : interfaces) {
                 String locallevel = level + 1;
-                ClassMembers cm = new ClassMembers(interfaces[i], locallevel);
+                ClassMembers cm = new ClassMembers(anInterface, locallevel);
                 cm.mapClass();
             }
             if (mappingClass.isClass()) {
@@ -370,14 +365,13 @@
          */
         private void addMembers(ClassDoc fromClass) {
             List<ProgramElementDoc> cdmembers = getClassMembers(fromClass, true);
-            List<ProgramElementDoc> incllist = new ArrayList<ProgramElementDoc>();
-            for (int i = 0; i < cdmembers.size(); i++) {
-                ProgramElementDoc pgmelem = cdmembers.get(i);
+            List<ProgramElementDoc> incllist = new ArrayList<>();
+            for (ProgramElementDoc pgmelem : cdmembers) {
                 if (!found(members, pgmelem) &&
                     memberIsVisible(pgmelem) &&
                     !isOverridden(pgmelem, level) &&
                     !isTreatedAsPrivate(pgmelem)) {
-                        incllist.add(pgmelem);
+                    incllist.add(pgmelem);
                 }
             }
             if (incllist.size() > 0) {
@@ -490,19 +484,18 @@
         private AnnotationTypeElementDoc[] filter(AnnotationTypeDoc doc,
             boolean required) {
             AnnotationTypeElementDoc[] members = doc.elements();
-            List<AnnotationTypeElementDoc> targetMembers = new ArrayList<AnnotationTypeElementDoc>();
-            for (int i = 0; i < members.length; i++) {
-                if ((required && members[i].defaultValue() == null) ||
-                     ((!required) && members[i].defaultValue() != null)){
-                    targetMembers.add(members[i]);
+            List<AnnotationTypeElementDoc> targetMembers = new ArrayList<>();
+            for (AnnotationTypeElementDoc member : members) {
+                if ((required && member.defaultValue() == null) ||
+                    ((!required) && member.defaultValue() != null)) {
+                    targetMembers.add(member);
                 }
             }
             return targetMembers.toArray(new AnnotationTypeElementDoc[]{});
         }
 
         private boolean found(List<ProgramElementDoc> list, ProgramElementDoc elem) {
-            for (int i = 0; i < list.size(); i++) {
-                ProgramElementDoc pgmelem = list.get(i);
+            for (ProgramElementDoc pgmelem : list) {
                 if (Util.matches(pgmelem, elem)) {
                     return true;
                 }
@@ -520,10 +513,7 @@
             Map<?,String> memberLevelMap = (Map<?,String>) memberNameMap.get(getMemberKey(pgmdoc));
             if (memberLevelMap == null)
                 return false;
-            String mappedlevel = null;
-            Iterator<String> iterator = memberLevelMap.values().iterator();
-            while (iterator.hasNext()) {
-                mappedlevel = iterator.next();
+            for (String mappedlevel : memberLevelMap.values()) {
                 if (mappedlevel.equals(STARTLEVEL) ||
                     (level.startsWith(mappedlevel) &&
                      !level.equals(mappedlevel))) {
@@ -541,7 +531,7 @@
                 return propertiesCache.get(cd);
             }
 
-            final List<MethodDoc> result = new ArrayList<MethodDoc>();
+            final List<MethodDoc> result = new ArrayList<>();
 
             for (final MethodDoc propertyMethod : allMethods) {
 
@@ -702,7 +692,7 @@
         private boolean isPropertyGetterOrSetter(MethodDoc[] members,
                                                  MethodDoc methodDoc) {
             boolean found = false;
-            String propertyName = Util.propertyNameFromMethodName(methodDoc.name());
+            String propertyName = Util.propertyNameFromMethodName(configuration, methodDoc.name());
             if (!propertyName.isEmpty()) {
                 String propertyMethodName = propertyName + "Property";
                 for (MethodDoc member: members) {
@@ -744,8 +734,7 @@
     }
 
     private ClassMember getClassMember(MethodDoc member) {
-        for (Iterator<?> iter = memberNameMap.keySet().iterator(); iter.hasNext();) {
-            Object key = iter.next();
+        for (Object key : memberNameMap.keySet()) {
             if (key instanceof String) {
                 continue;
             } else if (((ClassMember) key).isEqual(member)) {
--- a/langtools/src/share/classes/com/sun/tools/doclint/Checker.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclint/Checker.java	Wed Jul 05 19:26:54 2017 +0200
@@ -80,6 +80,7 @@
 import com.sun.source.util.TreePath;
 import com.sun.tools.doclint.HtmlTag.AttrKind;
 import com.sun.tools.javac.tree.DocPretty;
+import com.sun.tools.javac.util.StringUtils;
 import static com.sun.tools.doclint.Messages.Group.*;
 
 
@@ -243,7 +244,7 @@
         markEnclosingTag(Flag.HAS_TEXT);
         String name = tree.getName().toString();
         if (name.startsWith("#")) {
-            int v = name.toLowerCase().startsWith("#x")
+            int v = StringUtils.toLowerCase(name).startsWith("#x")
                     ? Integer.parseInt(name.substring(2), 16)
                     : Integer.parseInt(name.substring(1), 10);
             if (!Entity.isValid(v)) {
--- a/langtools/src/share/classes/com/sun/tools/doclint/DocLint.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclint/DocLint.java	Wed Jul 05 19:26:54 2017 +0200
@@ -257,8 +257,7 @@
 
     public void init(JavacTask task, String[] args, boolean addTaskListener) {
         env = new Env();
-        for (int i = 0; i < args.length; i++) {
-            String arg = args[i];
+        for (String arg : args) {
             if (arg.equals(XMSGS_OPTION)) {
                 env.messages.setOptions(null);
             } else if (arg.startsWith(XMSGS_CUSTOM_PREFIX)) {
@@ -307,7 +306,7 @@
                     }
                 }
 
-                Queue<CompilationUnitTree> todo = new LinkedList<CompilationUnitTree>();
+                Queue<CompilationUnitTree> todo = new LinkedList<>();
             };
 
             task.addTaskListener(tl);
--- a/langtools/src/share/classes/com/sun/tools/doclint/Entity.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclint/Entity.java	Wed Jul 05 19:26:54 2017 +0200
@@ -312,8 +312,8 @@
         return codes.containsKey(code) || ( 32 <= code && code < 2127);
     }
 
-    private static final Map<String,Entity> names = new HashMap<String,Entity>();
-    private static final Map<Integer,Entity> codes = new HashMap<Integer,Entity>();
+    private static final Map<String,Entity> names = new HashMap<>();
+    private static final Map<Integer,Entity> codes = new HashMap<>();
     static {
         for (Entity e: values()) {
             String name = e.name();
--- a/langtools/src/share/classes/com/sun/tools/doclint/Env.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclint/Env.java	Wed Jul 05 19:26:54 2017 +0200
@@ -44,6 +44,7 @@
 import com.sun.source.util.TreePath;
 import com.sun.tools.javac.model.JavacTypes;
 import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.util.StringUtils;
 
 /**
  * Utility container for current execution environment,
@@ -66,7 +67,7 @@
 
         static boolean accepts(String opt) {
             for (AccessKind g: values())
-                if (opt.equals(g.name().toLowerCase())) return true;
+                if (opt.equals(StringUtils.toLowerCase(g.name()))) return true;
             return false;
         }
 
@@ -80,7 +81,7 @@
             else
                 return AccessKind.PACKAGE;
         }
-    };
+    }
 
     /** Message handler. */
     final Messages messages;
@@ -139,7 +140,7 @@
     }
 
     void setCustomTags(String cTags) {
-        customTags = new LinkedHashSet<String>();
+        customTags = new LinkedHashSet<>();
         for (String s : cTags.split(DocLint.TAGS_SEPARATOR)) {
             if (!s.isEmpty())
                 customTags.add(s);
--- a/langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java	Wed Jul 05 19:26:54 2017 +0200
@@ -36,6 +36,7 @@
 import javax.lang.model.element.Name;
 
 import static com.sun.tools.doclint.HtmlTag.Attr.*;
+import com.sun.tools.javac.util.StringUtils;
 
 /**
  * Enum representing HTML tags.
@@ -290,7 +291,7 @@
         INLINE,
         LIST_ITEM,
         TABLE_ITEM,
-        OTHER;
+        OTHER
     }
 
     /**
@@ -299,7 +300,7 @@
     public static enum EndKind {
         NONE,
         OPTIONAL,
-        REQUIRED;
+        REQUIRED
     }
 
     public static enum Flag {
@@ -352,10 +353,10 @@
         WIDTH;
 
         public String getText() {
-            return toLowerCase(name());
+            return StringUtils.toLowerCase(name());
         }
 
-        static final Map<String,Attr> index = new HashMap<String,Attr>();
+        static final Map<String,Attr> index = new HashMap<>();
         static {
             for (Attr t: values()) {
                 index.put(t.getText(), t);
@@ -393,7 +394,7 @@
         this.blockType = blockType;
         this.endKind = endKind;
         this.flags = flags;
-        this.attrs = new EnumMap<Attr,AttrKind>(Attr.class);
+        this.attrs = new EnumMap<>(Attr.class);
         for (Map<Attr,AttrKind> m: attrMaps)
             this.attrs.putAll(m);
         attrs.put(Attr.CLASS, AttrKind.OK);
@@ -431,11 +432,11 @@
     }
 
     public String getText() {
-        return toLowerCase(name());
+        return StringUtils.toLowerCase(name());
     }
 
     public Attr getAttr(Name attrName) {
-        return Attr.index.get(toLowerCase(attrName.toString()));
+        return Attr.index.get(StringUtils.toLowerCase(attrName.toString()));
     }
 
     public AttrKind getAttrKind(Name attrName) {
@@ -449,7 +450,7 @@
         return map;
     }
 
-    private static final Map<String,HtmlTag> index = new HashMap<String,HtmlTag>();
+    private static final Map<String,HtmlTag> index = new HashMap<>();
     static {
         for (HtmlTag t: values()) {
             index.put(t.getText(), t);
@@ -457,10 +458,7 @@
     }
 
     static HtmlTag get(Name tagName) {
-        return index.get(toLowerCase(tagName.toString()));
+        return index.get(StringUtils.toLowerCase(tagName.toString()));
     }
 
-    private static String toLowerCase(String s) {
-        return s.toLowerCase(Locale.US);
-    }
 }
--- a/langtools/src/share/classes/com/sun/tools/doclint/Messages.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclint/Messages.java	Wed Jul 05 19:26:54 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -42,6 +42,7 @@
 import com.sun.source.doctree.DocTree;
 import com.sun.source.tree.Tree;
 import com.sun.tools.doclint.Env.AccessKind;
+import com.sun.tools.javac.util.StringUtils;
 
 /**
  * Message reporting for DocLint.
@@ -67,7 +68,7 @@
         SYNTAX,
         REFERENCE;
 
-        String optName() { return name().toLowerCase(); }
+        String optName() { return StringUtils.toLowerCase(name()); }
         String notOptName() { return "-" + optName(); }
 
         static boolean accepts(String opt) {
@@ -75,7 +76,7 @@
                 if (opt.equals(g.optName())) return true;
             return false;
         }
-    };
+    }
 
     private final Options options;
     private final Stats stats;
@@ -153,12 +154,12 @@
      * Handler for (sub)options specific to message handling.
      */
     static class Options {
-        Map<String, Env.AccessKind> map = new HashMap<String, Env.AccessKind>();
+        Map<String, Env.AccessKind> map = new HashMap<>();
         private final Stats stats;
 
         static boolean isValidOptions(String opts) {
             for (String opt: opts.split(",")) {
-                if (!isValidOption(opt.trim().toLowerCase()))
+                if (!isValidOption(StringUtils.toLowerCase(opt.trim())))
                     return false;
             }
             return true;
@@ -203,7 +204,7 @@
                 setOption(ALL, Env.AccessKind.PRIVATE);
             else {
                 for (String opt: opts.split(","))
-                    setOption(opt.trim().toLowerCase());
+                    setOption(StringUtils.toLowerCase(opt.trim()));
             }
         }
 
@@ -215,7 +216,7 @@
 
             int sep = arg.indexOf("/");
             if (sep > 0) {
-                Env.AccessKind ak = Env.AccessKind.valueOf(arg.substring(sep + 1).toUpperCase());
+                Env.AccessKind ak = Env.AccessKind.valueOf(StringUtils.toUpperCase(arg.substring(sep + 1)));
                 setOption(arg.substring(0, sep), ak);
             } else {
                 setOption(arg, null);
@@ -255,7 +256,7 @@
             if (b) {
                 groupCounts = new int[Messages.Group.values().length];
                 dkindCounts = new int[Diagnostic.Kind.values().length];
-                codeCounts = new HashMap<String, Integer>();
+                codeCounts = new HashMap<>();
             } else {
                 groupCounts = null;
                 dkindCounts = null;
@@ -290,7 +291,7 @@
             out.println("By diagnostic kind...");
             Table dkindTable = new Table();
             for (Diagnostic.Kind k : Diagnostic.Kind.values()) {
-                dkindTable.put(k.toString().toLowerCase(), dkindCounts[k.ordinal()]);
+                dkindTable.put(StringUtils.toLowerCase(k.toString()), dkindCounts[k.ordinal()]);
             }
             dkindTable.print(out);
             out.println();
@@ -320,7 +321,7 @@
                     return o2.compareTo(o1);
                 }
             };
-            private final TreeMap<Integer, Set<String>> map = new TreeMap<Integer, Set<String>>(DECREASING);
+            private final TreeMap<Integer, Set<String>> map = new TreeMap<>(DECREASING);
 
             void put(String label, int n) {
                 if (n == 0) {
@@ -328,7 +329,7 @@
                 }
                 Set<String> labels = map.get(n);
                 if (labels == null) {
-                    map.put(n, labels = new TreeSet<String>());
+                    map.put(n, labels = new TreeSet<>());
                 }
                 labels.add(label);
             }
--- a/langtools/src/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java	Wed Jul 05 19:26:54 2017 +0200
@@ -107,7 +107,7 @@
     Map<Class<?>, Boolean> trustedClasses;
 
     protected ClientCodeWrapper(Context context) {
-        trustedClasses = new HashMap<Class<?>, Boolean>();
+        trustedClasses = new HashMap<>();
     }
 
     public JavaFileManager wrap(JavaFileManager fm) {
@@ -136,7 +136,7 @@
     }
 
     public Iterable<JavaFileObject> wrapJavaFileObjects(Iterable<? extends JavaFileObject> list) {
-        List<JavaFileObject> wrapped = new ArrayList<JavaFileObject>();
+        List<JavaFileObject> wrapped = new ArrayList<>();
         for (JavaFileObject fo : list)
             wrapped.add(wrap(fo));
         return Collections.unmodifiableList(wrapped);
@@ -152,7 +152,7 @@
     public <T /*super JavaFileOject*/> DiagnosticListener<T> wrap(DiagnosticListener<T> dl) {
         if (isTrusted(dl))
             return dl;
-        return new WrappedDiagnosticListener<T>(dl);
+        return new WrappedDiagnosticListener<>(dl);
     }
 
     TaskListener wrap(TaskListener tl) {
@@ -169,7 +169,7 @@
     }
 
     Collection<TaskListener> unwrap(Collection<? extends TaskListener> listeners) {
-        Collection<TaskListener> c = new ArrayList<TaskListener>(listeners.size());
+        Collection<TaskListener> c = new ArrayList<>(listeners.size());
         for (TaskListener l: listeners)
             c.add(unwrap(l));
         return c;
@@ -218,9 +218,7 @@
                 return clientJavaFileManager.getClassLoader(location);
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -231,9 +229,7 @@
                 return wrapJavaFileObjects(clientJavaFileManager.list(location, packageName, kinds, recurse));
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -244,9 +240,7 @@
                 return clientJavaFileManager.inferBinaryName(location, unwrap(file));
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -257,9 +251,7 @@
                 return clientJavaFileManager.isSameFile(unwrap(a), unwrap(b));
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -270,9 +262,7 @@
                 return clientJavaFileManager.handleOption(current, remaining);
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -283,9 +273,7 @@
                 return clientJavaFileManager.hasLocation(location);
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -296,9 +284,7 @@
                 return wrap(clientJavaFileManager.getJavaFileForInput(location, className, kind));
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -309,9 +295,7 @@
                 return wrap(clientJavaFileManager.getJavaFileForOutput(location, className, kind, unwrap(sibling)));
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -322,9 +306,7 @@
                 return wrap(clientJavaFileManager.getFileForInput(location, packageName, relativeName));
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -335,9 +317,7 @@
                 return wrap(clientJavaFileManager.getFileForOutput(location, packageName, relativeName, unwrap(sibling)));
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -348,9 +328,7 @@
                 clientJavaFileManager.flush();
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -361,9 +339,7 @@
                 clientJavaFileManager.close();
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -374,9 +350,7 @@
                 return clientJavaFileManager.isSupportedOption(option);
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -400,9 +374,7 @@
                 return clientFileObject.toUri();
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -413,9 +385,7 @@
                 return clientFileObject.getName();
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -426,9 +396,7 @@
                 return clientFileObject.openInputStream();
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -439,9 +407,7 @@
                 return clientFileObject.openOutputStream();
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -452,9 +418,7 @@
                 return clientFileObject.openReader(ignoreEncodingErrors);
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -465,9 +429,7 @@
                 return clientFileObject.getCharContent(ignoreEncodingErrors);
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -478,9 +440,7 @@
                 return clientFileObject.openWriter();
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -491,9 +451,7 @@
                 return clientFileObject.getLastModified();
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -504,9 +462,7 @@
                 return clientFileObject.delete();
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -528,9 +484,7 @@
                 return ((JavaFileObject)clientFileObject).getKind();
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -541,9 +495,7 @@
                 return ((JavaFileObject)clientFileObject).isNameCompatible(simpleName, kind);
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -554,9 +506,7 @@
                 return ((JavaFileObject)clientFileObject).getNestingKind();
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -567,9 +517,7 @@
                 return ((JavaFileObject)clientFileObject).getAccessLevel();
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -593,9 +541,7 @@
                 clientDiagnosticListener.report(unwrap(diagnostic));
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -668,9 +614,7 @@
                 clientTaskListener.started(ev);
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
@@ -681,9 +625,7 @@
                 clientTaskListener.finished(ev);
             } catch (ClientCodeException e) {
                 throw e;
-            } catch (RuntimeException e) {
-                throw new ClientCodeException(e);
-            } catch (Error e) {
+            } catch (RuntimeException | Error e) {
                 throw new ClientCodeException(e);
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/javac/api/DiagnosticFormatter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/DiagnosticFormatter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -176,7 +176,7 @@
             /**
              * JLS paragraph this diagnostic might refer to (if applicable).
              */
-            JLS;
+            JLS
         }
 
         /**
@@ -212,7 +212,7 @@
              * Controls the maximum amount of subdiagnostics that are part of a
              * given multiline diagnostic.
              */
-            LENGTH;
+            LENGTH
         }
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Wed Jul 05 19:26:54 2017 +0200
@@ -105,7 +105,7 @@
     }
 
     static private String[] toArray(Iterable<String> iter) {
-        ListBuffer<String> result = new ListBuffer<String>();
+        ListBuffer<String> result = new ListBuffer<>();
         if (iter != null)
             for (String s : iter)
                 result.append(s);
@@ -115,7 +115,7 @@
     static private List<JavaFileObject> toList(Iterable<? extends JavaFileObject> fileObjects) {
         if (fileObjects == null)
             return List.nil();
-        ListBuffer<JavaFileObject> result = new ListBuffer<JavaFileObject>();
+        ListBuffer<JavaFileObject> result = new ListBuffer<>();
         for (JavaFileObject fo : fileObjects)
             result.append(fo);
         return result.toList();
@@ -124,7 +124,7 @@
     public Main.Result doCall() {
         if (!used.getAndSet(true)) {
             initContext();
-            notYetEntered = new HashMap<JavaFileObject, JCCompilationUnit>();
+            notYetEntered = new HashMap<>();
             compilerMain.setAPIMode(true);
             result = compilerMain.compile(args, classNames, context, fileObjects, processors);
             cleanup();
@@ -160,7 +160,7 @@
             initContext();
             compilerMain.log = Log.instance(context);
             compilerMain.setOptions(Options.instance(context));
-            compilerMain.filenames = new LinkedHashSet<File>();
+            compilerMain.filenames = new LinkedHashSet<>();
             Collection<File> filenames = compilerMain.processArgs(CommandLine.parse(args), classNames);
             if (filenames != null && !filenames.isEmpty())
                 throw new IllegalArgumentException("Malformed arguments " + toString(filenames, " "));
@@ -169,10 +169,10 @@
             compiler.genEndPos = true;
             // NOTE: this value will be updated after annotation processing
             compiler.initProcessAnnotations(processors);
-            notYetEntered = new HashMap<JavaFileObject, JCCompilationUnit>();
+            notYetEntered = new HashMap<>();
             for (JavaFileObject file: fileObjects)
                 notYetEntered.put(file, null);
-            genList = new ListBuffer<Env<AttrContext>>();
+            genList = new ListBuffer<>();
             // endContext will be called when all classes have been generated
             // TODO: should handle the case after each phase if errors have occurred
             args = null;
@@ -289,7 +289,7 @@
                     JCCompilationUnit unit = notYetEntered.remove(file);
                     if (unit != null) {
                         if (roots == null)
-                            roots = new ListBuffer<JCCompilationUnit>();
+                            roots = new ListBuffer<>();
                         roots.append(unit);
                     }
                 }
@@ -300,7 +300,7 @@
             for (CompilationUnitTree cu : trees) {
                 if (cu instanceof JCCompilationUnit) {
                     if (roots == null)
-                        roots = new ListBuffer<JCCompilationUnit>();
+                        roots = new ListBuffer<>();
                     roots.append((JCCompilationUnit)cu);
                     notYetEntered.remove(cu.getSourceFile());
                 }
@@ -318,7 +318,7 @@
             if (notYetEntered.isEmpty())
                 compiler = compiler.processAnnotations(units);
 
-            ListBuffer<TypeElement> elements = new ListBuffer<TypeElement>();
+            ListBuffer<TypeElement> elements = new ListBuffer<>();
             for (JCCompilationUnit unit : units) {
                 for (JCTree node : unit.defs) {
                     if (node.hasTag(JCTree.Tag.CLASSDEF)) {
@@ -358,7 +358,7 @@
     public Iterable<? extends Element> analyze(Iterable<? extends TypeElement> classes) throws IOException {
         enter(null);  // ensure all classes have been entered
 
-        final ListBuffer<Element> results = new ListBuffer<Element>();
+        final ListBuffer<Element> results = new ListBuffer<>();
         try {
             if (classes == null) {
                 handleFlowResults(compiler.flow(compiler.attribute(compiler.todo)), results);
@@ -414,7 +414,7 @@
      * @param classes a list of class elements
      */
     public Iterable<? extends JavaFileObject> generate(Iterable<? extends TypeElement> classes) throws IOException {
-        final ListBuffer<JavaFileObject> results = new ListBuffer<JavaFileObject>();
+        final ListBuffer<JavaFileObject> results = new ListBuffer<>();
         try {
             analyze(null);  // ensure all classes have been parsed, entered, and analyzed
 
@@ -468,7 +468,7 @@
 
     abstract class Filter {
         void run(Queue<Env<AttrContext>> list, Iterable<? extends TypeElement> classes) {
-            Set<TypeElement> set = new HashSet<TypeElement>();
+            Set<TypeElement> set = new HashSet<>();
             for (TypeElement item: classes)
                 set.add(item);
 
--- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java	Wed Jul 05 19:26:54 2017 +0200
@@ -398,7 +398,7 @@
             if (ref.paramTypes == null)
                 paramTypes = null;
             else {
-                ListBuffer<Type> lb = new ListBuffer<Type>();
+                ListBuffer<Type> lb = new ListBuffer<>();
                 for (List<JCTree> l = ref.paramTypes; l.nonEmpty(); l = l.tail) {
                     JCTree tree = l.head;
                     Type t = attr.attribType(tree, env);
--- a/langtools/src/share/classes/com/sun/tools/javac/api/MultiTaskListener.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/MultiTaskListener.java	Wed Jul 05 19:26:54 2017 +0200
@@ -42,8 +42,7 @@
  */
 public class MultiTaskListener implements TaskListener {
     /** The context key for the MultiTaskListener. */
-    public static final Context.Key<MultiTaskListener> taskListenerKey =
-        new Context.Key<MultiTaskListener>();
+    public static final Context.Key<MultiTaskListener> taskListenerKey = new Context.Key<>();
 
     /** Get the MultiTaskListener instance for this context. */
     public static MultiTaskListener instance(Context context) {
--- a/langtools/src/share/classes/com/sun/tools/javac/api/WrappingJavaFileManager.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/WrappingJavaFileManager.java	Wed Jul 05 19:26:54 2017 +0200
@@ -115,7 +115,7 @@
      * @return the mapping
      */
     protected Iterable<JavaFileObject> wrap(Iterable<JavaFileObject> fileObjects) {
-        List<JavaFileObject> mapped = new ArrayList<JavaFileObject>();
+        List<JavaFileObject> mapped = new ArrayList<>();
         for (JavaFileObject fileObject : fileObjects)
             mapped.add(wrap(fileObject));
         return Collections.unmodifiableList(mapped);
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java	Wed Jul 05 19:26:54 2017 +0200
@@ -64,7 +64,7 @@
         return false;
     }
 
-    public TypeAnnotationPosition getPosition() { return null; };
+    public TypeAnnotationPosition getPosition() { return null; }
 
     /** The value for an annotation element of primitive type or String. */
     public static class Constant extends Attribute {
@@ -226,8 +226,7 @@
         }
 
         public Map<MethodSymbol, Attribute> getElementValues() {
-            Map<MethodSymbol, Attribute> valmap =
-                new LinkedHashMap<MethodSymbol, Attribute>();
+            Map<MethodSymbol, Attribute> valmap = new LinkedHashMap<>();
             for (Pair<MethodSymbol, Attribute> value : values)
                 valmap.put(value.fst, value.snd);
             return valmap;
--- a/langtools/src/share/classes/com/sun/tools/javac/code/DeferredLintHandler.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/DeferredLintHandler.java	Wed Jul 05 19:26:54 2017 +0200
@@ -43,8 +43,7 @@
  * deletion without notice.</b>
  */
 public class DeferredLintHandler {
-    protected static final Context.Key<DeferredLintHandler> deferredLintHandlerKey =
-        new Context.Key<DeferredLintHandler>();
+    protected static final Context.Key<DeferredLintHandler> deferredLintHandlerKey = new Context.Key<>();
 
     public static DeferredLintHandler instance(Context context) {
         DeferredLintHandler instance = context.get(deferredLintHandlerKey);
@@ -67,7 +66,7 @@
     }
 
     private DiagnosticPosition currentPos;
-    private Map<DiagnosticPosition, ListBuffer<LintLogger>> loggersQueue = new HashMap<DiagnosticPosition, ListBuffer<LintLogger>>();
+    private Map<DiagnosticPosition, ListBuffer<LintLogger>> loggersQueue = new HashMap<>();
 
     /**Associate the given logger with the current position as set by {@link #setPos(DiagnosticPosition) }.
      * Will be invoked when {@link #flush(DiagnosticPosition) } will be invoked with the same position.
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java	Wed Jul 05 19:26:54 2017 +0200
@@ -29,10 +29,12 @@
 import java.util.EnumSet;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 
 import javax.lang.model.element.Modifier;
 
 import com.sun.tools.javac.util.Assert;
+import com.sun.tools.javac.util.StringUtils;
 
 /** Access flags and other modifiers for Java classes and members.
  *
@@ -321,8 +323,7 @@
     }
 
     // Cache of modifier sets.
-    private static final Map<Long, Set<Modifier>> modifierSets =
-        new java.util.concurrent.ConcurrentHashMap<Long, Set<Modifier>>(64);
+    private static final Map<Long, Set<Modifier>> modifierSets = new ConcurrentHashMap<>(64);
 
     public static boolean isStatic(Symbol symbol) {
         return (symbol.flags() & STATIC) != 0;
@@ -388,7 +389,7 @@
 
         Flag(long flag) {
             this.value = flag;
-            this.lowercaseName = name().toLowerCase();
+            this.lowercaseName = StringUtils.toLowerCase(name());
         }
 
         @Override
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Lint.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Lint.java	Wed Jul 05 19:26:54 2017 +0200
@@ -27,6 +27,8 @@
 
 import java.util.EnumSet;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.List;
@@ -44,7 +46,7 @@
 public class Lint
 {
     /** The context key for the root Lint object. */
-    protected static final Context.Key<Lint> lintKey = new Context.Key<Lint>();
+    protected static final Context.Key<Lint> lintKey = new Context.Key<>();
 
     /** Get the root Lint instance. */
     public static Lint instance(Context context) {
@@ -83,8 +85,7 @@
     private final EnumSet<LintCategory> values;
     private final EnumSet<LintCategory> suppressedValues;
 
-    private static final Map<String, LintCategory> map =
-            new java.util.concurrent.ConcurrentHashMap<String, LintCategory>(20);
+    private static final Map<String, LintCategory> map = new ConcurrentHashMap<>(20);
 
     protected Lint(Context context) {
         // initialize values according to the lint options
@@ -242,7 +243,7 @@
 
         public final String option;
         public final boolean hidden;
-    };
+    }
 
     /**
      * Checks if a warning category is enabled. A warning category may be enabled
@@ -341,5 +342,5 @@
 
         public void visitError(Attribute.Error e) {
         }
-    };
+    }
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Source.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Source.java	Wed Jul 05 19:26:54 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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,11 +67,13 @@
     /** 1.7 introduced try-with-resources, multi-catch, string switch, etc. */
     JDK1_7("1.7"),
 
-    /** 1.8 covers the to be determined language features that will be added in JDK 8. */
-    JDK1_8("1.8");
+    /** 1.8 lambda expressions and default methods. */
+    JDK1_8("1.8"),
 
-    private static final Context.Key<Source> sourceKey
-        = new Context.Key<Source>();
+    /** 1.9 covers the to be determined language features that will be added in JDK 9. */
+    JDK1_9("1.9");
+
+    private static final Context.Key<Source> sourceKey = new Context.Key<>();
 
     public static Source instance(Context context) {
         Source instance = context.get(sourceKey);
@@ -87,7 +89,7 @@
 
     public final String name;
 
-    private static final Map<String,Source> tab = new HashMap<String,Source>();
+    private static final Map<String,Source> tab = new HashMap<>();
     static {
         for (Source s : values()) {
             tab.put(s.name, s);
@@ -96,19 +98,21 @@
         tab.put("6", JDK1_6); // Make 6 an alias for 1.6
         tab.put("7", JDK1_7); // Make 7 an alias for 1.7
         tab.put("8", JDK1_8); // Make 8 an alias for 1.8
+        tab.put("9", JDK1_9); // Make 9 an alias for 1.9
     }
 
     private Source(String name) {
         this.name = name;
     }
 
-    public static final Source DEFAULT = JDK1_8;
+    public static final Source DEFAULT = JDK1_9;
 
     public static Source lookup(String name) {
         return tab.get(name);
     }
 
     public Target requiredTarget() {
+        if (this.compareTo(JDK1_9) >= 0) return Target.JDK1_9;
         if (this.compareTo(JDK1_8) >= 0) return Target.JDK1_8;
         if (this.compareTo(JDK1_7) >= 0) return Target.JDK1_7;
         if (this.compareTo(JDK1_6) >= 0) return Target.JDK1_6;
@@ -203,6 +207,9 @@
     public boolean allowDefaultMethods() {
         return compareTo(JDK1_8) >= 0;
     }
+    public boolean allowDefaultMethodsResolution() {
+        return compareTo(JDK1_7) >= 0;
+    }
     public boolean allowStaticInterfaceMethods() {
         return compareTo(JDK1_8) >= 0;
     }
@@ -243,6 +250,8 @@
             return RELEASE_7;
         case JDK1_8:
             return RELEASE_8;
+        case JDK1_9:
+            return RELEASE_9;
         default:
             return null;
         }
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Wed Jul 05 19:26:54 2017 +0200
@@ -1541,7 +1541,7 @@
                 if (paramNames == null || paramNames.size() != type.getParameterTypes().size()) {
                     paramNames = List.nil();
                 }
-                ListBuffer<VarSymbol> buf = new ListBuffer<VarSymbol>();
+                ListBuffer<VarSymbol> buf = new ListBuffer<>();
                 List<Name> remaining = paramNames;
                 // assert: remaining and paramNames are both empty or both
                 // have same cardinality as type.getParameterTypes()
--- a/langtools/src/share/classes/com/sun/tools/javac/code/SymbolMetadata.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/SymbolMetadata.java	Wed Jul 05 19:26:54 2017 +0200
@@ -180,7 +180,7 @@
                 // are introduced, because PlaceHolder is a subtype of TypeCompound.
                 T res;
                 @SuppressWarnings("unchecked")
-                T ph = (T) new Placeholder<T>(ctx, lb.toList(), sym);
+                T ph = (T) new Placeholder<>(ctx, lb.toList(), sym);
                 res = ph;
                 buf = buf.prepend(res);
                 atLeastOneRepeated = true;
@@ -244,7 +244,7 @@
         attributes = filterDeclSentinels(attributes);
 
         if (l.isEmpty()) {
-            ; // no-op
+            // no-op
         } else if (attributes.isEmpty()) {
             attributes = l;
         } else {
@@ -255,7 +255,7 @@
 
     public SymbolMetadata appendUniqueTypes(List<Attribute.TypeCompound> l) {
         if (l.isEmpty()) {
-            ; // no-op
+            // no-op
         } else if (type_attributes.isEmpty()) {
             type_attributes = l;
         } else {
@@ -271,7 +271,7 @@
 
     public SymbolMetadata appendInitTypeAttributes(List<Attribute.TypeCompound> l) {
         if (l.isEmpty()) {
-            ; // no-op
+            // no-op
         } else if (init_type_attributes.isEmpty()) {
             init_type_attributes = l;
         } else {
@@ -282,7 +282,7 @@
 
     public SymbolMetadata appendClassInitTypeAttributes(List<Attribute.TypeCompound> l) {
         if (l.isEmpty()) {
-            ; // no-op
+            // no-op
         } else if (clinit_type_attributes.isEmpty()) {
             clinit_type_attributes = l;
         } else {
@@ -295,7 +295,7 @@
         attributes = filterDeclSentinels(attributes);
 
         if (l.isEmpty()) {
-            ; // no-op
+            // no-op
         } else if (attributes.isEmpty()) {
             attributes = l;
         } else {
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java	Wed Jul 05 19:26:54 2017 +0200
@@ -51,8 +51,7 @@
  */
 public class Symtab {
     /** The context key for the symbol table. */
-    protected static final Context.Key<Symtab> symtabKey =
-        new Context.Key<Symtab>();
+    protected static final Context.Key<Symtab> symtabKey = new Context.Key<>();
 
     /** Get the symbol table instance. */
     public static Symtab instance(Context context) {
@@ -190,20 +189,20 @@
 
     /** A set containing all operator names.
      */
-    public final Set<Name> operatorNames = new HashSet<Name>();
+    public final Set<Name> operatorNames = new HashSet<>();
 
     /** A hashtable containing the encountered top-level and member classes,
      *  indexed by flat names. The table does not contain local classes.
      *  It should be updated from the outside to reflect classes defined
      *  by compiled source files.
      */
-    public final Map<Name, ClassSymbol> classes = new HashMap<Name, ClassSymbol>();
+    public final Map<Name, ClassSymbol> classes = new HashMap<>();
 
     /** A hashtable containing the encountered packages.
      *  the table should be updated from outside to reflect packages defined
      *  by compiled source files.
      */
-    public final Map<Name, PackageSymbol> packages = new HashMap<Name, PackageSymbol>();
+    public final Map<Name, PackageSymbol> packages = new HashMap<>();
 
     public void initType(Type type, ClassSymbol c) {
         type.tsym = c;
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	Wed Jul 05 19:26:54 2017 +0200
@@ -1450,7 +1450,7 @@
             /** lower bounds */
             LOWER,
             /** equality constraints */
-            EQ;
+            EQ
         }
 
         /** inference variable bounds */
@@ -1472,7 +1472,7 @@
 
         public UndetVar(TypeVar origin, Types types) {
             super(UNDETVAR, origin);
-            bounds = new EnumMap<InferenceBound, List<Type>>(InferenceBound.class);
+            bounds = new EnumMap<>(InferenceBound.class);
             List<Type> declaredBounds = types.getBounds(origin);
             declaredCount = declaredBounds.length();
             bounds.put(InferenceBound.UPPER, declaredBounds);
--- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Wed Jul 05 19:26:54 2017 +0200
@@ -82,8 +82,7 @@
  * and determine the TypeAnnotationPositions for all type annotations.
  */
 public class TypeAnnotations {
-    protected static final Context.Key<TypeAnnotations> typeAnnosKey =
-        new Context.Key<TypeAnnotations>();
+    protected static final Context.Key<TypeAnnotations> typeAnnosKey = new Context.Key<>();
 
     public static TypeAnnotations instance(Context context) {
         TypeAnnotations instance = context.get(typeAnnosKey);
@@ -155,7 +154,7 @@
         new TypeAnnotationPositions(false).scan(tree);
     }
 
-    public enum AnnotationType { DECLARATION, TYPE, BOTH };
+    public enum AnnotationType { DECLARATION, TYPE, BOTH }
 
     /**
      * Determine whether an annotation is a declaration annotation,
@@ -286,9 +285,9 @@
         private void separateAnnotationsKinds(JCTree typetree, Type type, Symbol sym,
                 TypeAnnotationPosition pos) {
             List<Attribute.Compound> annotations = sym.getRawAttributes();
-            ListBuffer<Attribute.Compound> declAnnos = new ListBuffer<Attribute.Compound>();
-            ListBuffer<Attribute.TypeCompound> typeAnnos = new ListBuffer<Attribute.TypeCompound>();
-            ListBuffer<Attribute.TypeCompound> onlyTypeAnnos = new ListBuffer<Attribute.TypeCompound>();
+            ListBuffer<Attribute.Compound> declAnnos = new ListBuffer<>();
+            ListBuffer<Attribute.TypeCompound> typeAnnos = new ListBuffer<>();
+            ListBuffer<Attribute.TypeCompound> onlyTypeAnnos = new ListBuffer<>();
 
             for (Attribute.Compound a : annotations) {
                 switch (annotationType(a, sym)) {
@@ -351,7 +350,7 @@
                     MethodType methType = sym.owner.type.asMethodType();
                     List<VarSymbol> params = ((MethodSymbol)sym.owner).params;
                     List<Type> oldArgs = methType.argtypes;
-                    ListBuffer<Type> newArgs = new ListBuffer<Type>();
+                    ListBuffer<Type> newArgs = new ListBuffer<>();
                     while (params.nonEmpty()) {
                         if (params.head == sym) {
                             newArgs.add(type);
@@ -1224,8 +1223,7 @@
         private void copyNewClassAnnotationsToOwner(JCNewClass tree) {
             Symbol sym = tree.def.sym;
             TypeAnnotationPosition pos = new TypeAnnotationPosition();
-            ListBuffer<Attribute.TypeCompound> newattrs =
-                new ListBuffer<Attribute.TypeCompound>();
+            ListBuffer<Attribute.TypeCompound> newattrs = new ListBuffer<>();
 
             for (Attribute.TypeCompound old : sym.getRawTypeAttributes()) {
                 newattrs.append(new Attribute.TypeCompound(old.type, old.values,
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Wed Jul 05 19:26:54 2017 +0200
@@ -75,8 +75,7 @@
  * deletion without notice.</b>
  */
 public class Types {
-    protected static final Context.Key<Types> typesKey =
-        new Context.Key<Types>();
+    protected static final Context.Key<Types> typesKey = new Context.Key<>();
 
     final Symtab syms;
     final JavacMessages messages;
@@ -84,7 +83,6 @@
     final boolean allowBoxing;
     final boolean allowCovariantReturns;
     final boolean allowObjectToPrimitiveCast;
-    final boolean allowDefaultMethods;
     final ClassReader reader;
     final Check chk;
     final Enter enter;
@@ -111,7 +109,6 @@
         allowBoxing = source.allowBoxing();
         allowCovariantReturns = source.allowCovariantReturns();
         allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast();
-        allowDefaultMethods = source.allowDefaultMethods();
         reader = ClassReader.instance(context);
         chk = Check.instance(context);
         enter = Enter.instance(context);
@@ -247,8 +244,8 @@
                 Type base = asSuper(sym.type, t.tsym);
                 if (base == null)
                     return null;
-                ListBuffer<Type> from = new ListBuffer<Type>();
-                ListBuffer<Type> to = new ListBuffer<Type>();
+                ListBuffer<Type> from = new ListBuffer<>();
+                ListBuffer<Type> to = new ListBuffer<>();
                 try {
                     adapt(base, t, from, to);
                 } catch (AdaptFailure ex) {
@@ -257,7 +254,7 @@
                 Type res = subst(sym.type, from.toList(), to.toList());
                 if (!isSubtype(res, t))
                     return null;
-                ListBuffer<Type> openVars = new ListBuffer<Type>();
+                ListBuffer<Type> openVars = new ListBuffer<>();
                 for (List<Type> l = sym.type.allparams();
                      l.nonEmpty(); l = l.tail)
                     if (res.contains(l.head) && !t.contains(l.head))
@@ -269,7 +266,7 @@
                     } else {
                         // Unbound type arguments default to ?
                         List<Type> opens = openVars.toList();
-                        ListBuffer<Type> qs = new ListBuffer<Type>();
+                        ListBuffer<Type> qs = new ListBuffer<>();
                         for (List<Type> iter = opens; iter.nonEmpty(); iter = iter.tail) {
                             qs.append(new WildcardType(syms.objectType, BoundKind.UNBOUND, syms.boundClass, (TypeVar) iter.head.unannotatedType()));
                         }
@@ -347,7 +344,7 @@
      */
     class DescriptorCache {
 
-        private WeakHashMap<TypeSymbol, Entry> _map = new WeakHashMap<TypeSymbol, Entry>();
+        private WeakHashMap<TypeSymbol, Entry> _map = new WeakHashMap<>();
 
         class FunctionDescriptor {
             Symbol descSym;
@@ -727,7 +724,7 @@
                    !overridesObjectMethod(origin, sym) &&
                    (interfaceCandidates(origin.type, (MethodSymbol)sym).head.flags() & DEFAULT) == 0;
        }
-    };
+    }
 
     // <editor-fold defaultstate="collapsed" desc="isSubtype">
     /**
@@ -864,7 +861,7 @@
                  }
             }
 
-            private Set<TypePair> cache = new HashSet<TypePair>();
+            private Set<TypePair> cache = new HashSet<>();
 
             private boolean containsTypeRecursive(Type t, Type s) {
                 TypePair pair = new TypePair(t, s);
@@ -1144,7 +1141,7 @@
                     if (!visit(supertype(t), supertype(s)))
                         return false;
 
-                    HashSet<UniqueType> set = new HashSet<UniqueType>();
+                    HashSet<UniqueType> set = new HashSet<>();
                     for (Type x : interfaces(t))
                         set.add(new UniqueType(x.unannotatedType(), Types.this));
                     for (Type x : interfaces(s)) {
@@ -1232,9 +1229,9 @@
             protected boolean containsTypes(List<Type> ts1, List<Type> ts2) {
                 return containsTypeEquivalent(ts1, ts2);
             }
-        };
-
-        /**
+        }
+
+    /**
          * Strict type-equality relation - type variables are considered
          * equals if they share the same object identity.
          */
@@ -1707,7 +1704,7 @@
     // where
         private TypeRelation disjointType = new TypeRelation() {
 
-            private Set<TypePair> cache = new HashSet<TypePair>();
+            private Set<TypePair> cache = new HashSet<>();
 
             @Override
             public Boolean visitType(Type t, Type s) {
@@ -2446,7 +2443,7 @@
     // </editor-fold>
 
     // <editor-fold defaultstate="collapsed" desc="isDerivedRaw">
-    Map<Type,Boolean> isDerivedRawCache = new HashMap<Type,Boolean>();
+    Map<Type,Boolean> isDerivedRawCache = new HashMap<>();
 
     public boolean isDerivedRaw(Type t) {
         Boolean result = isDerivedRawCache.get(t);
@@ -2608,8 +2605,7 @@
     // <editor-fold defaultstate="collapsed" desc="Determining method implementation in given site">
     class ImplementationCache {
 
-        private WeakHashMap<MethodSymbol, SoftReference<Map<TypeSymbol, Entry>>> _map =
-                new WeakHashMap<MethodSymbol, SoftReference<Map<TypeSymbol, Entry>>>();
+        private WeakHashMap<MethodSymbol, SoftReference<Map<TypeSymbol, Entry>>> _map = new WeakHashMap<>();
 
         class Entry {
             final MethodSymbol cachedImpl;
@@ -2638,8 +2634,8 @@
             SoftReference<Map<TypeSymbol, Entry>> ref_cache = _map.get(ms);
             Map<TypeSymbol, Entry> cache = ref_cache != null ? ref_cache.get() : null;
             if (cache == null) {
-                cache = new HashMap<TypeSymbol, Entry>();
-                _map.put(ms, new SoftReference<Map<TypeSymbol, Entry>>(cache));
+                cache = new HashMap<>();
+                _map.put(ms, new SoftReference<>(cache));
             }
             Entry e = cache.get(origin);
             CompoundScope members = membersClosure(origin.type, true);
@@ -2681,8 +2677,7 @@
     // <editor-fold defaultstate="collapsed" desc="compute transitive closure of all members in given site">
     class MembersClosureCache extends SimpleVisitor<CompoundScope, Boolean> {
 
-        private WeakHashMap<TypeSymbol, Entry> _map =
-                new WeakHashMap<TypeSymbol, Entry>();
+        private WeakHashMap<TypeSymbol, Entry> _map = new WeakHashMap<>();
 
         class Entry {
             final boolean skipInterfaces;
@@ -2800,7 +2795,7 @@
                             s.isInheritedIn(site.tsym, Types.this) &&
                             overrideEquivalent(memberType(site, s), memberType(site, msym));
                 }
-            };
+            }
     // </editor-fold>
 
     /**
@@ -2856,9 +2851,9 @@
             public Boolean visitErrorType(ErrorType t, Type s) {
                 return false;
             }
-        };
-
-        TypeRelation hasSameArgs_strict = new HasSameArgs(true);
+        }
+
+    TypeRelation hasSameArgs_strict = new HasSameArgs(true);
         TypeRelation hasSameArgs_nonstrict = new HasSameArgs(false);
 
     // </editor-fold>
@@ -3301,7 +3296,7 @@
      * (that is, subclasses come first, arbitrary but fixed
      * otherwise).
      */
-    private Map<Type,List<Type>> closureCache = new HashMap<Type,List<Type>>();
+    private Map<Type,List<Type>> closureCache = new HashMap<>();
 
     /**
      * Returns the closure of a class or interface type.
@@ -3404,13 +3399,13 @@
                     && isSameType(t2, typePair.t2);
             }
         }
-        Set<TypePair> mergeCache = new HashSet<TypePair>();
+        Set<TypePair> mergeCache = new HashSet<>();
         private Type merge(Type c1, Type c2) {
             ClassType class1 = (ClassType) c1;
             List<Type> act1 = class1.getTypeArguments();
             ClassType class2 = (ClassType) c2;
             List<Type> act2 = class2.getTypeArguments();
-            ListBuffer<Type> merged = new ListBuffer<Type>();
+            ListBuffer<Type> merged = new ListBuffer<>();
             List<Type> typarams = class1.tsym.type.getTypeArguments();
 
             while (act1.nonEmpty() && act2.nonEmpty() && typarams.nonEmpty()) {
@@ -4090,7 +4085,7 @@
         Adapter(ListBuffer<Type> from, ListBuffer<Type> to) {
             this.from = from;
             this.to = to;
-            mapping = new HashMap<Symbol,Type>();
+            mapping = new HashMap<>();
         }
 
         public void adapt(Type source, Type target) throws AdaptFailure {
@@ -4159,7 +4154,7 @@
             return null;
         }
 
-        private Set<TypePair> cache = new HashSet<TypePair>();
+        private Set<TypePair> cache = new HashSet<>();
 
         private void adaptRecursive(Type source, Type target) {
             TypePair pair = new TypePair(source, target);
@@ -4233,7 +4228,7 @@
 
         @Override
         public Type visitClassType(ClassType t, Void s) {
-            ListBuffer<Type> rewritten = new ListBuffer<Type>();
+            ListBuffer<Type> rewritten = new ListBuffer<>();
             boolean changed = false;
             for (Type arg : t.allparams()) {
                 Type bound = visit(arg);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Wed Jul 05 19:26:54 2017 +0200
@@ -49,8 +49,7 @@
  *  deletion without notice.</b>
  */
 public class Annotate {
-    protected static final Context.Key<Annotate> annotateKey =
-        new Context.Key<Annotate>();
+    protected static final Context.Key<Annotate> annotateKey = new Context.Key<>();
 
     public static Annotate instance(Context context) {
         Annotate instance = context.get(annotateKey);
@@ -88,11 +87,11 @@
 
     private int enterCount = 0;
 
-    ListBuffer<Worker> q = new ListBuffer<Worker>();
-    ListBuffer<Worker> typesQ = new ListBuffer<Worker>();
-    ListBuffer<Worker> repeatedQ = new ListBuffer<Worker>();
-    ListBuffer<Worker> afterRepeatedQ = new ListBuffer<Worker>();
-    ListBuffer<Worker> validateQ = new ListBuffer<Worker>();
+    ListBuffer<Worker> q = new ListBuffer<>();
+    ListBuffer<Worker> typesQ = new ListBuffer<>();
+    ListBuffer<Worker> repeatedQ = new ListBuffer<>();
+    ListBuffer<Worker> afterRepeatedQ = new ListBuffer<>();
+    ListBuffer<Worker> validateQ = new ListBuffer<>();
 
     public void earlier(Worker a) {
         q.prepend(a);
@@ -352,7 +351,7 @@
             if (na.elemtype != null) {
                 log.error(na.elemtype.pos(), "new.not.allowed.in.annotation");
             }
-            ListBuffer<Attribute> buf = new ListBuffer<Attribute>();
+            ListBuffer<Attribute> buf = new ListBuffer<>();
             for (List<JCExpression> l = na.elems; l.nonEmpty(); l=l.tail) {
                 buf.append(enterAttributeValue(types.elemtype(expected),
                                                l.head,
@@ -510,7 +509,7 @@
             TreeMaker m = make.at(ctx.pos.get(firstOccurrence));
             Pair<MethodSymbol, Attribute> p =
                     new Pair<MethodSymbol, Attribute>(containerValueSymbol,
-                                                      new Attribute.Array(arrayOfOrigAnnoType, repeated));
+                               new Attribute.Array(arrayOfOrigAnnoType, repeated));
             if (ctx.isTypeCompound) {
                 /* TODO: the following code would be cleaner:
                 Attribute.TypeCompound at = new Attribute.TypeCompound(targetContainerType, List.of(p),
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Wed Jul 05 19:26:54 2017 +0200
@@ -73,8 +73,7 @@
  *  deletion without notice.</b>
  */
 public class Attr extends JCTree.Visitor {
-    protected static final Context.Key<Attr> attrKey =
-        new Context.Key<Attr>();
+    protected static final Context.Key<Attr> attrKey = new Context.Key<>();
 
     final Names names;
     final Log log;
@@ -668,7 +667,7 @@
     /** Attribute a list of expressions, returning a list of types.
      */
     List<Type> attribExprs(List<JCExpression> trees, Env<AttrContext> env, Type pt) {
-        ListBuffer<Type> ts = new ListBuffer<Type>();
+        ListBuffer<Type> ts = new ListBuffer<>();
         for (List<JCExpression> l = trees; l.nonEmpty(); l = l.tail)
             ts.append(attribExpr(l.head, env, pt));
         return ts.toList();
@@ -702,7 +701,7 @@
      *  Caller is responsible for calling checkRefTypes.
      */
     List<Type> attribAnyTypes(List<JCExpression> trees, Env<AttrContext> env) {
-        ListBuffer<Type> argtypes = new ListBuffer<Type>();
+        ListBuffer<Type> argtypes = new ListBuffer<>();
         for (List<JCExpression> l = trees; l.nonEmpty(); l = l.tail)
             argtypes.append(attribType(l.head, env));
         return argtypes.toList();
@@ -1238,7 +1237,7 @@
 
             // Attribute all cases and
             // check that there are no duplicate case labels or default clauses.
-            Set<Object> labels = new HashSet<Object>(); // The set of case labels.
+            Set<Object> labels = new HashSet<>(); // The set of case labels.
             boolean hasDefault = false;      // Is there a default label?
             for (List<JCCase> l = tree.cases; l.nonEmpty(); l = l.tail) {
                 JCCase c = l.head;
@@ -2590,15 +2589,61 @@
             }
         }
 
+        /* Map to hold 'fake' clinit methods. If a lambda is used to initialize a
+         * static field and that lambda has type annotations, these annotations will
+         * also be stored at these fake clinit methods.
+         *
+         * LambdaToMethod also use fake clinit methods so they can be reused.
+         * Also as LTM is a phase subsequent to attribution, the methods from
+         * clinits can be safely removed by LTM to save memory.
+         */
+        private Map<ClassSymbol, MethodSymbol> clinits = new HashMap<>();
+
+        public MethodSymbol removeClinit(ClassSymbol sym) {
+            return clinits.remove(sym);
+        }
+
+        /* This method returns an environment to be used to attribute a lambda
+         * expression.
+         *
+         * The owner of this environment is a method symbol. If the current owner
+         * is not a method, for example if the lambda is used to initialize
+         * a field, then if the field is:
+         *
+         * - an instance field, we use the first constructor.
+         * - a static field, we create a fake clinit method.
+         */
         private Env<AttrContext> lambdaEnv(JCLambda that, Env<AttrContext> env) {
             Env<AttrContext> lambdaEnv;
             Symbol owner = env.info.scope.owner;
             if (owner.kind == VAR && owner.owner.kind == TYP) {
                 //field initializer
                 lambdaEnv = env.dup(that, env.info.dup(env.info.scope.dupUnshared()));
-                lambdaEnv.info.scope.owner =
-                    new MethodSymbol((owner.flags() & STATIC) | BLOCK, names.empty, null,
-                                     env.info.scope.owner);
+                ClassSymbol enclClass = owner.enclClass();
+                /* if the field isn't static, then we can get the first constructor
+                 * and use it as the owner of the environment. This is what
+                 * LTM code is doing to look for type annotations so we are fine.
+                 */
+                if ((owner.flags() & STATIC) == 0) {
+                    for (Symbol s : enclClass.members_field.getElementsByName(names.init)) {
+                        lambdaEnv.info.scope.owner = s;
+                        break;
+                    }
+                } else {
+                    /* if the field is static then we need to create a fake clinit
+                     * method, this method can later be reused by LTM.
+                     */
+                    MethodSymbol clinit = clinits.get(enclClass);
+                    if (clinit == null) {
+                        Type clinitType = new MethodType(List.<Type>nil(),
+                                syms.voidType, List.<Type>nil(), syms.methodClass);
+                        clinit = new MethodSymbol(STATIC | SYNTHETIC | PRIVATE,
+                                names.clinit, clinitType, enclClass);
+                        clinit.params = List.<VarSymbol>nil();
+                        clinits.put(enclClass, clinit);
+                    }
+                    lambdaEnv.info.scope.owner = clinit;
+                }
             } else {
                 lambdaEnv = env.dup(that, env.info.dup(env.info.scope.dup()));
             }
@@ -3769,7 +3814,7 @@
             Resolve.InapplicableSymbolError errSym = rs.new InapplicableSymbolError(null) {
                 @Override
                 protected Pair<Symbol, JCDiagnostic> errCandidate() {
-                    return new Pair<Symbol, JCDiagnostic>(sym, diag);
+                    return new Pair<>(sym, diag);
                 }
             };
             List<Type> argtypes2 = Type.map(argtypes,
@@ -3922,7 +3967,7 @@
     }
 
     Type checkIntersection(JCTree tree, List<JCExpression> bounds) {
-        Set<Type> boundSet = new HashSet<Type>();
+        Set<Type> boundSet = new HashSet<>();
         if (bounds.nonEmpty()) {
             // accept class or interface or typevar as first bound.
             bounds.head.type = checkBase(bounds.head.type, bounds.head, env, false, false, false);
@@ -4527,7 +4572,7 @@
                         if (at.getAnnotations().size() == 1) {
                             log.error(at.underlyingType.pos(), "cant.type.annotate.scoping.1", at.getAnnotations().head.attribute);
                         } else {
-                            ListBuffer<Attribute.Compound> comps = new ListBuffer<Attribute.Compound>();
+                            ListBuffer<Attribute.Compound> comps = new ListBuffer<>();
                             for (JCAnnotation an : at.getAnnotations()) {
                                 comps.add(an.attribute);
                             }
@@ -4588,7 +4633,7 @@
                 }
             }
         }
-    };
+    }
 
     // <editor-fold desc="post-attribution visitor">
 
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Wed Jul 05 19:26:54 2017 +0200
@@ -64,8 +64,7 @@
  *  deletion without notice.</b>
  */
 public class Check {
-    protected static final Context.Key<Check> checkKey =
-        new Context.Key<Check>();
+    protected static final Context.Key<Check> checkKey = new Context.Key<>();
 
     private final Names names;
     private final Log log;
@@ -191,7 +190,7 @@
     /** A table mapping flat names of all compiled classes in this run to their
      *  symbols; maintained from outside.
      */
-    public Map<Name,ClassSymbol> compiled = new HashMap<Name, ClassSymbol>();
+    public Map<Name,ClassSymbol> compiled = new HashMap<>();
 
     /** A handler for messages about deprecated usage.
      */
@@ -937,7 +936,7 @@
             List<Type> actuals = type.allparams();
             List<Type> args = type.getTypeArguments();
             List<Type> forms = type.tsym.type.getTypeArguments();
-            ListBuffer<Type> bounds_buf = new ListBuffer<Type>();
+            ListBuffer<Type> bounds_buf = new ListBuffer<>();
 
             // For matching pairs of actual argument types `a' and
             // formal type parameters with declared bound `b' ...
@@ -1169,7 +1168,7 @@
             boolean specialized;
             SpecialTreeVisitor() {
                 this.specialized = false;
-            };
+            }
 
             @Override
             public void visitTree(JCTree tree) { /* no-op */ }
@@ -1818,13 +1817,13 @@
      *  @returns symbol from t2 that conflicts with one in t1.
      */
     private Symbol firstIncompatibility(DiagnosticPosition pos, Type t1, Type t2, Type site) {
-        Map<TypeSymbol,Type> interfaces1 = new HashMap<TypeSymbol,Type>();
+        Map<TypeSymbol,Type> interfaces1 = new HashMap<>();
         closure(t1, interfaces1);
         Map<TypeSymbol,Type> interfaces2;
         if (t1 == t2)
             interfaces2 = interfaces1;
         else
-            closure(t2, interfaces1, interfaces2 = new HashMap<TypeSymbol,Type>());
+            closure(t2, interfaces1, interfaces2 = new HashMap<>());
 
         for (Type t3 : interfaces1.values()) {
             for (Type t4 : interfaces2.values()) {
@@ -1904,7 +1903,7 @@
     }
     //WHERE
     boolean checkCommonOverriderIn(Symbol s1, Symbol s2, Type site) {
-        Map<TypeSymbol,Type> supertypes = new HashMap<TypeSymbol,Type>();
+        Map<TypeSymbol,Type> supertypes = new HashMap<>();
         Type st1 = types.memberType(site, s1);
         Type st2 = types.memberType(site, s2);
         closure(site, supertypes);
@@ -2846,14 +2845,14 @@
         if (containerTarget == null) {
             containerTargets = getDefaultTargetSet();
         } else {
-            containerTargets = new HashSet<Name>();
-        for (Attribute app : containerTarget.values) {
-            if (!(app instanceof Attribute.Enum)) {
-                continue; // recovery
+            containerTargets = new HashSet<>();
+            for (Attribute app : containerTarget.values) {
+                if (!(app instanceof Attribute.Enum)) {
+                    continue; // recovery
+                }
+                Attribute.Enum e = (Attribute.Enum)app;
+                containerTargets.add(e.value.name);
             }
-            Attribute.Enum e = (Attribute.Enum)app;
-            containerTargets.add(e.value.name);
-        }
         }
 
         Set<Name> containedTargets;
@@ -2861,14 +2860,14 @@
         if (containedTarget == null) {
             containedTargets = getDefaultTargetSet();
         } else {
-            containedTargets = new HashSet<Name>();
-        for (Attribute app : containedTarget.values) {
-            if (!(app instanceof Attribute.Enum)) {
-                continue; // recovery
+            containedTargets = new HashSet<>();
+            for (Attribute app : containedTarget.values) {
+                if (!(app instanceof Attribute.Enum)) {
+                    continue; // recovery
+                }
+                Attribute.Enum e = (Attribute.Enum)app;
+                containedTargets.add(e.value.name);
             }
-            Attribute.Enum e = (Attribute.Enum)app;
-            containedTargets.add(e.value.name);
-        }
         }
 
         if (!isTargetSubsetOf(containerTargets, containedTargets)) {
@@ -2879,7 +2878,7 @@
     /* get a set of names for the default target */
     private Set<Name> getDefaultTargetSet() {
         if (defaultTargets == null) {
-            Set<Name> targets = new HashSet<Name>();
+            Set<Name> targets = new HashSet<>();
             targets.add(names.ANNOTATION_TYPE);
             targets.add(names.CONSTRUCTOR);
             targets.add(names.FIELD);
@@ -3078,7 +3077,7 @@
     private boolean validateAnnotation(JCAnnotation a) {
         boolean isValid = true;
         // collect an inventory of the annotation elements
-        Set<MethodSymbol> members = new LinkedHashSet<MethodSymbol>();
+        Set<MethodSymbol> members = new LinkedHashSet<>();
         for (Scope.Entry e = a.annotationType.type.tsym.members().elems;
                 e != null;
                 e = e.sibling)
@@ -3128,7 +3127,7 @@
         JCTree rhs = assign.rhs;
         if (!rhs.hasTag(NEWARRAY)) return false;
         JCNewArray na = (JCNewArray) rhs;
-        Set<Symbol> targets = new HashSet<Symbol>();
+        Set<Symbol> targets = new HashSet<>();
         for (JCTree elem : na.elems) {
             if (!targets.add(TreeInfo.symbol(elem))) {
                 isValid = false;
@@ -3246,7 +3245,7 @@
      *  constructors.
      */
     void checkCyclicConstructors(JCClassDecl tree) {
-        Map<Symbol,Symbol> callMap = new HashMap<Symbol, Symbol>();
+        Map<Symbol,Symbol> callMap = new HashMap<>();
 
         // enter each constructor this-call into the map
         for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/CompileStates.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/CompileStates.java	Wed Jul 05 19:26:54 2017 +0200
@@ -39,8 +39,7 @@
  */
 public class CompileStates extends HashMap<Env<AttrContext>, CompileStates.CompileState> {
     /** The context key for the compile states. */
-    protected static final Context.Key<CompileStates> compileStatesKey =
-        new Context.Key<CompileStates>();
+    protected static final Context.Key<CompileStates> compileStatesKey = new Context.Key<>();
 
     /** Get the CompileStates instance for this context. */
     public static CompileStates instance(Context context) {
@@ -74,7 +73,7 @@
             return a.value > b.value ? a : b;
         }
         private final int value;
-    };
+    }
 
     private static final long serialVersionUID = 1812267524140424433L;
 
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/ConstFold.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/ConstFold.java	Wed Jul 05 19:26:54 2017 +0200
@@ -42,8 +42,7 @@
  *  deletion without notice.</b>
  */
 strictfp class ConstFold {
-    protected static final Context.Key<ConstFold> constFoldKey =
-        new Context.Key<ConstFold>();
+    protected static final Context.Key<ConstFold> constFoldKey = new Context.Key<>();
 
     private Symtab syms;
 
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Wed Jul 05 19:26:54 2017 +0200
@@ -63,8 +63,7 @@
  *  deletion without notice.</b>
  */
 public class DeferredAttr extends JCTree.Visitor {
-    protected static final Context.Key<DeferredAttr> deferredAttrKey =
-        new Context.Key<DeferredAttr>();
+    protected static final Context.Key<DeferredAttr> deferredAttrKey = new Context.Key<>();
 
     final Attr attr;
     final Check chk;
@@ -147,8 +146,7 @@
          */
         class SpeculativeCache {
 
-            private Map<Symbol, List<Entry>> cache =
-                    new WeakHashMap<Symbol, List<Entry>>();
+            private Map<Symbol, List<Entry>> cache = new WeakHashMap<>();
 
             class Entry {
                 JCTree speculativeTree;
@@ -335,7 +333,7 @@
         /**
          * This is the plain type-checking mode. Produces side-effects on the underlying AST node
          */
-        CHECK;
+        CHECK
     }
 
     /**
@@ -345,7 +343,7 @@
      * disabled during speculative type-checking.
      */
     JCTree attribSpeculative(JCTree tree, Env<AttrContext> env, ResultInfo resultInfo) {
-        final JCTree newTree = new TreeCopier<Object>(make).copy(tree);
+        final JCTree newTree = new TreeCopier<>(make).copy(tree);
         Env<AttrContext> speculativeEnv = env.dup(newTree, env.info.dup(env.info.scope.dupUnshared()));
         speculativeEnv.info.scope.owner = env.info.scope.owner;
         Log.DeferredDiagnosticHandler deferredDiagnosticHandler =
@@ -362,7 +360,7 @@
                         }
                         super.scan(tree);
                     }
-                };
+                }
                 PosScanner posScanner = new PosScanner();
                 posScanner.scan(newTree);
                 return posScanner.found;
@@ -425,7 +423,7 @@
         final Warner warn;
 
         /** list of deferred attribution nodes to be processed */
-        ArrayList<DeferredAttrNode> deferredAttrNodes = new ArrayList<DeferredAttrNode>();
+        ArrayList<DeferredAttrNode> deferredAttrNodes = new ArrayList<>();
 
         DeferredAttrContext(AttrMode mode, Symbol msym, MethodResolutionPhase phase,
                 InferenceContext inferenceContext, DeferredAttrContext parent, Warner warn) {
@@ -454,7 +452,7 @@
          */
         void complete() {
             while (!deferredAttrNodes.isEmpty()) {
-                Map<Type, Set<Type>> depVarsMap = new LinkedHashMap<Type, Set<Type>>();
+                Map<Type, Set<Type>> depVarsMap = new LinkedHashMap<>();
                 List<Type> stuckVars = List.nil();
                 boolean progress = false;
                 //scan a defensive copy of the node list - this is because a deferred
@@ -470,7 +468,7 @@
                                 .intersect(inferenceContext.restvars())) {
                             Set<Type> prevDeps = depVarsMap.get(t);
                             if (prevDeps == null) {
-                                prevDeps = new LinkedHashSet<Type>();
+                                prevDeps = new LinkedHashSet<>();
                                 depVarsMap.put(t, prevDeps);
                             }
                             prevDeps.addAll(restStuckVars);
@@ -815,8 +813,8 @@
 
         Type pt;
         Infer.InferenceContext inferenceContext;
-        Set<Type> stuckVars = new LinkedHashSet<Type>();
-        Set<Type> depVars = new LinkedHashSet<Type>();
+        Set<Type> stuckVars = new LinkedHashSet<>();
+        Set<Type> depVars = new LinkedHashSet<>();
 
         @Override
         public boolean isStuck() {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -90,8 +90,7 @@
  *  deletion without notice.</b>
  */
 public class Enter extends JCTree.Visitor {
-    protected static final Context.Key<Enter> enterKey =
-        new Context.Key<Enter>();
+    protected static final Context.Key<Enter> enterKey = new Context.Key<>();
 
     Log log;
     Symtab syms;
@@ -147,8 +146,7 @@
     /** A hashtable mapping classes and packages to the environments current
      *  at the points of their definitions.
      */
-    Map<TypeSymbol,Env<AttrContext>> typeEnvs =
-            new HashMap<TypeSymbol,Env<AttrContext>>();
+    Map<TypeSymbol,Env<AttrContext>> typeEnvs = new HashMap<>();
 
     /** Accessor for typeEnvs
      */
@@ -207,7 +205,7 @@
      *  @param tree     The toplevel tree.
      */
     Env<AttrContext> topLevelEnv(JCCompilationUnit tree) {
-        Env<AttrContext> localEnv = new Env<AttrContext>(tree, new AttrContext());
+        Env<AttrContext> localEnv = new Env<>(tree, new AttrContext());
         localEnv.toplevel = tree;
         localEnv.enclClass = predefClassDef;
         tree.namedImportScope = new ImportScope(tree.packge);
@@ -218,7 +216,7 @@
     }
 
     public Env<AttrContext> getTopLevelEnv(JCCompilationUnit tree) {
-        Env<AttrContext> localEnv = new Env<AttrContext>(tree, new AttrContext());
+        Env<AttrContext> localEnv = new Env<>(tree, new AttrContext());
         localEnv.toplevel = tree;
         localEnv.enclClass = predefClassDef;
         localEnv.info.scope = tree.namedImportScope;
@@ -271,7 +269,7 @@
     /** Visitor method: enter classes of a list of trees, returning a list of types.
      */
     <T extends JCTree> List<Type> classEnter(List<T> trees, Env<AttrContext> env) {
-        ListBuffer<Type> ts = new ListBuffer<Type>();
+        ListBuffer<Type> ts = new ListBuffer<>();
         for (List<T> l = trees; l.nonEmpty(); l = l.tail) {
             Type t = classEnter(l.head, env);
             if (t != null)
@@ -483,7 +481,7 @@
     public void complete(List<JCCompilationUnit> trees, ClassSymbol c) {
         annotate.enterStart();
         ListBuffer<ClassSymbol> prevUncompleted = uncompleted;
-        if (memberEnter.completionEnabled) uncompleted = new ListBuffer<ClassSymbol>();
+        if (memberEnter.completionEnabled) uncompleted = new ListBuffer<>();
 
         try {
             // enter all classes, and construct uncompleted list
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Env.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Env.java	Wed Jul 05 19:26:54 2017 +0200
@@ -92,7 +92,7 @@
      *  and copying all other fields.
      */
     public Env<A> dup(JCTree tree, A info) {
-        return dupto(new Env<A>(tree, info));
+        return dupto(new Env<>(tree, info));
     }
 
     /** Duplicate this environment into a given Environment,
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Wed Jul 05 19:26:54 2017 +0200
@@ -181,8 +181,7 @@
  *  deletion without notice.</b>
  */
 public class Flow {
-    protected static final Context.Key<Flow> flowKey =
-        new Context.Key<Flow>();
+    protected static final Context.Key<Flow> flowKey = new Context.Key<>();
 
     private final Names names;
     private final Log log;
@@ -449,7 +448,7 @@
             ListBuffer<PendingExit> pendingExitsPrev = pendingExits;
             Lint lintPrev = lint;
 
-            pendingExits = new ListBuffer<PendingExit>();
+            pendingExits = new ListBuffer<>();
             lint = lint.augment(tree.sym);
 
             try {
@@ -498,7 +497,7 @@
                     log.error(TreeInfo.diagEndPos(tree.body), "missing.ret.stmt");
 
                 List<PendingExit> exits = pendingExits.toList();
-                pendingExits = new ListBuffer<PendingExit>();
+                pendingExits = new ListBuffer<>();
                 while (exits.nonEmpty()) {
                     PendingExit exit = exits.head;
                     exits = exits.tail;
@@ -527,7 +526,7 @@
 
         public void visitDoLoop(JCDoWhileLoop tree) {
             ListBuffer<PendingExit> prevPendingExits = pendingExits;
-            pendingExits = new ListBuffer<PendingExit>();
+            pendingExits = new ListBuffer<>();
             scanStat(tree.body);
             alive |= resolveContinues(tree);
             scan(tree.cond);
@@ -537,7 +536,7 @@
 
         public void visitWhileLoop(JCWhileLoop tree) {
             ListBuffer<PendingExit> prevPendingExits = pendingExits;
-            pendingExits = new ListBuffer<PendingExit>();
+            pendingExits = new ListBuffer<>();
             scan(tree.cond);
             alive = !tree.cond.type.isFalse();
             scanStat(tree.body);
@@ -549,7 +548,7 @@
         public void visitForLoop(JCForLoop tree) {
             ListBuffer<PendingExit> prevPendingExits = pendingExits;
             scanStats(tree.init);
-            pendingExits = new ListBuffer<PendingExit>();
+            pendingExits = new ListBuffer<>();
             if (tree.cond != null) {
                 scan(tree.cond);
                 alive = !tree.cond.type.isFalse();
@@ -567,7 +566,7 @@
             visitVarDef(tree.var);
             ListBuffer<PendingExit> prevPendingExits = pendingExits;
             scan(tree.expr);
-            pendingExits = new ListBuffer<PendingExit>();
+            pendingExits = new ListBuffer<>();
             scanStat(tree.body);
             alive |= resolveContinues(tree);
             resolveBreaks(tree, prevPendingExits);
@@ -576,14 +575,14 @@
 
         public void visitLabelled(JCLabeledStatement tree) {
             ListBuffer<PendingExit> prevPendingExits = pendingExits;
-            pendingExits = new ListBuffer<PendingExit>();
+            pendingExits = new ListBuffer<>();
             scanStat(tree.body);
             alive |= resolveBreaks(tree, prevPendingExits);
         }
 
         public void visitSwitch(JCSwitch tree) {
             ListBuffer<PendingExit> prevPendingExits = pendingExits;
-            pendingExits = new ListBuffer<PendingExit>();
+            pendingExits = new ListBuffer<>();
             scan(tree.selector);
             boolean hasDefault = false;
             for (List<JCCase> l = tree.cases; l.nonEmpty(); l = l.tail) {
@@ -610,7 +609,7 @@
 
         public void visitTry(JCTry tree) {
             ListBuffer<PendingExit> prevPendingExits = pendingExits;
-            pendingExits = new ListBuffer<PendingExit>();
+            pendingExits = new ListBuffer<>();
             for (JCTree resource : tree.resources) {
                 if (resource instanceof JCVariableDecl) {
                     JCVariableDecl vdecl = (JCVariableDecl) resource;
@@ -741,7 +740,7 @@
             try {
                 attrEnv = env;
                 Flow.this.make = make;
-                pendingExits = new ListBuffer<PendingExit>();
+                pendingExits = new ListBuffer<>();
                 alive = true;
                 scan(tree);
             } finally {
@@ -846,7 +845,7 @@
             ListBuffer<FlowPendingExit> pendingExitsPrev = pendingExits;
             Lint lintPrev = lint;
 
-            pendingExits = new ListBuffer<FlowPendingExit>();
+            pendingExits = new ListBuffer<>();
             if (tree.name != names.empty) {
                 caught = List.nil();
             }
@@ -951,7 +950,7 @@
                 scan(tree.body);
 
                 List<FlowPendingExit> exits = pendingExits.toList();
-                pendingExits = new ListBuffer<FlowPendingExit>();
+                pendingExits = new ListBuffer<>();
                 while (exits.nonEmpty()) {
                     FlowPendingExit exit = exits.head;
                     exits = exits.tail;
@@ -986,7 +985,7 @@
 
         public void visitDoLoop(JCDoWhileLoop tree) {
             ListBuffer<FlowPendingExit> prevPendingExits = pendingExits;
-            pendingExits = new ListBuffer<FlowPendingExit>();
+            pendingExits = new ListBuffer<>();
             scan(tree.body);
             resolveContinues(tree);
             scan(tree.cond);
@@ -995,7 +994,7 @@
 
         public void visitWhileLoop(JCWhileLoop tree) {
             ListBuffer<FlowPendingExit> prevPendingExits = pendingExits;
-            pendingExits = new ListBuffer<FlowPendingExit>();
+            pendingExits = new ListBuffer<>();
             scan(tree.cond);
             scan(tree.body);
             resolveContinues(tree);
@@ -1005,7 +1004,7 @@
         public void visitForLoop(JCForLoop tree) {
             ListBuffer<FlowPendingExit> prevPendingExits = pendingExits;
             scan(tree.init);
-            pendingExits = new ListBuffer<FlowPendingExit>();
+            pendingExits = new ListBuffer<>();
             if (tree.cond != null) {
                 scan(tree.cond);
             }
@@ -1019,7 +1018,7 @@
             visitVarDef(tree.var);
             ListBuffer<FlowPendingExit> prevPendingExits = pendingExits;
             scan(tree.expr);
-            pendingExits = new ListBuffer<FlowPendingExit>();
+            pendingExits = new ListBuffer<>();
             scan(tree.body);
             resolveContinues(tree);
             resolveBreaks(tree, prevPendingExits);
@@ -1027,14 +1026,14 @@
 
         public void visitLabelled(JCLabeledStatement tree) {
             ListBuffer<FlowPendingExit> prevPendingExits = pendingExits;
-            pendingExits = new ListBuffer<FlowPendingExit>();
+            pendingExits = new ListBuffer<>();
             scan(tree.body);
             resolveBreaks(tree, prevPendingExits);
         }
 
         public void visitSwitch(JCSwitch tree) {
             ListBuffer<FlowPendingExit> prevPendingExits = pendingExits;
-            pendingExits = new ListBuffer<FlowPendingExit>();
+            pendingExits = new ListBuffer<>();
             scan(tree.selector);
             for (List<JCCase> l = tree.cases; l.nonEmpty(); l = l.tail) {
                 JCCase c = l.head;
@@ -1060,7 +1059,7 @@
             }
 
             ListBuffer<FlowPendingExit> prevPendingExits = pendingExits;
-            pendingExits = new ListBuffer<FlowPendingExit>();
+            pendingExits = new ListBuffer<>();
             for (JCTree resource : tree.resources) {
                 if (resource instanceof JCVariableDecl) {
                     JCVariableDecl vdecl = (JCVariableDecl) resource;
@@ -1270,7 +1269,7 @@
                 thrown = List.nil();
                 scan(tree.body);
                 List<FlowPendingExit> exits = pendingExits.toList();
-                pendingExits = new ListBuffer<FlowPendingExit>();
+                pendingExits = new ListBuffer<>();
                 while (exits.nonEmpty()) {
                     FlowPendingExit exit = exits.head;
                     exits = exits.tail;
@@ -1307,8 +1306,8 @@
             try {
                 attrEnv = env;
                 Flow.this.make = make;
-                pendingExits = new ListBuffer<FlowPendingExit>();
-                preciseRethrowTypes = new HashMap<Symbol, List<Type>>();
+                pendingExits = new ListBuffer<>();
+                preciseRethrowTypes = new HashMap<>();
                 this.thrown = this.caught = null;
                 this.classDef = null;
                 scan(tree);
@@ -1461,9 +1460,19 @@
             this.names = names;
         }
 
+        private boolean isInitialConstructor = false;
+
         @Override
         protected void markDead(JCTree tree) {
-            inits.inclRange(returnadr, nextadr);
+            if (!isInitialConstructor) {
+                inits.inclRange(returnadr, nextadr);
+            } else {
+                for (int address = returnadr; address < nextadr; address++) {
+                    if (!(isFinalUninitializedStaticField(vardecls[address].sym))) {
+                        inits.incl(address);
+                    }
+                }
+            }
             uninits.inclRange(returnadr, nextadr);
         }
 
@@ -1476,8 +1485,17 @@
             return
                 sym.pos >= startPos &&
                 ((sym.owner.kind == MTH ||
-                 ((sym.flags() & (FINAL | HASINIT | PARAMETER)) == FINAL &&
-                  classDef.sym.isEnclosedBy((ClassSymbol)sym.owner))));
+                isFinalUninitializedField(sym)));
+        }
+
+        boolean isFinalUninitializedField(VarSymbol sym) {
+            return sym.owner.kind == TYP &&
+                   ((sym.flags() & (FINAL | HASINIT | PARAMETER)) == FINAL &&
+                   classDef.sym.isEnclosedBy((ClassSymbol)sym.owner));
+        }
+
+        boolean isFinalUninitializedStaticField(VarSymbol sym) {
+            return isFinalUninitializedField(sym) && sym.isStatic();
         }
 
         /** Initialize new trackable variable by setting its address field
@@ -1651,7 +1669,7 @@
             int nextadrPrev = nextadr;
             ListBuffer<P> pendingExitsPrev = pendingExits;
 
-            pendingExits = new ListBuffer<P>();
+            pendingExits = new ListBuffer<>();
             if (tree.name != names.empty) {
                 firstadr = nextadr;
             }
@@ -1731,10 +1749,9 @@
             int returnadrPrev = returnadr;
 
             Assert.check(pendingExits.isEmpty());
-
+            boolean lastInitialConstructor = isInitialConstructor;
             try {
-                boolean isInitialConstructor =
-                    TreeInfo.isInitialConstructor(tree);
+                isInitialConstructor = TreeInfo.isInitialConstructor(tree);
 
                 if (!isInitialConstructor) {
                     firstadr = nextadr;
@@ -1789,6 +1806,7 @@
                 nextadr = nextadrPrev;
                 firstadr = firstadrPrev;
                 returnadr = returnadrPrev;
+                isInitialConstructor = lastInitialConstructor;
             }
         }
 
@@ -1826,7 +1844,7 @@
             flowKind = FlowKind.NORMAL;
             final Bits initsSkip = new Bits(true);
             final Bits uninitsSkip = new Bits(true);
-            pendingExits = new ListBuffer<P>();
+            pendingExits = new ListBuffer<>();
             int prevErrors = getLogNumberOfErrors();
             do {
                 final Bits uninitsEntry = new Bits(uninits);
@@ -1896,7 +1914,7 @@
             scan(tree.init);
             final Bits initsSkip = new Bits(true);
             final Bits uninitsSkip = new Bits(true);
-            pendingExits = new ListBuffer<P>();
+            pendingExits = new ListBuffer<>();
             int prevErrors = getLogNumberOfErrors();
             do {
                 final Bits uninitsEntry = new Bits(uninits);
@@ -1946,7 +1964,7 @@
             final Bits uninitsStart = new Bits(uninits);
 
             letInit(tree.pos(), tree.var.sym);
-            pendingExits = new ListBuffer<P>();
+            pendingExits = new ListBuffer<>();
             int prevErrors = getLogNumberOfErrors();
             do {
                 final Bits uninitsEntry = new Bits(uninits);
@@ -1969,7 +1987,7 @@
 
         public void visitLabelled(JCLabeledStatement tree) {
             ListBuffer<P> prevPendingExits = pendingExits;
-            pendingExits = new ListBuffer<P>();
+            pendingExits = new ListBuffer<>();
             scan(tree.body);
             resolveBreaks(tree, prevPendingExits);
         }
@@ -2219,7 +2237,7 @@
             ListBuffer<P> prevPending = pendingExits;
             try {
                 returnadr = nextadr;
-                pendingExits = new ListBuffer<P>();
+                pendingExits = new ListBuffer<>();
                 for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) {
                     JCVariableDecl def = l.head;
                     scan(def);
@@ -2676,7 +2694,7 @@
             try {
                 attrEnv = env;
                 Flow.this.make = make;
-                pendingExits = new ListBuffer<PendingExit>();
+                pendingExits = new ListBuffer<>();
                 scan(tree);
             } finally {
                 pendingExits = null;
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Wed Jul 05 19:26:54 2017 +0200
@@ -62,8 +62,7 @@
  *  deletion without notice.</b>
  */
 public class Infer {
-    protected static final Context.Key<Infer> inferKey =
-        new Context.Key<Infer>();
+    protected static final Context.Key<Infer> inferKey = new Context.Key<>();
 
     Resolve rs;
     Check chk;
@@ -510,9 +509,9 @@
                     uv.listener = null;
                 }
             }
-        };
+        }
 
-        /** max number of incorporation rounds */
+    /** max number of incorporation rounds */
         static final int MAX_INCORPORATION_STEPS = 100;
 
     /**
@@ -893,8 +892,7 @@
     }
 
     /** an incorporation cache keeps track of all executed incorporation-related operations */
-    Map<IncorporationBinaryOp, Boolean> incorporationCache =
-            new HashMap<IncorporationBinaryOp, Boolean>();
+    Map<IncorporationBinaryOp, Boolean> incorporationCache = new HashMap<>();
 
     /**
      * Make sure that the upper bounds we got so far lead to a solvable inference
@@ -927,7 +925,7 @@
                 return !t.isErroneous() && !inferenceContext.free(t) &&
                         !t.hasTag(BOT);
             }
-        };
+        }
 
     /**
      * This enumeration defines all possible bound-checking related errors.
@@ -1045,7 +1043,7 @@
             if (g.nodes.isEmpty()) {
                 //should not happen
                 throw new NodeNotFoundException(g);
-            };
+            }
             return g.nodes.get(0);
         }
 
@@ -1111,16 +1109,15 @@
                 //cache miss
                 if (n.isLeaf()) {
                     //if leaf, stop
-                    cachedPath = new Pair<List<Node>, Integer>(List.of(n), n.data.length());
+                    cachedPath = new Pair<>(List.of(n), n.data.length());
                 } else {
                     //if non-leaf, proceed recursively
-                    Pair<List<Node>, Integer> path = new Pair<List<Node>, Integer>(List.of(n), n.data.length());
+                    Pair<List<Node>, Integer> path = new Pair<>(List.of(n), n.data.length());
                     for (Node n2 : n.getAllDependencies()) {
                         if (n2 == n) continue;
                         Pair<List<Node>, Integer> subpath = computeTreeToLeafs(n2);
-                        path = new Pair<List<Node>, Integer>(
-                                path.fst.prependList(subpath.fst),
-                                path.snd + subpath.snd);
+                        path = new Pair<>(path.fst.prependList(subpath.fst),
+                                          path.snd + subpath.snd);
                     }
                     cachedPath = path;
                 }
@@ -1131,12 +1128,10 @@
         }
 
         /** cache used to avoid redundant computation of tree costs */
-        final Map<Node, Pair<List<Node>, Integer>> treeCache =
-                new HashMap<Node, Pair<List<Node>, Integer>>();
+        final Map<Node, Pair<List<Node>, Integer>> treeCache = new HashMap<>();
 
         /** constant value used to mark non-existent paths */
-        final Pair<List<Node>, Integer> noPath =
-                new Pair<List<Node>, Integer>(null, Integer.MAX_VALUE);
+        final Pair<List<Node>, Integer> noPath = new Pair<>(null, Integer.MAX_VALUE);
 
         /**
          * Pick the leaf that minimize cost
@@ -1460,7 +1455,7 @@
 
                 Node(Type ivar) {
                     super(ListBuffer.of(ivar));
-                    this.deps = new EnumMap<DependencyKind, Set<Node>>(DependencyKind.class);
+                    this.deps = new EnumMap<>(DependencyKind.class);
                 }
 
                 @Override
@@ -1502,7 +1497,7 @@
                  * Retrieves all dependencies with given kind(s).
                  */
                 protected Set<Node> getDependencies(DependencyKind... depKinds) {
-                    Set<Node> buf = new LinkedHashSet<Node>();
+                    Set<Node> buf = new LinkedHashSet<>();
                     for (DependencyKind dk : depKinds) {
                         Set<Node> depsByKind = deps.get(dk);
                         if (depsByKind != null) {
@@ -1518,7 +1513,7 @@
                 protected void addDependency(DependencyKind dk, Node depToAdd) {
                     Set<Node> depsByKind = deps.get(dk);
                     if (depsByKind == null) {
-                        depsByKind = new LinkedHashSet<Node>();
+                        depsByKind = new LinkedHashSet<>();
                         deps.put(dk, depsByKind);
                     }
                     depsByKind.add(depToAdd);
@@ -1554,11 +1549,11 @@
                  */
                 protected Set<Node> closure(DependencyKind... depKinds) {
                     boolean progress = true;
-                    Set<Node> closure = new HashSet<Node>();
+                    Set<Node> closure = new HashSet<>();
                     closure.add(this);
                     while (progress) {
                         progress = false;
-                        for (Node n1 : new HashSet<Node>(closure)) {
+                        for (Node n1 : new HashSet<>(closure)) {
                             progress = closure.addAll(n1.getDependencies(depKinds));
                         }
                     }
@@ -1595,12 +1590,12 @@
                         }
                     }
                     //update deps
-                    EnumMap<DependencyKind, Set<Node>> deps2 = new EnumMap<DependencyKind, Set<Node>>(DependencyKind.class);
+                    EnumMap<DependencyKind, Set<Node>> deps2 = new EnumMap<>(DependencyKind.class);
                     for (DependencyKind dk : DependencyKind.values()) {
                         for (Node d : getDependencies(dk)) {
                             Set<Node> depsByKind = deps2.get(dk);
                             if (depsByKind == null) {
-                                depsByKind = new LinkedHashSet<Node>();
+                                depsByKind = new LinkedHashSet<>();
                                 deps2.put(dk, depsByKind);
                             }
                             if (data.contains(d.data.first())) {
@@ -1674,7 +1669,7 @@
              */
             void initNodes(Map<Type, Set<Type>> stuckDeps) {
                 //add nodes
-                nodes = new ArrayList<Node>();
+                nodes = new ArrayList<>();
                 for (Type t : inferenceContext.restvars()) {
                     nodes.add(new Node(t));
                 }
@@ -1696,7 +1691,7 @@
                     }
                 }
                 //merge cyclic nodes
-                ArrayList<Node> acyclicNodes = new ArrayList<Node>();
+                ArrayList<Node> acyclicNodes = new ArrayList<>();
                 for (List<? extends Node> conSubGraph : GraphUtils.tarjan(nodes)) {
                     if (conSubGraph.length() > 1) {
                         Node root = conSubGraph.head;
@@ -1753,8 +1748,7 @@
         /** list of inference vars in this context */
         List<Type> inferencevars;
 
-        java.util.Map<FreeTypeListener, List<Type>> freeTypeListeners =
-                new java.util.HashMap<FreeTypeListener, List<Type>>();
+        Map<FreeTypeListener, List<Type>> freeTypeListeners = new HashMap<>();
 
         List<FreeTypeListener> freetypeListeners = List.nil();
 
@@ -1946,7 +1940,7 @@
         void notifyChange(List<Type> inferredVars) {
             InferenceException thrownEx = null;
             for (Map.Entry<FreeTypeListener, List<Type>> entry :
-                    new HashMap<FreeTypeListener, List<Type>>(freeTypeListeners).entrySet()) {
+                    new HashMap<>(freeTypeListeners).entrySet()) {
                 if (!Type.containsAny(entry.getValue(), inferencevars.diff(inferredVars))) {
                     try {
                         entry.getKey().typesInferred(this);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Wed Jul 05 19:26:54 2017 +0200
@@ -106,8 +106,7 @@
     public static final int FLAG_BRIDGES = 1 << 2;
 
     // <editor-fold defaultstate="collapsed" desc="Instantiating">
-    protected static final Context.Key<LambdaToMethod> unlambdaKey =
-            new Context.Key<LambdaToMethod>();
+    protected static final Context.Key<LambdaToMethod> unlambdaKey = new Context.Key<>();
 
     public static LambdaToMethod instance(Context context) {
         LambdaToMethod instance = context.get(unlambdaKey);
@@ -161,7 +160,7 @@
         private KlassInfo(JCClassDecl clazz) {
             this.clazz = clazz;
             appendedMethodList = new ListBuffer<>();
-            deserializeCases = new HashMap<String, ListBuffer<JCStatement>>();
+            deserializeCases = new HashMap<>();
             MethodType type = new MethodType(List.of(syms.serializedLambdaType), syms.objectType,
                     List.<Type>nil(), syms.methodClass);
             deserMethodSym = makePrivateSyntheticMethod(STATIC, names.deserializeLambda, type, clazz.sym);
@@ -204,7 +203,7 @@
         this.make = make;
         this.attrEnv = env;
         this.context = null;
-        this.contextMap = new HashMap<JCTree, TranslationContext<?>>();
+        this.contextMap = new HashMap<>();
         return translate(cdef);
     }
     // </editor-fold>
@@ -261,8 +260,8 @@
 
         {
             Symbol owner = localContext.owner;
-            ListBuffer<Attribute.TypeCompound> ownerTypeAnnos = new ListBuffer<Attribute.TypeCompound>();
-            ListBuffer<Attribute.TypeCompound> lambdaTypeAnnos = new ListBuffer<Attribute.TypeCompound>();
+            ListBuffer<Attribute.TypeCompound> ownerTypeAnnos = new ListBuffer<>();
+            ListBuffer<Attribute.TypeCompound> lambdaTypeAnnos = new ListBuffer<>();
 
             for (Attribute.TypeCompound tc : owner.getRawTypeAttributes()) {
                 if (tc.position.onLambda == tree) {
@@ -1147,12 +1146,11 @@
          * maps for fake clinit symbols to be used as owners of lambda occurring in
          * a static var init context
          */
-        private Map<ClassSymbol, Symbol> clinits =
-                new HashMap<ClassSymbol, Symbol>();
+        private Map<ClassSymbol, Symbol> clinits = new HashMap<>();
 
         private JCClassDecl analyzeAndPreprocessClass(JCClassDecl tree) {
             frameStack = List.nil();
-            localClassDefs = new HashMap<Symbol, JCClassDecl>();
+            localClassDefs = new HashMap<>();
             return translate(tree);
         }
 
@@ -1180,7 +1178,7 @@
             try {
                 log.useSource(tree.sym.sourcefile);
                 syntheticMethodNameCounts = new SyntheticMethodNameCounter();
-                prevClinits = new HashMap<ClassSymbol, Symbol>();
+                prevClinits = new HashMap<>();
                 if (tree.sym.owner.kind == MTH) {
                     localClassDefs.put(tree.sym, tree);
                 }
@@ -1352,7 +1350,7 @@
                 // Build lambda parameters
                 // partially cloned from TreeMaker.Params until 8014021 is fixed
                 Symbol owner = owner();
-                ListBuffer<JCVariableDecl> paramBuff = new ListBuffer<JCVariableDecl>();
+                ListBuffer<JCVariableDecl> paramBuff = new ListBuffer<>();
                 int i = 0;
                 for (List<Type> l = ptypes; l.nonEmpty(); l = l.tail) {
                     JCVariableDecl param = make.Param(make.paramName(i++), l.head, owner);
@@ -1474,12 +1472,27 @@
         private Symbol initSym(ClassSymbol csym, long flags) {
             boolean isStatic = (flags & STATIC) != 0;
             if (isStatic) {
-                //static clinits are generated in Gen - so we need to fake them
-                Symbol clinit = clinits.get(csym);
+                /* static clinits are generated in Gen, so we need to use a fake
+                 * one. Attr creates a fake clinit method while attributing
+                 * lambda expressions used as initializers of static fields, so
+                 * let's use that one.
+                 */
+                MethodSymbol clinit = attr.removeClinit(csym);
+                if (clinit != null) {
+                    clinits.put(csym, clinit);
+                    return clinit;
+                }
+
+                /* if no clinit is found at Attr, then let's try at clinits.
+                 */
+                clinit = (MethodSymbol)clinits.get(csym);
                 if (clinit == null) {
+                    /* no luck, let's create a new one
+                     */
                     clinit = makePrivateSyntheticMethod(STATIC,
                             names.clinit,
-                            new MethodType(List.<Type>nil(), syms.voidType, List.<Type>nil(), syms.methodClass),
+                            new MethodType(List.<Type>nil(), syms.voidType,
+                                List.<Type>nil(), syms.methodClass),
                             csym);
                     clinits.put(csym, clinit);
                 }
@@ -2153,7 +2166,7 @@
         LOCAL_VAR,      // original to translated lambda locals
         CAPTURED_VAR,   // variables in enclosing scope to translated synthetic parameters
         CAPTURED_THIS,  // class symbols to translated synthetic parameters (for captured member access)
-        TYPE_VAR;       // original to translated lambda type variables
+        TYPE_VAR       // original to translated lambda type variables
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Wed Jul 05 19:26:54 2017 +0200
@@ -59,8 +59,7 @@
  *  deletion without notice.</b>
  */
 public class Lower extends TreeTranslator {
-    protected static final Context.Key<Lower> lowerKey =
-        new Context.Key<Lower>();
+    protected static final Context.Key<Lower> lowerKey = new Context.Key<>();
 
     public static Lower instance(Context context) {
         Lower instance = context.get(lowerKey);
@@ -141,7 +140,7 @@
 
     /** A hash table mapping local classes to a list of pruned trees.
      */
-    public Map<ClassSymbol, List<JCTree>> prunedTree = new WeakHashMap<ClassSymbol, List<JCTree>>();
+    public Map<ClassSymbol, List<JCTree>> prunedTree = new WeakHashMap<>();
 
     /** A hash table mapping virtual accessed symbols in outer subclasses
      *  to the actually referred symbol in superclasses.
@@ -396,7 +395,7 @@
         }
     }
 
-    Map<TypeSymbol,EnumMapping> enumSwitchMap = new LinkedHashMap<TypeSymbol,EnumMapping>();
+    Map<TypeSymbol,EnumMapping> enumSwitchMap = new LinkedHashMap<>();
 
     EnumMapping mapForEnum(DiagnosticPosition pos, TypeSymbol enumClass) {
         EnumMapping map = enumSwitchMap.get(enumClass);
@@ -441,7 +440,7 @@
     class EnumMapping {
         EnumMapping(DiagnosticPosition pos, TypeSymbol forEnum) {
             this.forEnum = forEnum;
-            this.values = new LinkedHashMap<VarSymbol,Integer>();
+            this.values = new LinkedHashMap<>();
             this.pos = pos;
             Name varName = names
                 .fromString(target.syntheticNameChar() +
@@ -497,7 +496,7 @@
                 .setType(new ArrayType(syms.intType, syms.arrayClass));
 
             // try { $SwitchMap$Color[red.ordinal()] = 1; } catch (java.lang.NoSuchFieldError ex) {}
-            ListBuffer<JCStatement> stmts = new ListBuffer<JCStatement>();
+            ListBuffer<JCStatement> stmts = new ListBuffer<>();
             Symbol ordinalMethod = lookupMethod(pos,
                                                 names.ordinal,
                                                 forEnum.type,
@@ -1654,7 +1653,7 @@
             return block;
 
         // Add resource declaration or expression to block statements
-        ListBuffer<JCStatement> stats = new ListBuffer<JCStatement>();
+        ListBuffer<JCStatement> stats = new ListBuffer<>();
         JCTree resource = resources.head;
         JCExpression expr = null;
         if (resource instanceof JCVariableDecl) {
@@ -2548,9 +2547,9 @@
 
         // process each enumeration constant, adding implicit constructor parameters
         int nextOrdinal = 0;
-        ListBuffer<JCExpression> values = new ListBuffer<JCExpression>();
-        ListBuffer<JCTree> enumDefs = new ListBuffer<JCTree>();
-        ListBuffer<JCTree> otherDefs = new ListBuffer<JCTree>();
+        ListBuffer<JCExpression> values = new ListBuffer<>();
+        ListBuffer<JCTree> enumDefs = new ListBuffer<>();
+        ListBuffer<JCTree> otherDefs = new ListBuffer<>();
         for (List<JCTree> defs = tree.defs;
              defs.nonEmpty();
              defs=defs.tail) {
@@ -2824,7 +2823,7 @@
     }
     //where
         private Map<Symbol, Symbol> makeTranslationMap(JCMethodDecl tree) {
-            Map<Symbol, Symbol> translationMap = new HashMap<Symbol,Symbol>();
+            Map<Symbol, Symbol> translationMap = new HashMap<>();
             for (JCVariableDecl vd : tree.params) {
                 Symbol p = vd.sym;
                 if (p != p.baseSymbol()) {
@@ -3075,7 +3074,7 @@
         List<JCExpression> args = _args;
         if (parameters.isEmpty()) return args;
         boolean anyChanges = false;
-        ListBuffer<JCExpression> result = new ListBuffer<JCExpression>();
+        ListBuffer<JCExpression> result = new ListBuffer<>();
         while (parameters.tail.nonEmpty()) {
             JCExpression arg = translate(args.head, parameters.head);
             anyChanges |= (arg != args.head);
@@ -3086,7 +3085,7 @@
         Type parameter = parameters.head;
         if (varargsElement != null) {
             anyChanges = true;
-            ListBuffer<JCExpression> elems = new ListBuffer<JCExpression>();
+            ListBuffer<JCExpression> elems = new ListBuffer<>();
             while (args.nonEmpty()) {
                 JCExpression arg = translate(args.head, varargsElement);
                 elems.append(arg);
@@ -3611,7 +3610,7 @@
         JCArrayAccess selector = make.Indexed(map.mapVar,
                                         make.App(make.Select(tree.selector,
                                                              ordinalMethod)));
-        ListBuffer<JCCase> cases = new ListBuffer<JCCase>();
+        ListBuffer<JCCase> cases = new ListBuffer<>();
         for (JCCase c : tree.cases) {
             if (c.pat != null) {
                 VarSymbol label = (VarSymbol)TreeInfo.symbol(c.pat);
@@ -3674,16 +3673,14 @@
              * used instead of String.hashCode.
              */
 
-            ListBuffer<JCStatement> stmtList = new ListBuffer<JCStatement>();
+            ListBuffer<JCStatement> stmtList = new ListBuffer<>();
 
             // Map from String case labels to their original position in
             // the list of case labels.
-            Map<String, Integer> caseLabelToPosition =
-                new LinkedHashMap<String, Integer>(alternatives + 1, 1.0f);
+            Map<String, Integer> caseLabelToPosition = new LinkedHashMap<>(alternatives + 1, 1.0f);
 
             // Map of hash codes to the string case labels having that hashCode.
-            Map<Integer, Set<String>> hashToString =
-                new LinkedHashMap<Integer, Set<String>>(alternatives + 1, 1.0f);
+            Map<Integer, Set<String>> hashToString = new LinkedHashMap<>(alternatives + 1, 1.0f);
 
             int casePosition = 0;
             for(JCCase oneCase : caseList) {
@@ -3697,7 +3694,7 @@
 
                     Set<String> stringSet = hashToString.get(hashCode);
                     if (stringSet == null) {
-                        stringSet = new LinkedHashSet<String>(1, 1.0f);
+                        stringSet = new LinkedHashSet<>(1, 1.0f);
                         stringSet.add(labelExpr);
                         hashToString.put(hashCode, stringSet);
                     } else {
@@ -3907,18 +3904,18 @@
             currentMethodDef = null;
             outermostClassDef = (cdef.hasTag(CLASSDEF)) ? (JCClassDecl)cdef : null;
             outermostMemberDef = null;
-            this.translated = new ListBuffer<JCTree>();
-            classdefs = new HashMap<ClassSymbol,JCClassDecl>();
-            actualSymbols = new HashMap<Symbol,Symbol>();
-            freevarCache = new HashMap<ClassSymbol,List<VarSymbol>>();
+            this.translated = new ListBuffer<>();
+            classdefs = new HashMap<>();
+            actualSymbols = new HashMap<>();
+            freevarCache = new HashMap<>();
             proxies = new Scope(syms.noSymbol);
             twrVars = new Scope(syms.noSymbol);
             outerThisStack = List.nil();
-            accessNums = new HashMap<Symbol,Integer>();
-            accessSyms = new HashMap<Symbol,MethodSymbol[]>();
-            accessConstrs = new HashMap<Symbol,MethodSymbol>();
+            accessNums = new HashMap<>();
+            accessSyms = new HashMap<>();
+            accessConstrs = new HashMap<>();
             accessConstrTags = List.nil();
-            accessed = new ListBuffer<Symbol>();
+            accessed = new ListBuffer<>();
             translate(cdef, (JCExpression)null);
             for (List<Symbol> l = accessed.toList(); l.nonEmpty(); l = l.tail)
                 makeAccessible(l.head);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -62,8 +62,7 @@
  *  deletion without notice.</b>
  */
 public class MemberEnter extends JCTree.Visitor implements Completer {
-    protected static final Context.Key<MemberEnter> memberEnterKey =
-        new Context.Key<MemberEnter>();
+    protected static final Context.Key<MemberEnter> memberEnterKey = new Context.Key<>();
 
     /** A switch to determine whether we check for package/class conflicts
      */
@@ -126,7 +125,7 @@
     /** A queue for classes whose members still need to be entered into the
      *  symbol table.
      */
-    ListBuffer<Env<AttrContext>> halfcompleted = new ListBuffer<Env<AttrContext>>();
+    ListBuffer<Env<AttrContext>> halfcompleted = new ListBuffer<>();
 
     /** Set to true only when the first of a set of classes is
      *  processed from the half completed queue.
@@ -178,7 +177,7 @@
 
         // enter imported types immediately
         new Object() {
-            Set<Symbol> processed = new HashSet<Symbol>();
+            Set<Symbol> processed = new HashSet<>();
             void importFrom(TypeSymbol tsym) {
                 if (tsym == null || !processed.add(tsym))
                     return;
@@ -203,7 +202,7 @@
 
         // enter non-types before annotations that might use them
         annotate.earlier(new Annotate.Worker() {
-            Set<Symbol> processed = new HashSet<Symbol>();
+            Set<Symbol> processed = new HashSet<>();
 
             public String toString() {
                 return "import static " + tsym + ".*" + " in " + sourcefile;
@@ -271,7 +270,7 @@
 
         // enter imported types immediately
         new Object() {
-            Set<Symbol> processed = new HashSet<Symbol>();
+            Set<Symbol> processed = new HashSet<>();
             void importFrom(TypeSymbol tsym) {
                 if (tsym == null || !processed.add(tsym))
                     return;
@@ -297,7 +296,7 @@
 
         // enter non-types before annotations that might use them
         annotate.earlier(new Annotate.Worker() {
-            Set<Symbol> processed = new HashSet<Symbol>();
+            Set<Symbol> processed = new HashSet<>();
             boolean found = false;
 
             public String toString() {
@@ -378,7 +377,7 @@
         attr.attribTypeVariables(typarams, env);
 
         // Enter and attribute value parameters.
-        ListBuffer<Type> argbuf = new ListBuffer<Type>();
+        ListBuffer<Type> argbuf = new ListBuffer<>();
         for (List<JCVariableDecl> l = params; l.nonEmpty(); l = l.tail) {
             memberEnter(l.head, env);
             argbuf.append(l.head.vartype.type);
@@ -397,7 +396,7 @@
         }
 
         // Attribute thrown exceptions.
-        ListBuffer<Type> thrownbuf = new ListBuffer<Type>();
+        ListBuffer<Type> thrownbuf = new ListBuffer<>();
         for (List<JCExpression> l = thrown; l.nonEmpty(); l = l.tail) {
             Type exc = attr.attribType(l.head, env);
             if (!exc.hasTag(TYPEVAR)) {
@@ -591,7 +590,7 @@
             }
 
             // Set m.params
-            ListBuffer<VarSymbol> params = new ListBuffer<VarSymbol>();
+            ListBuffer<VarSymbol> params = new ListBuffer<>();
             JCVariableDecl lastParam = null;
             for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) {
                 JCVariableDecl param = lastParam = l.head;
@@ -915,10 +914,8 @@
     private void actualEnterAnnotations(List<JCAnnotation> annotations,
                           Env<AttrContext> env,
                           Symbol s) {
-        Map<TypeSymbol, ListBuffer<Attribute.Compound>> annotated =
-                new LinkedHashMap<TypeSymbol, ListBuffer<Attribute.Compound>>();
-        Map<Attribute.Compound, DiagnosticPosition> pos =
-                new HashMap<Attribute.Compound, DiagnosticPosition>();
+        Map<TypeSymbol, ListBuffer<Attribute.Compound>> annotated = new LinkedHashMap<>();
+        Map<Attribute.Compound, DiagnosticPosition> pos = new HashMap<>();
 
         for (List<JCAnnotation> al = annotations; !al.isEmpty(); al = al.tail) {
             JCAnnotation a = al.head;
@@ -952,7 +949,7 @@
         }
 
         s.setDeclarationAttributesWithCompletion(
-                annotate.new AnnotateRepeatedContext<Attribute.Compound>(env, annotated, pos, log, false));
+                annotate.new AnnotateRepeatedContext<>(env, annotated, pos, log, false));
     }
 
     /** Queue processing of an attribute default value. */
@@ -1064,9 +1061,9 @@
             ct.supertype_field = modelMissingTypes(supertype, tree.extending, false);
 
             // Determine interfaces.
-            ListBuffer<Type> interfaces = new ListBuffer<Type>();
+            ListBuffer<Type> interfaces = new ListBuffer<>();
             ListBuffer<Type> all_interfaces = null; // lazy init
-            Set<Type> interfaceSet = new HashSet<Type>();
+            Set<Type> interfaceSet = new HashSet<>();
             List<JCExpression> interfaceTrees = tree.implementing;
             for (JCExpression iface : interfaceTrees) {
                 Type i = attr.attribBase(iface, baseEnv, false, true, true);
@@ -1214,10 +1211,8 @@
     private void actualEnterTypeAnnotations(final List<JCAnnotation> annotations,
             final Env<AttrContext> env,
             final Symbol s) {
-        Map<TypeSymbol, ListBuffer<Attribute.TypeCompound>> annotated =
-                new LinkedHashMap<TypeSymbol, ListBuffer<Attribute.TypeCompound>>();
-        Map<Attribute.TypeCompound, DiagnosticPosition> pos =
-                new HashMap<Attribute.TypeCompound, DiagnosticPosition>();
+        Map<TypeSymbol, ListBuffer<Attribute.TypeCompound>> annotated = new LinkedHashMap<>();
+        Map<Attribute.TypeCompound, DiagnosticPosition> pos = new HashMap<>();
 
         for (List<JCAnnotation> al = annotations; !al.isEmpty(); al = al.tail) {
             JCAnnotation a = al.head;
@@ -1245,7 +1240,7 @@
 
         if (s != null) {
             s.appendTypeAttributesWithCompletion(
-                    annotate.new AnnotateRepeatedContext<Attribute.TypeCompound>(env, annotated, pos, log, true));
+                    annotate.new AnnotateRepeatedContext<>(env, annotated, pos, log, true));
         }
     }
 
@@ -1448,7 +1443,7 @@
         }
 
         List<Type> visit(List<? extends JCTree> trees) {
-            ListBuffer<Type> lb = new ListBuffer<Type>();
+            ListBuffer<Type> lb = new ListBuffer<>();
             for (JCTree t: trees)
                 lb.append(visit(t));
             return lb.toList();
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Wed Jul 05 19:26:54 2017 +0200
@@ -78,8 +78,7 @@
  *  deletion without notice.</b>
  */
 public class Resolve {
-    protected static final Context.Key<Resolve> resolveKey =
-        new Context.Key<Resolve>();
+    protected static final Context.Key<Resolve> resolveKey = new Context.Key<>();
 
     Names names;
     Log log;
@@ -95,7 +94,7 @@
     public final boolean boxingEnabled; // = source.allowBoxing();
     public final boolean varargsEnabled; // = source.allowVarargs();
     public final boolean allowMethodHandles;
-    public final boolean allowDefaultMethods;
+    public final boolean allowDefaultMethodsResolution;
     public final boolean allowStructuralMostSpecific;
     private final boolean debugResolve;
     private final boolean compactMethodDiags;
@@ -137,7 +136,7 @@
         verboseResolutionMode = VerboseResolutionMode.getVerboseResolutionMode(options);
         Target target = Target.instance(context);
         allowMethodHandles = target.hasMethodHandles();
-        allowDefaultMethods = source.allowDefaultMethods();
+        allowDefaultMethodsResolution = source.allowDefaultMethodsResolution();
         allowStructuralMostSpecific = source.allowStructuralMostSpecific();
         polymorphicSignatureScope = new Scope(syms.noSymbol);
 
@@ -918,7 +917,7 @@
         public MethodCheck mostSpecificCheck(List<Type> actuals, boolean strict) {
             return new MostSpecificCheck(strict, actuals);
         }
-    };
+    }
 
     /**
      * Check context to be used during method applicability checks. A method check
@@ -1503,7 +1502,7 @@
             return ambiguityError(m1, m2);
         case AMBIGUOUS:
             //check if m1 is more specific than all ambiguous methods in m2
-            AmbiguityError e = (AmbiguityError)m2;
+            AmbiguityError e = (AmbiguityError)m2.baseSymbol();
             for (Symbol s : e.ambiguousSyms) {
                 if (mostSpecific(argtypes, m1, s, env, site, allowBoxing, useVarargs) != m1) {
                     return e.addAmbiguousSymbol(m1);
@@ -1616,7 +1615,7 @@
                         (flags & DEFAULT) != 0 ||
                         (flags & ABSTRACT) == 0);
             }
-        };
+        }
 
     /** Find best qualified method matching given name, type and value
      *  arguments.
@@ -1681,7 +1680,7 @@
                 bestSoFar : methodNotFound;
 
         for (InterfaceLookupPhase iphase2 : InterfaceLookupPhase.values()) {
-            if (iphase2 == InterfaceLookupPhase.DEFAULT_OK && !allowDefaultMethods) break;
+            if (iphase2 == InterfaceLookupPhase.DEFAULT_OK && !allowDefaultMethodsResolution) break;
             //keep searching for abstract methods
             for (Type itype : itypes[iphase2.ordinal()]) {
                 if (!itype.isInterface()) continue; //skip j.l.Object (included by Types.closure())
@@ -1714,7 +1713,7 @@
                 //from superinterfaces)
                 if ((s.flags() & (ABSTRACT | INTERFACE | ENUM)) != 0) {
                     return this;
-                } else if (rs.allowDefaultMethods) {
+                } else if (rs.allowDefaultMethodsResolution) {
                     return DEFAULT_OK;
                 } else {
                     return null;
@@ -3055,7 +3054,7 @@
         final Symbol lookup(Env<AttrContext> env, MethodResolutionPhase phase) {
             Symbol sym = doLookup(env, phase);
             if (sym.kind == AMBIGUOUS) {
-                AmbiguityError a_err = (AmbiguityError)sym;
+                AmbiguityError a_err = (AmbiguityError)sym.baseSymbol();
                 sym = a_err.mergeAbstracts(site);
             }
             return sym;
@@ -3125,7 +3124,7 @@
 
         Symbol access(Env<AttrContext> env, DiagnosticPosition pos, Symbol location, Symbol sym) {
             if (sym.kind == AMBIGUOUS) {
-                AmbiguityError a_err = (AmbiguityError)sym;
+                AmbiguityError a_err = (AmbiguityError)sym.baseSymbol();
                 sym = a_err.mergeAbstracts(site);
             }
             //skip error reporting
@@ -3341,7 +3340,7 @@
             if ((env1.enclClass.sym.flags() & STATIC) != 0) staticOnly = true;
             env1 = env1.outer;
         }
-        if (allowDefaultMethods && c.isInterface() &&
+        if (allowDefaultMethodsResolution && c.isInterface() &&
                 name == names._super && !isStatic(env) &&
                 types.isDirectSuperInterface(c, env.enclClass.sym)) {
             //this might be a default super call if one of the superinterfaces is 'c'
@@ -3780,7 +3779,7 @@
                 bestSoFar = c;
             }
             Assert.checkNonNull(bestSoFar);
-            return new Pair<Symbol, JCDiagnostic>(bestSoFar.sym, bestSoFar.details);
+            return new Pair<>(bestSoFar.sym, bestSoFar.details);
         }
     }
 
@@ -3827,7 +3826,7 @@
             } else if (filteredCandidates.size() == 1) {
                 Map.Entry<Symbol, JCDiagnostic> _e =
                                 filteredCandidates.entrySet().iterator().next();
-                final Pair<Symbol, JCDiagnostic> p = new Pair<Symbol, JCDiagnostic>(_e.getKey(), _e.getValue());
+                final Pair<Symbol, JCDiagnostic> p = new Pair<>(_e.getKey(), _e.getValue());
                 JCDiagnostic d = new InapplicableSymbolError(resolveContext) {
                     @Override
                     protected Pair<Symbol, JCDiagnostic> errCandidate() {
@@ -3846,7 +3845,7 @@
         }
         //where
             private Map<Symbol, JCDiagnostic> mapCandidates() {
-                Map<Symbol, JCDiagnostic> candidates = new LinkedHashMap<Symbol, JCDiagnostic>();
+                Map<Symbol, JCDiagnostic> candidates = new LinkedHashMap<>();
                 for (Candidate c : resolveContext.candidates) {
                     if (c.isApplicable()) continue;
                     candidates.put(c.sym, c.details);
@@ -3855,7 +3854,7 @@
             }
 
             Map<Symbol, JCDiagnostic> filterCandidates(Map<Symbol, JCDiagnostic> candidatesMap) {
-                Map<Symbol, JCDiagnostic> candidates = new LinkedHashMap<Symbol, JCDiagnostic>();
+                Map<Symbol, JCDiagnostic> candidates = new LinkedHashMap<>();
                 for (Map.Entry<Symbol, JCDiagnostic> _entry : candidatesMap.entrySet()) {
                     JCDiagnostic d = _entry.getValue();
                     if (!new Template(MethodCheckDiag.ARITY_MISMATCH.regex()).matches(d)) {
@@ -3992,7 +3991,7 @@
 
         private List<Symbol> flatten(Symbol sym) {
             if (sym.kind == AMBIGUOUS) {
-                return ((AmbiguityError)sym).ambiguousSyms;
+                return ((AmbiguityError)sym.baseSymbol()).ambiguousSyms;
             } else {
                 return List.of(sym);
             }
@@ -4175,8 +4174,7 @@
         };
 
         /** rewriter map used for method resolution simplification */
-        static final Map<Template, DiagnosticRewriter> rewriters =
-                new LinkedHashMap<Template, DiagnosticRewriter>();
+        static final Map<Template, DiagnosticRewriter> rewriters = new LinkedHashMap<>();
 
         static {
             String argMismatchRegex = MethodCheckDiag.ARG_MISMATCH.regex();
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Todo.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Todo.java	Wed Jul 05 19:26:54 2017 +0200
@@ -43,8 +43,7 @@
  */
 public class Todo extends AbstractQueue<Env<AttrContext>> {
     /** The context key for the todo list. */
-    protected static final Context.Key<Todo> todoKey =
-        new Context.Key<Todo>();
+    protected static final Context.Key<Todo> todoKey = new Context.Key<>();
 
     /** Get the Todo instance for this context. */
     public static Todo instance(Context context) {
@@ -98,7 +97,7 @@
 
     public Queue<Queue<Env<AttrContext>>> groupByFile() {
         if (contentsByFile == null) {
-            contentsByFile = new LinkedList<Queue<Env<AttrContext>>>();
+            contentsByFile = new LinkedList<>();
             for (Env<AttrContext> env: contents) {
                 addByFile(env);
             }
@@ -109,7 +108,7 @@
     private void addByFile(Env<AttrContext> env) {
         JavaFileObject file = env.toplevel.sourcefile;
         if (fileMap == null)
-            fileMap = new HashMap<JavaFileObject, FileQueue>();
+            fileMap = new HashMap<>();
         FileQueue fq = fileMap.get(file);
         if (fq == null) {
             fq = new FileQueue();
@@ -132,7 +131,7 @@
         }
     }
 
-    LinkedList<Env<AttrContext>> contents = new LinkedList<Env<AttrContext>>();
+    LinkedList<Env<AttrContext>> contents = new LinkedList<>();
     LinkedList<Queue<Env<AttrContext>>> contentsByFile;
     Map<JavaFileObject, FileQueue> fileMap;
 
@@ -167,6 +166,6 @@
             return (fileContents.size() == 0 ? null : fileContents.get(0));
         }
 
-        LinkedList<Env<AttrContext>> fileContents = new LinkedList<Env<AttrContext>>();
+        LinkedList<Env<AttrContext>> fileContents = new LinkedList<>();
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Wed Jul 05 19:26:54 2017 +0200
@@ -51,8 +51,7 @@
  */
 public class TransTypes extends TreeTranslator {
     /** The context key for the TransTypes phase. */
-    protected static final Context.Key<TransTypes> transTypesKey =
-        new Context.Key<TransTypes>();
+    protected static final Context.Key<TransTypes> transTypesKey = new Context.Key<>();
 
     /** Get the instance for this context. */
     public static TransTypes instance(Context context) {
@@ -88,7 +87,7 @@
         log = Log.instance(context);
         syms = Symtab.instance(context);
         enter = Enter.instance(context);
-        overridden = new HashMap<MethodSymbol,MethodSymbol>();
+        overridden = new HashMap<>();
         Source source = Source.instance(context);
         allowEnums = source.allowEnums();
         addBridges = source.addBridges();
@@ -586,7 +585,7 @@
         try {
             currentMethod = null;
             tree.params = translate(tree.params);
-            tree.body = translate(tree.body, null);
+            tree.body = translate(tree.body, tree.body.type==null? null : erasure(tree.body.type));
             tree.type = erasure(tree.type);
             result = tree;
         }
@@ -1004,7 +1003,7 @@
                 super.visitClassDef(tree);
                 make.at(tree.pos);
                 if (addBridges) {
-                    ListBuffer<JCTree> bridges = new ListBuffer<JCTree>();
+                    ListBuffer<JCTree> bridges = new ListBuffer<>();
                     if (false) //see CR: 6996415
                         bridges.appendList(addOverrideBridgesIfNeeded(tree, c));
                     if (allowInterfaceBridges || (tree.sym.flags() & INTERFACE) == 0) {
--- a/langtools/src/share/classes/com/sun/tools/javac/file/CacheFSInfo.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/CacheFSInfo.java	Wed Jul 05 19:26:54 2017 +0200
@@ -112,7 +112,7 @@
     }
 
     // could also be a Map<File,SoftReference<Entry>> ?
-    private Map<File,Entry> cache = new ConcurrentHashMap<File,Entry>();
+    private Map<File,Entry> cache = new ConcurrentHashMap<>();
 
     private static class Entry {
         File canonicalFile;
--- a/langtools/src/share/classes/com/sun/tools/javac/file/FSInfo.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/FSInfo.java	Wed Jul 05 19:26:54 2017 +0200
@@ -64,8 +64,7 @@
 
     public List<File> getJarClassPath(File file) throws IOException {
         String parent = file.getParent();
-        JarFile jarFile = new JarFile(file);
-        try {
+        try (JarFile jarFile = new JarFile(file)) {
             Manifest man = jarFile.getManifest();
             if (man == null)
                 return Collections.emptyList();
@@ -78,17 +77,16 @@
             if (path == null)
                 return Collections.emptyList();
 
-            List<File> list = new ArrayList<File>();
+            List<File> list = new ArrayList<>();
 
-            for (StringTokenizer st = new StringTokenizer(path); st.hasMoreTokens(); ) {
+            for (StringTokenizer st = new StringTokenizer(path);
+                 st.hasMoreTokens(); ) {
                 String elt = st.nextToken();
                 File f = (parent == null ? new File(elt) : new File(parent, elt));
                 list.add(f);
             }
 
             return list;
-        } finally {
-            jarFile.close();
         }
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Wed Jul 05 19:26:54 2017 +0200
@@ -102,8 +102,9 @@
             public int compare(File f1, File f2) {
                 return -f1.getName().compareTo(f2.getName());
             }
-        };
-    };
+        }
+    }
+
     protected SortFiles sortFiles;
 
     /**
@@ -179,7 +180,7 @@
     }
 
     public Iterable<? extends JavaFileObject> getJavaFileObjectsFromStrings(Iterable<String> names) {
-        ListBuffer<File> files = new ListBuffer<File>();
+        ListBuffer<File> files = new ListBuffer<>();
         for (String name : names)
             files.append(new File(nullCheck(name)));
         return getJavaFileObjectsFromFiles(files.toList());
@@ -445,7 +446,7 @@
 
     /** A directory of zip files already opened.
      */
-    Map<File, Archive> archives = new HashMap<File,Archive>();
+    Map<File, Archive> archives = new HashMap<>();
 
     private static final String[] symbolFileLocation = { "lib", "ct.sym" };
     private static final RelativeDirectory symbolFilePrefix
@@ -592,7 +593,7 @@
         Iterable<? extends File> path = getLocation(location);
         if (path == null)
             return null;
-        ListBuffer<URL> lb = new ListBuffer<URL>();
+        ListBuffer<URL> lb = new ListBuffer<>();
         for (File f: path) {
             try {
                 lb.append(f.toURI().toURL());
@@ -618,7 +619,7 @@
         if (path == null)
             return List.nil();
         RelativeDirectory subdirectory = RelativeDirectory.forPackage(packageName);
-        ListBuffer<JavaFileObject> results = new ListBuffer<JavaFileObject>();
+        ListBuffer<JavaFileObject> results = new ListBuffer<>();
 
         for (File directory : path)
             listContainer(directory, subdirectory, kinds, recurse, results);
@@ -778,9 +779,9 @@
     {
         ArrayList<RegularFileObject> result;
         if (files instanceof Collection<?>)
-            result = new ArrayList<RegularFileObject>(((Collection<?>)files).size());
+            result = new ArrayList<>(((Collection<?>)files).size());
         else
-            result = new ArrayList<RegularFileObject>();
+            result = new ArrayList<>();
         for (File f: files)
             result.add(new RegularFileObject(this, nullCheck(f)));
         return result;
--- a/langtools/src/share/classes/com/sun/tools/javac/file/Locations.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/Locations.java	Wed Jul 05 19:26:54 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
@@ -51,6 +51,7 @@
 import com.sun.tools.javac.util.ListBuffer;
 import com.sun.tools.javac.util.Log;
 import com.sun.tools.javac.util.Options;
+import com.sun.tools.javac.util.StringUtils;
 
 import javax.tools.JavaFileManager;
 import javax.tools.StandardJavaFileManager;
@@ -143,7 +144,7 @@
      * @return The elements of the path
      */
     private static Iterable<File> getPathEntries(String path, File emptyPathDefault) {
-        ListBuffer<File> entries = new ListBuffer<File>();
+        ListBuffer<File> entries = new ListBuffer<>();
         int start = 0;
         while (start <= path.length()) {
             int sep = path.indexOf(File.pathSeparatorChar, start);
@@ -166,7 +167,7 @@
         private static final long serialVersionUID = 0;
 
         private boolean expandJarClassPaths = false;
-        private Set<File> canonicalValues = new HashSet<File>();
+        private Set<File> canonicalValues = new HashSet<>();
 
         public Path expandJarClassPaths(boolean x) {
             expandJarClassPaths = x;
@@ -509,7 +510,7 @@
      */
     private class BootClassPathLocationHandler extends LocationHandler {
         private Collection<File> searchPath;
-        final Map<Option, String> optionValues = new EnumMap<Option,String>(Option.class);
+        final Map<Option, String> optionValues = new EnumMap<>(Option.class);
 
         /**
          * rt.jar as found on the default bootclasspath.
@@ -647,8 +648,8 @@
     Map<Option, LocationHandler> handlersForOption;
 
     void initHandlers() {
-        handlersForLocation = new HashMap<Location, LocationHandler>();
-        handlersForOption = new EnumMap<Option, LocationHandler>(Option.class);
+        handlersForLocation = new HashMap<>();
+        handlersForOption = new EnumMap<>(Option.class);
 
         LocationHandler[] handlers = {
             new BootClassPathLocationHandler(),
@@ -717,7 +718,7 @@
 
     /** Is this the name of an archive file? */
     private boolean isArchive(File file) {
-        String n = file.getName().toLowerCase();
+        String n = StringUtils.toLowerCase(file.getName());
         return fsInfo.isFile(file)
             && (n.endsWith(".jar") || n.endsWith(".zip"));
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java	Wed Jul 05 19:26:54 2017 +0200
@@ -109,8 +109,7 @@
     public CharBuffer getCharContent(boolean ignoreEncodingErrors) throws IOException {
         CharBuffer cb = fileManager.getCachedContent(this);
         if (cb == null) {
-            InputStream in = new FileInputStream(file);
-            try {
+            try (InputStream in = new FileInputStream(file)) {
                 ByteBuffer bb = fileManager.makeByteBuffer(in);
                 JavaFileObject prev = fileManager.log.useSource(this);
                 try {
@@ -122,8 +121,6 @@
                 if (!ignoreEncodingErrors) {
                     fileManager.cache(this, cb);
                 }
-            } finally {
-                in.close();
             }
         }
         return cb;
@@ -244,7 +241,7 @@
         File absFile = (absFileRef == null ? null : absFileRef.get());
         if (absFile == null) {
             absFile = file.getAbsoluteFile();
-            absFileRef = new SoftReference<File>(absFile);
+            absFileRef = new SoftReference<>(absFile);
         }
         return absFile;
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/file/ZipArchive.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/ZipArchive.java	Wed Jul 05 19:26:54 2017 +0200
@@ -65,7 +65,7 @@
     protected ZipArchive(JavacFileManager fm, ZipFile zfile, boolean initMap) throws IOException {
         this.fileManager = fm;
         this.zfile = zfile;
-        this.map = new HashMap<RelativeDirectory,List<String>>();
+        this.map = new HashMap<>();
         if (initMap)
             initMap();
     }
@@ -133,7 +133,7 @@
         File absFile = (absFileRef == null ? null : absFileRef.get());
         if (absFile == null) {
             absFile = new File(zfile.getName()).getAbsoluteFile();
-            absFileRef = new SoftReference<File>(absFile);
+            absFileRef = new SoftReference<>(absFile);
         }
         return absFile;
     }
@@ -205,8 +205,7 @@
         public CharBuffer getCharContent(boolean ignoreEncodingErrors) throws IOException {
             CharBuffer cb = fileManager.getCachedContent(this);
             if (cb == null) {
-                InputStream in = zarch.zfile.getInputStream(entry);
-                try {
+                try (InputStream in = zarch.zfile.getInputStream(entry)) {
                     ByteBuffer bb = fileManager.makeByteBuffer(in);
                     JavaFileObject prev = fileManager.log.useSource(this);
                     try {
@@ -218,8 +217,6 @@
                     if (!ignoreEncodingErrors) {
                         fileManager.cache(this, cb);
                     }
-                } finally {
-                    in.close();
                 }
             }
             return cb;
--- a/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java	Wed Jul 05 19:26:54 2017 +0200
@@ -110,8 +110,7 @@
 
     private boolean writeIndex = false;
 
-    private Map<String, SoftReference<RelativeDirectory>> relativeDirectoryCache =
-            new HashMap<String, SoftReference<RelativeDirectory>>();
+    private Map<String, SoftReference<RelativeDirectory>> relativeDirectoryCache = new HashMap<>();
 
 
     public synchronized boolean isOpen() {
@@ -284,7 +283,7 @@
         try {
             checkIndex();
             if (allDirs == Collections.EMPTY_SET) {
-                allDirs = new java.util.LinkedHashSet<RelativeDirectory>(directories.keySet());
+                allDirs = new java.util.LinkedHashSet<>(directories.keySet());
             }
 
             return allDirs;
@@ -449,7 +448,7 @@
 
         // construct the inflater object or reuse an existing one
         if (inflater == null)
-            inflaterRef = new SoftReference<Inflater>(inflater = new Inflater(true));
+            inflaterRef = new SoftReference<>(inflater = new Inflater(true));
 
         inflater.reset();
         inflater.setInput(src);
@@ -570,8 +569,8 @@
 
             // Add each of the files
             if (len > 0) {
-                directories = new LinkedHashMap<RelativeDirectory, DirectoryEntry>();
-                ArrayList<Entry> entryList = new ArrayList<Entry>();
+                directories = new LinkedHashMap<>();
+                ArrayList<Entry> entryList = new ArrayList<>();
                 for (int pos = 0; pos < len; ) {
                     pos = readEntry(pos, entryList, directories);
                 }
@@ -708,7 +707,7 @@
         private com.sun.tools.javac.util.List<String> zipFileEntriesDirectories = com.sun.tools.javac.util.List.<String>nil();
         private com.sun.tools.javac.util.List<Entry>  zipFileEntries = com.sun.tools.javac.util.List.<Entry>nil();
 
-        private List<Entry> entries = new ArrayList<Entry>();
+        private List<Entry> entries = new ArrayList<>();
 
         private ZipFileIndex zipFileIndex;
 
@@ -864,7 +863,7 @@
                 if (zipFile.lastModified() != fileStamp) {
                     ret = false;
                 } else {
-                    directories = new LinkedHashMap<RelativeDirectory, DirectoryEntry>();
+                    directories = new LinkedHashMap<>();
                     int numDirs = raf.readInt();
                     for (int nDirs = 0; nDirs < numDirs; nDirs++) {
                         int dirNameBytesLen = raf.readInt();
@@ -922,8 +921,8 @@
             raf.writeLong(zipFileLastModified);
             writtenSoFar += 8;
 
-            List<DirectoryEntry> directoriesToWrite = new ArrayList<DirectoryEntry>();
-            Map<RelativeDirectory, Long> offsets = new HashMap<RelativeDirectory, Long>();
+            List<DirectoryEntry> directoriesToWrite = new ArrayList<>();
+            Map<RelativeDirectory, Long> offsets = new HashMap<>();
             raf.writeInt(directories.keySet().size());
             writtenSoFar += 4;
 
@@ -1038,7 +1037,7 @@
         File absFile = (absFileRef == null ? null : absFileRef.get());
         if (absFile == null) {
             absFile = zipFile.getAbsoluteFile();
-            absFileRef = new SoftReference<File>(absFile);
+            absFileRef = new SoftReference<>(absFile);
         }
         return absFile;
     }
@@ -1052,7 +1051,7 @@
                 return rd;
         }
         rd = new RelativeDirectory(path);
-        relativeDirectoryCache.put(path, new SoftReference<RelativeDirectory>(rd));
+        relativeDirectoryCache.put(path, new SoftReference<>(rd));
         return rd;
     }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java	Wed Jul 05 19:26:54 2017 +0200
@@ -162,8 +162,7 @@
         public CharBuffer getCharContent(boolean ignoreEncodingErrors) throws IOException {
             CharBuffer cb = fileManager.getCachedContent(this);
             if (cb == null) {
-                InputStream in = new ByteArrayInputStream(zfIndex.read(entry));
-                try {
+                try (InputStream in = new ByteArrayInputStream(zfIndex.read(entry))) {
                     ByteBuffer bb = fileManager.makeByteBuffer(in);
                     JavaFileObject prev = fileManager.log.useSource(this);
                     try {
@@ -174,8 +173,6 @@
                     fileManager.recycleByteBuffer(bb); // save for next time
                     if (!ignoreEncodingErrors)
                         fileManager.cache(this, cb);
-                } finally {
-                    in.close();
                 }
             }
             return cb;
--- a/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndexCache.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndexCache.java	Wed Jul 05 19:26:54 2017 +0200
@@ -39,8 +39,7 @@
 /** A cache for ZipFileIndex objects. */
 public class ZipFileIndexCache {
 
-    private final Map<File, ZipFileIndex> map =
-            new HashMap<File, ZipFileIndex>();
+    private final Map<File, ZipFileIndex> map = new HashMap<>();
 
     /** Get a shared instance of the cache. */
     private static ZipFileIndexCache sharedInstance;
@@ -75,7 +74,7 @@
      * @return A list of ZipFileIndex entries, or an empty list
      */
     public synchronized List<ZipFileIndex> getZipFileIndexes(boolean openedOnly) {
-        List<ZipFileIndex> zipFileIndexes = new ArrayList<ZipFileIndex>();
+        List<ZipFileIndex> zipFileIndexes = new ArrayList<>();
 
         zipFileIndexes.addAll(map.values());
 
@@ -113,14 +112,12 @@
     }
 
     public synchronized void clearCache(long timeNotUsed) {
-        Iterator<File> cachedFileIterator = map.keySet().iterator();
-        while (cachedFileIterator.hasNext()) {
-            File cachedFile = cachedFileIterator.next();
+        for (File cachedFile : map.keySet()) {
             ZipFileIndex cachedZipIndex = map.get(cachedFile);
             if (cachedZipIndex != null) {
                 long timeToTest = cachedZipIndex.lastReferenceTimeStamp + timeNotUsed;
                 if (timeToTest < cachedZipIndex.lastReferenceTimeStamp || // Overflow...
-                        System.currentTimeMillis() > timeToTest) {
+                    System.currentTimeMillis() > timeToTest) {
                     map.remove(cachedFile);
                 }
             }
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/CRTable.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/CRTable.java	Wed Jul 05 19:26:54 2017 +0200
@@ -49,11 +49,11 @@
 
     /** The list of CRTable entries.
      */
-    private ListBuffer<CRTEntry> entries = new ListBuffer<CRTEntry>();
+    private ListBuffer<CRTEntry> entries = new ListBuffer<>();
 
     /** The hashtable for source positions.
      */
-    private Map<Object,SourceRange> positions = new HashMap<Object,SourceRange>();
+    private Map<Object,SourceRange> positions = new HashMap<>();
 
     /** The object for ending positions stored in the parser.
      */
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Wed Jul 05 19:26:54 2017 +0200
@@ -75,8 +75,7 @@
  */
 public class ClassReader {
     /** The context key for the class reader. */
-    protected static final Context.Key<ClassReader> classReaderKey =
-        new Context.Key<ClassReader>();
+    protected static final Context.Key<ClassReader> classReaderKey = new Context.Key<>();
 
     public static final int INITIAL_BUFFER_SIZE = 0x0fff0;
 
@@ -116,10 +115,6 @@
      */
     boolean lintClassfile;
 
-    /** Switch: allow default methods
-     */
-    boolean allowDefaultMethods;
-
     /** Switch: preserve parameter names from the variable table.
      */
     public boolean saveParameterNames;
@@ -233,7 +228,7 @@
     /**
      * The set of attribute names for which warnings have been generated for the current class
      */
-    Set<Name> warnedAttrs = new HashSet<Name>();
+    Set<Name> warnedAttrs = new HashSet<>();
 
     /**
      * Completer that delegates to the complete-method of this class.
@@ -271,8 +266,8 @@
             Assert.check(classes == null || classes == syms.classes);
             classes = syms.classes;
         } else {
-            packages = new HashMap<Name, PackageSymbol>();
-            classes = new HashMap<Name, ClassSymbol>();
+            packages = new HashMap<>();
+            classes = new HashMap<>();
         }
 
         packages.put(names.empty, syms.rootPackage);
@@ -307,7 +302,6 @@
         allowVarargs     = source.allowVarargs();
         allowAnnotations = source.allowAnnotations();
         allowSimplifiedVarargs = source.allowSimplifiedVarargs();
-        allowDefaultMethods = source.allowDefaultMethods();
 
         saveParameterNames = options.isSet("save-parameter-names");
         cacheCompletionFailure = options.isUnset("dev");
@@ -937,7 +931,8 @@
  * Reading Attributes
  ***********************************************************************/
 
-    protected enum AttributeKind { CLASS, MEMBER };
+    protected enum AttributeKind { CLASS, MEMBER }
+
     protected abstract class AttributeReader {
         protected AttributeReader(Name name, ClassFile.Version version, Set<AttributeKind> kinds) {
             this.name = name;
@@ -978,7 +973,7 @@
     protected Set<AttributeKind> CLASS_OR_MEMBER_ATTRIBUTE =
             EnumSet.of(AttributeKind.CLASS, AttributeKind.MEMBER);
 
-    protected Map<Name, AttributeReader> attributeReaders = new HashMap<Name, AttributeReader>();
+    protected Map<Name, AttributeReader> attributeReaders = new HashMap<>();
 
     private void initAttributeReaders() {
         AttributeReader[] readers = {
@@ -1131,7 +1126,7 @@
                             Assert.check(c == currentOwner);
                             ct1.typarams_field = readTypeParams(nextChar());
                             ct1.supertype_field = sigToType();
-                            ListBuffer<Type> is = new ListBuffer<Type>();
+                            ListBuffer<Type> is = new ListBuffer<>();
                             while (sigp != siglimit) is.append(sigToType());
                             ct1.interfaces_field = is.toList();
                         } finally {
@@ -1275,7 +1270,7 @@
         }
         enterTypevars(self);
         if (!missingTypeVariables.isEmpty()) {
-            ListBuffer<Type> typeVars =  new ListBuffer<Type>();
+            ListBuffer<Type> typeVars =  new ListBuffer<>();
             for (Type typevar : missingTypeVariables) {
                 typeVars.append(findTypeVar(typevar.tsym.name));
             }
@@ -1402,8 +1397,7 @@
     void attachAnnotations(final Symbol sym) {
         int numAttributes = nextChar();
         if (numAttributes != 0) {
-            ListBuffer<CompoundAnnotationProxy> proxies =
-                new ListBuffer<CompoundAnnotationProxy>();
+            ListBuffer<CompoundAnnotationProxy> proxies = new ListBuffer<>();
             for (int i = 0; i<numAttributes; i++) {
                 CompoundAnnotationProxy proxy = readCompoundAnnotation();
                 if (proxy.type.tsym == syms.proprietaryType.tsym)
@@ -1489,12 +1483,11 @@
     CompoundAnnotationProxy readCompoundAnnotation() {
         Type t = readTypeOrClassSymbol(nextChar());
         int numFields = nextChar();
-        ListBuffer<Pair<Name,Attribute>> pairs =
-            new ListBuffer<Pair<Name,Attribute>>();
+        ListBuffer<Pair<Name,Attribute>> pairs = new ListBuffer<>();
         for (int i=0; i<numFields; i++) {
             Name name = readName(nextChar());
             Attribute value = readAttributeValue();
-            pairs.append(new Pair<Name,Attribute>(name, value));
+            pairs.append(new Pair<>(name, value));
         }
         return new CompoundAnnotationProxy(t, pairs.toList());
     }
@@ -1631,7 +1624,7 @@
             return new Attribute.Class(types, readTypeOrClassSymbol(nextChar()));
         case '[': {
             int n = nextChar();
-            ListBuffer<Attribute> l = new ListBuffer<Attribute>();
+            ListBuffer<Attribute> l = new ListBuffer<>();
             for (int i=0; i<n; i++)
                 l.append(readAttributeValue());
             return new ArrayAttributeProxy(l.toList());
@@ -1726,8 +1719,7 @@
 
         List<Attribute.Compound> deproxyCompoundList(List<CompoundAnnotationProxy> pl) {
             // also must fill in types!!!!
-            ListBuffer<Attribute.Compound> buf =
-                new ListBuffer<Attribute.Compound>();
+            ListBuffer<Attribute.Compound> buf = new ListBuffer<>();
             for (List<CompoundAnnotationProxy> l = pl; l.nonEmpty(); l=l.tail) {
                 buf.append(deproxyCompound(l.head));
             }
@@ -1735,14 +1727,12 @@
         }
 
         Attribute.Compound deproxyCompound(CompoundAnnotationProxy a) {
-            ListBuffer<Pair<Symbol.MethodSymbol,Attribute>> buf =
-                new ListBuffer<Pair<Symbol.MethodSymbol,Attribute>>();
+            ListBuffer<Pair<Symbol.MethodSymbol,Attribute>> buf = new ListBuffer<>();
             for (List<Pair<Name,Attribute>> l = a.values;
                  l.nonEmpty();
                  l = l.tail) {
                 MethodSymbol meth = findAccessMethod(a.type, l.head.fst);
-                buf.append(new Pair<Symbol.MethodSymbol,Attribute>
-                           (meth, deproxy(meth.type.getReturnType(), l.head.snd)));
+                buf.append(new Pair<>(meth, deproxy(meth.type.getReturnType(), l.head.snd)));
             }
             return new Attribute.Compound(a.type, buf.toList());
         }
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -63,8 +63,7 @@
  *  deletion without notice.</b>
  */
 public class ClassWriter extends ClassFile {
-    protected static final Context.Key<ClassWriter> classWriterKey =
-        new Context.Key<ClassWriter>();
+    protected static final Context.Key<ClassWriter> classWriterKey = new Context.Key<>();
 
     private final Options options;
 
@@ -683,7 +682,7 @@
                     case SOURCE: break;
                     case CLASS: hasInvisible = true; break;
                     case RUNTIME: hasVisible = true; break;
-                    default: ;// /* fail soft */ throw new AssertionError(vis);
+                    default: // /* fail soft */ throw new AssertionError(vis);
                     }
                 }
             }
@@ -694,7 +693,7 @@
             int attrIndex = writeAttr(names.RuntimeVisibleParameterAnnotations);
             databuf.appendByte(m.params.length());
             for (VarSymbol s : m.params) {
-                ListBuffer<Attribute.Compound> buf = new ListBuffer<Attribute.Compound>();
+                ListBuffer<Attribute.Compound> buf = new ListBuffer<>();
                 for (Attribute.Compound a : s.getRawAttributes())
                     if (types.getRetention(a) == RetentionPolicy.RUNTIME)
                         buf.append(a);
@@ -709,7 +708,7 @@
             int attrIndex = writeAttr(names.RuntimeInvisibleParameterAnnotations);
             databuf.appendByte(m.params.length());
             for (VarSymbol s : m.params) {
-                ListBuffer<Attribute.Compound> buf = new ListBuffer<Attribute.Compound>();
+                ListBuffer<Attribute.Compound> buf = new ListBuffer<>();
                 for (Attribute.Compound a : s.getRawAttributes())
                     if (types.getRetention(a) == RetentionPolicy.CLASS)
                         buf.append(a);
@@ -732,14 +731,14 @@
      */
     int writeJavaAnnotations(List<Attribute.Compound> attrs) {
         if (attrs.isEmpty()) return 0;
-        ListBuffer<Attribute.Compound> visibles = new ListBuffer<Attribute.Compound>();
-        ListBuffer<Attribute.Compound> invisibles = new ListBuffer<Attribute.Compound>();
+        ListBuffer<Attribute.Compound> visibles = new ListBuffer<>();
+        ListBuffer<Attribute.Compound> invisibles = new ListBuffer<>();
         for (Attribute.Compound a : attrs) {
             switch (types.getRetention(a)) {
             case SOURCE: break;
             case CLASS: invisibles.append(a); break;
             case RUNTIME: visibles.append(a); break;
-            default: ;// /* fail soft */ throw new AssertionError(vis);
+            default: // /* fail soft */ throw new AssertionError(vis);
             }
         }
 
@@ -793,7 +792,7 @@
             case SOURCE: break;
             case CLASS: invisibles.append(tc); break;
             case RUNTIME: visibles.append(tc); break;
-            default: ;// /* fail soft */ throw new AssertionError(vis);
+            default: // /* fail soft */ throw new AssertionError(vis);
             }
         }
 
@@ -1009,8 +1008,8 @@
             if (c.name != names.empty)
                 pool.put(c.name);
             if (innerClasses == null) {
-                innerClasses = new HashSet<ClassSymbol>();
-                innerClassesQueue = new ListBuffer<ClassSymbol>();
+                innerClasses = new HashSet<>();
+                innerClassesQueue = new ListBuffer<>();
                 pool.put(names.InnerClasses);
             }
             innerClasses.add(c);
@@ -1644,7 +1643,7 @@
         pool = c.pool;
         innerClasses = null;
         innerClassesQueue = null;
-        bootstrapMethods = new LinkedHashMap<DynamicMethod, MethodHandle>();
+        bootstrapMethods = new LinkedHashMap<>();
 
         Type supertype = types.supertype(c.type);
         List<Type> interfaces = types.interfaces(c.type);
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java	Wed Jul 05 19:26:54 2017 +0200
@@ -112,7 +112,7 @@
     /** A buffer for expression catch data. Each enter is a vector
      *  of four unsigned shorts.
      */
-    ListBuffer<char[]> catchInfo = new ListBuffer<char[]>();
+    ListBuffer<char[]> catchInfo = new ListBuffer<>();
 
     /** A buffer for line number information. Each entry is a vector
      *  of two unsigned shorts.
@@ -1988,7 +1988,7 @@
             }
          }
 
-    };
+    }
 
     /** Local variables, indexed by register. */
     LocalVar[] lvar;
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Wed Jul 05 19:26:54 2017 +0200
@@ -59,8 +59,7 @@
  *  deletion without notice.</b>
  */
 public class Gen extends JCTree.Visitor {
-    protected static final Context.Key<Gen> genKey =
-        new Context.Key<Gen>();
+    protected static final Context.Key<Gen> genKey = new Context.Key<>();
 
     private final Log log;
     private final Symtab syms;
@@ -122,7 +121,7 @@
         stringBufferType = target.useStringBuilder()
             ? syms.stringBuilderType
             : syms.stringBufferType;
-        stringBufferAppend = new HashMap<Type,Symbol>();
+        stringBufferAppend = new HashMap<>();
         accessDollar = names.
             fromString("access" + target.syntheticNameChar());
         lower = Lower.instance(context);
@@ -475,11 +474,11 @@
      *  @param c            The enclosing class.
      */
     List<JCTree> normalizeDefs(List<JCTree> defs, ClassSymbol c) {
-        ListBuffer<JCStatement> initCode = new ListBuffer<JCStatement>();
-        ListBuffer<Attribute.TypeCompound> initTAs = new ListBuffer<Attribute.TypeCompound>();
-        ListBuffer<JCStatement> clinitCode = new ListBuffer<JCStatement>();
-        ListBuffer<Attribute.TypeCompound> clinitTAs = new ListBuffer<Attribute.TypeCompound>();
-        ListBuffer<JCTree> methodDefs = new ListBuffer<JCTree>();
+        ListBuffer<JCStatement> initCode = new ListBuffer<>();
+        ListBuffer<Attribute.TypeCompound> initTAs = new ListBuffer<>();
+        ListBuffer<JCStatement> clinitCode = new ListBuffer<>();
+        ListBuffer<Attribute.TypeCompound> clinitTAs = new ListBuffer<>();
+        ListBuffer<JCTree> methodDefs = new ListBuffer<>();
         // Sort definitions into three listbuffers:
         //  - initCode for instance initializers
         //  - clinitCode for class initializers
@@ -562,8 +561,8 @@
 
     private List<Attribute.TypeCompound> getAndRemoveNonFieldTAs(VarSymbol sym) {
         List<TypeCompound> tas = sym.getRawTypeAttributes();
-        ListBuffer<Attribute.TypeCompound> fieldTAs = new ListBuffer<Attribute.TypeCompound>();
-        ListBuffer<Attribute.TypeCompound> nonfieldTAs = new ListBuffer<Attribute.TypeCompound>();
+        ListBuffer<Attribute.TypeCompound> fieldTAs = new ListBuffer<>();
+        ListBuffer<Attribute.TypeCompound> nonfieldTAs = new ListBuffer<>();
         for (TypeCompound ta : tas) {
             if (ta.getPosition().type == TargetType.FIELD) {
                 fieldTAs.add(ta);
@@ -603,7 +602,7 @@
             // We are seeing a constructor that does not call another
             // constructor of the same class.
             List<JCStatement> stats = md.body.stats;
-            ListBuffer<JCStatement> newstats = new ListBuffer<JCStatement>();
+            ListBuffer<JCStatement> newstats = new ListBuffer<>();
 
             if (stats.nonEmpty()) {
                 // Copy initializers of synthetic variables generated in
@@ -1485,7 +1484,7 @@
                 }
             }
         };
-        syncEnv.info.gaps = new ListBuffer<Integer>();
+        syncEnv.info.gaps = new ListBuffer<>();
         genTry(tree.body, List.<JCCatch>nil(), syncEnv);
         code.endScopes(limit);
     }
@@ -1529,7 +1528,7 @@
                 return tree.finalizer != null;
             }
         };
-        tryEnv.info.gaps = new ListBuffer<Integer>();
+        tryEnv.info.gaps = new ListBuffer<>();
         genTry(tree.body, tree.catchers, tryEnv);
     }
     //where
@@ -2505,8 +2504,7 @@
             c.pool = pool;
             pool.reset();
             generateReferencesToPrunedTree(c, pool);
-            Env<GenContext> localEnv =
-                new Env<GenContext>(cdef, new GenContext());
+            Env<GenContext> localEnv = new Env<>(cdef, new GenContext());
             localEnv.toplevel = env.toplevel;
             localEnv.enclClass = cdef;
 
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -78,8 +78,7 @@
  *  deletion without notice.</b>
  */
 public class JNIWriter {
-    protected static final Context.Key<JNIWriter> jniWriterKey =
-        new Context.Key<JNIWriter>();
+    protected static final Context.Key<JNIWriter> jniWriterKey = new Context.Key<>();
 
     /** Access to files. */
     private final JavaFileManager fileManager;
@@ -240,9 +239,9 @@
      * Including super class fields.
      */
     List<VariableElement> getAllFields(TypeElement subclazz) {
-        List<VariableElement> fields = new ArrayList<VariableElement>();
+        List<VariableElement> fields = new ArrayList<>();
         TypeElement cd = null;
-        Stack<TypeElement> s = new Stack<TypeElement>();
+        Stack<TypeElement> s = new Stack<>();
 
         cd = subclazz;
         while (true) {
@@ -355,7 +354,7 @@
                                                Mangle.Type.METHOD_JNI_SHORT));
                 print(out, "  (JNIEnv *, ");
                 List<? extends VariableElement> paramargs = md.getParameters();
-                List<TypeMirror> args = new ArrayList<TypeMirror>();
+                List<TypeMirror> args = new ArrayList<>();
                 for (VariableElement p: paramargs) {
                     args.add(types.erasure(p.asType()));
                 }
@@ -493,7 +492,7 @@
             public static final int METHOD_JDK_1     = 6;
             public static final int METHOD_JNI_SHORT = 7;
             public static final int METHOD_JNI_LONG  = 8;
-        };
+        }
 
         private Elements elems;
         private Types types;
@@ -671,7 +670,7 @@
                 throws SignatureException {
             String signature = null; //Java type signature.
             String typeSignature = null; //Internal type signature.
-            List<String> params = new ArrayList<String>(); //List of parameters.
+            List<String> params = new ArrayList<>(); //List of parameters.
             String paramsig = null; //Java parameter signature.
             String paramJVMSig = null; //Internal parameter signature.
             String returnSig = null; //Java return type signature.
@@ -697,7 +696,7 @@
 
             // Separates parameters.
             if (signature != null) {
-                if (signature.indexOf(",") != -1) {
+                if (signature.contains(",")) {
                     st = new StringTokenizer(signature, ",");
                     if (st != null) {
                         while (st.hasMoreTokens()) {
@@ -755,13 +754,13 @@
 
             if(paramsig != null){
 
-                if(paramsig.indexOf("[]") != -1) {
+                if(paramsig.contains("[]")) {
                     // Gets array dimension.
                     int endindex = paramsig.indexOf("[]");
                     componentType = paramsig.substring(0, endindex);
                     String dimensionString =  paramsig.substring(endindex);
                     if(dimensionString != null){
-                        while(dimensionString.indexOf("[]") != -1){
+                        while(dimensionString.contains("[]")){
                             paramJVMSig += "[";
                             int beginindex = dimensionString.indexOf("]") + 1;
                             if(beginindex < dimensionString.length()){
@@ -785,29 +784,32 @@
             String JVMSig = "";
 
             if(componentType != null){
-                if(componentType.equals("void")) JVMSig += SIG_VOID ;
-                else if(componentType.equals("boolean"))  JVMSig += SIG_BOOLEAN ;
-                else if(componentType.equals("byte")) JVMSig += SIG_BYTE ;
-                else if(componentType.equals("char"))  JVMSig += SIG_CHAR ;
-                else if(componentType.equals("short"))  JVMSig += SIG_SHORT ;
-                else if(componentType.equals("int"))  JVMSig += SIG_INT ;
-                else if(componentType.equals("long"))  JVMSig += SIG_LONG ;
-                else if(componentType.equals("float")) JVMSig += SIG_FLOAT ;
-                else if(componentType.equals("double"))  JVMSig += SIG_DOUBLE ;
-                else {
-                    if(!componentType.equals("")){
-                        TypeElement classNameDoc = elems.getTypeElement(componentType);
+                switch (componentType) {
+                    case "void":    JVMSig += SIG_VOID;    break;
+                    case "boolean": JVMSig += SIG_BOOLEAN; break;
+                    case "byte":    JVMSig += SIG_BYTE;    break;
+                    case "char":    JVMSig += SIG_CHAR;    break;
+                    case "short":   JVMSig += SIG_SHORT;   break;
+                    case "int":     JVMSig += SIG_INT;     break;
+                    case "long":    JVMSig += SIG_LONG;    break;
+                    case "float":   JVMSig += SIG_FLOAT;   break;
+                    case "double":  JVMSig += SIG_DOUBLE;  break;
+                    default:
+                        if (!componentType.equals("")) {
+                            TypeElement classNameDoc = elems.getTypeElement(componentType);
 
-                        if(classNameDoc == null){
-                            throw new SignatureException(componentType);
-                        }else {
-                            String classname = classNameDoc.getQualifiedName().toString();
-                            String newclassname = classname.replace('.', '/');
-                            JVMSig += "L";
-                            JVMSig += newclassname;
-                            JVMSig += ";";
+                            if (classNameDoc == null) {
+                                throw new SignatureException(componentType);
+                            }
+                            else {
+                                String classname = classNameDoc.getQualifiedName().toString();
+                                String newclassname = classname.replace('.', '/');
+                                JVMSig += "L";
+                                JVMSig += newclassname;
+                                JVMSig += ";";
+                            }
                         }
-                    }
+                        break;
                 }
             }
             return JVMSig;
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java	Wed Jul 05 19:26:54 2017 +0200
@@ -71,7 +71,7 @@
         this.pp = pp;
         this.pool = pool;
         this.types = types;
-        this.indices = new HashMap<Object,Integer>(pool.length);
+        this.indices = new HashMap<>(pool.length);
         for (int i = 1; i < pp; i++) {
             if (pool[i] != null) indices.put(pool[i], i);
         }
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Profile.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Profile.java	Wed Jul 05 19:26:54 2017 +0200
@@ -39,9 +39,9 @@
  *  deletion without notice.</b>
  */
 public enum Profile {
-    COMPACT1("compact1", 1, Target.JDK1_8),
-    COMPACT2("compact2", 2, Target.JDK1_8),
-    COMPACT3("compact3", 3, Target.JDK1_8),
+    COMPACT1("compact1", 1, Target.JDK1_8, Target.JDK1_9),
+    COMPACT2("compact2", 2, Target.JDK1_8, Target.JDK1_9),
+    COMPACT3("compact3", 3, Target.JDK1_8, Target.JDK1_9),
 
     DEFAULT {
         @Override
@@ -50,8 +50,7 @@
         }
     };
 
-    private static final Context.Key<Profile> profileKey =
-        new Context.Key<Profile>();
+    private static final Context.Key<Profile> profileKey = new Context.Key<>();
 
     public static Profile instance(Context context) {
         Profile instance = context.get(profileKey);
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java	Wed Jul 05 19:26:54 2017 +0200
@@ -48,7 +48,7 @@
     /** J2SE1.4 = Merlin. */
     JDK1_4("1.4", 48, 0),
 
-    /** Tiger. */
+    /** JDK 5, codename Tiger. */
     JDK1_5("1.5", 49, 0),
 
     /** JDK 6. */
@@ -58,10 +58,12 @@
     JDK1_7("1.7", 51, 0),
 
     /** JDK 8. */
-    JDK1_8("1.8", 52, 0);
+    JDK1_8("1.8", 52, 0),
 
-    private static final Context.Key<Target> targetKey =
-        new Context.Key<Target>();
+    /** JDK 9, initially an alias for 8. */
+    JDK1_9("1.9", 52, 0);
+
+    private static final Context.Key<Target> targetKey = new Context.Key<>();
 
     public static Target instance(Context context) {
         Target instance = context.get(targetKey);
@@ -81,7 +83,7 @@
     private static final Target MAX = values()[values().length - 1];
     public static Target MAX() { return MAX; }
 
-    private static final Map<String,Target> tab = new HashMap<String,Target>();
+    private static final Map<String,Target> tab = new HashMap<>();
     static {
         for (Target t : values()) {
             tab.put(t.name, t);
@@ -90,6 +92,7 @@
         tab.put("6", JDK1_6);
         tab.put("7", JDK1_7);
         tab.put("8", JDK1_8);
+        tab.put("9", JDK1_9);
     }
 
     public final String name;
@@ -101,7 +104,7 @@
         this.minorVersion = minorVersion;
     }
 
-    public static final Target DEFAULT = JDK1_8;
+    public static final Target DEFAULT = JDK1_9;
 
     public static Target lookup(String name) {
         return tab.get(name);
--- a/langtools/src/share/classes/com/sun/tools/javac/main/CommandLine.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/CommandLine.java	Wed Jul 05 19:26:54 2017 +0200
@@ -54,9 +54,8 @@
     public static String[] parse(String[] args)
         throws IOException
     {
-        ListBuffer<String> newArgs = new ListBuffer<String>();
-        for (int i = 0; i < args.length; i++) {
-            String arg = args[i];
+        ListBuffer<String> newArgs = new ListBuffer<>();
+        for (String arg : args) {
             if (arg.length() > 1 && arg.charAt(0) == '@') {
                 arg = arg.substring(1);
                 if (arg.charAt(0) == '@') {
@@ -74,17 +73,17 @@
     private static void loadCmdFile(String name, ListBuffer<String> args)
         throws IOException
     {
-        Reader r = new BufferedReader(new FileReader(name));
-        StreamTokenizer st = new StreamTokenizer(r);
-        st.resetSyntax();
-        st.wordChars(' ', 255);
-        st.whitespaceChars(0, ' ');
-        st.commentChar('#');
-        st.quoteChar('"');
-        st.quoteChar('\'');
-        while (st.nextToken() != StreamTokenizer.TT_EOF) {
-            args.append(st.sval);
+        try (Reader r = new BufferedReader(new FileReader(name))) {
+            StreamTokenizer st = new StreamTokenizer(r);
+            st.resetSyntax();
+            st.wordChars(' ', 255);
+            st.whitespaceChars(0, ' ');
+            st.commentChar('#');
+            st.quoteChar('"');
+            st.quoteChar('\'');
+            while (st.nextToken() != StreamTokenizer.TT_EOF) {
+                args.append(st.sval);
+            }
         }
-        r.close();
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Wed Jul 05 19:26:54 2017 +0200
@@ -81,8 +81,7 @@
  */
 public class JavaCompiler {
     /** The context key for the compiler. */
-    protected static final Context.Key<JavaCompiler> compilerKey =
-        new Context.Key<JavaCompiler>();
+    protected static final Context.Key<JavaCompiler> compilerKey = new Context.Key<>();
 
     /** Get the JavaCompiler instance for this context. */
     public static JavaCompiler instance(Context context) {
@@ -556,7 +555,7 @@
      *  we don't accidentally overwrite an input file when -s is set.
      *  initialized by `compile'.
      */
-    protected Set<JavaFileObject> inputFiles = new HashSet<JavaFileObject>();
+    protected Set<JavaFileObject> inputFiles = new HashSet<>();
 
     protected boolean shouldStop(CompileState cs) {
         CompileState shouldStopPolicy = (errorCount() > 0 || unrecoverableError())
@@ -726,13 +725,10 @@
             log.error(cdef.pos(), "source.cant.overwrite.input.file", outFile);
             return null;
         } else {
-            BufferedWriter out = new BufferedWriter(outFile.openWriter());
-            try {
+            try (BufferedWriter out = new BufferedWriter(outFile.openWriter())) {
                 new Pretty(out, true).printUnit(env.toplevel, cdef);
                 if (verbose)
                     log.printVerbose("wrote.file", outFile);
-            } finally {
-                out.close();
             }
             return outFile;
         }
@@ -946,7 +942,7 @@
 
         //parse all files
         ListBuffer<JCCompilationUnit> trees = new ListBuffer<>();
-        Set<JavaFileObject> filesSoFar = new HashSet<JavaFileObject>();
+        Set<JavaFileObject> filesSoFar = new HashSet<>();
         for (JavaFileObject fileObject : fileObjects) {
             if (!filesSoFar.contains(fileObject)) {
                 filesSoFar.add(fileObject);
@@ -1355,8 +1351,7 @@
         return stopIfError(CompileState.FLOW, results);
     }
 
-    HashMap<Env<AttrContext>, Queue<Pair<Env<AttrContext>, JCClassDecl>>> desugaredEnvs =
-            new HashMap<Env<AttrContext>, Queue<Pair<Env<AttrContext>, JCClassDecl>>>();
+    HashMap<Env<AttrContext>, Queue<Pair<Env<AttrContext>, JCClassDecl>>> desugaredEnvs = new HashMap<>();
 
     /**
      * Prepare attributed parse trees, in conjunction with their attribution contexts,
@@ -1386,7 +1381,7 @@
          * already been added to C and its superclasses.
          */
         class ScanNested extends TreeScanner {
-            Set<Env<AttrContext>> dependencies = new LinkedHashSet<Env<AttrContext>>();
+            Set<Env<AttrContext>> dependencies = new LinkedHashSet<>();
             protected boolean hasLambdas;
             @Override
             public void visitClassDef(JCClassDecl node) {
@@ -1459,7 +1454,7 @@
                     List<JCTree> pdef = lower.translateTopLevelClass(env, env.tree, localMake);
                     if (pdef.head != null) {
                         Assert.check(pdef.tail.isEmpty());
-                        results.add(new Pair<Env<AttrContext>, JCClassDecl>(env, (JCClassDecl)pdef.head));
+                        results.add(new Pair<>(env, (JCClassDecl)pdef.head));
                     }
                 }
                 return;
@@ -1473,7 +1468,7 @@
                     rootClasses.contains((JCClassDecl)untranslated) &&
                     ((cdef.mods.flags & (Flags.PROTECTED|Flags.PUBLIC)) != 0 ||
                      cdef.sym.packge().getQualifiedName() == names.java_lang)) {
-                    results.add(new Pair<Env<AttrContext>, JCClassDecl>(env, removeMethodBodies(cdef)));
+                    results.add(new Pair<>(env, removeMethodBodies(cdef)));
                 }
                 return;
             }
@@ -1501,7 +1496,7 @@
                 JCClassDecl cdef = (JCClassDecl)env.tree;
                 if (untranslated instanceof JCClassDecl &&
                     rootClasses.contains((JCClassDecl)untranslated)) {
-                    results.add(new Pair<Env<AttrContext>, JCClassDecl>(env, cdef));
+                    results.add(new Pair<>(env, cdef));
                 }
                 return;
             }
@@ -1516,7 +1511,7 @@
             //generate code for each class
             for (List<JCTree> l = cdefs; l.nonEmpty(); l = l.tail) {
                 JCClassDecl cdef = (JCClassDecl)l.head;
-                results.add(new Pair<Env<AttrContext>, JCClassDecl>(env, cdef));
+                results.add(new Pair<>(env, cdef));
             }
         }
         finally {
@@ -1589,11 +1584,11 @@
         // where
         Map<JCCompilationUnit, Queue<Env<AttrContext>>> groupByFile(Queue<Env<AttrContext>> envs) {
             // use a LinkedHashMap to preserve the order of the original list as much as possible
-            Map<JCCompilationUnit, Queue<Env<AttrContext>>> map = new LinkedHashMap<JCCompilationUnit, Queue<Env<AttrContext>>>();
+            Map<JCCompilationUnit, Queue<Env<AttrContext>>> map = new LinkedHashMap<>();
             for (Env<AttrContext> env: envs) {
                 Queue<Env<AttrContext>> sublist = map.get(env.toplevel);
                 if (sublist == null) {
-                    sublist = new ListBuffer<Env<AttrContext>>();
+                    sublist = new ListBuffer<>();
                     map.put(env.toplevel, sublist);
                 }
                 sublist.add(env);
--- a/langtools/src/share/classes/com/sun/tools/javac/main/Main.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/Main.java	Wed Jul 05 19:26:54 2017 +0200
@@ -393,8 +393,8 @@
         if (options == null)
             options = Options.instance(context); // creates a new one
 
-        filenames = new LinkedHashSet<File>();
-        classnames = new ListBuffer<String>();
+        filenames = new LinkedHashSet<>();
+        classnames = new ListBuffer<>();
         JavaCompiler comp = null;
         /*
          * TODO: Logic below about what is an acceptable command line
@@ -453,15 +453,13 @@
                 JavacProcessingEnvironment pEnv = JavacProcessingEnvironment.instance(context);
                 ClassLoader cl = pEnv.getProcessorClassLoader();
                 ServiceLoader<Plugin> sl = ServiceLoader.load(Plugin.class, cl);
-                Set<List<String>> pluginsToCall = new LinkedHashSet<List<String>>();
+                Set<List<String>> pluginsToCall = new LinkedHashSet<>();
                 for (String plugin: plugins.split("\\x00")) {
                     pluginsToCall.add(List.from(plugin.split("\\s+")));
                 }
                 JavacTask task = null;
-                Iterator<Plugin> iter = sl.iterator();
-                while (iter.hasNext()) {
-                    Plugin plugin = iter.next();
-                    for (List<String> p: pluginsToCall) {
+                for (Plugin plugin : sl) {
+                    for (List<String> p : pluginsToCall) {
                         if (plugin.getName().equals(p.head)) {
                             pluginsToCall.remove(p);
                             try {
@@ -488,7 +486,7 @@
             String xdoclint = options.get(XDOCLINT);
             String xdoclintCustom = options.get(XDOCLINT_CUSTOM);
             if (xdoclint != null || xdoclintCustom != null) {
-                Set<String> doclintOpts = new LinkedHashSet<String>();
+                Set<String> doclintOpts = new LinkedHashSet<>();
                 if (xdoclint != null)
                     doclintOpts.add(DocLint.XMSGS_OPTION);
                 if (xdoclintCustom != null) {
@@ -640,14 +638,11 @@
                 final String algorithm = "MD5";
                 byte[] digest;
                 MessageDigest md = MessageDigest.getInstance(algorithm);
-                DigestInputStream in = new DigestInputStream(url.openStream(), md);
-                try {
+                try (DigestInputStream in = new DigestInputStream(url.openStream(), md)) {
                     byte[] buf = new byte[8192];
                     int n;
                     do { n = in.read(buf); } while (n > 0);
                     digest = md.digest();
-                } finally {
-                    in.close();
                 }
                 StringBuilder sb = new StringBuilder();
                 for (byte b: digest)
--- a/langtools/src/share/classes/com/sun/tools/javac/main/Option.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/Option.java	Wed Jul 05 19:26:54 2017 +0200
@@ -47,6 +47,7 @@
 import com.sun.tools.javac.util.Log.PrefixKind;
 import com.sun.tools.javac.util.Log.WriterKind;
 import com.sun.tools.javac.util.Options;
+import com.sun.tools.javac.util.StringUtils;
 import static com.sun.tools.javac.main.Option.ChoiceKind.*;
 import static com.sun.tools.javac.main.Option.OptionGroup.*;
 import static com.sun.tools.javac.main.Option.OptionKind.*;
@@ -563,7 +564,7 @@
     }
     // where
         private static Map<String,Boolean> createChoices(String... choices) {
-            Map<String,Boolean> map = new LinkedHashMap<String,Boolean>();
+            Map<String,Boolean> map = new LinkedHashMap<>();
             for (String c: choices)
                 map.put(c, false);
             return map;
@@ -713,12 +714,12 @@
             String v = options.get(XPKGINFO);
             return (v == null
                     ? PkgInfo.LEGACY
-                    : PkgInfo.valueOf(v.toUpperCase()));
+                    : PkgInfo.valueOf(StringUtils.toUpperCase(v)));
         }
     }
 
     private static Map<String,Boolean> getXLintChoices() {
-        Map<String,Boolean> choices = new LinkedHashMap<String,Boolean>();
+        Map<String,Boolean> choices = new LinkedHashMap<>();
         choices.put("all", false);
         for (Lint.LintCategory c : Lint.LintCategory.values())
             choices.put(c.option, c.hidden);
--- a/langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java	Wed Jul 05 19:26:54 2017 +0200
@@ -94,7 +94,7 @@
      * defaulted.
      */
     private Map<String, Object> getAllReflectedValues() {
-        Map<String, Object> res = new LinkedHashMap<String, Object>();
+        Map<String, Object> res = new LinkedHashMap<>();
 
         for (Map.Entry<MethodSymbol, Attribute> entry :
                                                   getAllValues().entrySet()) {
@@ -115,8 +115,7 @@
      * Includes all elements, whether explicit or defaulted.
      */
     private Map<MethodSymbol, Attribute> getAllValues() {
-        Map<MethodSymbol, Attribute> res =
-            new LinkedHashMap<MethodSymbol, Attribute>();
+        Map<MethodSymbol, Attribute> res = new LinkedHashMap<>();
 
         // First find the default values.
         ClassSymbol sym = (ClassSymbol) anno.type.tsym;
@@ -186,7 +185,7 @@
 
             if (elemName.equals(elemName.table.names.java_lang_Class)) {   // Class[]
                 // Construct a proxy for a MirroredTypesException
-                ListBuffer<TypeMirror> elems = new ListBuffer<TypeMirror>();
+                ListBuffer<TypeMirror> elems = new ListBuffer<>();
                 for (Attribute value : a.values) {
                     Type elem = ((Attribute.Class) value).classType;
                     elems.append(elem);
--- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacElements.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/JavacElements.java	Wed Jul 05 19:26:54 2017 +0200
@@ -547,7 +547,7 @@
         JCTree tree = TreeInfo.declarationFor(sym, enterEnv.tree);
         if (tree == null || enterEnv.toplevel == null)
             return null;
-        return new Pair<JCTree,JCCompilationUnit>(tree, enterEnv.toplevel);
+        return new Pair<>(tree, enterEnv.toplevel);
     }
 
     /**
@@ -578,7 +578,7 @@
         // 6388543: if v != null, we should search within annoTree to find
         // the tree matching v. For now, we ignore v and return the tree of
         // the annotation.
-        return new Pair<JCTree, JCCompilationUnit>(annoTree, elemTreeTop.snd);
+        return new Pair<>(annoTree, elemTreeTop.snd);
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java	Wed Jul 05 19:26:54 2017 +0200
@@ -246,7 +246,7 @@
                 throw new IllegalArgumentException(
                 "Incorrect number of type arguments");
 
-            ListBuffer<Type> targs = new ListBuffer<Type>();
+            ListBuffer<Type> targs = new ListBuffer<>();
             for (TypeMirror t : typeArgs) {
                 if (!(t instanceof ReferenceType || t instanceof WildcardType))
                     throw new IllegalArgumentException(t.toString());
@@ -314,7 +314,7 @@
         MethodSymbol m = (MethodSymbol) elem;
         ClassSymbol origin = (ClassSymbol) m.owner;
 
-        Set<MethodSymbol> results = new LinkedHashSet<MethodSymbol>();
+        Set<MethodSymbol> results = new LinkedHashSet<>();
         for (Type t : types.closure(origin.type)) {
             if (t != origin.type) {
                 ClassSymbol c = (ClassSymbol) t.tsym;
--- a/langtools/src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java	Wed Jul 05 19:26:54 2017 +0200
@@ -113,8 +113,8 @@
         super(charset);
         if (register)
             context.put(JavaFileManager.class, this);
-        pathsForLocation = new HashMap<Location, PathsForLocation>();
-        fileSystems = new HashMap<Path,FileSystem>();
+        pathsForLocation = new HashMap<>();
+        fileSystems = new HashMap<>();
         setContext(context);
     }
 
@@ -155,7 +155,7 @@
         Iterable<? extends Path> path = getLocation(location);
         if (path == null)
             return null;
-        ListBuffer<URL> lb = new ListBuffer<URL>();
+        ListBuffer<URL> lb = new ListBuffer<>();
         for (Path p: path) {
             try {
                 lb.append(p.toUri().toURL());
@@ -308,7 +308,7 @@
         Iterable<? extends Path> paths = getLocation(location);
         if (paths == null)
             return List.nil();
-        ListBuffer<JavaFileObject> results = new ListBuffer<JavaFileObject>();
+        ListBuffer<JavaFileObject> results = new ListBuffer<>();
 
         for (Path path : paths)
             list(path, packageName, kinds, recurse, results);
@@ -394,9 +394,9 @@
         Iterable<? extends Path> paths) {
         ArrayList<PathFileObject> result;
         if (paths instanceof Collection<?>)
-            result = new ArrayList<PathFileObject>(((Collection<?>)paths).size());
+            result = new ArrayList<>(((Collection<?>)paths).size());
         else
-            result = new ArrayList<PathFileObject>();
+            result = new ArrayList<>();
         for (Path p: paths)
             result.add(PathFileObject.createSimplePathFileObject(this, nullCheck(p)));
         return result;
--- a/langtools/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java	Wed Jul 05 19:26:54 2017 +0200
@@ -219,8 +219,7 @@
     public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
         CharBuffer cb = fileManager.getCachedContent(this);
         if (cb == null) {
-            InputStream in = openInputStream();
-            try {
+            try (InputStream in = openInputStream()) {
                 ByteBuffer bb = fileManager.makeByteBuffer(in);
                 JavaFileObject prev = fileManager.log.useSource(this);
                 try {
@@ -232,8 +231,6 @@
                 if (!ignoreEncodingErrors) {
                     fileManager.cache(this, cb);
                 }
-            } finally {
-                in.close();
             }
         }
         return cb;
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java	Wed Jul 05 19:26:54 2017 +0200
@@ -57,6 +57,7 @@
 import com.sun.tools.javac.util.Names;
 import com.sun.tools.javac.util.Options;
 import com.sun.tools.javac.util.Position;
+import com.sun.tools.javac.util.StringUtils;
 import static com.sun.tools.javac.util.LayoutCharacters.*;
 
 /**
@@ -129,7 +130,7 @@
         List<DCTree> tags = blockTags();
 
         // split body into first sentence and body
-        ListBuffer<DCTree> fs = new ListBuffer<DCTree>();
+        ListBuffer<DCTree> fs = new ListBuffer<>();
         loop:
         for (; body.nonEmpty(); body = body.tail) {
             DCTree t = body.head;
@@ -193,7 +194,7 @@
      */
     @SuppressWarnings("fallthrough")
     protected List<DCTree> blockContent() {
-        ListBuffer<DCTree> trees = new ListBuffer<DCTree>();
+        ListBuffer<DCTree> trees = new ListBuffer<>();
         textStart = -1;
 
         loop:
@@ -264,7 +265,7 @@
      * Non-standard tags are represented by {@link UnknownBlockTag}.
      */
     protected List<DCTree> blockTags() {
-        ListBuffer<DCTree> tags = new ListBuffer<DCTree>();
+        ListBuffer<DCTree> tags = new ListBuffer<>();
         while (ch == '@')
             tags.add(blockTag());
         return tags.toList();
@@ -534,7 +535,7 @@
             return List.nil();
 
         JavacParser p = fac.newParser(s.replace("...", "[]"), false, false, false);
-        ListBuffer<JCTree> paramTypes = new ListBuffer<JCTree>();
+        ListBuffer<JCTree> paramTypes = new ListBuffer<>();
         paramTypes.add(p.parseType());
 
         if (p.token().kind == TokenKind.IDENTIFIER)
@@ -613,7 +614,7 @@
      */
     @SuppressWarnings("fallthrough")
     protected List<DCTree> inlineContent() {
-        ListBuffer<DCTree> trees = new ListBuffer<DCTree>();
+        ListBuffer<DCTree> trees = new ListBuffer<>();
 
         skipWhitespace();
         int pos = bp;
@@ -791,7 +792,7 @@
      * "value" may be unquoted, single-quoted, or double-quoted.
      */
     protected List<DCTree> htmlAttrs() {
-        ListBuffer<DCTree> attrs = new ListBuffer<DCTree>();
+        ListBuffer<DCTree> attrs = new ListBuffer<>();
         skipWhitespace();
 
         loop:
@@ -802,7 +803,7 @@
             List<DCTree> value = null;
             ValueKind vkind = ValueKind.EMPTY;
             if (ch == '=') {
-                ListBuffer<DCTree> v = new ListBuffer<DCTree>();
+                ListBuffer<DCTree> v = new ListBuffer<>();
                 nextChar();
                 skipWhitespace();
                 if (ch == '\'' || ch == '"') {
@@ -989,11 +990,11 @@
     }
 
 
-    Set<String> htmlBlockTags = new HashSet<String>(Arrays.asList(
+    Set<String> htmlBlockTags = new HashSet<>(Arrays.asList(
                     "h1", "h2", "h3", "h4", "h5", "h6", "p", "pre"));
 
     protected boolean isSentenceBreak(Name n) {
-        return htmlBlockTags.contains(n.toString().toLowerCase());
+        return htmlBlockTags.contains(StringUtils.toLowerCase(n.toString()));
     }
 
     protected boolean isSentenceBreak(DCTree t) {
@@ -1277,7 +1278,7 @@
             },
         };
 
-        tagParsers = new HashMap<Name,TagParser>();
+        tagParsers = new HashMap<>();
         for (TagParser p: parsers)
             tagParsers.put(names.fromString(p.getTreeKind().tagName), p);
 
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java	Wed Jul 05 19:26:54 2017 +0200
@@ -729,7 +729,7 @@
                                + new String(reader.getRawCharacters(pos, endPos))
                                + "|");
         char[] buf = reader.getRawCharacters(pos, endPos);
-        return new BasicComment<UnicodeReader>(new UnicodeReader(fac, buf, buf.length), style);
+        return new BasicComment<>(new UnicodeReader(fac, buf, buf.length), style);
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Wed Jul 05 19:26:54 2017 +0200
@@ -1010,8 +1010,8 @@
         /** optimization: To save allocating a new operand/operator stack
          *  for every binary operation, we use supplys.
          */
-        ArrayList<JCExpression[]> odStackSupply = new ArrayList<JCExpression[]>();
-        ArrayList<Token[]> opStackSupply = new ArrayList<Token[]>();
+        ArrayList<JCExpression[]> odStackSupply = new ArrayList<>();
+        ArrayList<Token[]> opStackSupply = new ArrayList<>();
 
         private JCExpression[] newOdStack() {
             if (odStackSupply.isEmpty())
@@ -1314,7 +1314,7 @@
                             //is a generic type i.e. A<S>::m
                             int pos1 = token.pos;
                             accept(LT);
-                            ListBuffer<JCExpression> args = new ListBuffer<JCExpression>();
+                            ListBuffer<JCExpression> args = new ListBuffer<>();
                             args.append(typeArgument());
                             while (token.kind == COMMA) {
                                 nextToken();
@@ -1547,7 +1547,7 @@
                     }
                     break;
                 case BYTE: case SHORT: case INT: case LONG: case FLOAT:
-                case DOUBLE: case BOOLEAN: case CHAR:
+                case DOUBLE: case BOOLEAN: case CHAR: case VOID:
                     if (peekToken(lookahead, RPAREN)) {
                         //Type, ')' -> cast
                         return ParensResult.CAST;
@@ -1696,7 +1696,7 @@
         CAST,
         EXPLICIT_LAMBDA,
         IMPLICIT_LAMBDA,
-        PARENS;
+        PARENS
     }
 
     JCExpression lambdaExpressionOrStatement(boolean hasParens, boolean explicitParams, int pos) {
@@ -2172,7 +2172,7 @@
                 return syntaxError(token.pos, List.<JCTree>of(t), "array.dimension.missing");
             }
         } else {
-            ListBuffer<JCExpression> dims = new ListBuffer<JCExpression>();
+            ListBuffer<JCExpression> dims = new ListBuffer<>();
 
             // maintain array dimension type annotations
             ListBuffer<List<JCAnnotation>> dimAnnotations = new ListBuffer<>();
@@ -2226,7 +2226,7 @@
      */
     JCExpression arrayInitializer(int newpos, JCExpression t) {
         accept(LBRACE);
-        ListBuffer<JCExpression> elems = new ListBuffer<JCExpression>();
+        ListBuffer<JCExpression> elems = new ListBuffer<>();
         if (token.kind == COMMA) {
             nextToken();
         } else if (token.kind != RBRACE) {
@@ -2288,7 +2288,7 @@
     @SuppressWarnings("fallthrough")
     List<JCStatement> blockStatements() {
         //todo: skip to anchor on error(?)
-        ListBuffer<JCStatement> stats = new ListBuffer<JCStatement>();
+        ListBuffer<JCStatement> stats = new ListBuffer<>();
         while (true) {
             List<JCStatement> stat = blockStatement();
             if (stat.isEmpty()) {
@@ -2495,7 +2495,7 @@
                 accept(RPAREN);
             }
             JCBlock body = block();
-            ListBuffer<JCCatch> catchers = new ListBuffer<JCCatch>();
+            ListBuffer<JCCatch> catchers = new ListBuffer<>();
             JCBlock finalizer = null;
             if (token.kind == CATCH || token.kind == FINALLY) {
                 while (token.kind == CATCH) catchers.append(catchClause());
@@ -2643,7 +2643,7 @@
      *  SwitchLabel = CASE ConstantExpression ":" | DEFAULT ":"
      */
     List<JCCase> switchBlockStatementGroups() {
-        ListBuffer<JCCase> cases = new ListBuffer<JCCase>();
+        ListBuffer<JCCase> cases = new ListBuffer<>();
         while (true) {
             int pos = token.pos;
             switch (token.kind) {
@@ -2739,7 +2739,7 @@
      */
     List<JCAnnotation> annotationsOpt(Tag kind) {
         if (token.kind != MONKEYS_AT) return List.nil(); // optimization
-        ListBuffer<JCAnnotation> buf = new ListBuffer<JCAnnotation>();
+        ListBuffer<JCAnnotation> buf = new ListBuffer<>();
         int prevmode = mode;
         while (token.kind == MONKEYS_AT) {
             int pos = token.pos;
@@ -2768,7 +2768,7 @@
     }
     protected JCModifiers modifiersOpt(JCModifiers partial) {
         long flags;
-        ListBuffer<JCAnnotation> annotations = new ListBuffer<JCAnnotation>();
+        ListBuffer<JCAnnotation> annotations = new ListBuffer<>();
         int pos;
         if (partial == null) {
             flags = 0;
@@ -2868,7 +2868,7 @@
     /** AnnotationFieldValues   = "(" [ AnnotationFieldValue { "," AnnotationFieldValue } ] ")" */
     List<JCExpression> annotationFieldValues() {
         accept(LPAREN);
-        ListBuffer<JCExpression> buf = new ListBuffer<JCExpression>();
+        ListBuffer<JCExpression> buf = new ListBuffer<>();
         if (token.kind != RPAREN) {
             buf.append(annotationFieldValue());
             while (token.kind == COMMA) {
@@ -2913,7 +2913,7 @@
         case LBRACE:
             pos = token.pos;
             accept(LBRACE);
-            ListBuffer<JCExpression> buf = new ListBuffer<JCExpression>();
+            ListBuffer<JCExpression> buf = new ListBuffer<>();
             if (token.kind == COMMA) {
                 nextToken();
             } else if (token.kind != RBRACE) {
@@ -3035,7 +3035,7 @@
     /** Resources = Resource { ";" Resources }
      */
     List<JCTree> resources() {
-        ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
+        ListBuffer<JCTree> defs = new ListBuffer<>();
         defs.append(resource());
         while (token.kind == SEMI) {
             // All but last of multiple declarators must subsume a semicolon
@@ -3085,7 +3085,7 @@
             pid = qualident(false);
             accept(SEMI);
         }
-        ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
+        ListBuffer<JCTree> defs = new ListBuffer<>();
         boolean checkForImports = true;
         boolean firstTypeDecl = true;
         while (token.kind != EOF) {
@@ -3294,7 +3294,7 @@
      */
     List<JCTree> enumBody(Name enumName) {
         accept(LBRACE);
-        ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
+        ListBuffer<JCTree> defs = new ListBuffer<>();
         if (token.kind == COMMA) {
             nextToken();
         } else if (token.kind != RBRACE && token.kind != SEMI) {
@@ -3363,7 +3363,7 @@
     /** TypeList = Type {"," Type}
      */
     List<JCExpression> typeList() {
-        ListBuffer<JCExpression> ts = new ListBuffer<JCExpression>();
+        ListBuffer<JCExpression> ts = new ListBuffer<>();
         ts.append(parseType());
         while (token.kind == COMMA) {
             nextToken();
@@ -3383,7 +3383,7 @@
             if (token.kind == LBRACE)
                 nextToken();
         }
-        ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
+        ListBuffer<JCTree> defs = new ListBuffer<>();
         while (token.kind != RBRACE && token.kind != EOF) {
             defs.appendList(classOrInterfaceBodyDeclaration(className, isInterface));
             if (token.pos <= endPosTable.errorEndPos) {
@@ -3558,7 +3558,7 @@
     /** QualidentList = [Annotations] Qualident {"," [Annotations] Qualident}
      */
     List<JCExpression> qualidentList() {
-        ListBuffer<JCExpression> ts = new ListBuffer<JCExpression>();
+        ListBuffer<JCExpression> ts = new ListBuffer<>();
 
         List<JCAnnotation> typeAnnos = typeAnnotationsOpt();
         JCExpression qi = qualident(true);
@@ -3591,7 +3591,7 @@
     List<JCTypeParameter> typeParametersOpt() {
         if (token.kind == LT) {
             checkGenerics();
-            ListBuffer<JCTypeParameter> typarams = new ListBuffer<JCTypeParameter>();
+            ListBuffer<JCTypeParameter> typarams = new ListBuffer<>();
             nextToken();
             typarams.append(typeParameter());
             while (token.kind == COMMA) {
@@ -3616,7 +3616,7 @@
         int pos = token.pos;
         List<JCAnnotation> annos = typeAnnotationsOpt();
         Name name = ident();
-        ListBuffer<JCExpression> bounds = new ListBuffer<JCExpression>();
+        ListBuffer<JCExpression> bounds = new ListBuffer<>();
         if (token.kind == EXTENDS) {
             nextToken();
             bounds.append(parseType());
@@ -3636,7 +3636,7 @@
         return formalParameters(false);
     }
     List<JCVariableDecl> formalParameters(boolean lambdaParameters) {
-        ListBuffer<JCVariableDecl> params = new ListBuffer<JCVariableDecl>();
+        ListBuffer<JCVariableDecl> params = new ListBuffer<>();
         JCVariableDecl lastParam;
         accept(LPAREN);
         if (token.kind != RPAREN) {
@@ -3661,7 +3661,7 @@
         if (hasParens) {
             accept(LPAREN);
         }
-        ListBuffer<JCVariableDecl> params = new ListBuffer<JCVariableDecl>();
+        ListBuffer<JCVariableDecl> params = new ListBuffer<>();
         if (token.kind != RPAREN && token.kind != ARROW) {
             params.append(implicitParameter());
             while (token.kind == COMMA) {
@@ -4051,7 +4051,7 @@
 
         SimpleEndPosTable(JavacParser parser) {
             super(parser);
-            endPosMap = new HashMap<JCTree, Integer>();
+            endPosMap = new HashMap<>();
         }
 
         public void storeEnd(JCTree tree, int endpos) {
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/LazyDocCommentTable.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/LazyDocCommentTable.java	Wed Jul 05 19:26:54 2017 +0200
@@ -59,7 +59,7 @@
     LazyDocCommentTable(ParserFactory fac) {
         this.fac = fac;
         diagSource = fac.log.currentSource();
-        table = new HashMap<JCTree, Entry>();
+        table = new HashMap<>();
     }
 
     public boolean hasComment(JCTree tree) {
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/ParserFactory.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/ParserFactory.java	Wed Jul 05 19:26:54 2017 +0200
@@ -46,7 +46,7 @@
 public class ParserFactory {
 
     /** The context key for the parser factory. */
-    protected static final Context.Key<ParserFactory> parserFactoryKey = new Context.Key<ParserFactory>();
+    protected static final Context.Key<ParserFactory> parserFactoryKey = new Context.Key<>();
 
     public static ParserFactory instance(Context context) {
         ParserFactory instance = context.get(parserFactoryKey);
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Wed Jul 05 19:26:54 2017 +0200
@@ -56,7 +56,7 @@
 
     /** Buffer of saved tokens (used during lookahead)
      */
-    private List<Token> savedTokens = new ArrayList<Token>();
+    private List<Token> savedTokens = new ArrayList<>();
 
     private JavaTokenizer tokenizer;
 
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/ScannerFactory.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/ScannerFactory.java	Wed Jul 05 19:26:54 2017 +0200
@@ -43,8 +43,7 @@
  */
 public class ScannerFactory {
     /** The context key for the scanner factory. */
-    public static final Context.Key<ScannerFactory> scannerFactoryKey =
-        new Context.Key<ScannerFactory>();
+    public static final Context.Key<ScannerFactory> scannerFactoryKey = new Context.Key<>();
 
     /** Get the Factory instance for this context. */
     public static ScannerFactory instance(Context context) {
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/Tokens.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/Tokens.java	Wed Jul 05 19:26:54 2017 +0200
@@ -62,8 +62,7 @@
      */
     private Name[] tokenName = new Name[TokenKind.values().length];
 
-    public static final Context.Key<Tokens> tokensKey =
-        new Context.Key<Tokens>();
+    public static final Context.Key<Tokens> tokensKey = new Context.Key<>();
 
     public static Tokens instance(Context context) {
         Tokens instance = context.get(tokensKey);
@@ -316,7 +315,7 @@
             DEFAULT,
             NAMED,
             STRING,
-            NUMERIC;
+            NUMERIC
         }
 
         /** The token kind */
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java	Wed Jul 05 19:26:54 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
@@ -367,8 +367,8 @@
 
         openTypeNames  = synchronizedSet(new LinkedHashSet<String>());
 
-        aggregateGeneratedSourceNames = new LinkedHashSet<String>();
-        aggregateGeneratedClassNames  = new LinkedHashSet<String>();
+        aggregateGeneratedSourceNames = new LinkedHashSet<>();
+        aggregateGeneratedClassNames  = new LinkedHashSet<>();
 
         lint = (Lint.instance(context)).isEnabled(PROCESSING);
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Wed Jul 05 19:26:54 2017 +0200
@@ -201,7 +201,7 @@
     }
 
     private Set<String> initPlatformAnnotations() {
-        Set<String> platformAnnotations = new HashSet<String>();
+        Set<String> platformAnnotations = new HashSet<>();
         platformAnnotations.add("java.lang.Deprecated");
         platformAnnotations.add("java.lang.Override");
         platformAnnotations.add("java.lang.SuppressWarnings");
@@ -374,7 +374,7 @@
                 try {
                     loader.reload();
                 } catch(Exception e) {
-                    ; // Ignore problems during a call to reload.
+                    // Ignore problems during a call to reload.
                 }
             }
         }
@@ -450,7 +450,7 @@
     private Map<String, String> initProcessorOptions(Context context) {
         Options options = Options.instance(context);
         Set<String> keySet = options.keySet();
-        Map<String, String> tempOptions = new LinkedHashMap<String, String>();
+        Map<String, String> tempOptions = new LinkedHashMap<>();
 
         for(String key : keySet) {
             if (key.startsWith("-A") && key.length() > 2) {
@@ -473,7 +473,7 @@
     }
 
     private Set<String> initUnmatchedProcessorOptions() {
-        Set<String> unmatchedProcessorOptions = new HashSet<String>();
+        Set<String> unmatchedProcessorOptions = new HashSet<>();
         unmatchedProcessorOptions.addAll(processorOptions.keySet());
         return unmatchedProcessorOptions;
     }
@@ -501,14 +501,14 @@
 
                 checkSourceVersionCompatibility(source, log);
 
-                supportedAnnotationPatterns = new ArrayList<Pattern>();
+                supportedAnnotationPatterns = new ArrayList<>();
                 for (String importString : processor.getSupportedAnnotationTypes()) {
                     supportedAnnotationPatterns.add(importStringToPattern(importString,
                                                                           processor,
                                                                           log));
                 }
 
-                supportedOptionNames = new ArrayList<String>();
+                supportedOptionNames = new ArrayList<>();
                 for (String optionName : processor.getSupportedOptions() ) {
                     if (checkOptionName(optionName, log))
                         supportedOptionNames.add(optionName);
@@ -639,7 +639,7 @@
 
         DiscoveredProcessors(Iterator<? extends Processor> processorIterator) {
             this.processorIterator = processorIterator;
-            this.procStateList = new ArrayList<ProcessorState>();
+            this.procStateList = new ArrayList<>();
         }
 
         /**
@@ -657,8 +657,7 @@
                                      Set<TypeElement> annotationsPresent,
                                      List<ClassSymbol> topLevelClasses,
                                      List<PackageSymbol> packageInfoFiles) {
-        Map<String, TypeElement> unmatchedAnnotations =
-            new HashMap<String, TypeElement>(annotationsPresent.size());
+        Map<String, TypeElement> unmatchedAnnotations = new HashMap<>(annotationsPresent.size());
 
         for(TypeElement a  : annotationsPresent) {
                 unmatchedAnnotations.put(a.getQualifiedName().toString(),
@@ -676,7 +675,7 @@
         // were parse errors on the initial source files; however, we
         // are not doing processing in that case.
 
-        Set<Element> rootElements = new LinkedHashSet<Element>();
+        Set<Element> rootElements = new LinkedHashSet<>();
         rootElements.addAll(topLevelClasses);
         rootElements.addAll(packageInfoFiles);
         rootElements = Collections.unmodifiableSet(rootElements);
@@ -688,8 +687,8 @@
 
         while(unmatchedAnnotations.size() > 0 && psi.hasNext() ) {
             ProcessorState ps = psi.next();
-            Set<String>  matchedNames = new HashSet<String>();
-            Set<TypeElement> typeElements = new LinkedHashSet<TypeElement>();
+            Set<String>  matchedNames = new HashSet<>();
+            Set<TypeElement> typeElements = new LinkedHashSet<>();
 
             for (Map.Entry<String, TypeElement> entry: unmatchedAnnotations.entrySet()) {
                 String unmatchedAnnotationName = entry.getKey();
@@ -864,7 +863,7 @@
                 Log.DeferredDiagnosticHandler deferredDiagnosticHandler) {
             this(context, 1, 0, 0, deferredDiagnosticHandler);
             this.roots = roots;
-            genClassFiles = new HashMap<String,JavaFileObject>();
+            genClassFiles = new HashMap<>();
 
             compiler.todo.clear(); // free the compiler's resources
 
@@ -976,7 +975,7 @@
         void findAnnotationsPresent() {
             ComputeAnnotationSet annotationComputer = new ComputeAnnotationSet(elementUtils);
             // Use annotation processing to compute the set of annotations present
-            annotationsPresent = new LinkedHashSet<TypeElement>();
+            annotationsPresent = new LinkedHashSet<>();
             for (ClassSymbol classSym : topLevelClasses)
                 annotationComputer.scan(classSym, annotationsPresent);
             for (PackageSymbol pkgSym : packageInfoFiles)
@@ -1162,7 +1161,7 @@
                                      Log.DeferredDiagnosticHandler deferredDiagnosticHandler) {
         log = Log.instance(context);
 
-        Set<PackageSymbol> specifiedPackages = new LinkedHashSet<PackageSymbol>();
+        Set<PackageSymbol> specifiedPackages = new LinkedHashSet<>();
         for (PackageSymbol psym : pckSymbols)
             specifiedPackages.add(psym);
         this.specifiedPackages = Collections.unmodifiableSet(specifiedPackages);
@@ -1185,8 +1184,8 @@
             // Set up next round.
             // Copy mutable collections returned from filer.
             round = round.next(
-                    new LinkedHashSet<JavaFileObject>(filer.getGeneratedSourceFileObjects()),
-                    new LinkedHashMap<String,JavaFileObject>(filer.getGeneratedClasses()));
+                    new LinkedHashSet<>(filer.getGeneratedSourceFileObjects()),
+                    new LinkedHashMap<>(filer.getGeneratedClasses()));
 
              // Check for errors during setup.
             if (round.unrecoverableError())
@@ -1217,7 +1216,7 @@
             errorStatus = true;
 
         Set<JavaFileObject> newSourceFiles =
-                new LinkedHashSet<JavaFileObject>(filer.getGeneratedSourceFileObjects());
+                new LinkedHashSet<>(filer.getGeneratedSourceFileObjects());
         roots = cleanTrees(round.roots);
 
         JavaCompiler compiler = round.finalCompiler();
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java	Wed Jul 05 19:26:54 2017 +0200
@@ -138,7 +138,7 @@
     private class AnnotationSetScanner extends
         ElementScanner8<Set<Element>, DeclaredType> {
         // Insertion-order preserving set
-        Set<Element> annotatedElements = new LinkedHashSet<Element>();
+        Set<Element> annotatedElements = new LinkedHashSet<>();
         Types typeUtil;
 
         AnnotationSetScanner(Set<Element> defaultSet, Types typeUtil) {
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java	Wed Jul 05 19:26:54 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
@@ -36,6 +36,7 @@
 import java.io.PrintWriter;
 import java.io.Writer;
 import java.util.*;
+import com.sun.tools.javac.util.StringUtils;
 
 /**
  * A processor which prints out elements.  Used to implement the
@@ -48,7 +49,7 @@
  * deletion without notice.</b>
  */
 @SupportedAnnotationTypes("*")
-@SupportedSourceVersion(SourceVersion.RELEASE_8)
+@SupportedSourceVersion(SourceVersion.RELEASE_9)
 public class PrintingProcessor extends AbstractProcessor {
     PrintWriter writer;
 
@@ -202,7 +203,7 @@
                     writer.print("@interface");
                     break;
                 default:
-                    writer.print(kind.toString().toLowerCase());
+                    writer.print(StringUtils.toLowerCase(kind.toString()));
                 }
                 writer.print(" ");
                 writer.print(e.getSimpleName());
@@ -226,10 +227,9 @@
             indentation++;
 
             if (kind == ENUM) {
-                List<Element> enclosedElements =
-                    new ArrayList<Element>(e.getEnclosedElements());
+                List<Element> enclosedElements = new ArrayList<>(e.getEnclosedElements());
                 // Handle any enum constants specially before other entities.
-                List<Element> enumConstants = new ArrayList<Element>();
+                List<Element> enumConstants = new ArrayList<>();
                 for(Element element : enclosedElements) {
                     if (element.getKind() == ENUM_CONSTANT)
                         enumConstants.add(element);
@@ -332,7 +332,7 @@
             if (kind == ENUM_CONSTANT)
                 return;
 
-            Set<Modifier> modifiers = new LinkedHashSet<Modifier>();
+            Set<Modifier> modifiers = new LinkedHashSet<>();
             modifiers.addAll(e.getModifiers());
 
             switch (kind) {
--- a/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java	Wed Jul 05 19:26:54 2017 +0200
@@ -96,7 +96,7 @@
     static Set<String> getLegacyPackages() {
         ResourceBundle legacyBundle
             = ResourceBundle.getBundle("com.sun.tools.javac.resources.legacy");
-        Set<String> keys = new HashSet<String>();
+        Set<String> keys = new HashSet<>();
         for (Enumeration<String> e = legacyBundle.getKeys(); e.hasMoreElements(); )
             keys.add(e.nextElement());
         return keys;
@@ -129,7 +129,7 @@
     void createSymbols() throws IOException {
         Set<String> legacy = getLegacyPackages();
         Set<String> legacyProprietary = getLegacyPackages();
-        Set<String> documented = new HashSet<String>();
+        Set<String> documented = new HashSet<>();
         Set<PackageSymbol> packages =
             ((JavacProcessingEnvironment)processingEnv).getSpecifiedPackages();
         Map<String,String> pOptions = processingEnv.getOptions();
@@ -158,7 +158,7 @@
         fm.setLocation(StandardLocation.CLASS_PATH, List.<File>nil());
         fm.setLocation(StandardLocation.SOURCE_PATH, List.<File>nil());
         {
-            ArrayList<File> bootClassPath = new ArrayList<File>();
+            ArrayList<File> bootClassPath = new ArrayList<>();
             bootClassPath.add(jarFile);
             for (File path : fm.getLocation(StandardLocation.PLATFORM_CLASS_PATH)) {
                 if (!new File(path.getName()).equals(new File("rt.jar")))
@@ -173,8 +173,8 @@
             if (!destDir.mkdirs())
                 throw new RuntimeException("Could not create " + destDir);
         fm.setLocation(StandardLocation.CLASS_OUTPUT, List.of(destDir));
-        Set<String> hiddenPackages = new HashSet<String>();
-        Set<String> crisp = new HashSet<String>();
+        Set<String> hiddenPackages = new HashSet<>();
+        Set<String> crisp = new HashSet<>();
         List<String> options = List.of("-XDdev");
         // options = options.prepend("-doe");
         // options = options.prepend("-verbose");
@@ -193,7 +193,8 @@
         for (int i = 1; i < profileAnnos.length; i++) {
             profileAnnos[i] = new Attribute.Compound(syms.profileType,
                     List.<Pair<Symbol.MethodSymbol, Attribute>>of(
-                    new Pair<Symbol.MethodSymbol, Attribute>(profileValue, new Attribute.Constant(syms.intType, i))));
+                        new Pair<Symbol.MethodSymbol, Attribute>(profileValue,
+                        new Attribute.Constant(syms.intType, i))));
         }
 
         Type.moreInfo = true;
@@ -265,9 +266,7 @@
                     writeClass(pool, nestedClass, writer);
                 }
             }
-        } catch (ClassWriter.StringOverflow ex) {
-            throw new RuntimeException(ex);
-        } catch (ClassWriter.PoolOverflow ex) {
+        } catch (ClassWriter.StringOverflow | ClassWriter.PoolOverflow ex) {
             throw new RuntimeException(ex);
         }
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/sym/Profiles.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/sym/Profiles.java	Wed Jul 05 19:26:54 2017 +0200
@@ -54,7 +54,7 @@
     public static void main(String[] args) throws IOException {
         Profiles p = Profiles.read(new File(args[0]));
         if (args.length >= 2) {
-            Map<Integer,Set<String>> lists = new TreeMap<Integer,Set<String>>();
+            Map<Integer,Set<String>> lists = new TreeMap<>();
             for (int i = 1; i <= 4; i++)
                 lists.put(i, new TreeSet<String>());
 
@@ -69,30 +69,24 @@
             }
 
             for (int i = 1; i <= 4; i++) {
-                BufferedWriter out = new BufferedWriter(new FileWriter(i + ".txt"));
-                try {
-                    for (String type: lists.get(i)) {
+                try (BufferedWriter out = new BufferedWriter(new FileWriter(i + ".txt"))) {
+                    for (String type : lists.get(i)) {
                         out.write(type);
                         out.newLine();
                     }
-                } finally {
-                    out.close();
                 }
             }
         }
     }
 
     public static Profiles read(File file) throws IOException {
-        BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
-        try {
+        try (BufferedInputStream in = new BufferedInputStream(new FileInputStream(file))) {
             Properties p = new Properties();
             p.load(in);
             if (p.containsKey("java/lang/Object"))
                 return new SimpleProfiles(p);
             else
                 return new MakefileProfiles(p);
-        } finally {
-            in.close();
         }
     }
 
@@ -107,11 +101,11 @@
             final Package parent;
             final String name;
 
-            Map<String, Package> subpackages = new TreeMap<String, Package>();
+            Map<String, Package> subpackages = new TreeMap<>();
 
             int profile;
-            Map<String, Integer> includedTypes = new TreeMap<String,Integer>();
-            Map<String, Integer> excludedTypes = new TreeMap<String,Integer>();
+            Map<String, Integer> includedTypes = new TreeMap<>();
+            Map<String, Integer> excludedTypes = new TreeMap<>();
 
             Package(Package parent, String name) {
                 this.parent = parent;
@@ -148,7 +142,7 @@
             }
         }
 
-        final Map<String, Package> packages = new TreeMap<String, Package>();
+        final Map<String, Package> packages = new TreeMap<>();
 
         final int maxProfile = 4;  // Three compact profiles plus full JRE
 
@@ -197,7 +191,7 @@
 
         @Override
         public Set<String> getPackages(int profile) {
-            Set<String> results = new TreeSet<String>();
+            Set<String> results = new TreeSet<>();
             for (Package p: packages.values())
                 p.getPackages(profile, results);
             return results;
@@ -261,7 +255,7 @@
 
         SimpleProfiles(Properties p) {
             int max = 0;
-            map = new HashMap<String, Integer>();
+            map = new HashMap<>();
             for (Map.Entry<Object,Object> e: p.entrySet()) {
                 String typeName = (String) e.getKey();
                 int profile = Integer.valueOf((String) e.getValue());
@@ -283,7 +277,7 @@
 
         @Override
         public Set<String> getPackages(int profile) {
-            Set<String> results = new TreeSet<String>();
+            Set<String> results = new TreeSet<>();
             for (Map.Entry<String,Integer> e: map.entrySet()) {
                 String tn = e.getKey();
                 int prf = e.getValue();
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java	Wed Jul 05 19:26:54 2017 +0200
@@ -48,8 +48,7 @@
 public class DocTreeMaker {
 
     /** The context key for the tree factory. */
-    protected static final Context.Key<DocTreeMaker> treeMakerKey =
-        new Context.Key<DocTreeMaker>();
+    protected static final Context.Key<DocTreeMaker> treeMakerKey = new Context.Key<>();
 
     /** Get the TreeMaker instance. */
     public static DocTreeMaker instance(Context context) {
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Wed Jul 05 19:26:54 2017 +0200
@@ -522,7 +522,7 @@
             return packageAnnotations;
         }
         public List<JCImport> getImports() {
-            ListBuffer<JCImport> imports = new ListBuffer<JCImport>();
+            ListBuffer<JCImport> imports = new ListBuffer<>();
             for (JCTree tree : defs) {
                 if (tree.hasTag(IMPORT))
                     imports.append((JCImport)tree);
@@ -624,7 +624,7 @@
             /** poly expression to be treated as a standalone expression */
             STANDALONE,
             /** true poly expression */
-            POLY;
+            POLY
         }
 
         /** is this poly expression a 'true' poly expression? */
@@ -1590,7 +1590,7 @@
 
         public enum ParameterKind {
             IMPLICIT,
-            EXPLICIT;
+            EXPLICIT
         }
 
         public List<JCVariableDecl> params;
@@ -1921,7 +1921,7 @@
 
         public enum OverloadKind {
             OVERLOADED,
-            UNOVERLOADED;
+            UNOVERLOADED
         }
 
         /**
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Wed Jul 05 19:26:54 2017 +0200
@@ -65,7 +65,7 @@
     public <T extends JCTree> List<T> copy(List<T> trees, P p) {
         if (trees == null)
             return null;
-        ListBuffer<T> lb = new ListBuffer<T>();
+        ListBuffer<T> lb = new ListBuffer<>();
         for (T tree: trees)
             lb.append(copy(tree, p));
         return lb.toList();
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Wed Jul 05 19:26:54 2017 +0200
@@ -49,8 +49,7 @@
  *  deletion without notice.</b>
  */
 public class TreeInfo {
-    protected static final Context.Key<TreeInfo> treeInfoKey =
-        new Context.Key<TreeInfo>();
+    protected static final Context.Key<TreeInfo> treeInfoKey = new Context.Key<>();
 
     public static TreeInfo instance(Context context) {
         TreeInfo instance = context.get(treeInfoKey);
@@ -727,7 +726,7 @@
     /** Return the types of a list of trees.
      */
     public static List<Type> types(List<? extends JCTree> trees) {
-        ListBuffer<Type> ts = new ListBuffer<Type>();
+        ListBuffer<Type> ts = new ListBuffer<>();
         for (List<? extends JCTree> l = trees; l.nonEmpty(); l = l.tail)
             ts.append(l.head.type);
         return ts.toList();
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Wed Jul 05 19:26:54 2017 +0200
@@ -47,8 +47,7 @@
 public class TreeMaker implements JCTree.Factory {
 
     /** The context key for the tree factory. */
-    protected static final Context.Key<TreeMaker> treeMakerKey =
-        new Context.Key<TreeMaker>();
+    protected static final Context.Key<TreeMaker> treeMakerKey = new Context.Key<>();
 
     /** Get the TreeMaker instance. */
     public static TreeMaker instance(Context context) {
@@ -609,7 +608,7 @@
      *  in given list of variable declarations.
      */
     public List<JCExpression> Idents(List<JCVariableDecl> params) {
-        ListBuffer<JCExpression> ids = new ListBuffer<JCExpression>();
+        ListBuffer<JCExpression> ids = new ListBuffer<>();
         for (List<JCVariableDecl> l = params; l.nonEmpty(); l = l.tail)
             ids.append(Ident(l.head));
         return ids.toList();
@@ -710,7 +709,7 @@
     /** Create a list of trees representing given list of types.
      */
     public List<JCExpression> Types(List<Type> ts) {
-        ListBuffer<JCExpression> lb = new ListBuffer<JCExpression>();
+        ListBuffer<JCExpression> lb = new ListBuffer<>();
         for (List<Type> l = ts; l.nonEmpty(); l = l.tail)
             lb.append(Type(l.head));
         return lb.toList();
@@ -733,7 +732,7 @@
      */
     public List<JCAnnotation> Annotations(List<Attribute.Compound> attributes) {
         if (attributes == null) return List.nil();
-        ListBuffer<JCAnnotation> result = new ListBuffer<JCAnnotation>();
+        ListBuffer<JCAnnotation> result = new ListBuffer<>();
         for (List<Attribute.Compound> i = attributes; i.nonEmpty(); i=i.tail) {
             Attribute a = i.head;
             result.append(Annotation(a));
@@ -757,7 +756,7 @@
                 setType(syms.byteType.constType(value));
         } else if (value instanceof Character) {
             int v = (int) (((Character) value).toString().charAt(0));
-            result = Literal(CHAR, value).
+            result = Literal(CHAR, v).
                 setType(syms.charType.constType(v));
         } else if (value instanceof Double) {
             result = Literal(DOUBLE, value).
@@ -800,7 +799,7 @@
             }
         }
         public JCAnnotation visitCompoundInternal(Attribute.Compound compound) {
-            ListBuffer<JCExpression> args = new ListBuffer<JCExpression>();
+            ListBuffer<JCExpression> args = new ListBuffer<>();
             for (List<Pair<Symbol.MethodSymbol,Attribute>> values = compound.values; values.nonEmpty(); values=values.tail) {
                 Pair<MethodSymbol,Attribute> pair = values.head;
                 JCExpression valueTree = translate(pair.snd);
@@ -809,7 +808,7 @@
             return Annotation(Type(compound.type), args.toList());
         }
         public JCAnnotation visitTypeCompoundInternal(Attribute.TypeCompound compound) {
-            ListBuffer<JCExpression> args = new ListBuffer<JCExpression>();
+            ListBuffer<JCExpression> args = new ListBuffer<>();
             for (List<Pair<Symbol.MethodSymbol,Attribute>> values = compound.values; values.nonEmpty(); values=values.tail) {
                 Pair<MethodSymbol,Attribute> pair = values.head;
                 JCExpression valueTree = translate(pair.snd);
@@ -818,7 +817,7 @@
             return TypeAnnotation(Type(compound.type), args.toList());
         }
         public void visitArray(Attribute.Array array) {
-            ListBuffer<JCExpression> elems = new ListBuffer<JCExpression>();
+            ListBuffer<JCExpression> elems = new ListBuffer<>();
             for (int i = 0; i < array.values.length; i++)
                 elems.append(translate(array.values[i]));
             result = NewArray(null, List.<JCExpression>nil(), elems.toList()).setType(array.type);
@@ -881,7 +880,7 @@
     /** Create a list of type parameter trees from a list of type variables.
      */
     public List<JCTypeParameter> TypeParams(List<Type> typarams) {
-        ListBuffer<JCTypeParameter> tparams = new ListBuffer<JCTypeParameter>();
+        ListBuffer<JCTypeParameter> tparams = new ListBuffer<>();
         for (List<Type> l = typarams; l.nonEmpty(); l = l.tail)
             tparams.append(TypeParam(l.head.tsym.name, (TypeVar)l.head));
         return tparams.toList();
@@ -897,7 +896,7 @@
      *  their types and an their owner.
      */
     public List<JCVariableDecl> Params(List<Type> argtypes, Symbol owner) {
-        ListBuffer<JCVariableDecl> params = new ListBuffer<JCVariableDecl>();
+        ListBuffer<JCVariableDecl> params = new ListBuffer<>();
         MethodSymbol mth = (owner.kind == MTH) ? ((MethodSymbol)owner) : null;
         if (mth != null && mth.params != null && argtypes.length() == mth.params.length()) {
             for (VarSymbol param : ((MethodSymbol)owner).params)
--- a/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -156,7 +156,7 @@
      * @return a Collection whose elements are the formatted arguments of the diagnostic
      */
     protected Collection<String> formatArguments(JCDiagnostic d, Locale l) {
-        ListBuffer<String> buf = new ListBuffer<String>();
+        ListBuffer<String> buf = new ListBuffer<>();
         for (Object o : d.getArgs()) {
            buf.append(formatArgument(d, o, l));
         }
@@ -389,7 +389,7 @@
         protected boolean caretEnabled;
 
         public SimpleConfiguration(Set<DiagnosticPart> parts) {
-            multilineLimits = new HashMap<MultilineLimit, Integer>();
+            multilineLimits = new HashMap<>();
             setVisible(parts);
             setMultilineLimit(MultilineLimit.DEPTH, -1);
             setMultilineLimit(MultilineLimit.LENGTH, -1);
--- a/langtools/src/share/classes/com/sun/tools/javac/util/AbstractLog.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/AbstractLog.java	Wed Jul 05 19:26:54 2017 +0200
@@ -45,9 +45,21 @@
  *  deletion without notice.</b>
  */
 public abstract class AbstractLog {
+    /** Factory for diagnostics
+     */
+    protected JCDiagnostic.Factory diags;
+
+    /** The file that's currently being translated.
+     */
+    protected DiagnosticSource source;
+
+    /** A cache of lightweight DiagnosticSource objects.
+     */
+    protected Map<JavaFileObject, DiagnosticSource> sourceMap;
+
     AbstractLog(JCDiagnostic.Factory diags) {
         this.diags = diags;
-        sourceMap = new HashMap<JavaFileObject, DiagnosticSource>();
+        sourceMap = new HashMap<>();
     }
 
     /** Re-assign source, returning previous setting.
@@ -246,16 +258,4 @@
     private DiagnosticPosition wrap(int pos) {
         return (pos == Position.NOPOS ? null : new SimpleDiagnosticPosition(pos));
     }
-
-    /** Factory for diagnostics
-     */
-    protected JCDiagnostic.Factory diags;
-
-    /** The file that's currently being translated.
-     */
-    protected DiagnosticSource source;
-
-    /** A cache of lightweight DiagnosticSource objects.
-     */
-    protected Map<JavaFileObject, DiagnosticSource> sourceMap;
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java	Wed Jul 05 19:26:54 2017 +0200
@@ -122,7 +122,7 @@
                         Class.forName(classLoaderClass).asSubclass(ClassLoader.class);
                 Class<?>[] constrArgTypes = { URL[].class, ClassLoader.class };
                 Constructor<? extends ClassLoader> constr = loader.getConstructor(constrArgTypes);
-                return constr.newInstance(new Object[] { urls, thisClassLoader });
+                return constr.newInstance(urls, thisClassLoader);
             } catch (Throwable t) {
                 // ignore errors loading user-provided class loader, fall through
             }
@@ -356,8 +356,7 @@
         contentCache.remove(file);
     }
 
-    protected final Map<JavaFileObject, ContentCacheEntry> contentCache
-            = new HashMap<JavaFileObject, ContentCacheEntry>();
+    protected final Map<JavaFileObject, ContentCacheEntry> contentCache = new HashMap<>();
 
     protected static class ContentCacheEntry {
         final long timestamp;
@@ -365,7 +364,7 @@
 
         ContentCacheEntry(JavaFileObject file, CharBuffer cb) {
             this.timestamp = file.getLastModified();
-            this.ref = new SoftReference<CharBuffer>(cb);
+            this.ref = new SoftReference<>(cb);
         }
 
         boolean isValid(JavaFileObject file) {
--- a/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -137,7 +137,7 @@
             BasicConfiguration conf = getConfiguration();
             int indentSource = conf.getIndentation(DiagnosticPart.SOURCE);
             String sourceLine = "\n" + formatSourceLine(d, indentSource);
-            boolean singleLine = msg.indexOf("\n") == -1;
+            boolean singleLine = !msg.contains("\n");
             if (singleLine || getConfiguration().getSourcePosition() == SourcePosition.BOTTOM)
                 return msg + sourceLine;
             else
@@ -288,7 +288,7 @@
         }
 
         private void initFormats(String pos, String nopos, String clazz) {
-            availableFormats = new EnumMap<BasicFormatKind, String>(BasicFormatKind.class);
+            availableFormats = new EnumMap<>(BasicFormatKind.class);
             setFormat(BasicFormatKind.DEFAULT_POS_FORMAT,    pos);
             setFormat(BasicFormatKind.DEFAULT_NO_POS_FORMAT, nopos);
             setFormat(BasicFormatKind.DEFAULT_CLASS_FORMAT,  clazz);
@@ -308,7 +308,7 @@
         }
 
         private void initIndentation() {
-            indentationLevels = new HashMap<DiagnosticPart, Integer>();
+            indentationLevels = new HashMap<>();
             setIndentation(DiagnosticPart.SUMMARY, 0);
             setIndentation(DiagnosticPart.DETAILS, DetailsInc);
             setIndentation(DiagnosticPart.SUBDIAGNOSTICS, DiagInc);
@@ -368,7 +368,7 @@
              * Source line is displayed after the first line of the diagnostic
              * message
              */
-            AFTER_SUMMARY;
+            AFTER_SUMMARY
         }
 
         /**
@@ -406,7 +406,7 @@
             /**
             * A format string to be used for diagnostics regarding classfiles
             */
-            DEFAULT_CLASS_FORMAT;
+            DEFAULT_CLASS_FORMAT
         }
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Context.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Context.java	Wed Jul 05 19:26:54 2017 +0200
@@ -109,7 +109,7 @@
      */
     public static interface Factory<T> {
         T make(Context c);
-    };
+    }
 
     /**
      * The underlying map storing the data.
@@ -119,7 +119,7 @@
      * or
      * {@literal Key<T> -> Factory<T> }
      */
-    private Map<Key<?>,Object> ht = new HashMap<Key<?>,Object>();
+    private Map<Key<?>,Object> ht = new HashMap<>();
 
     /** Set the factory for the key in this context. */
     public <T> void put(Key<T> key, Factory<T> fac) {
@@ -166,7 +166,7 @@
     /**
      * The table of preregistered factories.
      */
-    private Map<Key<?>,Factory<?>> ft = new HashMap<Key<?>,Factory<?>>();
+    private Map<Key<?>,Factory<?>> ft = new HashMap<>();
 
     public Context(Context prev) {
         kt.putAll(prev.kt);     // retain all implicit keys
@@ -177,13 +177,13 @@
     /*
      * The key table, providing a unique Key<T> for each Class<T>.
      */
-    private Map<Class<?>, Key<?>> kt = new HashMap<Class<?>, Key<?>>();
+    private Map<Class<?>, Key<?>> kt = new HashMap<>();
 
     private <T> Key<T> key(Class<T> clss) {
         checkState(kt);
         Key<T> k = uncheckedCast(kt.get(clss));
         if (k == null) {
-            k = new Key<T>();
+            k = new Key<>();
             kt.put(clss, k);
         }
         return k;
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Convert.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Convert.java	Wed Jul 05 19:26:54 2017 +0200
@@ -63,8 +63,8 @@
             char[] cs = s.toCharArray();
             int limit = Integer.MAX_VALUE / (radix/2);
             int n = 0;
-            for (int i = 0; i < cs.length; i++) {
-                int d = Character.digit(cs[i], radix);
+            for (char c : cs) {
+                int d = Character.digit(c, radix);
                 if (n < 0 ||
                     n > limit ||
                     n * radix > Integer.MAX_VALUE - d)
@@ -85,8 +85,8 @@
             char[] cs = s.toCharArray();
             long limit = Long.MAX_VALUE / (radix/2);
             long n = 0;
-            for (int i = 0; i < cs.length; i++) {
-                int d = Character.digit(cs[i], radix);
+            for (char c : cs) {
+                int d = Character.digit(c, radix);
                 if (n < 0 ||
                     n > limit ||
                     n * radix > Long.MAX_VALUE - d)
--- a/langtools/src/share/classes/com/sun/tools/javac/util/DiagnosticSource.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/DiagnosticSource.java	Wed Jul 05 19:26:54 2017 +0200
@@ -191,7 +191,7 @@
             buf = cs.toString().toCharArray();
             bufLen = buf.length;
         }
-        refBuf = new SoftReference<char[]>(buf);
+        refBuf = new SoftReference<>(buf);
         return buf;
     }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java	Wed Jul 05 19:26:54 2017 +0200
@@ -50,8 +50,7 @@
     /** A factory for creating diagnostic objects. */
     public static class Factory {
         /** The context key for the diagnostic factory. */
-        protected static final Context.Key<JCDiagnostic.Factory> diagnosticFactoryKey =
-            new Context.Key<JCDiagnostic.Factory>();
+        protected static final Context.Key<JCDiagnostic.Factory> diagnosticFactoryKey = new Context.Key<>();
 
         /** Get the Factory instance for this context. */
         public static Factory instance(Context context) {
@@ -292,7 +291,7 @@
         DiagnosticType(String key) {
             this.key = key;
         }
-    };
+    }
 
     /**
      * A DiagnosticPosition provides information about the positions in a file
--- a/langtools/src/share/classes/com/sun/tools/javac/util/JavacMessages.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/JavacMessages.java	Wed Jul 05 19:26:54 2017 +0200
@@ -44,8 +44,7 @@
  */
 public class JavacMessages implements Messages {
     /** The context key for the JavacMessages object. */
-    public static final Context.Key<JavacMessages> messagesKey =
-        new Context.Key<JavacMessages>();
+    public static final Context.Key<JavacMessages> messagesKey = new Context.Key<>();
 
     /** Get the JavacMessages instance for this context. */
     public static JavacMessages instance(Context context) {
@@ -93,7 +92,7 @@
      */
     public JavacMessages(String bundleName, Locale locale) throws MissingResourceException {
         bundleNames = List.nil();
-        bundleCache = new HashMap<Locale, SoftReference<List<ResourceBundle>>>();
+        bundleCache = new HashMap<>();
         add(bundleName);
         setCurrentLocale(locale);
     }
@@ -124,7 +123,7 @@
                     throw new InternalError("Cannot find javac resource bundle for locale " + locale);
                 }
             }
-            bundleCache.put(locale, new SoftReference<List<ResourceBundle>>(bundleList));
+            bundleCache.put(locale, new SoftReference<>(bundleList));
         }
         return bundleList;
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/util/List.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/List.java	Wed Jul 05 19:26:54 2017 +0200
@@ -132,26 +132,26 @@
     /** Construct a list consisting of given element.
      */
     public static <A> List<A> of(A x1) {
-        return new List<A>(x1, List.<A>nil());
+        return new List<>(x1, List.<A>nil());
     }
 
     /** Construct a list consisting of given elements.
      */
     public static <A> List<A> of(A x1, A x2) {
-        return new List<A>(x1, of(x2));
+        return new List<>(x1, of(x2));
     }
 
     /** Construct a list consisting of given elements.
      */
     public static <A> List<A> of(A x1, A x2, A x3) {
-        return new List<A>(x1, of(x2, x3));
+        return new List<>(x1, of(x2, x3));
     }
 
     /** Construct a list consisting of given elements.
      */
     @SuppressWarnings({"varargs", "unchecked"})
     public static <A> List<A> of(A x1, A x2, A x3, A... rest) {
-        return new List<A>(x1, new List<A>(x2, new List<A>(x3, from(rest))));
+        return new List<>(x1, new List<>(x2, new List<>(x3, from(rest))));
     }
 
     /**
@@ -162,7 +162,7 @@
         List<A> xs = nil();
         if (array != null)
             for (int i = array.length - 1; i >= 0; i--)
-                xs = new List<A>(array[i], xs);
+                xs = new List<>(array[i], xs);
         return xs;
     }
 
@@ -181,7 +181,7 @@
     @Deprecated
     public static <A> List<A> fill(int len, A init) {
         List<A> l = nil();
-        for (int i = 0; i < len; i++) l = new List<A>(init, l);
+        for (int i = 0; i < len; i++) l = new List<>(init, l);
         return l;
     }
 
@@ -225,7 +225,7 @@
      *  a new list.
      */
     public List<A> prepend(A x) {
-        return new List<A>(x, this);
+        return new List<>(x, this);
     }
 
     /** Prepend given list of elements to front of list, forming and returning
@@ -261,7 +261,7 @@
 
         List<A> rev = nil();
         for (List<A> l = this; l.nonEmpty(); l = l.tail)
-            rev = new List<A>(l.head, rev);
+            rev = new List<>(l.head, rev);
         return rev;
     }
 
@@ -526,7 +526,7 @@
         if  (fromIndex < 0 || toIndex > size() || fromIndex > toIndex)
             throw new IllegalArgumentException();
 
-        ArrayList<A> a = new ArrayList<A>(toIndex - fromIndex);
+        ArrayList<A> a = new ArrayList<>(toIndex - fromIndex);
         int i = 0;
         for (List<A> l = this; l.tail != null; l = l.tail, i++) {
             if (i == toIndex)
--- a/langtools/src/share/classes/com/sun/tools/javac/util/ListBuffer.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/ListBuffer.java	Wed Jul 05 19:26:54 2017 +0200
@@ -41,7 +41,7 @@
 public class ListBuffer<A> extends AbstractQueue<A> {
 
     public static <T> ListBuffer<T> of(T x) {
-        ListBuffer<T> lb = new ListBuffer<T>();
+        ListBuffer<T> lb = new ListBuffer<>();
         lb.add(x);
         return lb;
     }
@@ -156,8 +156,8 @@
     /** Append all elements in an array to buffer.
      */
     public ListBuffer<A> appendArray(A[] xs) {
-        for (int i = 0; i < xs.length; i++) {
-            append(xs[i]);
+        for (A x : xs) {
+            append(x);
         }
         return this;
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Log.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Log.java	Wed Jul 05 19:26:54 2017 +0200
@@ -53,12 +53,10 @@
  */
 public class Log extends AbstractLog {
     /** The context key for the log. */
-    public static final Context.Key<Log> logKey
-        = new Context.Key<Log>();
+    public static final Context.Key<Log> logKey = new Context.Key<>();
 
     /** The context key for the output PrintWriter. */
-    public static final Context.Key<PrintWriter> outKey =
-        new Context.Key<PrintWriter>();
+    public static final Context.Key<PrintWriter> outKey = new Context.Key<>();
 
     /* TODO: Should unify this with prefix handling in JCDiagnostic.Factory. */
     public enum PrefixKind {
@@ -164,7 +162,7 @@
         }
     }
 
-    public enum WriterKind { NOTICE, WARNING, ERROR };
+    public enum WriterKind { NOTICE, WARNING, ERROR }
 
     protected PrintWriter errWriter;
 
@@ -270,7 +268,7 @@
 
             String ek = options.get("expectKeys");
             if (ek != null)
-                expectDiagKeys = new HashSet<String>(Arrays.asList(ek.split(", *")));
+                expectDiagKeys = new HashSet<>(Arrays.asList(ek.split(", *")));
         }
 
         private int getIntOption(Options options, Option option, int defaultValue) {
@@ -339,7 +337,7 @@
      *  error message more than once. For each error, a pair consisting of the
      *  source file name and source code position of the error is added to the set.
      */
-    private Set<Pair<JavaFileObject, Integer>> recorded = new HashSet<Pair<JavaFileObject,Integer>>();
+    private Set<Pair<JavaFileObject, Integer>> recorded = new HashSet<>();
 
     public boolean hasDiagnosticListener() {
         return diagListener != null;
@@ -435,7 +433,7 @@
         if (multipleErrors || file == null)
             return true;
 
-        Pair<JavaFileObject,Integer> coords = new Pair<JavaFileObject,Integer>(file, pos);
+        Pair<JavaFileObject,Integer> coords = new Pair<>(file, pos);
         boolean shouldReport = !recorded.contains(coords);
         if (shouldReport)
             recorded.add(coords);
--- a/langtools/src/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java	Wed Jul 05 19:26:54 2017 +0200
@@ -126,7 +126,7 @@
 
         if (verbose) {
             if (sourcesWithReportedWarnings == null)
-                sourcesWithReportedWarnings = new HashSet<JavaFileObject>();
+                sourcesWithReportedWarnings = new HashSet<>();
 
             if (log.nwarnings < log.MaxWarnings) {
                 // generate message and remember the source file
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Names.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Names.java	Wed Jul 05 19:26:54 2017 +0200
@@ -36,7 +36,7 @@
  */
 public class Names {
 
-    public static final Context.Key<Names> namesKey = new Context.Key<Names>();
+    public static final Context.Key<Names> namesKey = new Context.Key<>();
 
     public static Names instance(Context context) {
         Names instance = context.get(namesKey);
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Options.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Options.java	Wed Jul 05 19:26:54 2017 +0200
@@ -42,8 +42,7 @@
     private static final long serialVersionUID = 0;
 
     /** The context key for the options. */
-    public static final Context.Key<Options> optionsKey =
-        new Context.Key<Options>();
+    public static final Context.Key<Options> optionsKey = new Context.Key<>();
 
     private LinkedHashMap<String,String> values;
 
@@ -57,7 +56,7 @@
 
     protected Options(Context context) {
 // DEBUGGING -- Use LinkedHashMap for reproducability
-        values = new LinkedHashMap<String,String>();
+        values = new LinkedHashMap<>();
         context.put(optionsKey, this);
     }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Pair.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Pair.java	Wed Jul 05 19:26:54 2017 +0200
@@ -62,6 +62,6 @@
     }
 
     public static <A,B> Pair<A,B> of(A a, B b) {
-        return new Pair<A,B>(a,b);
+        return new Pair<>(a,b);
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -97,7 +97,7 @@
         this.diags = JCDiagnostic.Factory.instance(context);
         this.types = Types.instance(context);
         this.messages = JavacMessages.instance(context);
-        whereClauses = new EnumMap<WhereClauseKind, Map<Type, JCDiagnostic>>(WhereClauseKind.class);
+        whereClauses = new EnumMap<>(WhereClauseKind.class);
         configuration = new RichConfiguration(Options.instance(context), formatter);
         for (WhereClauseKind kind : WhereClauseKind.values())
             whereClauses.put(kind, new LinkedHashMap<Type, JCDiagnostic>());
@@ -279,7 +279,7 @@
     protected class ClassNameSimplifier {
 
         /* table for keeping track of all short name usages */
-        Map<Name, List<Symbol>> nameClashes = new HashMap<Name, List<Symbol>>();
+        Map<Name, List<Symbol>> nameClashes = new HashMap<>();
 
         /**
          * Add a name usage to the simplifier's internal cache
@@ -322,7 +322,7 @@
             }
             return name;
         }
-    };
+    }
     // </editor-fold>
 
     // <editor-fold defaultstate="collapsed" desc="rich printer">
@@ -437,7 +437,7 @@
                 return ms;
             }
         }
-    };
+    }
     // </editor-fold>
 
     // <editor-fold defaultstate="collapsed" desc="type scanner">
@@ -704,7 +704,7 @@
             /** full class names simplification (where possible) */
             SIMPLE_NAMES,
             /** type-variable names disambiguation */
-            UNIQUE_TYPEVAR_NAMES;
+            UNIQUE_TYPEVAR_NAMES
         }
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/util/ServiceLoader.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/ServiceLoader.java	Wed Jul 05 19:26:54 2017 +0200
@@ -169,7 +169,6 @@
         throws ServiceConfigurationError
     {
         InputStream in = null;
-        BufferedReader r = null;
         ArrayList<String> names = new ArrayList<>();
         try {
             // The problem is that by default, streams opened with
@@ -186,14 +185,14 @@
             uc.setUseCaches(false);
             in = uc.getInputStream();
             // ... end of workaround.
-            r = new BufferedReader(new InputStreamReader(in, "utf-8"));
-            int lc = 1;
-            while ((lc = parseLine(service, u, r, lc, names)) >= 0);
+            try (BufferedReader r = new BufferedReader(new InputStreamReader(in, "utf-8"))) {
+                int lc = 1;
+                while ((lc = parseLine(service, u, r, lc, names)) >= 0);
+            }
         } catch (IOException x) {
             fail(service, "Error reading configuration file", x);
         } finally {
             try {
-                if (r != null) r.close();
                 if (in != null) in.close();
             } catch (IOException y) {
                 fail(service, "Error closing configuration file", y);
--- a/langtools/src/share/classes/com/sun/tools/javac/util/SharedNameTable.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/SharedNameTable.java	Wed Jul 05 19:26:54 2017 +0200
@@ -53,7 +53,7 @@
     }
 
     static private synchronized void dispose(SharedNameTable t) {
-        freelist = freelist.prepend(new SoftReference<SharedNameTable>(t));
+        freelist = freelist.prepend(new SoftReference<>(t));
     }
 
     /** The hash table for names.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/StringUtils.java	Wed Jul 05 19:26:54 2017 +0200
@@ -0,0 +1,53 @@
+/*
+ * 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 com.sun.tools.javac.util;
+
+import java.util.Locale;
+
+/** A collection of utilities for String manipulation.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class StringUtils {
+
+    /**Converts the given String to lower case using the {@link Locale#US US Locale}. The result
+     * is independent of the default Locale in the current JVM instance.
+     */
+    public static String toLowerCase(String source) {
+        return source.toLowerCase(Locale.US);
+    }
+
+    /**Converts the given String to upper case using the {@link Locale#US US Locale}. The result
+     * is independent of the default Locale in the current JVM instance.
+     */
+    public static String toUpperCase(String source) {
+        return source.toUpperCase(Locale.US);
+    }
+
+}
--- a/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java	Wed Jul 05 19:26:54 2017 +0200
@@ -545,7 +545,7 @@
      * Return an empty array if there are no interfaces.
      */
     public ClassDoc[] interfaces() {
-        ListBuffer<ClassDocImpl> ta = new ListBuffer<ClassDocImpl>();
+        ListBuffer<ClassDocImpl> ta = new ListBuffer<>();
         for (Type t : env.types.interfaces(type)) {
             ta.append(env.getClassDoc((ClassSymbol)t.tsym));
         }
@@ -716,7 +716,7 @@
      * are not included.
      */
     public ClassDoc[] innerClasses(boolean filter) {
-        ListBuffer<ClassDocImpl> innerClasses = new ListBuffer<ClassDocImpl>();
+        ListBuffer<ClassDocImpl> innerClasses = new ListBuffer<>();
         for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) {
             if (e.sym != null && e.sym.kind == Kinds.TYP) {
                 ClassSymbol s = (ClassSymbol)e.sym;
@@ -971,9 +971,8 @@
         }
 
         // search interfaces
-        ClassDoc intf[] = interfaces();
-        for (int i = 0; i < intf.length; i++) {
-            cdi = (ClassDocImpl)intf[i];
+        for (ClassDoc intf : interfaces()) {
+            cdi = (ClassDocImpl) intf;
             mdi = cdi.searchMethod(methodName, paramTypes, searched);
             if (mdi != null) {
                 return mdi;
@@ -1080,9 +1079,8 @@
         }
 
         // search interfaces
-        ClassDoc intf[] = interfaces();
-        for (int i = 0; i < intf.length; i++) {
-            cdi = (ClassDocImpl)intf[i];
+        for (ClassDoc intf : interfaces()) {
+            cdi = (ClassDocImpl) intf;
             FieldDocImpl fdi = cdi.searchField(fieldName, searched);
             if (fdi != null) {
                 return fdi;
@@ -1108,7 +1106,7 @@
         // information is not available for binary classfiles
         if (tsym.sourcefile == null) return new ClassDoc[0];
 
-        ListBuffer<ClassDocImpl> importedClasses = new ListBuffer<ClassDocImpl>();
+        ListBuffer<ClassDocImpl> importedClasses = new ListBuffer<>();
 
         Env<AttrContext> compenv = env.enter.getEnv(tsym);
         if (compenv == null) return new ClassDocImpl[0];
@@ -1146,7 +1144,7 @@
         // information is not available for binary classfiles
         if (tsym.sourcefile == null) return new PackageDoc[0];
 
-        ListBuffer<PackageDocImpl> importedPackages = new ListBuffer<PackageDocImpl>();
+        ListBuffer<PackageDocImpl> importedPackages = new ListBuffer<>();
 
         //### Add the implicit "import java.lang.*" to the result
         Names names = tsym.name.table.names;
--- a/langtools/src/share/classes/com/sun/tools/javadoc/Comment.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/Comment.java	Wed Jul 05 19:26:54 2017 +0200
@@ -50,7 +50,7 @@
     /**
      * sorted comments with different tags.
      */
-    private final ListBuffer<Tag> tagList = new ListBuffer<Tag>();
+    private final ListBuffer<Tag> tagList = new ListBuffer<>();
 
     /**
      * text minus any tags.
@@ -151,29 +151,39 @@
                     text = tx;
                 } else {
                     TagImpl tag;
-                    if (tagName.equals("@exception") || tagName.equals("@throws")) {
-                        warnIfEmpty(tagName, tx);
-                        tag = new ThrowsTagImpl(holder, tagName, tx);
-                    } else if (tagName.equals("@param")) {
-                        warnIfEmpty(tagName, tx);
-                        tag = new ParamTagImpl(holder, tagName, tx);
-                    } else if (tagName.equals("@see")) {
-                        warnIfEmpty(tagName, tx);
-                        tag = new SeeTagImpl(holder, tagName, tx);
-                    } else if (tagName.equals("@serialField")) {
-                        warnIfEmpty(tagName, tx);
-                        tag = new SerialFieldTagImpl(holder, tagName, tx);
-                    } else if (tagName.equals("@return")) {
-                        warnIfEmpty(tagName, tx);
-                        tag = new TagImpl(holder, tagName, tx);
-                    } else if (tagName.equals("@author")) {
-                        warnIfEmpty(tagName, tx);
-                        tag = new TagImpl(holder, tagName, tx);
-                    } else if (tagName.equals("@version")) {
-                        warnIfEmpty(tagName, tx);
-                        tag = new TagImpl(holder, tagName, tx);
-                    } else {
-                        tag = new TagImpl(holder, tagName, tx);
+                    switch (tagName) {
+                        case "@exception":
+                        case "@throws":
+                            warnIfEmpty(tagName, tx);
+                            tag = new ThrowsTagImpl(holder, tagName, tx);
+                            break;
+                        case "@param":
+                            warnIfEmpty(tagName, tx);
+                            tag = new ParamTagImpl(holder, tagName, tx);
+                            break;
+                        case "@see":
+                            warnIfEmpty(tagName, tx);
+                            tag = new SeeTagImpl(holder, tagName, tx);
+                            break;
+                        case "@serialField":
+                            warnIfEmpty(tagName, tx);
+                            tag = new SerialFieldTagImpl(holder, tagName, tx);
+                            break;
+                        case "@return":
+                            warnIfEmpty(tagName, tx);
+                            tag = new TagImpl(holder, tagName, tx);
+                            break;
+                        case "@author":
+                            warnIfEmpty(tagName, tx);
+                            tag = new TagImpl(holder, tagName, tx);
+                            break;
+                        case "@version":
+                            warnIfEmpty(tagName, tx);
+                            tag = new TagImpl(holder, tagName, tx);
+                            break;
+                        default:
+                            tag = new TagImpl(holder, tagName, tx);
+                            break;
                     }
                     tagList.append(tag);
                 }
@@ -208,7 +218,7 @@
      * Return tags of the specified kind in this comment.
      */
     Tag[] tags(String tagname) {
-        ListBuffer<Tag> found = new ListBuffer<Tag>();
+        ListBuffer<Tag> found = new ListBuffer<>();
         String target = tagname;
         if (target.charAt(0) != '@') {
             target = "@" + target;
@@ -225,7 +235,7 @@
      * Return throws tags in this comment.
      */
     ThrowsTag[] throwsTags() {
-        ListBuffer<ThrowsTag> found = new ListBuffer<ThrowsTag>();
+        ListBuffer<ThrowsTag> found = new ListBuffer<>();
         for (Tag next : tagList) {
             if (next instanceof ThrowsTag) {
                 found.append((ThrowsTag)next);
@@ -254,7 +264,7 @@
      * param tags.
      */
     private ParamTag[] paramTags(boolean typeParams) {
-        ListBuffer<ParamTag> found = new ListBuffer<ParamTag>();
+        ListBuffer<ParamTag> found = new ListBuffer<>();
         for (Tag next : tagList) {
             if (next instanceof ParamTag) {
                 ParamTag p = (ParamTag)next;
@@ -270,7 +280,7 @@
      * Return see also tags in this comment.
      */
     SeeTag[] seeTags() {
-        ListBuffer<SeeTag> found = new ListBuffer<SeeTag>();
+        ListBuffer<SeeTag> found = new ListBuffer<>();
         for (Tag next : tagList) {
             if (next instanceof SeeTag) {
                 found.append((SeeTag)next);
@@ -283,7 +293,7 @@
      * Return serialField tags in this comment.
      */
     SerialFieldTag[] serialFieldTags() {
-        ListBuffer<SerialFieldTag> found = new ListBuffer<SerialFieldTag>();
+        ListBuffer<SerialFieldTag> found = new ListBuffer<>();
         for (Tag next : tagList) {
             if (next instanceof SerialFieldTag) {
                 found.append((SerialFieldTag)next);
@@ -296,7 +306,7 @@
      * Return array of tags with text and inline See Tags for a Doc comment.
      */
     static Tag[] getInlineTags(DocImpl holder, String inlinetext) {
-        ListBuffer<Tag> taglist = new ListBuffer<Tag>();
+        ListBuffer<Tag> taglist = new ListBuffer<>();
         int delimend = 0, textstart = 0, len = inlinetext.length();
         boolean inPre = false;
         DocEnv docenv = holder.env;
--- a/langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java	Wed Jul 05 19:26:54 2017 +0200
@@ -62,8 +62,7 @@
  * @author Scott Seligman (generics)
  */
 public class DocEnv {
-    protected static final Context.Key<DocEnv> docEnvKey =
-        new Context.Key<DocEnv>();
+    protected static final Context.Key<DocEnv> docEnvKey = new Context.Key<>();
 
     public static DocEnv instance(Context context) {
         DocEnv instance = context.get(docEnvKey);
@@ -110,7 +109,7 @@
     Context context;
     DocLint doclint;
 
-    WeakHashMap<JCTree, TreePath> treePaths = new WeakHashMap<JCTree, TreePath>();
+    WeakHashMap<JCTree, TreePath> treePaths = new WeakHashMap<>();
 
     /** Allow documenting from class files? */
     boolean docClasses = false;
@@ -544,8 +543,7 @@
         messager.exit();
     }
 
-    protected Map<PackageSymbol, PackageDocImpl> packageMap =
-            new HashMap<PackageSymbol, PackageDocImpl>();
+    protected Map<PackageSymbol, PackageDocImpl> packageMap = new HashMap<>();
     /**
      * Return the PackageDoc of this package symbol.
      */
@@ -571,8 +569,7 @@
     }
 
 
-    protected Map<ClassSymbol, ClassDocImpl> classMap =
-            new HashMap<ClassSymbol, ClassDocImpl>();
+    protected Map<ClassSymbol, ClassDocImpl> classMap = new HashMap<>();
     /**
      * Return the ClassDoc (or a subtype) of this class symbol.
      */
@@ -613,8 +610,7 @@
         return (tree.mods.flags & Flags.ANNOTATION) != 0;
     }
 
-    protected Map<VarSymbol, FieldDocImpl> fieldMap =
-            new HashMap<VarSymbol, FieldDocImpl>();
+    protected Map<VarSymbol, FieldDocImpl> fieldMap = new HashMap<>();
     /**
      * Return the FieldDoc of this var symbol.
      */
@@ -638,8 +634,7 @@
         }
     }
 
-    protected Map<MethodSymbol, ExecutableMemberDocImpl> methodMap =
-            new HashMap<MethodSymbol, ExecutableMemberDocImpl>();
+    protected Map<MethodSymbol, ExecutableMemberDocImpl> methodMap = new HashMap<>();
     /**
      * Create a MethodDoc for this MethodSymbol.
      * Should be called only on symbols representing methods.
@@ -805,7 +800,7 @@
     }
 
     void initDoclint(Collection<String> opts, Collection<String> customTagNames) {
-        ArrayList<String> doclintOpts = new ArrayList<String>();
+        ArrayList<String> doclintOpts = new ArrayList<>();
 
         for (String opt: opts) {
             doclintOpts.add(opt == null ? DocLint.XMSGS_OPTION : DocLint.XMSGS_CUSTOM_PREFIX + opt);
--- a/langtools/src/share/classes/com/sun/tools/javadoc/DocLocale.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/DocLocale.java	Wed Jul 05 19:26:54 2017 +0200
@@ -159,12 +159,11 @@
      */
     private Locale searchLocale(String language, String country,
                                 String variant) {
-        Locale[] locales = Locale.getAvailableLocales();
-        for (int i = 0; i < locales.length; i++) {
-            if (locales[i].getLanguage().equals(language) &&
-               (country == null || locales[i].getCountry().equals(country)) &&
-               (variant == null || locales[i].getVariant().equals(variant))) {
-                return locales[i];
+        for (Locale loc : Locale.getAvailableLocales()) {
+            if (loc.getLanguage().equals(language) &&
+                (country == null || loc.getCountry().equals(country)) &&
+                (variant == null || loc.getVariant().equals(variant))) {
+                return loc;
             }
         }
         return null;
@@ -231,11 +230,10 @@
      * return true else return false.
      */
     private boolean htmlSentenceTerminatorFound(String str, int index) {
-        for (int i = 0; i < sentenceTerminators.length; i++) {
-            String terminator = sentenceTerminators[i];
+        for (String terminator : sentenceTerminators) {
             if (str.regionMatches(true, index, terminator,
                                   0, terminator.length())) {
-                    return true;
+                return true;
             }
         }
         return false;
--- a/langtools/src/share/classes/com/sun/tools/javadoc/DocletInvoker.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/DocletInvoker.java	Wed Jul 05 19:26:54 2017 +0200
@@ -210,7 +210,7 @@
         Class<?>[] paramTypes = { String.class };
         Object[] params = { option };
         try {
-            retVal = invoke(methodName, new Integer(0), paramTypes, params);
+            retVal = invoke(methodName, 0, paramTypes, params);
         } catch (DocletInvokeException exc) {
             return -1;
         }
@@ -308,7 +308,7 @@
                 if (appClassLoader != null) // will be null if doclet class provided via API
                     Thread.currentThread().setContextClassLoader(appClassLoader);
                 return meth.invoke(null , params);
-            } catch (IllegalArgumentException exc) {
+            } catch (IllegalArgumentException | NullPointerException exc) {
                 messager.error(Messager.NOPOS, "main.internal_error_exception_thrown",
                                docletClassName, methodName, exc.toString());
                 throw new DocletInvokeException();
@@ -316,11 +316,8 @@
                 messager.error(Messager.NOPOS, "main.doclet_method_not_accessible",
                                docletClassName, methodName);
                 throw new DocletInvokeException();
-            } catch (NullPointerException exc) {
-                messager.error(Messager.NOPOS, "main.internal_error_exception_thrown",
-                               docletClassName, methodName, exc.toString());
-                throw new DocletInvokeException();
-            } catch (InvocationTargetException exc) {
+            }
+            catch (InvocationTargetException exc) {
                 Throwable err = exc.getTargetException();
                 if (apiMode)
                     throw new ClientCodeException(err);
--- a/langtools/src/share/classes/com/sun/tools/javadoc/ExecutableMemberDocImpl.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/ExecutableMemberDocImpl.java	Wed Jul 05 19:26:54 2017 +0200
@@ -155,7 +155,7 @@
      * thrown by this method.
      */
     public ClassDoc[] thrownExceptions() {
-        ListBuffer<ClassDocImpl> l = new ListBuffer<ClassDocImpl>();
+        ListBuffer<ClassDocImpl> l = new ListBuffer<>();
         for (Type ex : sym.type.getThrownTypes()) {
             ex = env.types.erasure(ex);
             //### Will these casts succeed in the face of static semantic
--- a/langtools/src/share/classes/com/sun/tools/javadoc/JavadocTool.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/JavadocTool.java	Wed Jul 05 19:26:54 2017 +0200
@@ -136,9 +136,9 @@
         docenv.legacyDoclet = legacyDoclet;
         javadocReader.sourceCompleter = docClasses ? null : thisCompleter;
 
-        ListBuffer<String> names = new ListBuffer<String>();
-        ListBuffer<JCCompilationUnit> classTrees = new ListBuffer<JCCompilationUnit>();
-        ListBuffer<JCCompilationUnit> packTrees = new ListBuffer<JCCompilationUnit>();
+        ListBuffer<String> names = new ListBuffer<>();
+        ListBuffer<JCCompilationUnit> classTrees = new ListBuffer<>();
+        ListBuffer<JCCompilationUnit> packTrees = new ListBuffer<>();
 
         try {
             StandardJavaFileManager fm = docenv.fileManager instanceof StandardJavaFileManager
@@ -226,7 +226,7 @@
         if (files == null) {
             Location location = docenv.fileManager.hasLocation(StandardLocation.SOURCE_PATH)
                     ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH;
-            ListBuffer<JavaFileObject> lb = new ListBuffer<JavaFileObject>();
+            ListBuffer<JavaFileObject> lb = new ListBuffer<>();
             for (JavaFileObject fo: docenv.fileManager.list(
                     location, name, EnumSet.of(JavaFileObject.Kind.SOURCE), false)) {
                 String binaryName = docenv.fileManager.inferBinaryName(location, fo);
@@ -259,10 +259,9 @@
             ListBuffer<String> packages,
             List<String> excludedPackages)
             throws IOException {
-        Map<String,List<JavaFileObject>> packageFiles =
-                new HashMap<String,List<JavaFileObject>>();
+        Map<String,List<JavaFileObject>> packageFiles = new HashMap<>();
 
-        Map<String,Boolean> includedPackages = new HashMap<String,Boolean>();
+        Map<String,Boolean> includedPackages = new HashMap<>();
         includedPackages.put("", true);
         for (String p: excludedPackages)
             includedPackages.put(p, false);
@@ -427,7 +426,7 @@
      * From a list of top level trees, return the list of contained class definitions
      */
     List<JCClassDecl> listClasses(List<JCCompilationUnit> trees) {
-        ListBuffer<JCClassDecl> result = new ListBuffer<JCClassDecl>();
+        ListBuffer<JCClassDecl> result = new ListBuffer<>();
         for (JCCompilationUnit t : trees) {
             for (JCTree def : t.defs) {
                 if (def.hasTag(JCTree.Tag.CLASSDEF))
--- a/langtools/src/share/classes/com/sun/tools/javadoc/PackageDocImpl.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/PackageDocImpl.java	Wed Jul 05 19:26:54 2017 +0200
@@ -145,7 +145,7 @@
         if (allClassesFiltered != null && filtered) {
             return allClassesFiltered;
         }
-        ListBuffer<ClassDocImpl> classes = new ListBuffer<ClassDocImpl>();
+        ListBuffer<ClassDocImpl> classes = new ListBuffer<>();
         for (Scope.Entry e = sym.members().elems; e != null; e = e.sibling) {
             if (e.sym != null) {
                 ClassSymbol s = (ClassSymbol)e.sym;
@@ -198,7 +198,7 @@
      * @return included ordinary classes in this package.
      */
     public ClassDoc[] ordinaryClasses() {
-        ListBuffer<ClassDocImpl> ret = new ListBuffer<ClassDocImpl>();
+        ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
         for (ClassDocImpl c : getClasses(true)) {
             if (c.isOrdinaryClass()) {
                 ret.append(c);
@@ -213,7 +213,7 @@
      * @return included Exceptions in this package.
      */
     public ClassDoc[] exceptions() {
-        ListBuffer<ClassDocImpl> ret = new ListBuffer<ClassDocImpl>();
+        ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
         for (ClassDocImpl c : getClasses(true)) {
             if (c.isException()) {
                 ret.append(c);
@@ -228,7 +228,7 @@
      * @return included Errors in this package.
      */
     public ClassDoc[] errors() {
-        ListBuffer<ClassDocImpl> ret = new ListBuffer<ClassDocImpl>();
+        ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
         for (ClassDocImpl c : getClasses(true)) {
             if (c.isError()) {
                 ret.append(c);
@@ -243,7 +243,7 @@
      * @return included enum types in this package.
      */
     public ClassDoc[] enums() {
-        ListBuffer<ClassDocImpl> ret = new ListBuffer<ClassDocImpl>();
+        ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
         for (ClassDocImpl c : getClasses(true)) {
             if (c.isEnum()) {
                 ret.append(c);
@@ -258,7 +258,7 @@
      * @return included interfaces in this package.
      */
     public ClassDoc[] interfaces() {
-        ListBuffer<ClassDocImpl> ret = new ListBuffer<ClassDocImpl>();
+        ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
         for (ClassDocImpl c : getClasses(true)) {
             if (c.isInterface()) {
                 ret.append(c);
@@ -273,8 +273,7 @@
      * @return included annotation types in this package.
      */
     public AnnotationTypeDoc[] annotationTypes() {
-        ListBuffer<AnnotationTypeDocImpl> ret =
-            new ListBuffer<AnnotationTypeDocImpl>();
+        ListBuffer<AnnotationTypeDocImpl> ret = new ListBuffer<>();
         for (ClassDocImpl c : getClasses(true)) {
             if (c.isAnnotationType()) {
                 ret.append((AnnotationTypeDocImpl)c);
--- a/langtools/src/share/classes/com/sun/tools/javadoc/RootDocImpl.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/RootDocImpl.java	Wed Jul 05 19:26:54 2017 +0200
@@ -97,7 +97,7 @@
         super(env, null);
         this.options = options;
         cmdLinePackages = List.nil();
-        ListBuffer<ClassDocImpl> classList = new ListBuffer<ClassDocImpl>();
+        ListBuffer<ClassDocImpl> classList = new ListBuffer<>();
         for (String className : classes) {
             ClassDocImpl c = env.loadClass(className);
             if (c == null)
@@ -116,7 +116,7 @@
      * @param classes a list of ClassDeclaration
      */
     private void setClasses(DocEnv env, List<JCClassDecl> classes) {
-        ListBuffer<ClassDocImpl> result = new ListBuffer<ClassDocImpl>();
+        ListBuffer<ClassDocImpl> result = new ListBuffer<>();
         for (JCClassDecl def : classes) {
             //### Do we want modifier check here?
             if (env.shouldDocument(def.sym)) {
@@ -137,7 +137,7 @@
      * @param packages a list of package names (String)
      */
     private void setPackages(DocEnv env, List<String> packages) {
-        ListBuffer<PackageDocImpl> packlist = new ListBuffer<PackageDocImpl>();
+        ListBuffer<PackageDocImpl> packlist = new ListBuffer<>();
         for (String name : packages) {
             PackageDocImpl pkg = env.lookupPackage(name);
             if (pkg != null) {
@@ -183,7 +183,7 @@
      * Classes and interfaces specified on the command line.
      */
     public ClassDoc[] specifiedClasses() {
-        ListBuffer<ClassDocImpl> classesToDocument = new ListBuffer<ClassDocImpl>();
+        ListBuffer<ClassDocImpl> classesToDocument = new ListBuffer<>();
         for (ClassDocImpl cd : cmdLineClasses) {
             cd.addAllClasses(classesToDocument, true);
         }
@@ -195,7 +195,7 @@
      * packages) to be documented.
      */
     public ClassDoc[] classes() {
-        ListBuffer<ClassDocImpl> classesToDocument = new ListBuffer<ClassDocImpl>();
+        ListBuffer<ClassDocImpl> classesToDocument = new ListBuffer<>();
         for (ClassDocImpl cd : cmdLineClasses) {
             cd.addAllClasses(classesToDocument, true);
         }
--- a/langtools/src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java	Wed Jul 05 19:26:54 2017 +0200
@@ -385,10 +385,9 @@
     private MemberDoc findReferencedMethod(String memName, String[] paramarr,
                                            ClassDoc referencedClass) {
         MemberDoc meth = findExecutableMember(memName, paramarr, referencedClass);
-        ClassDoc[] nestedclasses = referencedClass.innerClasses();
         if (meth == null) {
-            for (int i = 0; i < nestedclasses.length; i++) {
-                meth = findReferencedMethod(memName, paramarr, nestedclasses[i]);
+            for (ClassDoc nestedClass : referencedClass.innerClasses()) {
+                meth = findReferencedMethod(memName, paramarr, nestedClass);
                 if (meth != null) {
                     return meth;
                 }
@@ -427,7 +426,7 @@
 
         ParameterParseMachine(String parameters) {
             this.parameters = parameters;
-            this.paramList = new ListBuffer<String>();
+            this.paramList = new ListBuffer<>();
             typeId = new StringBuilder();
         }
 
--- a/langtools/src/share/classes/com/sun/tools/javadoc/SerializedForm.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/SerializedForm.java	Wed Jul 05 19:26:54 2017 +0200
@@ -68,14 +68,14 @@
  * @author Neal Gafter (rewrite but not too proud)
  */
 class SerializedForm {
-    ListBuffer<MethodDoc> methods = new ListBuffer<MethodDoc>();
+    ListBuffer<MethodDoc> methods = new ListBuffer<>();
 
     /* List of FieldDocImpl - Serializable fields.
      * Singleton list if class defines Serializable fields explicitly.
      * Otherwise, list of default serializable fields.
      * 0 length list for Externalizable.
      */
-    private final ListBuffer<FieldDocImpl> fields = new ListBuffer<FieldDocImpl>();
+    private final ListBuffer<FieldDocImpl> fields = new ListBuffer<>();
 
     /* True if class specifies serializable fields explicitly.
      * using special static member, serialPersistentFields.
@@ -234,20 +234,19 @@
                                                        DocEnv env,
                                                        ClassSymbol def) {
         Names names = def.name.table.names;
-
-        SerialFieldTag[] sfTag = spfDoc.serialFieldTags();
-        for (int i = 0; i < sfTag.length; i++) {
-            if (sfTag[i].fieldName() == null || sfTag[i].fieldType() == null) // ignore malformed @serialField tags
+        for (SerialFieldTag tag : spfDoc.serialFieldTags()) {
+            if (tag.fieldName() == null || tag.fieldType() == null) // ignore malformed @serialField tags
                 continue;
 
-            Name fieldName = names.fromString(sfTag[i].fieldName());
+            Name fieldName = names.fromString(tag.fieldName());
 
             // Look for a FieldDocImpl that is documented by serialFieldTagImpl.
-            for (Scope.Entry e = def.members().lookup(fieldName); e.scope != null; e = e.next()) {
+            for (Scope.Entry e = def.members().lookup(fieldName);
+                 e.scope != null; e = e.next()) {
                 if (e.sym.kind == Kinds.VAR) {
-                    VarSymbol f = (VarSymbol)e.sym;
+                    VarSymbol f = (VarSymbol) e.sym;
                     FieldDocImpl fdi = env.getFieldDoc(f);
-                    ((SerialFieldTagImpl)(sfTag[i])).mapToFieldDocImpl(fdi);
+                    ((SerialFieldTagImpl) (tag)).mapToFieldDocImpl(fdi);
                     break;
                 }
             }
--- a/langtools/src/share/classes/com/sun/tools/javadoc/Start.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/Start.java	Wed Jul 05 19:26:54 2017 +0200
@@ -207,7 +207,7 @@
     }
 
     public boolean begin(Class<?> docletClass, Iterable<String> options, Iterable<? extends JavaFileObject> fileObjects) {
-        Collection<String> opts = new ArrayList<String>();
+        Collection<String> opts = new ArrayList<>();
         for (String opt: options) opts.add(opt);
         return begin(docletClass, opts.toArray(new String[opts.size()]), fileObjects);
     }
@@ -251,7 +251,7 @@
             Iterable<? extends JavaFileObject> fileObjects) throws IOException {
         long tm = System.currentTimeMillis();
 
-        ListBuffer<String> javaNames = new ListBuffer<String>();
+        ListBuffer<String> javaNames = new ListBuffer<>();
 
         // Preprocess @file arguments
         try {
@@ -314,7 +314,7 @@
                     if ((i + optionLength) > argv.length) {
                         usageError("main.requires_argument", arg);
                     }
-                    ListBuffer<String> args = new ListBuffer<String>();
+                    ListBuffer<String> args = new ListBuffer<>();
                     for (int j = 0; j < optionLength-1; ++j) {
                         args.append(argv[++i]);
                     }
--- a/langtools/src/share/classes/com/sun/tools/javadoc/ToolOption.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/ToolOption.java	Wed Jul 05 19:26:54 2017 +0200
@@ -266,13 +266,13 @@
 
     static abstract class Helper {
         /** List of decoded options. */
-        final ListBuffer<String[]> options = new ListBuffer<String[]>();
+        final ListBuffer<String[]> options = new ListBuffer<>();
 
         /** Selected packages, from -subpackages. */
-        final ListBuffer<String> subPackages = new ListBuffer<String>();
+        final ListBuffer<String> subPackages = new ListBuffer<>();
 
         /** Excluded packages, from -exclude. */
-        final ListBuffer<String> excludedPackages = new ListBuffer<String>();
+        final ListBuffer<String> excludedPackages = new ListBuffer<>();
 
         /** javac options, set by various options. */
         Options compOpts; // = Options.instance(context)
--- a/langtools/src/share/classes/com/sun/tools/javah/Gen.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javah/Gen.java	Wed Jul 05 19:26:54 2017 +0200
@@ -347,9 +347,9 @@
      */
 
     List<VariableElement> getAllFields(TypeElement subclazz) {
-        List<VariableElement> fields = new ArrayList<VariableElement>();
+        List<VariableElement> fields = new ArrayList<>();
         TypeElement cd = null;
-        Stack<TypeElement> s = new Stack<TypeElement>();
+        Stack<TypeElement> s = new Stack<>();
 
         cd = subclazz;
         while (true) {
--- a/langtools/src/share/classes/com/sun/tools/javah/JNI.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javah/JNI.java	Wed Jul 05 19:26:54 2017 +0200
@@ -108,7 +108,7 @@
                                                    Mangle.Type.METHOD_JNI_SHORT));
                     pw.print("  (JNIEnv *, ");
                     List<? extends VariableElement> paramargs = md.getParameters();
-                    List<TypeMirror> args = new ArrayList<TypeMirror>();
+                    List<TypeMirror> args = new ArrayList<>();
                     for (VariableElement p: paramargs) {
                         args.add(types.erasure(p.asType()));
                     }
--- a/langtools/src/share/classes/com/sun/tools/javah/JavahTask.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javah/JavahTask.java	Wed Jul 05 19:26:54 2017 +0200
@@ -262,7 +262,7 @@
             throw new IllegalArgumentException(e.getMessage());
         }
 
-        this.classes = new ArrayList<String>();
+        this.classes = new ArrayList<>();
         if (classes != null) {
             for (String classname: classes) {
                 classname.getClass(); // null-check
@@ -367,7 +367,7 @@
                 handleOption(arg, iter);
             else if (allowClasses) {
                 if (classes == null)
-                    classes = new ArrayList<String>();
+                    classes = new ArrayList<>();
                 classes.add(arg);
                 while (iter.hasNext())
                     classes.add(iter.next());
@@ -414,7 +414,7 @@
 
     private Iterable<String> expandAtArgs(Iterable<String> args) throws BadArgs {
         try {
-            List<String> l = new ArrayList<String>();
+            List<String> l = new ArrayList<>();
             for (String arg: args) l.add(arg);
             return Arrays.asList(CommandLine.parse(l.toArray(new String[l.size()])));
         } catch (FileNotFoundException e) {
@@ -497,7 +497,7 @@
             ((JavahFileManager) fileManager).setSymbolFileEnabled(false);
 
         JavaCompiler c = ToolProvider.getSystemJavaCompiler();
-        List<String> opts = new ArrayList<String>();
+        List<String> opts = new ArrayList<>();
         opts.add("-proc:only");
         opts.addAll(javac_extras);
         CompilationTask t = c.getTask(log, fileManager, diagnosticListener, opts, classes, null);
@@ -511,7 +511,7 @@
     }
 
     private List<File> pathToFiles(String path) {
-        List<File> files = new ArrayList<File>();
+        List<File> files = new ArrayList<>();
         for (String f: path.split(File.pathSeparator)) {
             if (f.length() > 0)
                 files.add(new File(f));
@@ -618,7 +618,7 @@
             // could make this a HashMap<Locale,SoftReference<ResourceBundle>>
             // and for efficiency, keep a hard reference to the bundle for the task
             // locale
-            bundles = new HashMap<Locale, ResourceBundle>();
+            bundles = new HashMap<>();
         }
 
         if (locale == null)
@@ -657,7 +657,7 @@
     boolean llni;
     boolean doubleAlign;
     boolean force;
-    Set<String> javac_extras = new LinkedHashSet<String>();
+    Set<String> javac_extras = new LinkedHashSet<>();
 
     PrintWriter log;
     JavaFileManager fileManager;
@@ -711,7 +711,7 @@
         }
 
         private Set<TypeElement> getAllClasses(Set<? extends TypeElement> classes) {
-            Set<TypeElement> allClasses = new LinkedHashSet<TypeElement>();
+            Set<TypeElement> allClasses = new LinkedHashSet<>();
             getAllClasses0(classes, allClasses);
             return allClasses;
         }
--- a/langtools/src/share/classes/com/sun/tools/javah/JavahTool.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javah/JavahTool.java	Wed Jul 05 19:26:54 2017 +0200
@@ -74,10 +74,9 @@
     }
 
     public int isSupportedOption(String option) {
-        JavahTask.Option[] options = JavahTask.recognizedOptions;
-        for (int i = 0; i < options.length; i++) {
-            if (options[i].matches(option))
-                return (options[i].hasArg ? 1 : 0);
+        for (JavahTask.Option opt : JavahTask.recognizedOptions) {
+            if (opt.matches(option))
+                return (opt.hasArg ? 1 : 0);
         }
         return -1;
     }
--- a/langtools/src/share/classes/com/sun/tools/javah/LLNI.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javah/LLNI.java	Wed Jul 05 19:26:54 2017 +0200
@@ -89,7 +89,7 @@
     protected void generateDeclsForClass(PrintWriter pw,
             TypeElement clazz, String cname)
             throws TypeSignature.SignatureException, Util.Exit {
-        doneHandleTypes  = new HashSet<String>();
+        doneHandleTypes  = new HashSet<>();
         /* The following handle types are predefined in "typedefs.h". Suppress
            inclusion in the output by generating them "into the blue" here. */
         genHandleType(null, "java.lang.Class");
@@ -453,7 +453,7 @@
         res = "JNIEXPORT " + jniType(retType) + " JNICALL" + lineSep + jniMethodName(method, cname, longName)
             + "(JNIEnv *, " + cRcvrDecl(method, cname);
         List<? extends VariableElement> params = method.getParameters();
-        List<TypeMirror> argTypes = new ArrayList<TypeMirror>();
+        List<TypeMirror> argTypes = new ArrayList<>();
         for (VariableElement p: params){
             argTypes.add(types.erasure(p.asType()));
         }
@@ -488,7 +488,7 @@
         if (longName) {
             TypeMirror mType =  types.erasure(method.getReturnType());
             List<? extends VariableElement> params = method.getParameters();
-            List<TypeMirror> argTypes = new ArrayList<TypeMirror>();
+            List<TypeMirror> argTypes = new ArrayList<>();
             for (VariableElement param: params) {
                 argTypes.add(types.erasure(param.asType()));
             }
--- a/langtools/src/share/classes/com/sun/tools/javah/Mangle.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javah/Mangle.java	Wed Jul 05 19:26:54 2017 +0200
@@ -55,7 +55,7 @@
         public static final int METHOD_JDK_1     = 6;
         public static final int METHOD_JNI_SHORT = 7;
         public static final int METHOD_JNI_LONG  = 8;
-    };
+    }
 
     private Elements elems;
     private Types types;
@@ -176,7 +176,7 @@
     }
 
     /* Warning: Intentional ASCII operation. */
-    private static final boolean isalnum(char ch) {
+    private static boolean isalnum(char ch) {
         return ch <= 0x7f && /* quick test */
             ((ch >= 'A' && ch <= 'Z') ||
              (ch >= 'a' && ch <= 'z') ||
@@ -184,7 +184,7 @@
     }
 
     /* Warning: Intentional ASCII operation. */
-    private static final boolean isprint(char ch) {
+    private static boolean isprint(char ch) {
         return ch >= 32 && ch <= 126;
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/javah/TypeSignature.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javah/TypeSignature.java	Wed Jul 05 19:26:54 2017 +0200
@@ -95,7 +95,7 @@
             throws SignatureException {
         String signature = null; //Java type signature.
         String typeSignature = null; //Internal type signature.
-        List<String> params = new ArrayList<String>(); //List of parameters.
+        List<String> params = new ArrayList<>(); //List of parameters.
         String paramsig = null; //Java parameter signature.
         String paramJVMSig = null; //Internal parameter signature.
         String returnSig = null; //Java return type signature.
@@ -121,7 +121,7 @@
 
         // Separates parameters.
         if (signature != null) {
-            if (signature.indexOf(",") != -1) {
+            if (signature.contains(",")) {
                 st = new StringTokenizer(signature, ",");
                 if (st != null) {
                     while (st.hasMoreTokens()) {
@@ -179,13 +179,13 @@
 
         if(paramsig != null){
 
-            if(paramsig.indexOf("[]") != -1) {
+            if(paramsig.contains("[]")) {
                 // Gets array dimension.
                 int endindex = paramsig.indexOf("[]");
                 componentType = paramsig.substring(0, endindex);
                 String dimensionString =  paramsig.substring(endindex);
                 if(dimensionString != null){
-                    while(dimensionString.indexOf("[]") != -1){
+                    while(dimensionString.contains("[]")){
                         paramJVMSig += "[";
                         int beginindex = dimensionString.indexOf("]") + 1;
                         if(beginindex < dimensionString.length()){
@@ -209,29 +209,32 @@
         String JVMSig = "";
 
         if(componentType != null){
-            if(componentType.equals("void")) JVMSig += SIG_VOID ;
-            else if(componentType.equals("boolean"))  JVMSig += SIG_BOOLEAN ;
-            else if(componentType.equals("byte")) JVMSig += SIG_BYTE ;
-            else if(componentType.equals("char"))  JVMSig += SIG_CHAR ;
-            else if(componentType.equals("short"))  JVMSig += SIG_SHORT ;
-            else if(componentType.equals("int"))  JVMSig += SIG_INT ;
-            else if(componentType.equals("long"))  JVMSig += SIG_LONG ;
-            else if(componentType.equals("float")) JVMSig += SIG_FLOAT ;
-            else if(componentType.equals("double"))  JVMSig += SIG_DOUBLE ;
-            else {
-                if(!componentType.equals("")){
-                    TypeElement classNameDoc = elems.getTypeElement(componentType);
+            switch (componentType) {
+                case "void":    JVMSig += SIG_VOID;    break;
+                case "boolean": JVMSig += SIG_BOOLEAN; break;
+                case "byte":    JVMSig += SIG_BYTE;    break;
+                case "char":    JVMSig += SIG_CHAR;    break;
+                case "short":   JVMSig += SIG_SHORT;   break;
+                case "int":     JVMSig += SIG_INT;     break;
+                case "long":    JVMSig += SIG_LONG;    break;
+                case "float":   JVMSig += SIG_FLOAT;   break;
+                case "double":  JVMSig += SIG_DOUBLE;  break;
+                default:
+                    if (!componentType.equals("")) {
+                        TypeElement classNameDoc = elems.getTypeElement(componentType);
 
-                    if(classNameDoc == null){
-                        throw new SignatureException(componentType);
-                    }else {
-                        String classname = classNameDoc.getQualifiedName().toString();
-                        String newclassname = classname.replace('.', '/');
-                        JVMSig += "L";
-                        JVMSig += newclassname;
-                        JVMSig += ";";
+                        if (classNameDoc == null) {
+                            throw new SignatureException(componentType);
+                        }
+                        else {
+                            String classname = classNameDoc.getQualifiedName().toString();
+                            String newclassname = classname.replace('.', '/');
+                            JVMSig += "L";
+                            JVMSig += newclassname;
+                            JVMSig += ";";
+                        }
                     }
-                }
+                    break;
             }
         }
         return JVMSig;
--- a/langtools/src/share/classes/com/sun/tools/javap/AnnotationWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javap/AnnotationWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -219,8 +219,7 @@
                 Descriptor d = new Descriptor(index);
                 print(d.getFieldType(constant_pool));
                 return;
-            } catch (ConstantPoolException ignore) {
-            } catch (InvalidDescriptor ignore) {
+            } catch (ConstantPoolException | InvalidDescriptor ignore) {
             }
         }
 
--- a/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -62,6 +62,7 @@
 import com.sun.tools.classfile.Synthetic_attribute;
 
 import static com.sun.tools.classfile.AccessFlags.*;
+import com.sun.tools.javac.util.StringUtils;
 
 /*
  *  A writer for writing Attributes as text.
@@ -717,14 +718,14 @@
     }
 
     static String toHex(int i) {
-        return Integer.toString(i, 16).toUpperCase();
+        return StringUtils.toUpperCase(Integer.toString(i, 16));
     }
 
     static String toHex(int i, int w) {
-        String s = Integer.toHexString(i).toUpperCase();
+        String s = StringUtils.toUpperCase(Integer.toHexString(i));
         while (s.length() < w)
             s = "0" + s;
-        return s.toUpperCase();
+        return StringUtils.toUpperCase(s);
     }
 
     private AnnotationWriter annotationWriter;
--- a/langtools/src/share/classes/com/sun/tools/javap/CodeWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javap/CodeWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -235,8 +235,7 @@
     }
 
     private List<InstructionDetailWriter> getDetailWriters(Code_attribute attr) {
-        List<InstructionDetailWriter> detailWriters =
-                new ArrayList<InstructionDetailWriter>();
+        List<InstructionDetailWriter> detailWriters = new ArrayList<>();
         if (options.details.contains(InstructionDetailWriter.Kind.SOURCE)) {
             sourceWriter.reset(classWriter.getClassFile(), attr);
             if (sourceWriter.hasSource())
--- a/langtools/src/share/classes/com/sun/tools/javap/Context.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javap/Context.java	Wed Jul 05 19:26:54 2017 +0200
@@ -37,8 +37,11 @@
  *  deletion without notice.</b>
  */
 public class Context {
+
+    Map<Class<?>, Object> map;
+
     public Context() {
-       map = new HashMap<Class<?>, Object>();
+       map = new HashMap<>();
     }
 
     @SuppressWarnings("unchecked")
@@ -50,6 +53,4 @@
     public <T> T put(Class<T> key, T value) {
         return (T) map.put(key, value);
     }
-
-    Map<Class<?>, Object> map;
 }
--- a/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java	Wed Jul 05 19:26:54 2017 +0200
@@ -356,7 +356,7 @@
             Iterable<String> classes) {
         this(out, fileManager, diagnosticListener);
 
-        this.classes = new ArrayList<String>();
+        this.classes = new ArrayList<>();
         for (String classname: classes) {
             classname.getClass(); // null-check
             this.classes.add(classname);
@@ -512,7 +512,7 @@
                 handleOption(arg, iter);
             else if (allowClasses) {
                 if (classes == null)
-                    classes = new ArrayList<String>();
+                    classes = new ArrayList<>();
                 classes.add(arg);
                 while (iter.hasNext())
                     classes.add(iter.next());
@@ -758,8 +758,7 @@
                     }
 
                 };
-            } catch (URISyntaxException ignore) {
-            } catch (IOException ignore) {
+            } catch (URISyntaxException | IOException ignore) {
             }
         }
 
@@ -989,7 +988,7 @@
             // could make this a HashMap<Locale,SoftReference<ResourceBundle>>
             // and for efficiency, keep a hard reference to the bundle for the task
             // locale
-            bundles = new HashMap<Locale, ResourceBundle>();
+            bundles = new HashMap<>();
         }
 
         if (locale == null)
--- a/langtools/src/share/classes/com/sun/tools/javap/LocalVariableTableWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javap/LocalVariableTableWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -64,7 +64,7 @@
         }
         public abstract boolean match(LocalVariableTable_attribute.Entry entry, int pc);
         public final String text;
-    };
+    }
 
     static LocalVariableTableWriter instance(Context context) {
         LocalVariableTableWriter instance = context.get(LocalVariableTableWriter.class);
@@ -81,7 +81,7 @@
 
     public void reset(Code_attribute attr) {
         codeAttr = attr;
-        pcMap = new HashMap<Integer, List<LocalVariableTable_attribute.Entry>>();
+        pcMap = new HashMap<>();
         LocalVariableTable_attribute lvt =
                 (LocalVariableTable_attribute) (attr.attributes.get(Attribute.LocalVariableTable));
         if (lvt == null)
@@ -145,7 +145,7 @@
     private void put(int pc, LocalVariableTable_attribute.Entry entry) {
         List<LocalVariableTable_attribute.Entry> list = pcMap.get(pc);
         if (list == null) {
-            list = new ArrayList<LocalVariableTable_attribute.Entry>();
+            list = new ArrayList<>();
             pcMap.put(pc, list);
         }
         if (!list.contains(entry))
--- a/langtools/src/share/classes/com/sun/tools/javap/LocalVariableTypeTableWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javap/LocalVariableTypeTableWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -65,7 +65,7 @@
         }
         public abstract boolean match(LocalVariableTypeTable_attribute.Entry entry, int pc);
         public final String text;
-    };
+    }
 
     static LocalVariableTypeTableWriter instance(Context context) {
         LocalVariableTypeTableWriter instance = context.get(LocalVariableTypeTableWriter.class);
@@ -82,7 +82,7 @@
 
     public void reset(Code_attribute attr) {
         codeAttr = attr;
-        pcMap = new HashMap<Integer, List<LocalVariableTypeTable_attribute.Entry>>();
+        pcMap = new HashMap<>();
         LocalVariableTypeTable_attribute lvt =
                 (LocalVariableTypeTable_attribute) (attr.attributes.get(Attribute.LocalVariableTypeTable));
         if (lvt == null)
@@ -146,7 +146,7 @@
     private void put(int pc, LocalVariableTypeTable_attribute.Entry entry) {
         List<LocalVariableTypeTable_attribute.Entry> list = pcMap.get(pc);
         if (list == null) {
-            list = new ArrayList<LocalVariableTypeTable_attribute.Entry>();
+            list = new ArrayList<>();
             pcMap.put(pc, list);
         }
         if (!list.contains(entry))
--- a/langtools/src/share/classes/com/sun/tools/javap/Options.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javap/Options.java	Wed Jul 05 19:26:54 2017 +0200
@@ -78,7 +78,7 @@
     public boolean showFlags;
     public boolean showLineAndLocalVariableTables;
     public int showAccess;
-    public Set<String> accessOptions = new HashSet<String>();
+    public Set<String> accessOptions = new HashSet<>();
     public Set<InstructionDetailWriter.Kind> details = EnumSet.noneOf(InstructionDetailWriter.Kind.class);
     public boolean showDisassembled;
     public boolean showDescriptors;
--- a/langtools/src/share/classes/com/sun/tools/javap/SourceWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javap/SourceWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -106,9 +106,8 @@
     }
 
     private void setLineMap(Code_attribute attr) {
-        SortedMap<Integer, SortedSet<Integer>> map =
-                new TreeMap<Integer, SortedSet<Integer>>();
-        SortedSet<Integer> allLines = new TreeSet<Integer>();
+        SortedMap<Integer, SortedSet<Integer>> map = new TreeMap<>();
+        SortedSet<Integer> allLines = new TreeSet<>();
         for (Attribute a: attr.attributes) {
             if (a instanceof LineNumberTable_attribute) {
                 LineNumberTable_attribute t = (LineNumberTable_attribute) a;
@@ -117,7 +116,7 @@
                     int line = e.line_number;
                     SortedSet<Integer> pcLines = map.get(start_pc);
                     if (pcLines == null) {
-                        pcLines = new TreeSet<Integer>();
+                        pcLines = new TreeSet<>();
                         map.put(start_pc, pcLines);
                     }
                     pcLines.add(line);
@@ -126,7 +125,7 @@
             }
         }
         lineMap = map;
-        lineList = new ArrayList<Integer>(allLines);
+        lineList = new ArrayList<>(allLines);
     }
 
     private void setSource(ClassFile cf) {
@@ -186,7 +185,7 @@
         if (text == null)
             return new String[0];
 
-        List<String> lines = new ArrayList<String>();
+        List<String> lines = new ArrayList<>();
         lines.add(""); // dummy line 0
         try {
             BufferedReader r = new BufferedReader(new StringReader(text));
--- a/langtools/src/share/classes/com/sun/tools/javap/StackMapWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javap/StackMapWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -82,9 +82,7 @@
             ConstantPool cp = classWriter.getClassFile().constant_pool;
             String argString = d.getParameterTypes(cp);
             args = argString.substring(1, argString.length() - 1).split("[, ]+");
-        } catch (ConstantPoolException e) {
-            return;
-        } catch (InvalidDescriptor e) {
+        } catch (ConstantPoolException | InvalidDescriptor e) {
             return;
         }
         boolean isStatic = m.access_flags.is(AccessFlags.ACC_STATIC);
@@ -97,7 +95,7 @@
                     new CustomVerificationTypeInfo(args[i].replace(".", "/"));
         }
 
-        map = new HashMap<Integer, StackMap>();
+        map = new HashMap<>();
         StackMapBuilder builder = new StackMapBuilder();
 
         // using -1 as the pc for the initial frame effectively compensates for
--- a/langtools/src/share/classes/com/sun/tools/javap/TryBlockWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javap/TryBlockWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -64,7 +64,7 @@
         }
         public abstract boolean match(Exception_data entry, int pc);
         public final String text;
-    };
+    }
 
     static TryBlockWriter instance(Context context) {
         TryBlockWriter instance = context.get(TryBlockWriter.class);
@@ -80,8 +80,8 @@
     }
 
     public void reset(Code_attribute attr) {
-        indexMap = new HashMap<Exception_data, Integer>();
-        pcMap = new HashMap<Integer, List<Exception_data>>();
+        indexMap = new HashMap<>();
+        pcMap = new HashMap<>();
         for (int i = 0; i < attr.exception_table.length; i++) {
             Exception_data entry = attr.exception_table[i];
             indexMap.put(entry, i);
@@ -129,7 +129,7 @@
     private void put(int pc, Exception_data entry) {
         List<Exception_data> list = pcMap.get(pc);
         if (list == null) {
-            list = new ArrayList<Exception_data>();
+            list = new ArrayList<>();
             pcMap.put(pc, list);
         }
         if (!list.contains(entry))
--- a/langtools/src/share/classes/com/sun/tools/javap/TypeAnnotationWriter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javap/TypeAnnotationWriter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -37,6 +37,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import com.sun.tools.javac.util.StringUtils;
 
 /**
  * Annotate instructions with details about type annotations.
@@ -47,7 +48,8 @@
  *  deletion without notice.</b>
  */
 public class TypeAnnotationWriter extends InstructionDetailWriter {
-    public enum NoteKind { VISIBLE, INVISIBLE };
+    public enum NoteKind { VISIBLE, INVISIBLE }
+
     public static class Note {
         Note(NoteKind kind, TypeAnnotation anno) {
             this.kind = kind;
@@ -73,7 +75,7 @@
 
     public void reset(Code_attribute attr) {
         Method m = classWriter.getMethod();
-        pcMap = new HashMap<Integer, List<Note>>();
+        pcMap = new HashMap<>();
         check(NoteKind.VISIBLE, (RuntimeVisibleTypeAnnotations_attribute) m.attributes.get(Attribute.RuntimeVisibleTypeAnnotations));
         check(NoteKind.INVISIBLE, (RuntimeInvisibleTypeAnnotations_attribute) m.attributes.get(Attribute.RuntimeInvisibleTypeAnnotations));
     }
@@ -100,7 +102,7 @@
     private void addNote(int pc, Note note) {
         List<Note> list = pcMap.get(pc);
         if (list == null)
-            pcMap.put(pc, list = new ArrayList<Note>());
+            pcMap.put(pc, list = new ArrayList<>());
         list.add(note);
     }
 
@@ -115,7 +117,7 @@
                 print("@");
                 annotationWriter.write(n.anno, false, true);
                 print(", ");
-                println(n.kind.toString().toLowerCase());
+                println(StringUtils.toLowerCase(n.kind.toString()));
             }
         }
     }
--- a/langtools/src/share/classes/com/sun/tools/jdeps/Analyzer.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/Analyzer.java	Wed Jul 05 19:26:54 2017 +0200
@@ -50,7 +50,7 @@
         PACKAGE,
         CLASS,
         VERBOSE
-    };
+    }
 
     private final Type type;
     private final Map<Archive, ArchiveDeps> results = new HashMap<>();
--- a/langtools/src/share/classes/com/sun/tools/jdeps/ClassFileReader.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/ClassFileReader.java	Wed Jul 05 19:26:54 2017 +0200
@@ -189,7 +189,7 @@
         }
 
         private List<Path> walkTree(Path dir) throws IOException {
-            final List<Path> files = new ArrayList<Path>();
+            final List<Path> files = new ArrayList<>();
             Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
                 public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
                         throws IOException {
--- a/langtools/src/share/classes/com/sun/tools/jdeps/JdepsTask.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/JdepsTask.java	Wed Jul 05 19:26:54 2017 +0200
@@ -217,7 +217,7 @@
 
     private static final String PROGNAME = "jdeps";
     private final Options options = new Options();
-    private final List<String> classes = new ArrayList<String>();
+    private final List<String> classes = new ArrayList<>();
 
     private PrintWriter log;
     void setLog(PrintWriter out) {
@@ -614,7 +614,7 @@
     }
 
     private List<Archive> getArchives(List<String> filenames) throws IOException {
-        List<Archive> result = new ArrayList<Archive>();
+        List<Archive> result = new ArrayList<>();
         for (String s : filenames) {
             Path p = Paths.get(s);
             if (Files.exists(p)) {
--- a/langtools/src/share/classes/com/sun/tools/sjavac/BuildState.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/BuildState.java	Wed Jul 05 19:26:54 2017 +0200
@@ -42,12 +42,12 @@
  * or deletion without notice.</b></p>
  */
 public class BuildState {
-    private Map<String,Module> modules = new HashMap<String,Module>();
-    private Map<String,Package> packages = new HashMap<String,Package>();
-    private Map<String,Source> sources = new HashMap<String,Source>();
-    private Map<String,File> artifacts = new HashMap<String,File>();
+    private Map<String,Module> modules = new HashMap<>();
+    private Map<String,Package> packages = new HashMap<>();
+    private Map<String,Source> sources = new HashMap<>();
+    private Map<String,File> artifacts = new HashMap<>();
     // Map from package to a set of packages that depend on said package.
-    private Map<String,Set<String>> dependents = new HashMap<String,Set<String>>();
+    private Map<String,Set<String>> dependents = new HashMap<>();
 
     public  Map<String,Module> modules() { return modules; }
     public  Map<String,Package> packages() { return packages; }
@@ -151,13 +151,13 @@
      * Calculate the package dependents (ie the reverse of the dependencies).
      */
     public void calculateDependents() {
-        dependents = new HashMap<String,Set<String>>();
+        dependents = new HashMap<>();
         for (String s : packages.keySet()) {
             Package p = packages.get(s);
             for (String d : p.dependencies()) {
                 Set<String> ss = dependents.get(d);
                 if (ss == null) {
-                    ss = new HashSet<String>();
+                    ss = new HashSet<>();
                     dependents.put(d, ss);
                 }
                 // Add the dependent information to the global dependent map.
@@ -181,8 +181,8 @@
      */
     public void checkInternalState(String msg, boolean linkedOnly, Map<String,Source> srcs) {
         boolean baad = false;
-        Map<String,Source> original = new HashMap<String,Source>();
-        Map<String,Source> calculated = new HashMap<String,Source>();
+        Map<String,Source> original = new HashMap<>();
+        Map<String,Source> calculated = new HashMap<>();
 
         for (String s : sources.keySet()) {
             Source ss = sources.get(s);
--- a/langtools/src/share/classes/com/sun/tools/sjavac/CleanProperties.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/CleanProperties.java	Wed Jul 05 19:26:54 2017 +0200
@@ -97,18 +97,19 @@
         }
 
         // Sort the properties in increasing key order.
-        List<String> sortedKeys = new ArrayList<String>();
+        List<String> sortedKeys = new ArrayList<>();
         for (Object key : p.keySet()) {
             sortedKeys.add((String)key);
         }
         Collections.sort(sortedKeys);
-        Iterator<String> keys = sortedKeys.iterator();
 
         // Collect the properties into a string buffer.
         StringBuilder data = new StringBuilder();
-        while (keys.hasNext()) {
-            String key = keys.next();
-            data.append(CompileProperties.escape(key)+":"+CompileProperties.escape((String)p.get(key))+"\n");
+        for (String key : sortedKeys) {
+            data.append(CompileProperties.escape(key))
+                .append(":")
+                .append(CompileProperties.escape((String) p.get(key)))
+                .append("\n");
         }
 
         String destFilename = destRoot.getPath()+File.separator+pkgNameF+File.separator+src.getName();
@@ -124,7 +125,7 @@
 
         Set<URI> as = packageArtifacts.get(pkgName);
         if (as == null) {
-            as = new HashSet<URI>();
+            as = new HashSet<>();
             packageArtifacts.put(pkgName, as);
         }
         as.add(dest.toURI());
--- a/langtools/src/share/classes/com/sun/tools/sjavac/CompileChunk.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/CompileChunk.java	Wed Jul 05 19:26:54 2017 +0200
@@ -41,7 +41,7 @@
 public class CompileChunk implements Comparable<CompileChunk> {
     public int numPackages;
     public int numDependents;
-    public Set<URI> srcs = new HashSet<URI>();
+    public Set<URI> srcs = new HashSet<>();
     public StringBuilder pkgNames = new StringBuilder();
     public String pkgFromTos = "";
 
--- a/langtools/src/share/classes/com/sun/tools/sjavac/CompileProperties.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/CompileProperties.java	Wed Jul 05 19:26:54 2017 +0200
@@ -111,7 +111,7 @@
         String classname = src.getName().substring(0,dp);
 
         // Sort the properties in increasing key order.
-        List<String> sortedKeys = new ArrayList<String>();
+        List<String> sortedKeys = new ArrayList<>();
         for (Object key : p.keySet()) {
             sortedKeys.add((String)key);
         }
@@ -140,7 +140,7 @@
 
         Set<URI> as = packageArtifacts.get(pkgName);
         if (as == null) {
-            as = new HashSet<URI>();
+            as = new HashSet<>();
             packageArtifacts.put(pkgName, as);
         }
         as.add(dest.toURI());
--- a/langtools/src/share/classes/com/sun/tools/sjavac/CopyFile.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/CopyFile.java	Wed Jul 05 19:26:54 2017 +0200
@@ -85,7 +85,7 @@
 
                 Set<URI> as = packageArtifacts.get(pkgName);
                 if (as == null) {
-                    as = new HashSet<URI>();
+                    as = new HashSet<>();
                     packageArtifacts.put(pkgName, as);
                 }
                 as.add(dest.toURI());
--- a/langtools/src/share/classes/com/sun/tools/sjavac/JavacState.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/JavacState.java	Wed Jul 05 19:26:54 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -157,9 +157,9 @@
         }
         prev = new BuildState();
         now = new BuildState();
-        taintedPackages = new HashSet<String>();
-        recompiledPackages = new HashSet<String>();
-        packagesWithChangedPublicApis = new HashSet<String>();
+        taintedPackages = new HashSet<>();
+        recompiledPackages = new HashSet<>();
+        packagesWithChangedPublicApis = new HashSet<>();
     }
 
     public BuildState prev() { return prev; }
@@ -197,7 +197,7 @@
      * Specify which sources are visible to the compiler through -sourcepath.
      */
     public void setVisibleSources(Map<String,Source> vs) {
-        visibleSrcs = new HashSet<URI>();
+        visibleSrcs = new HashSet<>();
         for (String s : vs.keySet()) {
             Source src = vs.get(s);
             visibleSrcs.add(src.file().toURI());
@@ -208,7 +208,7 @@
      * Specify which classes are visible to the compiler through -classpath.
      */
     public void setVisibleClasses(Map<String,Source> vs) {
-        visibleSrcs = new HashSet<URI>();
+        visibleSrcs = new HashSet<>();
         for (String s : vs.keySet()) {
             Source src = vs.get(s);
             visibleSrcs.add(src.file().toURI());
@@ -238,7 +238,7 @@
         if (p != null) {
             return p.artifacts();
         }
-        return new HashMap<String,File>();
+        return new HashMap<>();
     }
 
     /**
@@ -421,7 +421,7 @@
      * prior to propagating dependencies.
      */
     public void clearTaintedPackages() {
-        taintedPackages = new HashSet<String>();
+        taintedPackages = new HashSet<>();
     }
 
     /**
@@ -462,7 +462,7 @@
      * Acquire the compile_java_packages suffix rule for .java files.
      */
     public Map<String,Transformer> getJavaSuffixRule() {
-        Map<String,Transformer> sr = new HashMap<String,Transformer>();
+        Map<String,Transformer> sr = new HashMap<>();
         sr.put(".java", compileJavaPackages);
         return sr;
     }
@@ -509,7 +509,7 @@
      * that are not recognized as such, in the javac_state file.
      */
     public void removeUnidentifiedArtifacts() {
-        Set<File> allKnownArtifacts = new HashSet<File>();
+        Set<File> allKnownArtifacts = new HashSet<>();
         for (Package pkg : prev.packages().values()) {
             for (File f : pkg.artifacts().values()) {
                 allKnownArtifacts.add(f);
@@ -562,7 +562,7 @@
      * Return those files belonging to prev, but not now.
      */
     private Set<Source> calculateRemovedSources() {
-        Set<Source> removed = new HashSet<Source>();
+        Set<Source> removed = new HashSet<>();
         for (String src : prev.sources().keySet()) {
             if (now.sources().get(src) == null) {
                 removed.add(prev.sources().get(src));
@@ -575,7 +575,7 @@
      * Return those files belonging to now, but not prev.
      */
     private Set<Source> calculateAddedSources() {
-        Set<Source> added = new HashSet<Source>();
+        Set<Source> added = new HashSet<>();
         for (String src : now.sources().keySet()) {
             if (prev.sources().get(src) == null) {
                 added.add(now.sources().get(src));
@@ -591,7 +591,7 @@
      * a warning!
      */
     private Set<Source> calculateModifiedSources() {
-        Set<Source> modified = new HashSet<Source>();
+        Set<Source> modified = new HashSet<>();
         for (String src : now.sources().keySet()) {
             Source n = now.sources().get(src);
             Source t = prev.sources().get(src);
@@ -627,7 +627,7 @@
      * Run the copy translator only.
      */
     public void performCopying(File binDir, Map<String,Transformer> suffixRules) {
-        Map<String,Transformer> sr = new HashMap<String,Transformer>();
+        Map<String,Transformer> sr = new HashMap<>();
         for (Map.Entry<String,Transformer> e : suffixRules.entrySet()) {
             if (e.getValue() == copyFiles) {
                 sr.put(e.getKey(), e.getValue());
@@ -641,7 +641,7 @@
      * I.e. all translators that are not copy nor compile_java_source.
      */
     public void performTranslation(File gensrcDir, Map<String,Transformer> suffixRules) {
-        Map<String,Transformer> sr = new HashMap<String,Transformer>();
+        Map<String,Transformer> sr = new HashMap<>();
         for (Map.Entry<String,Transformer> e : suffixRules.entrySet()) {
             if (e.getValue() != copyFiles &&
                 e.getValue() != compileJavaPackages) {
@@ -659,7 +659,7 @@
                                            String[] args,
                                            Set<String> recentlyCompiled,
                                            boolean[] rcValue) {
-        Map<String,Transformer> suffixRules = new HashMap<String,Transformer>();
+        Map<String,Transformer> suffixRules = new HashMap<>();
         suffixRules.put(".java", compileJavaPackages);
         compileJavaPackages.setExtra(serverSettings);
         compileJavaPackages.setExtra(args);
@@ -669,7 +669,7 @@
         clearTaintedPackages();
         boolean again = !packagesWithChangedPublicApis.isEmpty();
         taintPackagesDependingOnChangedPackages(packagesWithChangedPublicApis, recentlyCompiled);
-        packagesWithChangedPublicApis = new HashSet<String>();
+        packagesWithChangedPublicApis = new HashSet<>();
         return again && rcValue[0];
     }
 
@@ -679,12 +679,12 @@
     private void addFileToTransform(Map<Transformer,Map<String,Set<URI>>> gs, Transformer t, Source s) {
         Map<String,Set<URI>> fs = gs.get(t);
         if (fs == null) {
-            fs = new HashMap<String,Set<URI>>();
+            fs = new HashMap<>();
             gs.put(t, fs);
         }
         Set<URI> ss = fs.get(s.pkg().name());
         if (ss == null) {
-            ss = new HashSet<URI>();
+            ss = new HashSet<>();
             fs.put(s.pkg().name(), ss);
         }
         ss.add(s.file().toURI());
@@ -698,7 +698,7 @@
     {
         boolean rc = true;
         // Group sources based on transforms. A source file can only belong to a single transform.
-        Map<Transformer,Map<String,Set<URI>>> groupedSources = new HashMap<Transformer,Map<String,Set<URI>>>();
+        Map<Transformer,Map<String,Set<URI>>> groupedSources = new HashMap<>();
         for (Source src : now.sources().values()) {
             Transformer t = suffixRules.get(src.suffix());
                if (t != null) {
@@ -712,9 +712,12 @@
             Transformer t = e.getKey();
             Map<String,Set<URI>> srcs = e.getValue();
             // These maps need to be synchronized since multiple threads will be writing results into them.
-            Map<String,Set<URI>> packageArtifacts = Collections.synchronizedMap(new HashMap<String,Set<URI>>());
-            Map<String,Set<String>> packageDependencies = Collections.synchronizedMap(new HashMap<String,Set<String>>());
-            Map<String,String> packagePublicApis = Collections.synchronizedMap(new HashMap<String,String>());
+            Map<String,Set<URI>> packageArtifacts =
+                    Collections.synchronizedMap(new HashMap<String,Set<URI>>());
+            Map<String,Set<String>> packageDependencies =
+                    Collections.synchronizedMap(new HashMap<String,Set<String>>());
+            Map<String,String> packagePublicApis =
+                    Collections.synchronizedMap(new HashMap<String, String>());
 
             boolean  r = t.transform(srcs,
                                      visibleSrcs,
@@ -770,7 +773,7 @@
      * Utility method to recursively find all files below a directory.
      */
     private static Set<File> findAllFiles(File dir) {
-        Set<File> foundFiles = new HashSet<File>();
+        Set<File> foundFiles = new HashSet<>();
         if (dir == null) {
             return foundFiles;
         }
@@ -803,8 +806,8 @@
 
         if (makefileSourceList == null) return;
 
-        Set<String> calculatedSources = new HashSet<String>();
-        Set<String> listedSources = new HashSet<String>();
+        Set<String> calculatedSources = new HashSet<>();
+        Set<String> listedSources = new HashSet<>();
 
         // Create a set of filenames with full paths.
         for (Source s : now.sources().values()) {
--- a/langtools/src/share/classes/com/sun/tools/sjavac/Log.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/Log.java	Wed Jul 05 19:26:54 2017 +0200
@@ -75,11 +75,14 @@
         throws ProblemException {
         out = o;
         err = e;
-        if (l.equals("warn")) level = WARN;
-        else if (l.equals("info")) level = INFO;
-        else if (l.equals("debug")) level = DEBUG;
-        else if (l.equals("trace")) level = TRACE;
-        else throw new ProblemException("No such log level \""+l+"\"");
+        switch (l) {
+            case "warn": level = WARN; break;
+            case "info": level = INFO; break;
+            case "debug": level = DEBUG; break;
+            case "trace": level = TRACE; break;
+            default:
+                throw new ProblemException("No such log level \"" + l + "\"");
+        }
     }
 
     static public boolean isTracing() {
--- a/langtools/src/share/classes/com/sun/tools/sjavac/Main.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/Main.java	Wed Jul 05 19:26:54 2017 +0200
@@ -232,14 +232,14 @@
             findCopyOptions(args, suffix_rules);
 
             // All found modules are put here.
-            Map<String,Module> modules = new HashMap<String,Module>();
+            Map<String,Module> modules = new HashMap<>();
             // We start out in the legacy empty no-name module.
             // As soon as we stumble on a module-info.java file we change to that module.
             Module current_module = new Module("", "");
             modules.put("", current_module);
 
             // Find all sources, use the suffix rules to know which files are sources.
-            Map<String,Source> sources = new HashMap<String,Source>();
+            Map<String,Source> sources = new HashMap<>();
             // Find the files, this will automatically populate the found modules
             // with found packages where the sources are found!
             findFiles(args, "-src", suffix_rules.keySet(), sources, modules, current_module, false);
@@ -257,7 +257,7 @@
             // all concatenated. The list created here is used by the SmartFileWrapper to
             // make sure only the correct sources are actually available.
             // We might find more modules here as well.
-            Map<String,Source> sources_to_link_to = new HashMap<String,Source>();
+            Map<String,Source> sources_to_link_to = new HashMap<>();
             findFiles(args, "-src", Util.set(".java"), sources_to_link_to, modules, current_module, true);
             findFiles(args, "-sourcepath", Util.set(".java"), sources_to_link_to, modules, current_module, true);
             // Rewrite the -src option to make it through to the javac instances.
@@ -308,7 +308,7 @@
             javac_state.performTranslation(gensrc_dir, suffix_rules);
             // Add any potentially generated java sources to the tobe compiled list.
             // (Generated sources must always have a package.)
-            Map<String,Source> generated_sources = new HashMap<String,Source>();
+            Map<String,Source> generated_sources = new HashMap<>();
             Source.scanRoot(gensrc_dir, Util.set(".java"), null, null, null, null,
                    generated_sources, modules, current_module, false, true, false);
             javac_state.now().flattenPackagesSourcesAndArtifacts(modules);
@@ -325,7 +325,7 @@
             // Do the compilations, repeatedly until no tainted packages exist.
             boolean again;
             // Collect the name of all compiled packages.
-            Set<String> recently_compiled = new HashSet<String>();
+            Set<String> recently_compiled = new HashSet<>();
             boolean[] rc = new boolean[1];
             do {
                 // Clean out artifacts in tainted packages.
@@ -670,7 +670,7 @@
      * Add -src before source root directories if not already there.
      */
     private static String[] addSrcBeforeDirectories(String[] args) {
-        List<String> newargs = new ArrayList<String>();
+        List<String> newargs = new ArrayList<>();
         for (int i = 0; i<args.length; ++i) {
             File dir = new File(args[i]);
             if (dir.exists() && dir.isDirectory()) {
@@ -688,7 +688,7 @@
      */
     private static void checkSrcOption(String[] args)
         throws ProblemException {
-        Set<File> dirs = new HashSet<File>();
+        Set<File> dirs = new HashSet<>();
         for (int i = 0; i<args.length; ++i) {
             if (args[i].equals("-src")) {
                 if (i+1 >= args.length) {
@@ -749,8 +749,9 @@
      * Look for a specific switch, return true if found.
      */
     public static boolean findBooleanOption(String[] args, String option) {
-        for (int i = 0; i<args.length; ++i) {
-            if (args[i].equals(option)) return true;
+        for (String arg : args) {
+            if (arg.equals(option))
+                return true;
         }
         return false;
     }
@@ -869,15 +870,15 @@
         throws ProblemException, ProblemException
     {
         // Track which source roots, source path roots and class path roots have been added.
-        Set<File> roots = new HashSet<File>();
+        Set<File> roots = new HashSet<>();
         // Track the current set of package includes,excludes as well as excluded source files,
         // to be used in the next -src/-sourcepath/-classpath
-        List<String> includes = new LinkedList<String>();
-        List<String> excludes = new LinkedList<String>();
-        List<String> excludefiles = new LinkedList<String>();
-        List<String> includefiles = new LinkedList<String>();
+        List<String> includes = new LinkedList<>();
+        List<String> excludes = new LinkedList<>();
+        List<String> excludefiles = new LinkedList<>();
+        List<String> includefiles = new LinkedList<>();
         // This include is used to find all modules in the source.
-        List<String> moduleinfo = new LinkedList<String>();
+        List<String> moduleinfo = new LinkedList<>();
         moduleinfo.add("module-info.java");
 
         for (int i = 0; i<args.length; ++i) {
@@ -956,10 +957,10 @@
                 args[i].equals("-cp"))
             {
                 // Reset the includes,excludes and excludefiles after they have been used.
-                includes = new LinkedList<String>();
-                excludes = new LinkedList<String>();
-                excludefiles = new LinkedList<String>();
-                includefiles = new LinkedList<String>();
+                includes = new LinkedList<>();
+                excludes = new LinkedList<>();
+                excludefiles = new LinkedList<>();
+                includefiles = new LinkedList<>();
             }
         }
         return true;
--- a/langtools/src/share/classes/com/sun/tools/sjavac/Module.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/Module.java	Wed Jul 05 19:26:54 2017 +0200
@@ -44,9 +44,9 @@
 public class Module implements Comparable<Module> {
     private String name;
     private String dirname;
-    private Map<String,Package> packages = new HashMap<String,Package>();
-    private Map<String,Source> sources = new HashMap<String,Source>();
-    private Map<String,File> artifacts = new HashMap<String,File>();
+    private Map<String,Package> packages = new HashMap<>();
+    private Map<String,Source> sources = new HashMap<>();
+    private Map<String,File> artifacts = new HashMap<>();
 
     public Module(String n, String dn) {
         name = n;
--- a/langtools/src/share/classes/com/sun/tools/sjavac/Package.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/Package.java	Wed Jul 05 19:26:54 2017 +0200
@@ -71,15 +71,15 @@
     // then that module's file system name is part of the path.
     private String dirname;
     // This package depends on these packages.
-    private Set<String> dependencies = new HashSet<String>();
+    private Set<String> dependencies = new HashSet<>();
     // This package has the following dependents, that depend on this package.
-    private Set<String> dependents = new HashSet<String>();
+    private Set<String> dependents = new HashSet<>();
     // This is the public api of this package.
-    private List<String> pubapi = new ArrayList<String>();
+    private List<String> pubapi = new ArrayList<>();
     // Map from source file name to Source info object.
-    private Map<String,Source> sources = new HashMap<String,Source>();
+    private Map<String,Source> sources = new HashMap<>();
     // This package generated these artifacts.
-    private Map<String,File> artifacts = new HashMap<String,File>();
+    private Map<String,File> artifacts = new HashMap<>();
 
     public Package(Module m, String n) {
         int c = n.indexOf(":");
@@ -146,7 +146,7 @@
     public static List<String> pubapiToList(String ps)
     {
         String[] lines = ps.split("\n");
-        List<String> r = new ArrayList<String>();
+        List<String> r = new ArrayList<>();
         for (String l : lines) {
             r.add(l);
         }
@@ -213,7 +213,7 @@
     }
 
     public void saveDependencies(StringBuilder b) {
-        List<String> sorted_dependencies = new ArrayList<String>();
+        List<String> sorted_dependencies = new ArrayList<>();
         for (String key : dependencies) {
             sorted_dependencies.add(key);
         }
@@ -230,7 +230,7 @@
     }
 
     public static void savePackages(Map<String,Package> packages, StringBuilder b) {
-        List<String> sorted_packages = new ArrayList<String>();
+        List<String> sorted_packages = new ArrayList<>();
         for (String key : packages.keySet() ) {
             sorted_packages.add(key);
         }
@@ -257,7 +257,7 @@
 
     public void setArtifacts(Set<URI> as) {
         assert(!artifacts.isEmpty());
-        artifacts = new HashMap<String,File>();
+        artifacts = new HashMap<>();
         addArtifacts(as);
     }
 
@@ -279,7 +279,7 @@
     }
 
     public void saveArtifacts(StringBuilder b) {
-        List<File> sorted_artifacts = new ArrayList<File>();
+        List<File> sorted_artifacts = new ArrayList<>();
         for (File f : artifacts.values()) {
             sorted_artifacts.add(f);
         }
--- a/langtools/src/share/classes/com/sun/tools/sjavac/Source.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/Source.java	Wed Jul 05 19:26:54 2017 +0200
@@ -165,7 +165,7 @@
     }
 
     public static void saveSources(Map<String,Source> sources, StringBuilder b) {
-        List<String> sorted_sources = new ArrayList<String>();
+        List<String> sorted_sources = new ArrayList<>();
         for (String key : sources.keySet()) {
             sorted_sources.add(key);
         }
--- a/langtools/src/share/classes/com/sun/tools/sjavac/Util.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/Util.java	Wed Jul 05 19:26:54 2017 +0200
@@ -121,7 +121,7 @@
      * Convenience method to create a set with strings.
      */
     public static Set<String> set(String... ss) {
-        Set<String> set = new HashSet<String>();
+        Set<String> set = new HashSet<>();
         set.addAll(Arrays.asList(ss));
         return set;
     }
--- a/langtools/src/share/classes/com/sun/tools/sjavac/comp/Dependencies.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/comp/Dependencies.java	Wed Jul 05 19:26:54 2017 +0200
@@ -47,8 +47,7 @@
  * or deletion without notice.</b></p>
  */
 public class Dependencies {
-    protected static final Context.Key<Dependencies> dependenciesKey =
-        new Context.Key<Dependencies>();
+    protected static final Context.Key<Dependencies> dependenciesKey = new Context.Key<>();
 
     // The log to be used for error reporting.
     protected Log log;
@@ -77,9 +76,9 @@
 
     public void reset()
     {
-        deps = new HashMap<Name, Set<Name>>();
-        explicitPackages = new HashSet<Name>();
-        publicApiPerClass = new HashMap<Name,StringBuffer>();
+        deps = new HashMap<>();
+        explicitPackages = new HashSet<>();
+        publicApiPerClass = new HashMap<>();
     }
 
     /**
@@ -89,14 +88,14 @@
      * @return
      */
     public Map<String,Set<String>> getDependencies() {
-        Map<String,Set<String>> new_deps = new HashMap<String,Set<String>>();
+        Map<String,Set<String>> new_deps = new HashMap<>();
         if (explicitPackages == null) return new_deps;
         for (Name pkg : explicitPackages) {
             Set<Name> set = deps.get(pkg);
             if (set != null) {
                 Set<String> new_set = new_deps.get(pkg.toString());
                 if (new_set == null) {
-                    new_set = new HashSet<String>();
+                    new_set = new HashSet<>();
                     // Modules beware....
                     new_deps.put(":"+pkg.toString(), new_set);
                 }
@@ -121,7 +120,7 @@
      * of all the class pubapis)
      */
     public Map<String,String> getPubapis() {
-        Map<String,String> publicApiPerPackage = new HashMap<String,String>();
+        Map<String,String> publicApiPerPackage = new HashMap<>();
         if (publicApiPerClass == null) return publicApiPerPackage;
         Name[] keys = publicApiPerClass.keySet().toArray(new Name[0]);
         Arrays.sort(keys, new CompareNames());
@@ -176,7 +175,7 @@
         if (!currPkg.equals(depPkg)) {
             Set<Name> theset = deps.get(currPkg);
             if (theset==null) {
-                theset = new HashSet<Name>();
+                theset = new HashSet<>();
                 deps.put(currPkg, theset);
             }
             theset.add(depPkg);
--- a/langtools/src/share/classes/com/sun/tools/sjavac/comp/SmartFileManager.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/comp/SmartFileManager.java	Wed Jul 05 19:26:54 2017 +0200
@@ -54,9 +54,9 @@
 public class SmartFileManager extends ForwardingJavaFileManager<JavaFileManager> {
 
     // Set of sources that can be seen by javac.
-    Set<URI> visibleSources = new HashSet<URI>();
+    Set<URI> visibleSources = new HashSet<>();
     // Map from modulename:packagename to artifacts.
-    Map<String,Set<URI>> packageArtifacts = new HashMap<String,Set<URI>>();
+    Map<String,Set<URI>> packageArtifacts = new HashMap<>();
     // Where to print informational messages.
     PrintWriter stdout;
 
@@ -69,7 +69,7 @@
     }
 
     public void cleanArtifacts() {
-        packageArtifacts = new HashMap<String,Set<URI>>();
+        packageArtifacts = new HashMap<>();
     }
 
     public void setLog(PrintWriter pw) {
@@ -93,7 +93,7 @@
             return files;
         }
         // Now filter!
-        ListBuffer<JavaFileObject> filteredFiles = new ListBuffer<JavaFileObject>();
+        ListBuffer<JavaFileObject> filteredFiles = new ListBuffer<>();
         for (JavaFileObject f : files) {
             URI uri = f.toUri();
             String t = uri.toString();
@@ -213,7 +213,7 @@
     void addArtifact(String pkgName, URI art) {
         Set<URI> s = packageArtifacts.get(pkgName);
         if (s == null) {
-            s = new HashSet<URI>();
+            s = new HashSet<>();
             packageArtifacts.put(pkgName, s);
         }
         s.add(art);
--- a/langtools/src/share/classes/com/sun/tools/sjavac/server/CompilerPool.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/server/CompilerPool.java	Wed Jul 05 19:26:54 2017 +0200
@@ -44,7 +44,7 @@
     // A semaphore protecting the poolsize number of threads.
     private Semaphore available;
     // The stack of compiler threads.
-    private Stack<CompilerThread> compilers = new Stack<CompilerThread>();
+    private Stack<CompilerThread> compilers = new Stack<>();
     // And the executor server to spawn threads.
     private final ExecutorService executorPool;
     // How many requests are active right now?
--- a/langtools/src/share/classes/com/sun/tools/sjavac/server/CompilerThread.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/server/CompilerThread.java	Wed Jul 05 19:26:54 2017 +0200
@@ -47,8 +47,10 @@
 import javax.tools.StandardJavaFileManager;
 
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.ListBuffer;
 import com.sun.tools.javac.util.Log;
 import com.sun.tools.javac.util.BaseFileManager;
+import com.sun.tools.javac.util.StringUtils;
 import com.sun.tools.sjavac.comp.Dependencies;
 import com.sun.tools.sjavac.comp.JavaCompilerWithDeps;
 import com.sun.tools.sjavac.comp.SmartFileManager;
@@ -130,7 +132,7 @@
         context.put(JavaFileManager.class, smartFileManager);
         ResolveWithDeps.preRegister(context);
         JavaCompilerWithDeps.preRegister(context, this);
-        subTasks = new ArrayList<Future<?>>();
+        subTasks = new ArrayList<>();
     }
 
     /**
@@ -217,8 +219,8 @@
             if (!expect(in, JavacServer.PROTOCOL_ARGS)) {
                 return;
             }
-            ArrayList<String> the_options = new ArrayList<String>();
-            ArrayList<File> the_classes = new ArrayList<File>();
+            ArrayList<String> the_options = new ArrayList<>();
+            ArrayList<File> the_classes = new ArrayList<>();
             Iterable<File> path = Arrays.<File> asList(new File(cwd));
 
             for (;;) {
@@ -239,7 +241,7 @@
             }
 
             // Load sources to compile
-            Set<URI> sourcesToCompile = new HashSet<URI>();
+            Set<URI> sourcesToCompile = new HashSet<>();
             for (;;) {
                 String l = in.readLine();
                 if (l == null)
@@ -254,9 +256,9 @@
                 }
             }
             // Load visible sources
-            Set<URI> visibleSources = new HashSet<URI>();
+            Set<URI> visibleSources = new HashSet<>();
             boolean fix_drive_letter_case =
-                System.getProperty("os.name").toLowerCase().startsWith("windows");
+                StringUtils.toLowerCase(System.getProperty("os.name")).startsWith("windows");
             for (;;) {
                 String l = in.readLine();
                 if (l == null)
@@ -283,14 +285,12 @@
 
             // Now setup the actual compilation....
             // First deal with explicit source files on cmdline and in at file.
-            com.sun.tools.javac.util.ListBuffer<JavaFileObject> compilationUnits =
-                new com.sun.tools.javac.util.ListBuffer<JavaFileObject>();
+            ListBuffer<JavaFileObject> compilationUnits = new ListBuffer<>();
             for (JavaFileObject i : fileManager.getJavaFileObjectsFromFiles(the_classes)) {
                 compilationUnits.append(i);
             }
             // Now deal with sources supplied as source_to_compile.
-            com.sun.tools.javac.util.ListBuffer<File> sourcesToCompileFiles =
-                new com.sun.tools.javac.util.ListBuffer<File>();
+            ListBuffer<File> sourcesToCompileFiles = new ListBuffer<>();
             for (URI u : sourcesToCompile) {
                 sourcesToCompileFiles.append(new File(u));
             }
--- a/langtools/src/share/classes/com/sun/tools/sjavac/server/JavacServer.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/server/JavacServer.java	Wed Jul 05 19:26:54 2017 +0200
@@ -101,7 +101,7 @@
      */
     private static synchronized PortFile getPortFile(String filename) throws FileNotFoundException {
         if (allPortFiles == null) {
-            allPortFiles = new HashMap<String, PortFile>();
+            allPortFiles = new HashMap<>();
         }
         PortFile pf = allPortFiles.get(filename);
         if (pf == null) {
@@ -371,7 +371,7 @@
             // If the java/sh/cmd launcher fails the failure will be captured by stdouterr because of the redirection here.
             String[] cmd = {"/bin/sh", "-c", sjavac + " >> " + stdouterrfile + " 2>&1"};
             if (!(new File("/bin/sh")).canExecute()) {
-                ArrayList<String> wincmd = new ArrayList<String>();
+                ArrayList<String> wincmd = new ArrayList<>();
                 wincmd.add("cmd");
                 wincmd.add("/c");
                 wincmd.add("start");
@@ -567,7 +567,7 @@
                 }
                 if (l.length() > 1 && l.charAt(0) == '+') {
                     String pkg = l.substring(1);
-                    lastUriSet = new HashSet<URI>();
+                    lastUriSet = new HashSet<>();
                     packageArtifacts.put(pkg, lastUriSet);
                 } else if (l.length() > 1 && lastUriSet != null) {
                     lastUriSet.add(new URI(l.substring(1)));
@@ -585,14 +585,14 @@
                 }
                 if (l.length() > 1 && l.charAt(0) == '+') {
                     String pkg = l.substring(1);
-                    lastPackageSet = new HashSet<String>();
+                    lastPackageSet = new HashSet<>();
                     packageDependencies.put(pkg, lastPackageSet);
                 } else if (l.length() > 1 && lastPackageSet != null) {
                     lastPackageSet.add(l.substring(1));
                 }
             }
             // Load package pubapis
-            Map<String, StringBuffer> tmp = new HashMap<String, StringBuffer>();
+            Map<String, StringBuffer> tmp = new HashMap<>();
             StringBuffer lastPublicApi = null;
             for (;;) {
                 String l = in.readLine();
--- a/langtools/src/share/classes/javax/annotation/processing/AbstractProcessor.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/javax/annotation/processing/AbstractProcessor.java	Wed Jul 05 19:26:54 2017 +0200
@@ -187,7 +187,7 @@
 
     private static Set<String> arrayToSet(String[] array) {
         assert array != null;
-        Set<String> set = new HashSet<String>(array.length);
+        Set<String> set = new HashSet<>(array.length);
         for (String s : array)
             set.add(s);
         return Collections.unmodifiableSet(set);
--- a/langtools/src/share/classes/javax/lang/model/SourceVersion.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/javax/lang/model/SourceVersion.java	Wed Jul 05 19:26:54 2017 +0200
@@ -55,6 +55,7 @@
      * 1.6: no changes
      * 1.7: diamond syntax, try-with-resources, etc.
      * 1.8: lambda expressions and default methods
+     * 1.9: To be determined
      */
 
     /**
@@ -138,7 +139,15 @@
      * Additions in this release include lambda expressions and default methods.
      * @since 1.8
      */
-    RELEASE_8;
+    RELEASE_8,
+
+    /**
+     * The version recognized by the Java Platform, Standard Edition
+     * 9.
+     *
+     * @since 1.9
+     */
+     RELEASE_9;
 
     // Note that when adding constants for newer releases, the
     // behavior of latest() and latestSupported() must be updated too.
@@ -149,7 +158,7 @@
      * @return the latest source version that can be modeled
      */
     public static SourceVersion latest() {
-        return RELEASE_8;
+        return RELEASE_9;
     }
 
     private static final SourceVersion latestSupported = getLatestSupported();
@@ -158,12 +167,16 @@
         try {
             String specVersion = System.getProperty("java.specification.version");
 
-            if ("1.8".equals(specVersion))
-                return RELEASE_8;
-            else if("1.7".equals(specVersion))
-                return RELEASE_7;
-            else if("1.6".equals(specVersion))
-                return RELEASE_6;
+            switch (specVersion) {
+                case "1.9":
+                    return RELEASE_9;
+                case "1.8":
+                    return RELEASE_8;
+                case "1.7":
+                    return RELEASE_7;
+                case "1.6":
+                    return RELEASE_6;
+            }
         } catch (SecurityException se) {}
 
         return RELEASE_5;
@@ -241,7 +254,7 @@
 
     private final static Set<String> keywords;
     static {
-        Set<String> s = new HashSet<String>();
+        Set<String> s = new HashSet<>();
         String [] kws = {
             "abstract", "continue",     "for",          "new",          "switch",
             "assert",   "default",      "if",           "package",      "synchronized",
@@ -269,7 +282,6 @@
      * @return {@code true} if {@code s} is a keyword or literal, {@code false} otherwise.
      */
     public static boolean isKeyword(CharSequence s) {
-        String keywordOrLiteral = s.toString();
-        return keywords.contains(keywordOrLiteral);
+        return keywords.contains(s.toString());
     }
 }
--- a/langtools/src/share/classes/javax/lang/model/type/IntersectionType.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/javax/lang/model/type/IntersectionType.java	Wed Jul 05 19:26:54 2017 +0200
@@ -35,10 +35,12 @@
  * {@code <T extends Number & Runnable>} is an (implicit) intersection
  * type.  As of {@link javax.lang.model.SourceVersion#RELEASE_8
  * RELEASE_8}, this is represented by an {@code IntersectionType} with
- * {@code Number} and {@code Runnable} as its bounds.  Also as of the
- * {@link javax.lang.model.SourceVersion#RELEASE_8 RELEASE_8},
- * intersection types can explicitly appear as the target type of a
- * cast expression.
+ * {@code Number} and {@code Runnable} as its bounds.
+ *
+ * @implNote Also as of {@link
+ * javax.lang.model.SourceVersion#RELEASE_8 RELEASE_8}, in the
+ * reference implementation an {@code IntersectionType} is used to
+ * model the explicit target type of a cast expression.
  *
  * @since 1.8
  */
--- a/langtools/src/share/classes/javax/lang/model/type/MirroredTypesException.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/javax/lang/model/type/MirroredTypesException.java	Wed Jul 05 19:26:54 2017 +0200
@@ -55,7 +55,7 @@
      */
     MirroredTypesException(String message, TypeMirror type) {
         super(message);
-        List<TypeMirror> tmp = (new ArrayList<TypeMirror>());
+        List<TypeMirror> tmp = (new ArrayList<>());
         tmp.add(type);
         types = Collections.unmodifiableList(tmp);
     }
@@ -68,7 +68,7 @@
     public MirroredTypesException(List<? extends TypeMirror> types) {
         super("Attempt to access Class objects for TypeMirrors " +
               (types = // defensive copy
-               new ArrayList<TypeMirror>(types)).toString() );
+               new ArrayList<>(types)).toString() );
         this.types = Collections.unmodifiableList(types);
     }
 
--- a/langtools/src/share/classes/javax/lang/model/util/ElementFilter.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/javax/lang/model/util/ElementFilter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -187,7 +187,7 @@
     private static <E extends Element> List<E> listFilter(Iterable<? extends Element> elements,
                                                           Set<ElementKind> targetKinds,
                                                           Class<E> clazz) {
-        List<E> list = new ArrayList<E>();
+        List<E> list = new ArrayList<>();
         for (Element e : elements) {
             if (targetKinds.contains(e.getKind()))
                 list.add(clazz.cast(e));
@@ -200,7 +200,7 @@
                                                         Set<ElementKind> targetKinds,
                                                         Class<E> clazz) {
         // Return set preserving iteration order of input set.
-        Set<E> set = new LinkedHashSet<E>();
+        Set<E> set = new LinkedHashSet<>();
         for (Element e : elements) {
             if (targetKinds.contains(e.getKind()))
                 set.add(clazz.cast(e));
--- a/langtools/src/share/classes/javax/lang/model/util/Types.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/javax/lang/model/util/Types.java	Wed Jul 05 19:26:54 2017 +0200
@@ -60,13 +60,6 @@
     /**
      * Tests whether two {@code TypeMirror} objects represent the same type.
      *
-     * <p>Since annotations are only meta-data associated with a type,
-     * the set of annotations on either argument is <em>not</em> taken
-     * into account when computing whether or not two {@code
-     * TypeMirror} objects are the same type. In particular, two
-     * {@code TypeMirror} objects can have different annotations and
-     * still be considered the same.
-     *
      * <p>Caveat: if either of the arguments to this method represents a
      * wildcard, this method will return false.  As a consequence, a wildcard
      * is not the same type as itself.  This might be surprising at first,
@@ -77,6 +70,13 @@
      *   {@code list.add(list.get(0));}
      * </pre>
      *
+     * <p>Since annotations are only meta-data associated with a type,
+     * the set of annotations on either argument is <em>not</em> taken
+     * into account when computing whether or not two {@code
+     * TypeMirror} objects are the same type. In particular, two
+     * {@code TypeMirror} objects can have different annotations and
+     * still be considered the same.
+     *
      * @param t1  the first type
      * @param t2  the second type
      * @return {@code true} if and only if the two types are the same
--- a/langtools/src/share/classes/javax/tools/DiagnosticCollector.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/javax/tools/DiagnosticCollector.java	Wed Jul 05 19:26:54 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
@@ -40,7 +40,7 @@
  */
 public final class DiagnosticCollector<S> implements DiagnosticListener<S> {
     private List<Diagnostic<? extends S>> diagnostics =
-        Collections.synchronizedList(new ArrayList<Diagnostic<? extends S>>());
+            Collections.synchronizedList(new ArrayList<Diagnostic<? extends S>>());
 
     public void report(Diagnostic<? extends S> diagnostic) {
         diagnostic.getClass(); // null check
--- a/langtools/src/share/classes/javax/tools/JavaFileObject.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/javax/tools/JavaFileObject.java	Wed Jul 05 19:26:54 2017 +0200
@@ -81,7 +81,7 @@
             extension.getClass(); // null check
             this.extension = extension;
         }
-    };
+    }
 
     /**
      * Gets the kind of this file object.
--- a/langtools/src/share/classes/javax/tools/StandardLocation.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/javax/tools/StandardLocation.java	Wed Jul 05 19:26:54 2017 +0200
@@ -98,7 +98,7 @@
     }
     //where
         private static final ConcurrentMap<String,Location> locations
-            = new ConcurrentHashMap<String,Location>();
+            = new ConcurrentHashMap<>();
 
     public String getName() { return name(); }
 
--- a/langtools/src/share/classes/javax/tools/ToolProvider.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/src/share/classes/javax/tools/ToolProvider.java	Wed Jul 05 19:26:54 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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
@@ -145,7 +145,7 @@
 
     // Cache for tool classes.
     // Use weak references to avoid keeping classes around unnecessarily
-    private Map<String, Reference<Class<?>>> toolClasses = new HashMap<String, Reference<Class<?>>>();
+    private Map<String, Reference<Class<?>>> toolClasses = new HashMap<>();
 
     // Cache for tool classloader.
     // Use a weak reference to avoid keeping it around unnecessarily
@@ -207,7 +207,7 @@
                 trace(FINE, urls[0].toString());
 
                 cl = URLClassLoader.newInstance(urls);
-                refToolClassLoader = new WeakReference<ClassLoader>(cl);
+                refToolClassLoader = new WeakReference<>(cl);
             }
 
             return Class.forName(toolClassName, false, cl);
--- a/langtools/test/com/sun/javadoc/testDocRootLink/TestDocRootLink.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testDocRootLink/TestDocRootLink.java	Wed Jul 05 19:26:54 2017 +0200
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6553182 8025416
+ * @bug 6553182 8025416 8029504
  * @summary This test verifies the -Xdocrootparent option.
  * @author Bhavesh Patel
  * @library ../lib/
--- a/langtools/test/tools/javac/6330997/T6330997.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/6330997/T6330997.java	Wed Jul 05 19:26:54 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2011, 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
@@ -23,12 +23,12 @@
 
 /**
  * @test
- * @bug     6330997 7025789
+ * @bug     6330997 7025789 8000961
  * @summary javac should accept class files with major version of the next release
  * @author  Wei Tao
  * @clean T1 T2
- * @compile -target 8 T1.java
- * @compile -target 8 T2.java
+ * @compile -source 8 -target 8 T1.java
+ * @compile -source 8 -target 8 T2.java
  * @run main/othervm T6330997
  */
 
@@ -67,19 +67,16 @@
 
     // Increase class file cfile's major version by delta
     static void increaseMajor(String cfile, int delta) {
-        try {
-            RandomAccessFile cls = new RandomAccessFile(
-                    new File(System.getProperty("test.classes", "."), cfile), "rw");
-            FileChannel fc = cls.getChannel();
+        try (RandomAccessFile cls =
+             new RandomAccessFile(new File(System.getProperty("test.classes", "."), cfile), "rw");
+             FileChannel fc = cls.getChannel()) {
             ByteBuffer rbuf = ByteBuffer.allocate(2);
             fc.read(rbuf, 6);
             ByteBuffer wbuf = ByteBuffer.allocate(2);
             wbuf.putShort(0, (short)(rbuf.getShort(0) + delta));
             fc.write(wbuf, 6);
             fc.force(false);
-            cls.close();
-         } catch (Exception e){
-            e.printStackTrace();
+        } catch (Exception e){
             throw new RuntimeException("Failed: unexpected exception");
          }
      }
--- a/langtools/test/tools/javac/MethodParameters/AnnotationTest.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/MethodParameters/AnnotationTest.java	Wed Jul 05 19:26:54 2017 +0200
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8006582
+ * @ignore 8030656 Bad version check for parameter information in src/share/vm/classfile/javaClasses.cpp
  * @summary javac should generate method parameters correctly.
  * @build Tester
  * @compile -parameters AnnotationTest.java
--- a/langtools/test/tools/javac/MethodParameters/AnonymousClass.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/MethodParameters/AnonymousClass.java	Wed Jul 05 19:26:54 2017 +0200
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8006582
+ * @ignore 8030656 Bad version check for parameter information in src/share/vm/classfile/javaClasses.cpp
  * @summary javac should generate method parameters correctly.
  * @build Tester
  * @compile -parameters AnonymousClass.java
--- a/langtools/test/tools/javac/MethodParameters/CaptureTest.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/MethodParameters/CaptureTest.java	Wed Jul 05 19:26:54 2017 +0200
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8015701
+ * @ignore 8030656 Bad version check for parameter information in src/share/vm/classfile/javaClasses.cpp
  * @summary Test method parameter attribute generation with captured locals.
  * @compile -parameters CaptureTest.java
  * @run main CaptureTest
--- a/langtools/test/tools/javac/MethodParameters/Constructors.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/MethodParameters/Constructors.java	Wed Jul 05 19:26:54 2017 +0200
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8006582
+ * @ignore 8030656 Bad version check for parameter information in src/share/vm/classfile/javaClasses.cpp
  * @summary javac should generate method parameters correctly.
  * @build Tester
  * @compile -parameters Constructors.java
--- a/langtools/test/tools/javac/MethodParameters/EnumTest.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/MethodParameters/EnumTest.java	Wed Jul 05 19:26:54 2017 +0200
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8006582 8008658
+ * @ignore 8030656 Bad version check for parameter information in src/share/vm/classfile/javaClasses.cpp
  * @summary javac should generate method parameters correctly.
  * @build Tester
  * @compile -parameters EnumTest.java
--- a/langtools/test/tools/javac/MethodParameters/InstanceMethods.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/MethodParameters/InstanceMethods.java	Wed Jul 05 19:26:54 2017 +0200
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8006582
+ * @ignore 8030656 Bad version check for parameter information in src/share/vm/classfile/javaClasses.cpp
  * @summary javac should generate method parameters correctly.
  * @build Tester
  * @compile -parameters InstanceMethods.java
--- a/langtools/test/tools/javac/MethodParameters/LambdaTest.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/MethodParameters/LambdaTest.java	Wed Jul 05 19:26:54 2017 +0200
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8006582
+ * @ignore 8030656 Bad version check for parameter information in src/share/vm/classfile/javaClasses.cpp
  * @summary javac should generate method parameters correctly.
  * @build Tester
  * @compile -parameters LambdaTest.java
--- a/langtools/test/tools/javac/MethodParameters/LocalClassTest.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/MethodParameters/LocalClassTest.java	Wed Jul 05 19:26:54 2017 +0200
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8006582 8008658
+ * @ignore 8030656 Bad version check for parameter information in src/share/vm/classfile/javaClasses.cpp
  * @summary javac should generate method parameters correctly.
  * @build Tester
  * @compile -parameters LocalClassTest.java
--- a/langtools/test/tools/javac/MethodParameters/MemberClassTest.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/MethodParameters/MemberClassTest.java	Wed Jul 05 19:26:54 2017 +0200
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8006582 8008658
+ * @ignore 8030656 Bad version check for parameter information in src/share/vm/classfile/javaClasses.cpp
  * @summary javac should generate method parameters correctly.
  * @build Tester
  * @compile -parameters MemberClassTest.java
--- a/langtools/test/tools/javac/MethodParameters/StaticMethods.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/MethodParameters/StaticMethods.java	Wed Jul 05 19:26:54 2017 +0200
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8006582
+ * @ignore 8030656 Bad version check for parameter information in src/share/vm/classfile/javaClasses.cpp
  * @summary javac should generate method parameters correctly.
  * @build Tester
  * @compile -parameters StaticMethods.java
--- a/langtools/test/tools/javac/MethodParameters/UncommonParamNames.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/MethodParameters/UncommonParamNames.java	Wed Jul 05 19:26:54 2017 +0200
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8006582
+ * @ignore 8030656 Bad version check for parameter information in src/share/vm/classfile/javaClasses.cpp
  * @summary javac should generate method parameters correctly.
  * @build Tester
  * @compile -parameters UncommonParamNames.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/NoStringToLower.java	Wed Jul 05 19:26:54 2017 +0200
@@ -0,0 +1,136 @@
+/*
+ * 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 8029800
+ * @summary String.toLowerCase()/toUpperCase is generally dangerous, check it is not used in langtools
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.tools.*;
+import com.sun.tools.classfile.*;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Methodref_info;
+
+public class NoStringToLower {
+    public static void main(String... args) throws Exception {
+        NoStringToLower c = new NoStringToLower();
+        if (c.run(args))
+            return;
+
+        if (is_jtreg())
+            throw new Exception(c.errors + " errors occurred");
+        else
+            System.exit(1);
+    }
+
+    static boolean is_jtreg() {
+        return (System.getProperty("test.src") != null);
+    }
+
+    /**
+     * Main entry point.
+     */
+    boolean run(String... args) throws Exception {
+        JavaCompiler c = ToolProvider.getSystemJavaCompiler();
+        JavaFileManager fm = c.getStandardFileManager(null, null, null);
+        JavaFileManager.Location javacLoc = findJavacLocation(fm);
+        String[] pkgs = {
+            "javax.annotation.processing",
+            "javax.lang.model",
+            "javax.tools",
+            "com.sun.source",
+            "com.sun.tools.classfile",
+            "com.sun.tools.doclet",
+            "com.sun.tools.doclint",
+            "com.sun.tools.javac",
+            "com.sun.tools.javadoc",
+            "com.sun.tools.javah",
+            "com.sun.tools.javap",
+            "com.sun.tools.jdeps",
+            "com.sun.tools.sjavac"
+        };
+        for (String pkg: pkgs) {
+            for (JavaFileObject fo: fm.list(javacLoc,
+                    pkg, EnumSet.of(JavaFileObject.Kind.CLASS), true)) {
+                scan(fo);
+            }
+        }
+
+        return (errors == 0);
+    }
+
+    // depending on how the test is run, javac may be on bootclasspath or classpath
+    JavaFileManager.Location findJavacLocation(JavaFileManager fm) {
+        JavaFileManager.Location[] locns =
+            { StandardLocation.PLATFORM_CLASS_PATH, StandardLocation.CLASS_PATH };
+        try {
+            for (JavaFileManager.Location l: locns) {
+                JavaFileObject fo = fm.getJavaFileForInput(l,
+                    "com.sun.tools.javac.Main", JavaFileObject.Kind.CLASS);
+                if (fo != null)
+                    return l;
+            }
+        } catch (IOException e) {
+            throw new Error(e);
+        }
+        throw new IllegalStateException("Cannot find javac");
+    }
+
+    /**
+     * Verify there are no references to String.toLowerCase() in a class file.
+     */
+    void scan(JavaFileObject fo) throws IOException {
+        InputStream in = fo.openInputStream();
+        try {
+            ClassFile cf = ClassFile.read(in);
+            for (ConstantPool.CPInfo cpinfo: cf.constant_pool.entries()) {
+                if (cpinfo.getTag() == ConstantPool.CONSTANT_Methodref) {
+                    CONSTANT_Methodref_info ref = (CONSTANT_Methodref_info) cpinfo;
+                    String methodDesc = ref.getClassInfo().getName() + "." + ref.getNameAndTypeInfo().getName() + ":" + ref.getNameAndTypeInfo().getType();
+
+                    if ("java/lang/String.toLowerCase:()Ljava/lang/String;".equals(methodDesc)) {
+                        error("found reference to String.toLowerCase() in: " + fo.getName());
+                    }
+                    if ("java/lang/String.toUpperCase:()Ljava/lang/String;".equals(methodDesc)) {
+                        error("found reference to String.toLowerCase() in: " + fo.getName());
+                    }
+                }
+            }
+        } catch (ConstantPoolException ignore) {
+        } finally {
+            in.close();
+        }
+    }
+
+    /**
+     * Report an error.
+     */
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    int errors;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8029240/DefaultMethodsNotVisibileForSource7Test.java	Wed Jul 05 19:26:54 2017 +0200
@@ -0,0 +1,164 @@
+/*
+ * 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 8029240
+ * @summary Default methods not always visible under -source 7
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main DefaultMethodsNotVisibileForSource7Test
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+public class DefaultMethodsNotVisibileForSource7Test {
+    // common definitions
+
+    // this one should be compiled with source 8, the rest with source 7
+    static final String ISrc =
+        "interface I {\n" +
+        "    default void m() {}\n" +
+        "}";
+
+    static final String JSrc =
+        "interface J extends I {}";
+
+    static final String ASrc =
+        "abstract class A implements I {}";
+
+    static final String BSrc =
+        "class B implements I {}";
+
+    // test legacy implementations
+    static final String C1Src =
+        "class C1 implements I {\n" +
+        "    @Override public void m() {}\n" +
+        "}";
+
+    static final String C2Src =
+        "class C2 implements J {\n" +
+        "    @Override public void m() {}\n" +
+        "}";
+
+    static final String C3Src =
+        "class C3 extends A {\n" +
+        "    @Override public void m() {}\n" +
+        "}";
+
+    static final String C4Src =
+        "class C4 extends B {\n" +
+        "    @Override public void m() {}\n" +
+        "}";
+
+    //test legacy invocations
+    static final String LegacyInvocationSrc =
+        "class LegacyInvocation {\n" +
+        "    public static void test(I i, J j, A a, B b) {\n" +
+        "        i.m();\n" +
+        "        j.m();\n" +
+        "        a.m();\n" +
+        "        b.m();\n" +
+        "    }\n" +
+        "}";
+
+    //test case super invocations
+    static final String SubASrc =
+        "class SubA extends A {\n" +
+        "    public void test() {\n" +
+        "        super.m();\n" +
+        "    }\n" +
+        "}";
+
+    static final String SubBSrc =
+        "class SubB extends B {\n" +
+        "    public void test() {\n" +
+        "        super.m();\n" +
+        "    }\n" +
+        "}";
+
+    public static void main(String[] args) throws Exception {
+        new DefaultMethodsNotVisibileForSource7Test().run();
+    }
+
+    void run() throws Exception {
+        testsPreparation();
+        testLegacyImplementations();
+        testLegacyInvocations();
+        testSuperInvocations();
+    }
+
+    void testsPreparation() throws Exception {
+        Files.createDirectory(Paths.get("out"));
+
+        /* as an extra check let's make sure that interface 'I' can't be compiled
+         * with source 7
+         */
+        ToolBox.JavaToolArgs javacArgs =
+                new ToolBox.JavaToolArgs(ToolBox.Expect.FAIL)
+                .setOptions("-d", "out", "-source", "7")
+                .setSources(ISrc);
+        ToolBox.javac(javacArgs);
+
+        //but it should compile with source >= 8
+        javacArgs =
+                new ToolBox.JavaToolArgs()
+                .setOptions("-d", "out")
+                .setSources(ISrc);
+        ToolBox.javac(javacArgs);
+
+        javacArgs =
+                new ToolBox.JavaToolArgs()
+                .setOptions("-cp", "out", "-d", "out", "-source", "7")
+                .setSources(JSrc, ASrc, BSrc);
+        ToolBox.javac(javacArgs);
+    }
+
+    void testLegacyImplementations() throws Exception {
+        //compile C1-4
+        ToolBox.JavaToolArgs javacArgs =
+                new ToolBox.JavaToolArgs()
+                .setOptions("-cp", "out", "-d", "out", "-source", "7")
+                .setSources(C1Src, C2Src, C3Src, C4Src);
+        ToolBox.javac(javacArgs);
+    }
+
+    void testLegacyInvocations() throws Exception {
+        //compile LegacyInvocation
+        ToolBox.JavaToolArgs javacArgs =
+                new ToolBox.JavaToolArgs()
+                .setOptions("-cp", "out", "-d", "out", "-source", "7")
+                .setSources(LegacyInvocationSrc);
+        ToolBox.javac(javacArgs);
+    }
+
+    void testSuperInvocations() throws Exception {
+        //compile SubA, SubB
+        ToolBox.JavaToolArgs javacArgs =
+                new ToolBox.JavaToolArgs()
+                .setOptions("-cp", "out", "-d", "out", "-source", "7")
+                .setSources(SubASrc, SubBSrc);
+        ToolBox.javac(javacArgs);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8029569/VarargsAmbiguityCrashTest.java	Wed Jul 05 19:26:54 2017 +0200
@@ -0,0 +1,41 @@
+/*
+ * 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 8029569
+ * @summary internal javac cast exception when resolving varargs ambiguity
+ * @compile/fail/ref=VarargsAmbiguityCrashTest.out -XDrawDiagnostics VarargsAmbiguityCrashTest.java
+ */
+
+public class VarargsAmbiguityCrashTest {
+    void m1() {
+        m2(null, new Exception());
+    }
+
+    void m2(Long l) {}
+
+    void m2(Exception... exception) {}
+
+    void m2(Long l, Exception... exception) {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8029569/VarargsAmbiguityCrashTest.out	Wed Jul 05 19:26:54 2017 +0200
@@ -0,0 +1,2 @@
+VarargsAmbiguityCrashTest.java:33:9: compiler.err.ref.ambiguous: m2, kindname.method, m2(java.lang.Exception...), VarargsAmbiguityCrashTest, kindname.method, m2(java.lang.Long,java.lang.Exception...), VarargsAmbiguityCrashTest
+1 error
--- a/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/Lambda.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/Lambda.java	Wed Jul 05 19:26:54 2017 +0200
@@ -23,8 +23,9 @@
 
 /*
  * @test
- * @bug 8008077
+ * @bug 8008077 8029721
  * @summary new type annotation location: lambda expressions
+ * javac crash for annotated parameter type of lambda in a field
  * @compile Lambda.java
  * @author Werner Dietl
  */
@@ -57,6 +58,14 @@
     LambdaInt2 getLambda() {
         return (@TA Object x, @TB Object y) -> { @TA Object l = null; System.out.println("We have: " + (@TB Object) x); };
     }
+
+    java.util.function.IntUnaryOperator x = (@TA int y) -> 1;
+
+    static java.util.function.IntUnaryOperator xx = (@TA int y) -> 1;
+
+    java.util.function.IntUnaryOperator foo() {
+        return (@TA int y) -> 2;
+    }
 }
 
 @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Lambda.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Lambda.java	Wed Jul 05 19:26:54 2017 +0200
@@ -23,8 +23,9 @@
 
 /*
  * @test
- * @bug 8008077
+ * @bug 8008077 8029721
  * @summary Test population of reference info for lambda expressions
+ * javac crash for annotated parameter type of lambda in a field
  * @compile -g Driver.java ReferenceInfoUtil.java Lambda.java
  * @run main Driver Lambda
  * @author Werner Dietl
@@ -285,4 +286,24 @@
                 "  }" +
                 "}";
     }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
+            paramIndex = 0)})
+    public String lambdaField1() {
+        return
+            "class Test {" +
+                " java.util.function.IntUnaryOperator field = (@TA int y) -> 1;" +
+            "}";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
+            paramIndex = 0)})
+    public String lambdaField2() {
+        return
+            "class Test {" +
+                " static java.util.function.IntUnaryOperator field = (@TA int y) -> 1;" +
+            "}";
+    }
 }
--- a/langtools/test/tools/javac/api/T6395981.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/api/T6395981.java	Wed Jul 05 19:26:54 2017 +0200
@@ -23,13 +23,13 @@
 
 /*
  * @test
- * @bug     6395981 6458819 7025784
+ * @bug     6395981 6458819 7025784 8028543
  * @summary JavaCompilerTool and Tool must specify version of JLS and JVMS
  * @author  Peter von der Ah\u00e9
  * @run main/fail T6395981
  * @run main/fail T6395981 RELEASE_3 RELEASE_5 RELEASE_6
  * @run main/fail T6395981 RELEASE_0 RELEASE_1 RELEASE_2 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6
- * @run main T6395981 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6 RELEASE_7 RELEASE_8
+ * @run main T6395981 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6 RELEASE_7 RELEASE_8 RELEASE_9
  */
 
 import java.util.EnumSet;
--- a/langtools/test/tools/javac/api/ToolProvider/HelloWorldTest.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/api/ToolProvider/HelloWorldTest.java	Wed Jul 05 19:26:54 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -25,10 +25,14 @@
  * @test
  * @bug 6604599
  * @summary ToolProvider should be less compiler-specific
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main HelloWorldTest
  */
 
-import java.io.*;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 
 // verify that running a simple program, such as this one, does not trigger
 // the loading of ToolProvider or any com.sun.tools.javac class
@@ -43,32 +47,28 @@
     }
 
     void run() throws Exception {
-        File javaHome = new File(System.getProperty("java.home"));
-        if (javaHome.getName().equals("jre"))
-            javaHome = javaHome.getParentFile();
-        File javaExe = new File(new File(javaHome, "bin"), "java");
         String classpath = System.getProperty("java.class.path");
 
-        String[] cmd = {
-            javaExe.getPath(),
-            "-verbose:class",
-            "-classpath", classpath,
-            HelloWorldTest.class.getName(),
-            "Hello", "World"
-        };
+        List<String> output = new ArrayList<>();
+        ToolBox.AnyToolArgs javaParams =
+                new ToolBox.AnyToolArgs()
+                        .appendArgs(ToolBox.javaBinary)
+                        .appendArgs(ToolBox.testVMOpts)
+                        .appendArgs(ToolBox.testJavaOpts)
+                        .appendArgs("-verbose:class",
+                                "-classpath", classpath,
+                                HelloWorldTest.class.getName(),
+                                "Hello", "World")
+                        .setErrOutput(output)
+                        .setStdOutput(output);
 
-        ProcessBuilder pb = new ProcessBuilder(cmd).redirectErrorStream(true);
-        Process p = pb.start();
-        BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
-        String line;
-        while ((line = r.readLine()) != null) {
+       ToolBox.executeCommand(javaParams);
+
+        for (String line : output) {
             System.err.println(line);
             if (line.contains("javax.tools.ToolProvider") || line.contains("com.sun.tools.javac."))
                 error(">>> " + line);
         }
-        int rc = p.waitFor();
-        if (rc != 0)
-            error("Unexpected exit code: " + rc);
 
         if (errors > 0)
             throw new Exception(errors + " errors occurred");
--- a/langtools/test/tools/javac/api/ToolProvider/ToolProviderTest1.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/api/ToolProvider/ToolProviderTest1.java	Wed Jul 05 19:26:54 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -25,9 +25,13 @@
  * @test
  * @bug 6604599
  * @summary ToolProvider should be less compiler-specific
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main ToolProviderTest1
  */
 
-import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
 
 // verify that running accessing ToolProvider by itself does not
 // trigger loading com.sun.tools.javac.*
@@ -42,32 +46,28 @@
     }
 
     void run() throws Exception {
-        File javaHome = new File(System.getProperty("java.home"));
-        if (javaHome.getName().equals("jre"))
-            javaHome = javaHome.getParentFile();
-        File javaExe = new File(new File(javaHome, "bin"), "java");
         String classpath = System.getProperty("java.class.path");
 
-        String[] cmd = {
-            javaExe.getPath(),
-            "-verbose:class",
-            "-classpath", classpath,
-            ToolProviderTest1.class.getName(),
-            "javax.tools.ToolProvider"
-        };
+        List<String> output = new ArrayList<>();
+        ToolBox.AnyToolArgs javaParams =
+                new ToolBox.AnyToolArgs()
+                        .appendArgs(ToolBox.javaBinary)
+                        .appendArgs(ToolBox.testVMOpts)
+                        .appendArgs(ToolBox.testJavaOpts)
+                        .appendArgs("-verbose:class",
+                                "-classpath", classpath,
+                                ToolProviderTest1.class.getName(),
+                                "javax.tools.ToolProvider")
+                        .setErrOutput(output)
+                        .setStdOutput(output);
 
-        ProcessBuilder pb = new ProcessBuilder(cmd).redirectErrorStream(true);
-        Process p = pb.start();
-        BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
-        String line;
-        while ((line = r.readLine()) != null) {
+        ToolBox.executeCommand(javaParams);
+
+        for (String line : output) {
             System.err.println(line);
             if (line.contains("com.sun.tools.javac."))
                 error(">>> " + line);
         }
-        int rc = p.waitFor();
-        if (rc != 0)
-            error("Unexpected exit code: " + rc);
 
         if (errors > 0)
             throw new Exception(errors + " errors occurred");
--- a/langtools/test/tools/javac/api/ToolProvider/ToolProviderTest2.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/api/ToolProvider/ToolProviderTest2.java	Wed Jul 05 19:26:54 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -25,10 +25,14 @@
  * @test
  * @bug 6604599
  * @summary ToolProvider should be less compiler-specific
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main ToolProviderTest2
  */
 
-import java.io.*;
-import javax.tools.*;
+import javax.tools.ToolProvider;
+import java.util.ArrayList;
+import java.util.List;
 
 // control for ToolProviderTest1 -- verify that using ToolProvider to
 // access the compiler does trigger loading com.sun.tools.javac.*
@@ -43,36 +47,32 @@
     }
 
     void run() throws Exception {
-        File javaHome = new File(System.getProperty("java.home"));
-        if (javaHome.getName().equals("jre"))
-            javaHome = javaHome.getParentFile();
-        File javaExe = new File(new File(javaHome, "bin"), "java");
         String classpath = System.getProperty("java.class.path");
 
-        String[] cmd = {
-            javaExe.getPath(),
-            "-verbose:class",
-            "-classpath", classpath,
-            ToolProviderTest2.class.getName(),
-            "javax.tools.ToolProvider"
-        };
+        List<String> output = new ArrayList<>();
+        ToolBox.AnyToolArgs javaParams =
+                new ToolBox.AnyToolArgs()
+                        .appendArgs(ToolBox.javaBinary)
+                        .appendArgs(ToolBox.testVMOpts)
+                        .appendArgs(ToolBox.testJavaOpts)
+                        .appendArgs( "-verbose:class",
+                                "-classpath", classpath,
+                                ToolProviderTest2.class.getName(),
+                                "javax.tools.ToolProvider")
+                        .setErrOutput(output)
+                        .setStdOutput(output);
 
-        ProcessBuilder pb = new ProcessBuilder(cmd).redirectErrorStream(true);
-        Process p = pb.start();
-        BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
-        String line;
+        ToolBox.executeCommand(javaParams);
+
         boolean found = false;
-        while ((line = r.readLine()) != null) {
+        for (String line : output) {
             System.err.println(line);
             if (line.contains("com.sun.tools.javac."))
                 found = true;
         }
-        int rc = p.waitFor();
-        if (rc != 0)
-            error("Unexpected exit code: " + rc);
 
         if (!found)
-            System.err.println("expected class name not found");
+            error("expected class name not found");
 
         if (errors > 0)
             throw new Exception(errors + " errors occurred");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/flow/T8030218/CompileTimeErrorForNonAssignedStaticFieldTest.java	Wed Jul 05 19:26:54 2017 +0200
@@ -0,0 +1,29 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8030218
+ * @summary javac, compile time error isn't shown when final static field is not assigned, follow-up
+ * @compile/fail/ref=CompileTimeErrorForNonAssignedStaticFieldTest.out -XDrawDiagnostics CompileTimeErrorForNonAssignedStaticFieldTest.java
+ */
+
+public class CompileTimeErrorForNonAssignedStaticFieldTest {
+    private final static int i;
+
+    public CompileTimeErrorForNonAssignedStaticFieldTest()
+            throws InstantiationException {
+        throw new InstantiationException("Can't instantiate");
+    }
+
+    static class Inner {
+        private final int j;
+        public Inner(int x)
+                throws InstantiationException {
+            if (x == 0) {
+                throw new InstantiationException("Can't instantiate");
+            } else {
+                j = 1;
+            }
+            System.out.println(j);
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/flow/T8030218/CompileTimeErrorForNonAssignedStaticFieldTest.out	Wed Jul 05 19:26:54 2017 +0200
@@ -0,0 +1,2 @@
+CompileTimeErrorForNonAssignedStaticFieldTest.java:14:5: compiler.err.var.might.not.have.been.initialized: i
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaParenGeneric.java	Wed Jul 05 19:26:54 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 8029558
+ * @summary VerifyError lambda body is parenthesized generic value
+ * @author  Robert Field
+ * @run main LambdaParenGeneric
+ */
+
+public class LambdaParenGeneric {
+
+    @FunctionalInterface
+    public interface FI {
+        Integer apply();
+    }
+
+    public static class Val<A> {
+        A value;
+        Val(A v) { value = v; }
+    }
+
+    public static void main(String[] args) {
+        FI inc = () -> (new Val<Integer>(77).value);
+        System.out.println(inc.apply());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaParenGenericOrig.java	Wed Jul 05 19:26:54 2017 +0200
@@ -0,0 +1,49 @@
+/*
+ * 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 8029558
+ * @summary VerifyError lambda body is parenthesized generic value (originally submitted test)
+ * @author  Dmitrii Afanasyev
+ * @run main LambdaParenGenericOrig
+ */
+
+public class LambdaParenGenericOrig {
+
+    @FunctionalInterface
+    public static interface Function1<R, A> {
+        R apply(A input);
+    }
+
+    @FunctionalInterface
+    public static interface Function2<R, A1, A2> {
+        R apply(A1 input1, A2 input2);
+    }
+
+    public static void main(String[] args) {
+        final Function2<Integer, Integer, Integer> add = (x, y) -> x + y;
+        final Function1<Integer, Integer> inc = x -> (add.apply(x, 1));
+        System.out.println(inc.apply(0));
+    }
+}
--- a/langtools/test/tools/javac/lambda/LambdaScope05.out	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/lambda/LambdaScope05.out	Wed Jul 05 19:26:54 2017 +0200
@@ -1,5 +1,5 @@
 LambdaScope05.java:13:47: compiler.err.already.defined.in.clinit: kindname.variable, p, kindname.static.init, kindname.class, LambdaScope05
-LambdaScope05.java:14:40: compiler.err.already.defined.in.clinit: kindname.variable, p, kindname.instance.init, kindname.class, LambdaScope05
+LambdaScope05.java:14:40: compiler.err.already.defined: kindname.variable, p, kindname.constructor, LambdaScope05()
 LambdaScope05.java:17:43: compiler.err.already.defined.in.clinit: kindname.variable, p, kindname.static.init, kindname.class, LambdaScope05
 LambdaScope05.java:21:43: compiler.err.already.defined.in.clinit: kindname.variable, p, kindname.instance.init, kindname.class, LambdaScope05
 LambdaScope05.java:25:43: compiler.err.already.defined: kindname.variable, p, kindname.method, m_static()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/VoidLambdaParameter.java	Wed Jul 05 19:26:54 2017 +0200
@@ -0,0 +1,12 @@
+/* @test /nodynamiccopyright/
+ * @bug 8028235
+ * @summary Using void as a lambda parameter should produce sane AST and errors
+ * @compile/fail/ref=VoidLambdaParameter.out -XDrawDiagnostics VoidLambdaParameter.java
+ */
+public class VoidLambdaParameter {
+    Runnable r = (void v) -> { };
+    I i = (void v) -> { };
+    interface I {
+        public void v(void v);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/VoidLambdaParameter.out	Wed Jul 05 19:26:54 2017 +0200
@@ -0,0 +1,5 @@
+VoidLambdaParameter.java:7:19: compiler.err.void.not.allowed.here
+VoidLambdaParameter.java:7:18: compiler.err.prob.found.req: (compiler.misc.incompatible.arg.types.in.lambda)
+VoidLambdaParameter.java:8:12: compiler.err.void.not.allowed.here
+VoidLambdaParameter.java:10:23: compiler.err.void.not.allowed.here
+4 errors
--- a/langtools/test/tools/javac/lib/JavacTestingAbstractProcessor.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/lib/JavacTestingAbstractProcessor.java	Wed Jul 05 19:26:54 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
@@ -102,7 +102,7 @@
      * corresponding platform visitor type.
      */
 
-    @SupportedSourceVersion(RELEASE_8)
+    @SupportedSourceVersion(RELEASE_9)
     public static abstract class AbstractAnnotationValueVisitor<R, P> extends AbstractAnnotationValueVisitor8<R, P> {
 
         /**
@@ -113,7 +113,7 @@
         }
     }
 
-    @SupportedSourceVersion(RELEASE_8)
+    @SupportedSourceVersion(RELEASE_9)
     public static abstract class AbstractElementVisitor<R, P> extends AbstractElementVisitor8<R, P> {
         /**
          * Constructor for concrete subclasses to call.
@@ -123,7 +123,7 @@
         }
     }
 
-    @SupportedSourceVersion(RELEASE_8)
+    @SupportedSourceVersion(RELEASE_9)
     public static abstract class AbstractTypeVisitor<R, P> extends AbstractTypeVisitor8<R, P> {
         /**
          * Constructor for concrete subclasses to call.
@@ -133,7 +133,7 @@
         }
     }
 
-    @SupportedSourceVersion(RELEASE_8)
+    @SupportedSourceVersion(RELEASE_9)
     public static class ElementKindVisitor<R, P> extends ElementKindVisitor8<R, P> {
         /**
          * Constructor for concrete subclasses; uses {@code null} for the
@@ -154,7 +154,7 @@
         }
     }
 
-    @SupportedSourceVersion(RELEASE_8)
+    @SupportedSourceVersion(RELEASE_9)
     public static class ElementScanner<R, P> extends ElementScanner8<R, P> {
         /**
          * Constructor for concrete subclasses; uses {@code null} for the
@@ -173,7 +173,7 @@
         }
     }
 
-    @SupportedSourceVersion(RELEASE_8)
+    @SupportedSourceVersion(RELEASE_9)
     public static class SimpleAnnotationValueVisitor<R, P> extends SimpleAnnotationValueVisitor8<R, P> {
         /**
          * Constructor for concrete subclasses; uses {@code null} for the
@@ -194,7 +194,7 @@
         }
     }
 
-    @SupportedSourceVersion(RELEASE_8)
+    @SupportedSourceVersion(RELEASE_9)
     public static class SimpleElementVisitor<R, P> extends SimpleElementVisitor8<R, P> {
         /**
          * Constructor for concrete subclasses; uses {@code null} for the
@@ -215,7 +215,7 @@
         }
     }
 
-    @SupportedSourceVersion(RELEASE_8)
+    @SupportedSourceVersion(RELEASE_9)
     public static class SimpleTypeVisitor<R, P> extends SimpleTypeVisitor8<R, P> {
         /**
          * Constructor for concrete subclasses; uses {@code null} for the
@@ -236,7 +236,7 @@
         }
     }
 
-    @SupportedSourceVersion(RELEASE_8)
+    @SupportedSourceVersion(RELEASE_9)
     public static class TypeKindVisitor<R, P> extends TypeKindVisitor8<R, P> {
         /**
          * Constructor for concrete subclasses to call; uses {@code null}
--- a/langtools/test/tools/javac/lib/ToolBox.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/lib/ToolBox.java	Wed Jul 05 19:26:54 2017 +0200
@@ -69,27 +69,17 @@
     public static final Path javaBinary = Paths.get(jdkUnderTest, "bin", "java");
     public static final Path javacBinary = Paths.get(jdkUnderTest, "bin", "javac");
 
-    public static final List<String> testToolVMOpts;
-    public static final List<String> testVMOpts;
+    public static final List<String> testVMOpts = readOptions("test.vm.opts");
+    public static final List<String> testToolVMOpts = readOptions("test.tool.vm.opts");
+    public static final List<String> testJavaOpts = readOptions("test.java.opts");
 
     private static final Charset defaultCharset = Charset.defaultCharset();
 
     static final JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
 
-    static {
-        String sysProp = System.getProperty("test.tool.vm.opts");
-        if (sysProp != null && sysProp.length() > 0) {
-            testToolVMOpts = Arrays.asList(sysProp.split("\\s+"));
-        } else {
-            testToolVMOpts = Collections.<String>emptyList();
-        }
-
-        sysProp = System.getProperty("test.vm.opts");
-        if (sysProp != null && sysProp.length() > 0) {
-            testVMOpts = Arrays.asList(sysProp.split("\\s+"));
-        } else {
-            testVMOpts = Collections.<String>emptyList();
-        }
+    private static List<String> readOptions(String property) {
+        String options = System.getProperty(property, "");
+        return options.length() > 0 ? Arrays.asList(options.split("\\s+")) : Collections.<String>emptyList();
     }
 
     /**
--- a/langtools/test/tools/javac/limits/ArrayDims2.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/limits/ArrayDims2.java	Wed Jul 05 19:26:54 2017 +0200
@@ -27,7 +27,7 @@
  * @summary Compiler silently generates bytecode that exceeds VM limits
  * @author gafter
  *
- * @compile/fail ArrayDims2.java
+ * @compile/fail/ref=ArrayDims2.out -XDrawDiagnostics ArrayDims2.java
  */
 
 class ArrayDims2 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/limits/ArrayDims2.out	Wed Jul 05 19:26:54 2017 +0200
@@ -0,0 +1,2 @@
+ArrayDims2.java:60:22: compiler.err.limit.dimensions
+1 error
--- a/langtools/test/tools/javac/limits/ArrayDims4.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/limits/ArrayDims4.java	Wed Jul 05 19:26:54 2017 +0200
@@ -27,7 +27,7 @@
  * @summary Compiler silently generates bytecode that exceeds VM limits
  * @author gafter
  *
- * @compile/fail ArrayDims4.java
+ * @compile/fail/ref=ArrayDims4.out -XDrawDiagnostics ArrayDims4.java
  */
 
 class ArrayDims4 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/limits/ArrayDims4.out	Wed Jul 05 19:26:54 2017 +0200
@@ -0,0 +1,2 @@
+ArrayDims4.java:34:23: compiler.err.limit.dimensions
+1 error
--- a/langtools/test/tools/javac/limits/ArrayDims5.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/limits/ArrayDims5.java	Wed Jul 05 19:26:54 2017 +0200
@@ -27,7 +27,7 @@
  * @summary javac fails to diagnose too many array dimensions
  * @author gafter
  *
- * @compile/fail ArrayDims5.java
+ * @compile/fail/ref=ArrayDims5.out -XDrawDiagnostics ArrayDims5.java
  */
 
 public abstract class ArrayDims5 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/limits/ArrayDims5.out	Wed Jul 05 19:26:54 2017 +0200
@@ -0,0 +1,2 @@
+ArrayDims5.java:43:9: compiler.err.limit.dimensions
+1 error
--- a/langtools/test/tools/javac/limits/CodeSize.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/limits/CodeSize.java	Wed Jul 05 19:26:54 2017 +0200
@@ -27,7 +27,7 @@
  * @summary Compiler silently generates bytecode that exceeds VM limits
  * @author gafter
  *
- * @compile/fail CodeSize.java
+ * @compile/fail/ref=CodeSize.out -XDrawDiagnostics CodeSize.java
  */
 
 class CodeSize {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/limits/CodeSize.out	Wed Jul 05 19:26:54 2017 +0200
@@ -0,0 +1,2 @@
+CodeSize.java:34:10: compiler.err.limit.code
+1 error
--- a/langtools/test/tools/javac/limits/LongName.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/limits/LongName.java	Wed Jul 05 19:26:54 2017 +0200
@@ -27,7 +27,7 @@
  * @summary Compiler silently generates bytecode that exceeds VM limits
  * @author gafter
  *
- * @compile/fail LongName.java
+ * @compile/fail/ref=LongName.out -XDrawDiagnostics LongName.java
  */
 
 class LongName {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/limits/LongName.out	Wed Jul 05 19:26:54 2017 +0200
@@ -0,0 +1,2 @@
+LongName.java:33:1: compiler.err.limit.string.overflow: abcdefghijklnmopqrst
+1 error
--- a/langtools/test/tools/javac/limits/PoolSize1.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/limits/PoolSize1.java	Wed Jul 05 19:26:54 2017 +0200
@@ -27,7 +27,7 @@
  * @summary Compiler silently generates bytecode that exceeds VM limits
  * @author gafter
  *
- * @compile/fail PoolSize1.java
+ * @compile/fail/ref=PoolSize1.out -XDrawDiagnostics PoolSize1.java
  */
 
 import java.io.PrintStream;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/limits/PoolSize1.out	Wed Jul 05 19:26:54 2017 +0200
@@ -0,0 +1,2 @@
+PoolSize1.java:35:1: compiler.err.limit.pool
+1 error
--- a/langtools/test/tools/javac/limits/PoolSize2.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/limits/PoolSize2.java	Wed Jul 05 19:26:54 2017 +0200
@@ -27,7 +27,7 @@
  * @summary Compiler silently generates bytecode that exceeds VM limits
  * @author gafter
  *
- * @compile/fail PoolSize2.java
+ * @compile/fail/ref=PoolSize2.out -XDrawDiagnostics PoolSize2.java
  */
 
 import java.io.PrintStream;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/limits/PoolSize2.out	Wed Jul 05 19:26:54 2017 +0200
@@ -0,0 +1,2 @@
+PoolSize2.java:35:1: compiler.err.limit.pool
+1 error
--- a/langtools/test/tools/javac/limits/StringLength.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/limits/StringLength.java	Wed Jul 05 19:26:54 2017 +0200
@@ -27,7 +27,7 @@
  * @summary Compiler silently generates bytecode that exceeds VM limits
  * @author gafter
  *
- * @compile/fail StringLength.java
+ * @compile/fail/ref=StringLength.out -XDrawDiagnostics StringLength.java
  */
 
 class StringLength {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/limits/StringLength.out	Wed Jul 05 19:26:54 2017 +0200
@@ -0,0 +1,2 @@
+StringLength.java:45:37: compiler.err.limit.string
+1 error
--- a/langtools/test/tools/javac/parser/JavacParserTest.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/parser/JavacParserTest.java	Wed Jul 05 19:26:54 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7073631 7159445 7156633
+ * @bug 7073631 7159445 7156633 8028235
  * @summary tests error and diagnostics positions
  * @author  Jan Lahoda
  */
@@ -35,9 +35,11 @@
 import com.sun.source.tree.ErroneousTree;
 import com.sun.source.tree.ExpressionStatementTree;
 import com.sun.source.tree.ExpressionTree;
+import com.sun.source.tree.LambdaExpressionTree;
 import com.sun.source.tree.MethodInvocationTree;
 import com.sun.source.tree.MethodTree;
 import com.sun.source.tree.ModifiersTree;
+import com.sun.source.tree.PrimitiveTypeTree;
 import com.sun.source.tree.StatementTree;
 import com.sun.source.tree.Tree;
 import com.sun.source.tree.Tree.Kind;
@@ -60,6 +62,7 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.regex.Pattern;
+import javax.lang.model.type.TypeKind;
 import javax.tools.Diagnostic;
 import javax.tools.DiagnosticCollector;
 import javax.tools.DiagnosticListener;
@@ -895,6 +898,43 @@
         assertEquals("testStartPositionEnumConstantInit", -1, start);
     }
 
+    @Test
+    void testVoidLambdaParameter() throws IOException {
+        String code = "package t; class Test { " +
+                "Runnable r = (void v) -> { };" +
+                "}";
+        DiagnosticCollector<JavaFileObject> coll =
+                new DiagnosticCollector<>();
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, coll, null,
+                null, Arrays.asList(new MyFileObject(code)));
+
+        CompilationUnitTree cut = ct.parse().iterator().next();
+        ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
+        VariableTree field = (VariableTree) clazz.getMembers().get(0);
+
+        assertEquals("actual kind: " + field.getInitializer().getKind(),
+                     field.getInitializer().getKind(),
+                     Kind.LAMBDA_EXPRESSION);
+
+        LambdaExpressionTree lambda = (LambdaExpressionTree) field.getInitializer();
+
+        assertEquals("actual parameters: " + lambda.getParameters().size(),
+                     lambda.getParameters().size(),
+                     1);
+
+        Tree paramType = lambda.getParameters().get(0).getType();
+
+        assertEquals("actual parameter type: " + paramType.getKind(),
+                     paramType.getKind(),
+                     Kind.PRIMITIVE_TYPE);
+
+        TypeKind primitiveTypeKind = ((PrimitiveTypeTree) paramType).getPrimitiveTypeKind();
+
+        assertEquals("actual parameter type: " + primitiveTypeKind,
+                     primitiveTypeKind,
+                     TypeKind.VOID);
+    }
+
     void run(String[] args) throws Exception {
         int passed = 0, failed = 0;
         final Pattern p = (args != null && args.length > 0)
--- a/langtools/test/tools/javac/processing/model/TestSourceVersion.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/processing/model/TestSourceVersion.java	Wed Jul 05 19:26:54 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7025809
+ * @bug 7025809 8028543
  * @summary Test latest and latestSupported
  * @author  Joseph D. Darcy
  */
@@ -36,8 +36,8 @@
  */
 public class TestSourceVersion {
     public static void main(String... args) {
-        if (SourceVersion.latest() != RELEASE_8 ||
-            SourceVersion.latestSupported() != RELEASE_8)
+        if (SourceVersion.latest() != RELEASE_9 ||
+            SourceVersion.latestSupported() != RELEASE_9)
             throw new RuntimeException("Unexpected release value(s) found:\n" +
                                        "latest:\t" + SourceVersion.latest() + "\n" +
                                        "latestSupported:\t" + SourceVersion.latestSupported());
--- a/langtools/test/tools/javac/processing/model/type/IntersectionPropertiesTest.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/processing/model/type/IntersectionPropertiesTest.java	Wed Jul 05 19:26:54 2017 +0200
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6499673
+ * @bug 6499673 6557966
  * @library /tools/javac/lib
  * @build JavacTestingAbstractProcessor IntersectionPropertiesTest
  * @run main IntersectionPropertiesTest
--- a/langtools/test/tools/javac/processing/warnings/TestSourceVersionWarnings.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/processing/warnings/TestSourceVersionWarnings.java	Wed Jul 05 19:26:54 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2011, 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
@@ -36,7 +36,7 @@
  * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_6 -source 1.6 -Xlint:-options HelloWorld.java
  * @compile/ref=gold_unsp_warn.out     -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_6 -source 1.6 -Xlint:-options -Aunsupported HelloWorld.java
  * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_7 -source 1.7 -Xlint:-options HelloWorld.java
- * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_8 -source 1.8                 HelloWorld.java
+ * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_8 -source 1.8 -Xlint:-options HelloWorld.java
  */
 
 import java.util.Set;
--- a/langtools/test/tools/javac/profiles/ProfileOptionTest.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/profiles/ProfileOptionTest.java	Wed Jul 05 19:26:54 2017 +0200
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8004182
+ * @bug 8004182 8028545
  * @summary Add support for profiles in javac
  */
 
@@ -110,7 +110,7 @@
             }
 
             for (Profile p: Profile.values()) {
-                List<String> opts = new ArrayList<String>();
+                List<String> opts = new ArrayList<>();
                 opts.addAll(Arrays.asList("-source", t.name, "-target", t.name));
                 opts.add("-Xlint:-options"); // dont warn about no -bootclasspath
                 if (p != Profile.DEFAULT)
@@ -128,6 +128,7 @@
 
                 switch (t) {
                     case JDK1_8:
+                    case JDK1_9:
                         if (!out.isEmpty())
                             error("unexpected output from compiler");
                         break;
--- a/langtools/test/tools/javac/scope/7046348/EagerInterfaceCompletionTest.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/scope/7046348/EagerInterfaceCompletionTest.java	Wed Jul 05 19:26:54 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
@@ -181,7 +181,7 @@
                 case FIELD:
                 case SUPER: return true;
                 case METHOD: return hk != HierarchyKind.INTERFACE || ak == ActionKind.REMOVE_B ||
-                        (hk == HierarchyKind.INTERFACE && ak == ActionKind.REMOVE_A && vk == VersionKind.LAMBDA);
+                        (hk == HierarchyKind.INTERFACE && ak == ActionKind.REMOVE_A);
                 default: throw new AssertionError("Unexpected test kind " + this);
             }
         }
--- a/langtools/test/tools/javac/tree/MakeLiteralTest.java	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/tree/MakeLiteralTest.java	Wed Jul 05 19:26:54 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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,7 +23,7 @@
 
 /*
  * @test
- * @bug 6504896
+ * @bug 6504896 8028415
  * @summary TreeMaker.Literal(Object) does not support Booleans
  */
 
@@ -76,6 +76,12 @@
                     + l.type.constValue().getClass() + " " + l.type.constValue()
                     + ": expected:" + constValue.getClass() + " " + constValue);
         }
+        if (l.getValue().getClass() != value.getClass()
+                || !value.equals(l.getValue()))  {
+            error("unexpected const value: "
+                    + l.getValue().getClass() + " " + l.type.constValue()
+                    + ": expected:" + value.getClass() + " " + value);
+        }
     }
 
     void error(String msg) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/util/StringUtilsTest.java	Wed Jul 05 19:26:54 2017 +0200
@@ -0,0 +1,66 @@
+/*
+ * 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 8029800
+ * @summary Unit test StringUtils
+ * @run main StringUtilsTest
+ */
+
+import java.util.Locale;
+import java.util.Objects;
+import com.sun.tools.javac.util.StringUtils;
+
+public class StringUtilsTest {
+    public static void main(String... args) throws Exception {
+        new StringUtilsTest().run();
+    }
+
+    void run() throws Exception {
+        Locale.setDefault(new Locale("tr", "TR"));
+
+        //verify the properties of the default locale:
+        assertEquals("\u0131", "I".toLowerCase());
+        assertEquals("\u0130", "i".toUpperCase());
+
+        //verify the StringUtils does what it should
+        assertEquals("i", StringUtils.toLowerCase("I"));
+        assertEquals("I", StringUtils.toUpperCase("i"));
+
+        //verify we can use index from indexOf of toLowerCase String in the original:
+        assertEquals(2, StringUtils.toLowerCase("\u0130\u0130lookFor").indexOf("lookfor"));
+    }
+
+    void assertEquals(String expected, String actual) {
+        if (!Objects.equals(expected, actual)) {
+            throw new IllegalStateException("expected=" + expected + "; actual=" + actual);
+        }
+    }
+
+    void assertEquals(int expected, int actual) {
+        if (expected != actual) {
+            throw new IllegalStateException("expected=" + expected + "; actual=" + actual);
+        }
+    }
+}
--- a/langtools/test/tools/javac/versions/check.sh	Wed Jul 05 19:26:09 2017 +0200
+++ b/langtools/test/tools/javac/versions/check.sh	Wed Jul 05 19:26:54 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2012, 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
@@ -22,7 +22,7 @@
 #
 
 # @test
-# @bug 4981566 5028634 5094412 6304984 7025786 7025789 8001112
+# @bug 4981566 5028634 5094412 6304984 7025786 7025789 8001112 8028545 8000961
 # @summary Check interpretation of -target and -source options
 # @build CheckClassFileVersion
 # @run shell check.sh 
@@ -44,7 +44,7 @@
 check() {
   V=$1; shift
   echo "+ javac $* [$V]"
-  "$JC" ${TESTTOOLVMOPTS} -d $TC $* $TC/X.java && "$J" $CFV $TC/X.class $V || exit 2
+  "$JC" ${TESTTOOLVMOPTS} -Xlint:-options -d $TC $* $TC/X.java && "$J" $CFV $TC/X.class $V || exit 2
 }
 
 # check for all combinations of target values
@@ -78,6 +78,10 @@
 check_source_target 52.0 7   8
 check_source_target 52.0 8   8
 
+check_target        52.0 1.5 9
+check_source_target 52.0 8   9
+check_source_target 52.0 9   9
+
 # and finally the default with no options
 check 52.0
 
@@ -85,7 +89,7 @@
 
 fail() {
   echo "+ javac $*"
-  if "$JC" ${TESTTOOLVMOPTS} -d $TC $*; then
+  if "$JC" ${TESTTOOLVMOPTS} -Xlint:-options -d $TC $*; then
     echo "-- did not fail as expected"
     exit 3
   else
@@ -95,7 +99,7 @@
 
 pass() {
   echo "+ javac $*"
-  if "$JC" ${TESTTOOLVMOPTS} -d $TC $*; then
+  if "$JC" ${TESTTOOLVMOPTS} -Xlint:options -d $TC $*; then
     echo "-- passed"
   else
     echo "-- failed"
@@ -109,6 +113,7 @@
 checksrc16() { checksrc15 $* ; }
 checksrc17() { checksrc15 $* ; }
 checksrc18() { checksrc15 $* ; }
+checksrc19() { checksrc15 $* ; }
 
 checksrc14 -source 1.4
 checksrc14 -source 1.4 -target 1.5
@@ -126,14 +131,19 @@
 checksrc17 -source 1.7 -target 1.7
 checksrc17 -source 7 -target 7
 
-checksrc18
-checksrc18 -target 1.8
-checksrc18 -target 8
 checksrc18 -source 1.8
 checksrc18 -source 8
 checksrc18 -source 1.8 -target 1.8
 checksrc18 -source 8 -target 8
 
+checksrc19
+checksrc19 -source 1.9
+checksrc19 -source 9
+checksrc19 -source 1.9 -target 1.9
+checksrc19 -source 9 -target 9
+checksrc19 -target 1.9
+checksrc19 -target 9
+
 fail -source 1.5 -target 1.4 $TC/X.java
 fail -source 1.6 -target 1.4 $TC/X.java
 fail -source 6   -target 1.4 $TC/X.java
@@ -142,3 +152,5 @@
 fail -source 7   -target 1.6 $TC/X.java
 fail -source 8   -target 1.6 $TC/X.java
 fail -source 8   -target 1.7 $TC/X.java
+fail -source 9   -target 1.7 $TC/X.java
+fail -source 9   -target 1.8 $TC/X.java
--- a/make/Javadoc.gmk	Wed Jul 05 19:26:09 2017 +0200
+++ b/make/Javadoc.gmk	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/make/Jprt.gmk	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/make/Main.gmk	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/make/MakeHelpers.gmk	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/make/jprt.properties	Wed Jul 05 19:26:54 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	Wed Jul 05 19:26:09 2017 +0200
+++ b/nashorn/.hgtags	Wed Jul 05 19:26:54 2017 +0200
@@ -230,3 +230,4 @@
 8d014b039b44c23fa520ce20c2c27f7aa91441e9 jdk8-b118
 c3343930c73c58a22c1d58719bb988aeb25a871f jdk8-b119
 55cbc2d00c93f82513ce33819d41dc67e71aaefd jdk8-b120
+32631eed0fad2b31346eb41b29a50227bd29e2ec jdk9-b00
--- a/nashorn/.jcheck/conf	Wed Jul 05 19:26:09 2017 +0200
+++ b/nashorn/.jcheck/conf	Wed Jul 05 19:26:54 2017 +0200
@@ -1,1 +1,1 @@
-project=jdk8
+project=jdk9